:root {
  --bg: #070A08; --panel: rgba(7, 10, 8, 0.9); --panel-solid: #0D1210; --line: #1C2720; --line2: #243326;
  --text: #E6EBE4; --muted: #8EA091; --dim: #3E4F42; --green: #7CFF9A; --green-dim: #4FBF6E; --amber: #F2B544; --red: #E0533D;
  --sel: #13201A; --display: 'Barlow Condensed', sans-serif; --body: Barlow, system-ui, sans-serif; --mono: 'IBM Plex Mono', monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #070A08; } }
:root[data-theme="dark"] { --bg: #070A08; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--body); overflow: hidden; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }
#app { display: flex; flex-direction: column; width: 100vw; height: 100vh; }
#stage { position: relative; flex: 1; min-height: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ad-strip { flex: 0 0 auto; min-height: 90px; display: flex; align-items: center; justify-content: center; background: #050705; border-bottom: 1px solid var(--line); overflow: hidden; }
#ad-bottom { border-bottom: none; border-top: 1px solid var(--line); }
.ad-strip .adsbygoogle { width: 100%; max-width: 970px; height: 90px; }
.adph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: min(970px, 100%); height: 74px; border: 1px dashed var(--line2); font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; color: var(--dim); }
.adph small { font-size: 9px; letter-spacing: 0.08em; }
@media (max-height: 700px) { .ad-strip { min-height: 50px; } .ad-strip .adsbygoogle { height: 50px; } .adph { height: 40px; } }
.tb-audio { height: 30px; padding: 0 10px; border: 1px solid #2B3A2F; background: transparent; color: var(--green); font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; }
.tb-audio.off { color: var(--muted); }
.tb-audio:hover { border-color: var(--muted); }
.audio-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.audio-note { font-size: 12px; color: var(--muted); }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
#topbar { position: absolute; top: 0; left: 0; right: 0; height: 48px; padding: 0 12px; display: flex; align-items: center; gap: 14px; background: var(--panel); border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--muted); }
.tb-run { display: flex; align-items: center; height: 28px; padding: 0 10px; font-weight: 500; letter-spacing: 0.16em; color: #0B0F0C; background: var(--amber); }
.tb-run.live { background: var(--green); }
.tb-title { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: 0.12em; color: #F3F6F2; }
.tb-status { margin-left: auto; display: flex; align-items: center; gap: 8px; letter-spacing: 0.14em; }
.tb-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tb-status.good { color: var(--green); } .tb-status.bad { color: var(--red); }
#tb-abort { width: 30px; height: 30px; border: 1px solid #2B3A2F; background: transparent; color: var(--muted); font-size: 14px; }
#tb-abort:hover { color: var(--text); border-color: var(--muted); }

#roster { position: absolute; top: 58px; left: 10px; width: 226px; background: var(--panel); border: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.panel-title { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; color: var(--muted); padding: 2px 4px; }
#roster-list { display: flex; flex-direction: column; gap: 2px; }
.row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 6px; background: transparent; border: none; border-left: 2px solid transparent; color: var(--text); text-align: left; }
.row:hover { background: #0F1612; }
.row.sel { background: var(--sel); border-left-color: var(--green); }
.row.down { opacity: 0.45; }
.r-short { font-family: var(--mono); font-size: 9px; color: var(--muted); width: 26px; }
.r-main { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.r-top { display: flex; justify-content: space-between; align-items: baseline; }
.r-top b { font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: 0.04em; }
.r-top i { font-style: normal; font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; color: var(--green); }
.bar { display: block; height: 3px; background: var(--line); }
.bar > span { display: block; height: 100%; background: var(--green); }
#log { display: flex; flex-direction: column; gap: 3px; padding-top: 6px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 10px; line-height: 1.35; color: #B4C0B6; }
.log-line span { color: var(--dim); margin-right: 6px; }
.log-line.good { color: var(--green); } .log-line.bad { color: var(--red); } .log-line.warn { color: var(--amber); }

#inspector { position: absolute; top: 58px; right: 10px; width: 262px; background: var(--panel); border: 1px solid var(--line); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 160px); overflow: auto; }
#objectives { display: flex; flex-direction: column; gap: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.obj { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 8px; font-size: 12px; color: #D9E0DA; }
.obj-box { width: 10px; height: 10px; border: 1px solid var(--muted); }
.obj.done .obj-box { background: var(--green); border-color: var(--green); }
.obj.done .obj-text { color: var(--muted); text-decoration: line-through; }
.obj.bonus .obj-box { border-color: var(--amber); }
.obj.bonus.done .obj-box { background: var(--amber); border-color: var(--amber); }
.obj-detail { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; color: var(--muted); }
.ins-head { display: flex; flex-direction: column; gap: 2px; }
.eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; color: var(--green); }
.eyebrow.red { color: var(--red); } .eyebrow.amber { color: var(--amber); }
.ins-head h3 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 28px; line-height: 1; color: #F3F6F2; }
.ins-head .sub { font-size: 12px; color: var(--muted); }
.kv { display: flex; justify-content: space-between; gap: 8px; font-family: var(--mono); font-size: 11px; line-height: 1.5; }
.kv span { color: var(--muted); } .kv b { font-weight: 500; color: #E6EBE4; text-align: right; }
.kv b.red { color: var(--red); } .kv b.amber { color: var(--amber); }
.stats { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; }
.stat { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; color: var(--muted); }
.stat > span:first-child { width: 26px; }
.stat .bar { flex: 1; }
.ins-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ins-actions button { height: 34px; padding: 0 10px; background: transparent; border: 1px solid #2B3A2F; color: #D9E0DA; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; }
.ins-actions button:hover:not(:disabled) { border-color: var(--green); color: var(--green); }
.ins-actions button:disabled { opacity: 0.4; cursor: default; }
.ins-actions button.danger { border-color: var(--red); color: var(--red); }
.note { margin: 0; font-size: 12px; line-height: 1.45; color: #B4C0B6; padding: 8px 10px; border: 1px dashed var(--line2); }

#cmdbar { position: absolute; left: 0; right: 0; bottom: 0; height: 78px; padding: 0 12px; display: flex; align-items: center; gap: 10px; background: rgba(7, 10, 8, 0.94); border-top: 1px solid var(--line); }
.cmd-group { display: flex; gap: 6px; }
.cmd { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 72px; height: 56px; background: #0F1612; border: 1px solid var(--line2); color: #D9E0DA; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; position: relative; }
.cmd .cmd-ic { color: #B4C0B6; display: flex; }
.cmd:hover:not(:disabled) { border-color: var(--muted); }
.cmd.active { background: var(--sel); border-color: #2E7A47; }
.cmd.active .cmd-ic { color: var(--green); }
.cmd:disabled { opacity: 0.35; cursor: default; }
.cmd kbd { position: absolute; top: 3px; right: 5px; font-family: var(--mono); font-size: 8px; color: var(--dim); }
.cmd-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.cmd-status { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; color: var(--muted); }
.speed { display: flex; gap: 4px; }
.spd { width: 44px; height: 56px; background: #0F1612; border: 1px solid var(--line2); color: #B4C0B6; font-family: var(--mono); font-size: 11px; }
.spd.active { border-color: var(--green); color: var(--green); }
.go { width: 150px; height: 56px; background: var(--green); border: none; color: #0B0F0C; font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: 0.18em; }
.go.pause { background: var(--amber); }
.go:hover { filter: brightness(1.08); }
#toast { position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%); max-width: 520px; padding: 8px 14px; background: rgba(7, 10, 8, 0.92); border: 1px solid var(--line2); font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: #E6EBE4; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
#toast.show { opacity: 1; }
#hint { position: absolute; left: 50%; top: 58px; transform: translateX(-50%); padding: 6px 12px; background: rgba(7, 10, 8, 0.8); border: 1px solid var(--line2); font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: #B4C0B6; }

/* ---------- Screens ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: rgba(7, 10, 8, 0.86); overflow: auto; }
.screen-inner { margin: auto; width: min(1080px, calc(100% - 32px)); padding: 32px 0; display: flex; flex-direction: column; gap: 24px; }
.title-wrap { padding: 24px 0; }
.eyebrow-lg { font-family: var(--mono); font-size: 13px; letter-spacing: 0.2em; color: var(--green); }
h1.title { margin: 8px 0 0; font-family: var(--display); font-weight: 800; font-size: clamp(56px, 9vw, 104px); line-height: 0.92; color: #F3F6F2; }
.lead { max-width: 560px; font-size: 18px; line-height: 1.5; color: #B4C0B6; margin: 12px 0 0; }
.menu { display: flex; flex-direction: column; gap: 4px; width: 320px; }
.menu button { display: flex; align-items: center; height: 48px; padding: 0 16px; background: transparent; border: none; border-left: 3px solid transparent; color: #B4C0B6; font-family: var(--display); font-weight: 600; font-size: 26px; letter-spacing: 0.12em; text-align: left; }
.menu button:hover, .menu button.primary { background: var(--sel); border-left-color: var(--green); color: #F3F6F2; }
.menu button:disabled { opacity: 0.4; cursor: default; }
.foot { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; color: var(--muted); display: flex; gap: 14px; align-items: center; }
.foot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

.brief { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
@media (max-width: 820px) { .brief { grid-template-columns: 1fr; } }
.card { background: var(--panel-solid); border: 1px solid var(--line); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1; color: #F3F6F2; }
.card p { margin: 0; font-size: 14px; line-height: 1.5; color: #B4C0B6; }
.tags { display: flex; gap: 16px; flex-wrap: wrap; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--muted); }
.tags .amber { color: var(--amber); }
.objlist { display: flex; flex-direction: column; gap: 6px; }
.objlist div { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); font-size: 14px; line-height: 1.4; }
.objlist div span { font-family: var(--mono); font-size: 11px; color: var(--green); padding-top: 2px; }
.objlist div.primary { background: var(--sel); border-color: var(--line2); }
.b-squad { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.b-op { display: flex; flex-direction: column; padding: 8px 10px; border: 1px solid var(--line); }
.b-op b { font-family: var(--display); font-size: 18px; font-weight: 700; }
.b-op span { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; color: var(--green); }
.b-op i { font-style: normal; font-size: 12px; color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { height: 50px; padding: 0 22px; border: 1px solid #2B3A2F; background: transparent; color: #D9E0DA; font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: 0.14em; }
.btn:hover { border-color: var(--muted); color: #F3F6F2; }
.btn.primary { background: var(--green); border-color: var(--green); color: #0B0F0C; font-weight: 800; font-size: 22px; padding: 0 32px; }
.btn.primary:hover { filter: brightness(1.08); }
.howto { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.howto .card h3 { margin: 0; font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--green); }
.howto .card ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.6; color: #B4C0B6; }
.howto kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line2); color: var(--text); }

#db-result { margin: 0; font-family: var(--display); font-weight: 800; font-size: 64px; line-height: 1; }
#db-result.good { color: var(--green); } #db-result.bad { color: var(--red); }
.rating { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; font-family: var(--mono); font-size: 13px; letter-spacing: 0.24em; color: #0B0F0C; background: var(--muted); }
.rating.ghost { background: var(--green); } .rating.clean { background: #B8FFC9; } .rating.loud { background: var(--amber); } .rating.failed { background: var(--red); }
.db-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 820px) { .db-grid { grid-template-columns: 1fr; } }
.db-stat { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; }
.db-stat span { color: var(--muted); letter-spacing: 0.1em; } .db-stat b { font-weight: 500; }
.db-op { display: grid; grid-template-columns: 1.2fr 0.6fr 1fr 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: #B4C0B6; }
.db-op b { font-family: var(--display); font-size: 16px; color: #F3F6F2; }
.db-op.down { opacity: 0.5; }

/* ---------- v0.2: guide, pause note, tutorial, squad select, sprites UI ---------- */
.tb-diff { padding: 3px 8px; border: 1px solid var(--line2); color: var(--amber); letter-spacing: 0.16em; }
#guide { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; width: min(820px, calc(100% - 520px)); padding: 10px 12px 10px 16px; background: rgba(9, 22, 13, 0.96); border: 1px solid #2E7A47; box-shadow: 0 0 0 1px rgba(124,255,154,0.15), 0 8px 30px rgba(0,0,0,0.5); z-index: 2; }
#guide.alert { border-color: var(--amber); background: rgba(26, 18, 6, 0.97); box-shadow: 0 0 0 1px rgba(242,181,68,0.2), 0 8px 30px rgba(0,0,0,0.5); }
.guide-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.guide-note { font-size: 14px; line-height: 1.35; color: #FFE7B3; padding-left: 10px; border-left: 3px solid var(--amber); }
.guide-step { display: flex; align-items: baseline; gap: 10px; }
.guide-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; color: var(--green); white-space: nowrap; }
#guide-text { font-size: 14px; line-height: 1.35; color: #F3F6F2; }
.guide-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
#guide-do { height: 40px; padding: 0 16px; background: var(--green); border: none; color: #0B0F0C; font-family: var(--display); font-weight: 800; font-size: 19px; letter-spacing: 0.12em; white-space: nowrap; }
#guide-do:hover, #guide-go:hover { filter: brightness(1.08); }
#guide-do kbd, #guide-go kbd { font-family: var(--mono); font-size: 9px; margin-left: 6px; opacity: 0.7; }
#guide-go { height: 40px; padding: 0 14px; background: var(--amber); border: none; color: #0B0F0C; font-family: var(--display); font-weight: 800; font-size: 19px; letter-spacing: 0.12em; white-space: nowrap; }
#guide button.ghost { height: 40px; padding: 0 10px; background: transparent; border: 1px solid #2B3A2F; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; white-space: nowrap; }
#guide button.ghost:hover { border-color: var(--muted); color: var(--text); }
.roster-head { display: flex; align-items: center; justify-content: space-between; }
#roster-all { height: 22px; padding: 0 8px; background: transparent; border: 1px solid #2B3A2F; color: var(--green); font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; }
#roster-all:hover { border-color: var(--green); }
.go.ready { animation: go-pulse 1.1s ease-in-out infinite; }
@keyframes go-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(124,255,154,0.0); } 50% { box-shadow: 0 0 0 6px rgba(124,255,154,0.35); } }
#roster { width: 236px; }
.row { gap: 8px; }
.r-face { width: 30px; height: 35px; object-fit: cover; border: 1px solid var(--line2); }
.r-role { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; color: var(--muted); }
.r-top b { font-size: 14px; }
.ins-op { flex-direction: row; gap: 12px; align-items: center; }
.ins-face { width: 60px; height: 70px; object-fit: cover; border: 1px solid var(--line2); }
.steps { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; color: #D9E0DA; display: flex; flex-direction: column; gap: 6px; }
.cmd-sep { width: 1px; height: 40px; background: var(--line2); margin: 0 4px; }
.cmd.act { border-color: #2E7A47; color: #F3F6F2; }
.cmd.act .cmd-ic { color: var(--green); }
.cmd { width: 74px; font-size: 9px; }
#cmdbar { height: 82px; }
#tutorial { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(5, 8, 6, 0.8); z-index: 5; }
.tut-card { width: min(880px, calc(100% - 32px)); padding: 28px; background: var(--panel-solid); border: 1px solid #2E7A47; display: flex; flex-direction: column; gap: 18px; }
.tut-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tut-step { padding: 14px; border: 1px solid var(--line2); display: flex; flex-direction: column; gap: 6px; }
.tut-step b { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: var(--green); color: #0B0F0C; font-family: var(--display); font-size: 20px; font-weight: 800; }
.tut-step h3 { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 700; color: #F3F6F2; }
.tut-step p { margin: 0; font-size: 14px; line-height: 1.5; color: #B4C0B6; }
.tut-note { margin: 0; font-size: 14px; line-height: 1.5; color: #D9E0DA; padding: 10px 12px; border-left: 3px solid var(--green); background: var(--sel); }
.screen-inner.wide { width: min(1240px, calc(100% - 32px)); }
.squad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.recruit { display: flex; gap: 12px; padding: 12px; background: #0F1612; border: 1px solid var(--line); color: #D9E0DA; text-align: left; }
.recruit:hover { border-color: var(--muted); }
.recruit.sel { background: var(--sel); border-color: #2E7A47; }
.recruit.locked { cursor: default; }
.recruit img { width: 72px; height: 84px; object-fit: cover; border: 1px solid var(--line2); flex: 0 0 auto; }
.rc-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.rc-top { display: flex; justify-content: space-between; align-items: baseline; }
.rc-top b { font-family: var(--display); font-weight: 700; font-size: 22px; color: #F3F6F2; }
.rc-top i { font-style: normal; font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; color: var(--muted); }
.recruit.sel .rc-top i { color: var(--green); }
.rc-role { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--green); }
.rc-weapon { font-size: 12px; color: #B4C0B6; }
.rc-bio { font-size: 12px; color: var(--muted); line-height: 1.4; }
.recruit .stats { padding: 4px 0 0; }
.squad-msg { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; padding: 10px 12px; border: 1px solid var(--line2); }
.squad-msg.good { color: var(--green); } .squad-msg.bad { color: var(--amber); }
.btn:disabled { opacity: 0.4; cursor: default; }
.b-op { flex-direction: row; gap: 10px; align-items: center; }
.b-op img { width: 40px; height: 46px; object-fit: cover; border: 1px solid var(--line2); }
.b-op > div { display: flex; flex-direction: column; min-width: 0; }
.diff-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.diff { height: 40px; padding: 0 12px; background: transparent; border: 1px solid #2B3A2F; color: #D9E0DA; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; }
.diff small { font-family: var(--body); font-size: 10px; letter-spacing: 0; color: var(--muted); text-transform: none; }
.diff.active { border-color: var(--green); color: var(--green); background: var(--sel); }
.db-op { grid-template-columns: 44px 1.2fr 0.6fr 1fr 1fr; align-items: center; }
.db-op img { width: 36px; height: 42px; object-fit: cover; border: 1px solid var(--line2); }
@media (max-width: 1100px) { #guide { width: calc(100% - 24px); flex-direction: column; align-items: stretch; } }
