:root { color-scheme:dark; color:#e5edf0; background:#10191e; font:14px/1.45 'Segoe UI','Microsoft YaHei',sans-serif; }
* { box-sizing:border-box; }
html,body,.workspace,.viewport { width:100%; height:100%; margin:0; overflow:hidden; }
.workspace,.viewport { position:relative; }
#game { display:block; width:100%; height:100%; border:0; background:#10191e; }
:root:not([data-mode]) #game, [data-mode=home] #game { visibility:hidden; }
button,input { color:inherit; font:inherit; }
button { min-height:32px; padding:6px 12px; background:#22323a; border:1px solid #496775; border-radius:4px; }
button:hover:not(:disabled),button[aria-pressed=true] { background:#35505b; border-color:#8fb8c6; }
button:focus-visible,input:focus-visible { outline:2px solid #a2d7dd; outline-offset:2px; }
button:disabled { opacity:.55; }
kbd { font:inherit; color:#a8d8dd; }
/* Menu palette is independent of battle overlays. */
.desktop-home,.startup {
  --deep:#0B1020; --panel:#151C31; --hover:#232C47; --edge:#3A4568;
  --cyan:#3EE0FF; --amber:#FFB04A; --text:#EAF0FF; --muted:#93A0BE;
  --cut:polygon(0 0,calc(100% - 8px) 0,100% 8px,100% 100%,8px 100%,0 calc(100% - 8px));
  position:absolute; inset:0; overflow:hidden; color:var(--text); background:var(--deep);
}
.desktop-home { display:none; isolation:isolate; }
[data-mode=home] .desktop-home { display:block; }
.menu-layer { position:absolute; inset:-8px; pointer-events:none; }
.menu-depth { background:linear-gradient(var(--panel),var(--deep)); transform:translate(calc(8px * var(--pointer-x,0)),calc(8px * var(--pointer-y,0))); }
.menu-grid {
  background-image:linear-gradient(to right,rgba(62,224,255,.06) 1px,transparent 1px),linear-gradient(to bottom,rgba(62,224,255,.06) 1px,transparent 1px);
  background-size:48px 48px; transform:translate(calc(3px * var(--pointer-x,0)),calc(3px * var(--pointer-y,0)));
}
.menu-geometry i,.menu-geometry b { position:absolute; display:block; }
.menu-geometry i:first-child { inset:0 36% 32% -12%; background:rgba(255,255,255,.02); clip-path:polygon(0 0,100% 0,58% 100%,0 76%); }
.menu-geometry i:nth-child(2) { inset:20% -10% 0 44%; background:rgba(255,255,255,.035); clip-path:polygon(42% 0,100% 0,100% 100%,0 100%); }
.menu-geometry i:nth-child(3) { inset:72% 16% 0 24%; background:rgba(255,255,255,.025); clip-path:polygon(20% 0,100% 63%,84% 100%,0 100%); }
.menu-geometry b { width:2px; height:2px; background:var(--text); animation:menu-stars 9s ease-in-out infinite alternate; }
.menu-geometry b:nth-of-type(1) { left:13%;top:18%;animation-delay:-5s; }
.menu-geometry b:nth-of-type(2) { left:37%;top:30%;animation-delay:-2s; }
.menu-geometry b:nth-of-type(3) { left:56%;top:16%;animation-delay:-7s; }
.menu-geometry b:nth-of-type(4) { left:64%;top:62%;animation-delay:-1s; }
.menu-geometry b:nth-of-type(5) { left:86%;top:35%;animation-delay:-4s; }
.menu-geometry b:nth-of-type(6) { left:91%;top:71%;animation-delay:-8s; }
@keyframes menu-stars { from { opacity:.12; } to { opacity:.58; } }
.menu-logo {
  position:absolute; z-index:2; top:clamp(22px,8vh,90px); left:50%; transform:translateX(-50%);
  margin:0; white-space:nowrap; font:900 clamp(35px,7vw,92px)/1.1 'Microsoft YaHei UI','SimHei',sans-serif;
  letter-spacing:.15em; padding-left:.15em; text-shadow:0 0 12px rgba(234,240,255,.2);
}
.operation-buttons {
  position:absolute; z-index:2; left:clamp(22px,11vw,170px); top:51%; transform:translateY(-36%);
  display:grid; justify-items:start; gap:13px; width:min(330px,46vw);
}
.operation-buttons button {
  width:90%; text-align:left; min-height:44px; padding:8px 20px; border-radius:4px;
  color:var(--cyan); background:var(--panel); border:1px solid rgba(62,224,255,.4);
  box-shadow:inset 0 1px rgba(255,255,255,.08);
  transition:transform 130ms,background 130ms,border-color 130ms,box-shadow 130ms;
}
.operation-buttons button[data-home="start"] {
  width:100%; min-height:61px; font-size:20px; font-weight:750; border:0; clip-path:var(--cut);
  color:var(--deep); background:var(--amber); animation:menu-pulse 1.8s ease-in-out infinite;
}
.operation-buttons button:not([data-home="start"]):not(:disabled):hover,
.operation-buttons button[aria-expanded="true"] {
  background:var(--hover); border-color:var(--cyan); transform:translateY(-1px);
  box-shadow:inset 0 1px rgba(255,255,255,.08),0 0 12px rgba(62,224,255,.35);
}
.operation-buttons button[data-home="start"]:not(:disabled) {
  outline:0; box-shadow:inset 0 0 12px rgba(62,224,255,.35),inset 0 1px rgba(255,255,255,.08);
}
.operation-buttons button:not(:disabled):active,
.operation-buttons button[data-home="start"]:not(:disabled):active { transform:translateY(1px); box-shadow:none; animation:none; }
.operation-buttons button:focus-visible { outline:2px solid var(--cyan); outline-offset:3px; }
.operation-buttons button[data-home="start"]:focus-visible { outline:0; box-shadow:inset 0 0 0 3px var(--deep); }
.operation-buttons button:disabled { opacity:.35; animation:none; }
.menu-primary { width:100%; }
.menu-primary:has(button:not(:disabled)) { filter:drop-shadow(0 0 12px rgba(62,224,255,.35)); }
.menu-primary:has(button:not(:disabled):active) { filter:none; }
@keyframes menu-pulse { 0%,100% { transform:scale(1); } 50% { transform:scale(1.02); } }
.base-preview {
  position:absolute; z-index:1; right:6%; top:27%; width:40%; height:57%; pointer-events:none;
  display:grid; place-items:center; isolation:isolate;
  background:radial-gradient(ellipse at 50% 46%,var(--hover) 0%,transparent 66%);
}
.base-preview::before {
  content:""; position:absolute; inset:35% 6% 12%; z-index:-1;
  background:repeating-linear-gradient(0deg,rgba(147,160,190,.14) 0 1px,transparent 1px 25px),
    repeating-linear-gradient(90deg,rgba(147,160,190,.14) 0 1px,transparent 1px 25px);
  transform:perspective(360px) rotateX(59deg);
  mask-image:radial-gradient(ellipse,#000 4%,transparent 69%);
}
.base-preview img {
  width:100%; height:100%; max-height:440px; object-fit:contain; user-select:none;
  filter:drop-shadow(0 21px 16px #0B1020);
}
.startup { z-index:60; display:flex; align-items:center; justify-content:center; background:linear-gradient(var(--panel),var(--deep)); }
.startup[hidden] { display:none; }
.startup-card { width:min(430px,80vw); padding:24px; border:1px solid var(--edge); border-radius:4px; box-shadow:inset 0 1px rgba(255,255,255,.08); }
.startup-card h2 { margin:0 0 20px; font:900 clamp(30px,5vw,68px)/1.1 'Microsoft YaHei UI','SimHei',sans-serif; letter-spacing:.15em; }
.startup-card p { margin:11px 0 0; color:var(--muted); }
.startup-card button { margin-inline-start:10px; color:var(--cyan); border-color:rgba(62,224,255,.4); background:var(--panel); }
.startup-track { width:100%; height:3px; background:var(--edge); overflow:hidden; }
.startup-track span { display:block; width:36%; height:100%; background:var(--muted); animation:scan 1.35s ease-in-out infinite; }
@keyframes scan { from { transform:translateX(-100%); } to { transform:translateX(380%); } }
@media(max-height:480px) { .menu-logo { top:18px; } .operation-buttons { gap:7px; } .operation-buttons button { min-height:34px; } }
@media(prefers-reduced-motion:reduce) {
  .startup-track span,.menu-geometry b,.operation-buttons button[data-home="start"] { animation:none; }
  .menu-depth,.menu-grid { transform:none; }
}
#battle-clock,#catalogue-toggle { display:none; position:absolute; z-index:6; }
[data-mode=battle] #battle-clock,[data-mode=battle] #catalogue-toggle { display:block; }
#battle-clock { left:50%; top:8px; transform:translateX(-50%); min-width:80px; text-align:center; padding:4px 10px;
  color:#e2eef1; background:#111d25e8; border:1px solid #597885; border-radius:4px;
  font:600 17px/1.15 Consolas,monospace; pointer-events:none; }
#battle-clock.paused { color:#e3bf88; border-color:#947758; }
#catalogue-toggle { right:14px; bottom:14px; }
#recoverable-notice { position:absolute; z-index:25; bottom:13px; left:50%; transform:translateX(-50%);
  padding:8px 14px; color:#ebebdc; background:#303a40ee; border:1px solid #80919b; border-radius:4px; pointer-events:none; }
.catalogue[hidden] { display:none; }
.catalogue { position:absolute; z-index:12; right:14px; bottom:54px; top:15px; width:min(355px,calc(100% - 28px));
  display:grid; grid-template-rows:auto auto auto minmax(0,1fr); gap:11px; padding:14px; color:#dce8ea;
  background:#17252df5; border:1px solid #587784; border-radius:6px; box-shadow:0 12px 30px #0006; }
.catalogue-heading { display:flex; align-items:center; justify-content:space-between; }
.catalogue h2 { margin:0; font-size:16px; }
.catalogue nav { display:grid; grid-template-columns:repeat(4,1fr); gap:5px; }
.catalogue input { width:100%; background:#111d25; border:1px solid #45606d; padding:8px; border-radius:4px; }
.catalogue-list { overflow-y:auto; scrollbar-width:thin; }
.entry { display:grid; grid-template-columns:57px minmax(0,1fr); gap:12px; padding:10px 0; border-bottom:1px solid #46606c60; align-items:center; }
.entry img { width:57px; height:57px; object-fit:contain; background:#2C425E; border-radius:4px; }
.entry h3 { margin:0; font-size:13px; }
.entry p { margin:3px 0 0; font-size:12px; color:#aabec6; }
.battle-report[hidden] { display:none; }
.battle-report { position:fixed; isolation:isolate; inset:0; z-index:50; display:grid; place-items:center; overflow:auto;
  background:linear-gradient(105deg,#0a1425 17%,#101f35cf 82%),url('gm-style/science/main.jpg') center 47% / cover;
  padding:clamp(24px,6vw,90px); }
.battle-report::before { content:""; z-index:-1; position:absolute; inset:0; pointer-events:none;
  background:repeating-linear-gradient(123deg,transparent 0 108px,#89cff215 109px 110px,transparent 111px 183px);
  mask-image:radial-gradient(ellipse at 69% 49%,#000 10%,transparent 72%); }
.battle-report:not([hidden]) .report-shell { animation:report-arrival 510ms ease-out both; }
.battle-report[data-outcome=victory] .report-intro h2 { color:#def5ff; text-shadow:0 0 27px #58c5fa66; }
.battle-report[data-outcome=ended] .report-intro h2 { color:#f1d8c4; }
.battle-report .report-stats dd { color:#d1ecff; font-family:Consolas,monospace; }
@keyframes report-arrival { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@media (prefers-reduced-motion:reduce) { .battle-report:not([hidden]) .report-shell { animation:none; } }
.report-shell { width:min(1050px,100%); display:grid; grid-template-columns:1.05fr 1fr; gap:54px;
  border-top:2px solid #80cfc9; border-bottom:1px solid #38535f; padding:42px 0; color:#e8f2f4; }
.report-intro h2 { font-size:clamp(36px,6vw,80px); line-height:1.1; margin:15px 0 24px; letter-spacing:.035em; }
#report-state { color:#96e3d4; font-size:16px; letter-spacing:.12em; font-weight:700; }
#report-summary { color:#aec5ce; font-size:17px; line-height:1.55; }
#report-rank { color:#95bfc5; margin:24px 0; }
#report-home { min-width:150px; display:inline-flex; align-items:center; justify-content:space-between; gap:24px;
  padding:12px 16px; color:#10222c; font-weight:750; background:#a5dcd7; border-color:#c6ebe8; border-radius:3px; }
#report-home:hover { color:#12232c; background:#c7ede8; }
.report-stats { margin:0; display:grid; grid-template-columns:1fr 1fr; align-content:center; column-gap:26px; }
.report-stats > div { padding:16px 0 17px; border-bottom:1px solid #3c5965; }
.report-stats dt { color:#9bb5bf; font-size:14px; }
.report-stats dd { margin:5px 0 0; font:650 35px/1.2 'Segoe UI',sans-serif; font-variant-numeric:tabular-nums; }
@media(max-width:700px) { .report-shell { grid-template-columns:1fr; gap:24px; padding:22px 0; } }
.catalogue h2 { font-size:calc(17px * var(--font-scale,1.15)); }
.entry h3 { font-size:calc(14px * var(--font-scale,1.15)); }
.entry p { font-size:calc(12px * var(--font-scale,1.15)); }
[data-mode=home] .catalogue { color:#EAF0FF; background:#151C31; border-color:#3A4568; box-shadow:none; }
[data-mode=home] .catalogue::before { content:""; height:1px; position:absolute; inset:0 0 auto; background:rgba(255,255,255,.08); }
[data-mode=home] .catalogue input { color:#EAF0FF; background:#0B1020; border-color:#3A4568; }
[data-mode=home] .catalogue p { color:#93A0BE; }
[data-mode=home] .catalogue .entry { border-color:#3A4568; }
.menu-primary button:not(:disabled):hover { box-shadow:inset 0 0 0 2px #0B1020; }

.catalogue .entry .entry-source { color:#9CDACE; }
