:root { color-scheme: dark; --background:#091218; --panel:#142129; --edge:#30454f; --text:#e4edf0; --muted:#a4b8c2; --accent:#79d2c5; --warning:#f0c369; }
* { box-sizing:border-box; }
[hidden] { display:none!important; }
body { margin:0; background:var(--background); color:var(--text); font-family:"Segoe UI",Arial,sans-serif; font-size:14px; }
button, summary { -webkit-tap-highlight-color:transparent; }
button { border:1px solid #4b626d; border-radius:5px; padding:10px 12px; color:var(--text); background:#23343e; font:inherit; cursor:pointer; min-height:42px; }
button:hover { background:#314851; border-color:#8da9b5; }
button:disabled { opacity:.45; cursor:default; }
button:focus-visible, summary:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
button[aria-pressed="true"] { border-color:var(--accent); background:#28473f; }
p { margin:0; line-height:1.45; }
h1,h2,h3 { margin:0; }
h2 { font-size:13px; font-weight:650; letter-spacing:.06em; text-transform:uppercase; color:#c9dce3; }
.command-console { height:100dvh; min-height:610px; padding:14px; display:grid; grid-template-rows:auto minmax(0,1fr) 168px; gap:12px; }
.console-header { display:flex; align-items:center; gap:24px; min-height:50px; }
.console-brand { flex:0 0 auto; }
.eyebrow { text-transform:uppercase; letter-spacing:.18em; color:var(--accent); font-size:12px; font-weight:700; }
h1 { font-size:20px; font-weight:650; }
.phase-readout { display:flex; align-items:center; gap:16px; flex-wrap:wrap; margin-left:auto; }
#phase-status { padding:7px 10px; border:1px solid #567873; border-radius:4px; color:#b5f0dc; background:#182e2b; font-size:13px; }
#turn-counter { font-weight:650; }
#round-clock { color:var(--muted); font-size:13px; }
.mission-mode { max-width:270px; font-size:12px; color:var(--muted); text-align:right; }
.console-workspace { min-height:0; display:grid; grid-template-columns:180px minmax(0,1fr) 210px; gap:12px; }
.console-panel { background:var(--panel); border:1px solid var(--edge); border-radius:6px; min-width:0; }
.squad-display,.command-display { padding:14px; overflow-y:auto; scrollbar-width:thin; }
.squad-display h2 { display:flex; justify-content:space-between; margin-bottom:16px; }
.squad-display h2 span { color:var(--muted); font-weight:400; }
#squad-panel { display:grid; gap:12px; }
.squad-card { text-align:left; width:100%; padding:13px 12px; display:grid; gap:12px; border-left:3px solid #4b626d; background:#192a33; }
.squad-card:disabled { opacity:1; }
.squad-card[aria-pressed="true"] { border-left-color:var(--accent); box-shadow:inset 0 0 0 1px #609c8e; }
.card-heading { display:flex; flex-direction:column; gap:3px; }
.operative-name { font-size:18px; }
.operative-role { color:var(--muted); font-size:13px; }
.card-resources { display:flex; gap:8px; flex-wrap:wrap; font-size:13px; }
.card-resources span { border:1px solid #41565e; border-radius:3px; padding:3px 5px; }
.operative-order { font-size:13px; line-height:1.5; color:#d0e1d6; overflow-wrap:anywhere; }
.squad-card[data-injured="true"] .operative-health { color:var(--warning); }
.squad-card[data-incapacitated="true"] { color:#aeb5bd; border-color:#7e8591; }
.panel-note { margin-top:10px; font-size:12px; line-height:1.45; color:var(--muted); }
.tactical-display { min-width:0; min-height:0; display:grid; grid-template-rows:auto minmax(0,1fr); gap:8px; }
.monitor-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; min-height:25px; }
#action-counter { color:#b9d7c9; font-size:13px; text-align:right; }
.canvas-stage { min-height:0; min-width:0; padding:0; display:flex; align-items:center; justify-content:center; background:#101820; border:1px solid var(--edge); border-radius:5px; overflow:hidden; }
canvas { display:block; border:0; flex:none; max-width:100%; max-height:100%; width:100%; height:auto; touch-action:none; cursor:grab; }
canvas:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
.context-prompt { font-size:13px; color:#d2e1df; min-height:36px; max-height:64px; overflow:auto; padding:3px 2px; scrollbar-width:thin; }
.command-display { display:flex; flex-direction:column; gap:10px; }
.command-display h2 { margin-bottom:3px; }
.primary-command { background:#3c7769; border-color:#8de0c7; color:#f0fff9; font-weight:700; font-size:16px; min-height:48px; }
.primary-command:hover { background:#4d907d; }
.edit-controls { border:0; border-top:1px solid var(--edge); margin:5px 0 0; padding:12px 0 0; display:grid; gap:8px; }
legend { color:var(--muted); font-size:12px; padding:0 6px 0 0; }
.paired-controls { display:grid; grid-template-columns:1fr 1fr; gap:6px; }
.paired-controls button { padding:9px 4px; font-size:12px; }
.input-toggle { font-size:12px; text-align:left; }
.command-display .panel-note { margin:0; }
.mission-controls { border-top:1px solid var(--edge); padding-top:10px; margin-top:auto; }
summary { cursor:pointer; min-height:36px; color:var(--muted); font-size:12px; line-height:1.5; }
.mission-controls button { width:100%; margin-top:6px; font-size:12px; }
.boss-mode-control { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:8px; font-size:12px; }
.boss-mode-control select { min-width:0; max-width:60%; padding:5px; color:var(--text); background:#17252c; border:1px solid var(--edge); border-radius:4px; font:inherit; }
.help-button { color:var(--accent); background:#172930; }
.audio-controls { display:grid; grid-template-columns:1fr 1fr; align-items:center; gap:6px; border-top:1px solid var(--edge); padding-top:8px; }
.audio-controls button { min-height:42px; padding:6px; font-size:12px; }
.audio-settings { min-width:0; }.audio-settings[open] { grid-column:1/-1; }
.audio-settings>summary { cursor:pointer; padding:10px 6px; font-size:12px; }
.audio-controls label { display:flex; justify-content:space-between; margin-top:8px; font-size:12px; color:var(--muted); }
.music-playback { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin-top:6px; }
#music-status,.music-credits { margin:6px 0 0; font-size:12px; color:var(--muted); overflow-wrap:anywhere; }
.music-credits summary { cursor:pointer; }.music-credits p { white-space:pre-line; }
.audio-controls input { width:100%; margin:0; accent-color:var(--accent); min-height:24px; }
.audio-controls input:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.mission-deck { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; min-height:0; }
.mission-deck .console-panel { min-height:0; overflow:auto; padding:12px 14px; display:flex; flex-direction:column; gap:9px; }
.readout-scroll { overflow:auto; min-height:0; scrollbar-width:thin; display:flex; flex-direction:column; gap:7px; font-size:13px; }
#mission-briefing { color:var(--muted); font-size:12px; }
#mission-progress { color:#d2e1df; }
#mission-status { color:#b7f5bc; font-weight:700; }
#mission-status.mission-failed { color:#ffb2b6; }
#mission-status.mission-warning { color:var(--warning); }
#phase-status.mission-failed { color:#ffb2b6; background:#352125; border-color:#89535b; }
#phase-status.mission-warning { color:var(--warning); background:#342e20; border-color:#88764c; }
#combat-message { color:#d4dedf; }
#enemy-intentions { color:#ffb3b9; }
#all-clear-status { color:#a4ead0; }
#hostile-signatures { font-size:16px; font-weight:650; color:var(--warning); }
.idle-events { color:var(--muted); font-size:12px; }
.event-display:has(#combat-message:not(:empty),#mission-status:not(:empty),#enemy-intentions:not(:empty),#generation-status:not(:empty)) .idle-events { display:none; }
.readout-scroll p:empty { display:none; }
dialog { width:min(680px,calc(100vw - 32px)); max-height:85dvh; padding:24px; border:1px solid #708d97; border-radius:8px; background:#14232b; color:var(--text); overflow:auto; }
dialog::backdrop { background:rgb(3 9 13 / 80%); }
.mission-debrief { width:min(600px,calc(100vw - 32px)); max-height:calc(100dvh - 24px); padding:0; border-color:#6b9f98; box-shadow:0 16px 60px #0008; }
.mission-debrief::backdrop { background:rgb(3 9 13 / 58%); }
.mission-debrief[open] { display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
.debrief-heading { padding:22px 24px 16px; border-bottom:1px solid var(--edge); background:#192c34; }
.debrief-heading h2 { font-size:21px; letter-spacing:.02em; text-transform:none; margin-top:6px; color:var(--text); }
.debrief-heading p { margin:0; }.debrief-heading .panel-note { margin-top:8px; }
.debrief-body { padding:20px 24px; overflow:auto; min-height:0; }
.mission-debrief h3 { font-size:21px; line-height:1.3; margin:0; color:#b7f5bc; }
.mission-debrief[data-tone="failure"] { border-color:#a9717a; }
.mission-debrief[data-tone="failure"] h3 { color:#ffb2b6; }
.mission-debrief[data-tone="warning"] { border-color:#ad9157; }
.mission-debrief[data-tone="warning"] h3 { color:var(--warning); }
.debrief-stats { display:grid; grid-template-columns:1.5fr 1fr 1fr; gap:8px; margin:20px 0 0; }
.debrief-stats div { padding:12px; background:#0f1c23; border:1px solid var(--edge); border-radius:4px; }
.debrief-stats dt { color:var(--muted); font-size:12px; }
.debrief-stats dd { font-size:26px; font-weight:650; margin:5px 0 0; }
.debrief-controls { position:sticky; bottom:0; display:grid; grid-template-columns:repeat(3,1fr); gap:8px; padding:16px 24px; background:#192c34; border-top:1px solid var(--edge); }
.debrief-controls button { padding:10px 6px; font-size:13px; min-height:44px; }
.briefing-controls { grid-template-columns:1fr; }
.mission-start h4 { margin:18px 0 6px; color:var(--accent); font-size:12px; letter-spacing:.09em; text-transform:uppercase; }
.mission-start .command-message { color:#d4dfce; font-style:italic; }
@media (max-height:520px), (max-width:600px) {
  .debrief-heading { padding:12px 16px; }.debrief-body { padding:12px 16px; }.debrief-controls { padding:12px 16px; }
  .mission-debrief h3 { font-size:18px; }.debrief-stats { margin-top:12px; }.debrief-stats div { padding:8px; }.debrief-stats dd { font-size:22px; }
}
.help-heading { display:flex; justify-content:space-between; gap:20px; align-items:center; margin-bottom:18px; position:sticky; top:-24px; padding:12px 0; background:#14232b; }
dialog p { margin:10px 0; font-size:14px; }
dialog h3 { font-size:16px; margin-top:22px; color:var(--accent); }
.legend-light { color:#a5ddc9; }.legend-dark { color:#91a29d; }
.rotate-message { display:none; }

.context-prompt { min-height:66px; max-height:108px; background:#101c23; padding:8px; border-radius:4px; }
.camera-controls { display:grid; grid-template-columns:44px minmax(0,1fr) 44px; gap:5px; }
.camera-controls button { padding:8px 4px; }
#inspect-mode { font-size:13px; }
#combat-message,#mission-events { white-space:pre-line; }
.info-tabs { display:none; }
.canvas-stage { position:relative; }
canvas:active { cursor:grabbing; }
@media (prefers-reduced-motion:reduce) { * { scroll-behavior:auto!important; } }

/* The readout scrolls independently of the persistent objective header. */
.objective-header { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; flex-shrink:0; }
.objective-header #hostile-signatures { font-size:12px; white-space:nowrap; }
.mission-deck .objective-display { overflow:hidden; }
.objective-display .readout-scroll { flex:1; }
.mobile-signatures { display:none; color:var(--warning); font-size:12px; font-weight:650; white-space:nowrap; }
/* Specialist controls share each card's footprint, without nested buttons. */
.operative-card { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.operative-card .squad-card { width: 100%; flex: 1; margin: 0; }
.skill-button { width: 100%; min-height: 42px; padding: 8px; font-size: .78rem; line-height: 1.3; border-color: #65bba5; }
.skill-button[aria-pressed="true"] { background: #335b50; outline: 2px solid #b5ff91; }

.skill-description { font-size: .7rem; line-height: 1.35; color: #b9ceca; padding: 0 4px; }

/* Keep the compact legend out of the flexible battlefield row. */
.tactical-display { grid-template-rows: auto auto minmax(0,1fr); }
.tactical-legend { margin: 0; font-size: 10px; line-height: 1.3; }

/* Developer catalogue stays in a modal; the sidebar receives only its entry. */
.sound-lab { width:min(760px,calc(100vw - 24px)); }
.sound-lab .debrief-controls { grid-template-columns:1fr 1fr; }
#sound-lab-status { grid-column:1/-1; margin:0; color:var(--muted); font-size:12px; }
.sound-category h3 { font-size:17px; margin:0 0 10px; }
.sound-category + .sound-category { margin-top:22px; }
.sound-category ul { list-style:none; padding:0; margin:0; }
.sound-category li { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:center; padding:10px 0; border-bottom:1px solid var(--edge); }
.sound-category p { margin:4px 0; color:var(--muted); font-size:12px; overflow-wrap:anywhere; }
.sound-category code { color:var(--muted); font-size:11px; overflow-wrap:anywhere; }
.sound-category button { min-height:44px; min-width:64px; padding:8px; }

@media (max-width:600px), (hover:none) and (pointer:coarse) { #open-sound-lab { display:none; } }

/* Command Bridge shell. These rules are scoped away from the Tactical Console. */
.command-bridge { min-height:100svh; position:relative; isolation:isolate; display:flex; flex-direction:column; padding:24px clamp(16px,4vw,72px) 14px; overflow:hidden; --bridge-background:#080F1D; --bridge-panel:#121E31; --bridge-text:#F5F7FF; --bridge-accent:#65D6F5; --bridge-highlight:#E9AD67; --bridge-muted:#b3c3d7; --bridge-body-size:16px; --bridge-label-size:14px; background:var(--bridge-background); color:var(--bridge-text); font-size:var(--bridge-body-size); line-height:1.5; }
.bridge-architecture { position:absolute; inset:0; z-index:-2; pointer-events:none; }.bridge-architecture svg { width:100%; height:100%; }
.bridge-masthead { position:relative; display:flex; justify-content:center; align-items:center; gap:16px; font-size:var(--bridge-label-size); text-transform:uppercase; letter-spacing:.1em; color:var(--bridge-muted); flex-wrap:wrap; row-gap:8px; }

.bridge-masthead .eyebrow { font-size:var(--bridge-label-size); color:var(--bridge-muted); }
.bridge-window { position:relative; margin:24px 1.5vw 0; height:clamp(245px,43vh,480px); display:grid; place-items:center; }
.space-view { position:absolute; inset:0; overflow:hidden; z-index:-1; clip-path:polygon(3% 1%,97% 1%,99.6% 84.5%,87.9% 99%,12.1% 99%,.4% 84.5%); isolation:isolate; background:radial-gradient(ellipse at 74% 85%,#17374a 0, #0a1627 38%,#050b16 80%); }
.star-layer { position:absolute; width:106%; height:106%; left:-3%; top:-3%; pointer-events:none; }
.bridge-planet { position:absolute; right:10%; top:30%; width:clamp(100px,14vw,220px); aspect-ratio:1; border-radius:50%; background:var(--bridge-background); z-index:1; transform:rotate(-25deg); box-shadow:-14px -10px 35px #36556a22; }
.bridge-window-frame { position:absolute; inset:0; width:100%; height:100%; overflow:visible; pointer-events:none; }
.bridge-planet::before { content:''; position:absolute; inset:0; border-radius:inherit; background:radial-gradient(circle at 72% 75%,#081322 38%,#173747 65%,#376476 74%,#6a9baa 76%,#102a3d 78%); opacity:.5; }
.bridge-heading { z-index:1; text-align:center; position:relative; padding:24px 8px; text-shadow:0 3px 18px #030a14; }
.bridge-kicker { text-transform:uppercase; font-size:var(--bridge-label-size); letter-spacing:.18em; color:var(--bridge-muted); margin-bottom:20px; }
#bridge-title { font-size:clamp(35px,4.7vw,72px); line-height:1; letter-spacing:.12em; font-weight:750; color:var(--bridge-text); }#bridge-title span { font-size:.61em; letter-spacing:.23em; color:#c3e2f1; }
.bridge-tagline { margin-top:22px; font-size:var(--bridge-body-size); color:var(--bridge-muted); letter-spacing:.03em; }
.bridge-stations { position:relative; display:grid; grid-template-columns:minmax(190px,.85fr) minmax(280px,1.3fr) minmax(230px,1fr); align-items:end; gap:clamp(14px,2vw,34px); max-width:1230px; width:100%; margin:12px auto auto; padding:0 1vw 26px; }
.bridge-station { position:relative; padding:15px 13px 25px; background:linear-gradient(135deg,#344b61,#1e3046 40%,#111e30); border-top:3px solid #4d6e83; clip-path:polygon(0 18px,18px 0,calc(100% - 18px) 0,100% 18px,100% calc(100% - 12px),calc(100% - 16px) 100%,16px 100%,0 calc(100% - 12px)); box-shadow:0 18px 0 #081321; }
.bridge-station::after { content:''; display:block; height:6px; margin:14px 18px -13px; background:repeating-linear-gradient(90deg,#081522 0 5px,#2b4356 5px 7px); opacity:.75; }
.station-screen { min-width:0; padding:20px 18px; border:1px solid #3f6479; border-top:2px solid #43879e; background:linear-gradient(150deg,var(--bridge-panel),#0c1627 70%); box-shadow:inset 0 0 25px #020a1360; }
.station-screen h2 { color:var(--bridge-muted); font-size:var(--bridge-label-size); letter-spacing:.1em; margin-bottom:18px; font-weight:650; }
.ship-station h2,.music-station h2 { text-align:center; }
.ship-station nav { display:grid; gap:5px; }.ship-station button { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:48px; border:0; border-bottom:1px solid #284456; border-radius:0; background:transparent; color:var(--bridge-text); padding:11px 4px; text-align:left; }.ship-station button span:last-child { color:var(--bridge-accent); }
.command-bridge button:hover { background:#1b3249; color:var(--bridge-text); }.command-bridge button:active { transform:translateY(1px); }.command-bridge button:focus-visible { outline:3px solid var(--bridge-accent); outline-offset:3px; }.shell-dialog button:focus-visible { outline:3px solid #9ee4f0; outline-offset:3px; }
.mission-station { padding:18px 15px 28px; border-top-color:#a5b7bd; }.mission-station .station-screen { padding:25px 24px 14px; border-top-color:var(--bridge-highlight); text-align:center; }.mission-station h2 { margin-bottom:12px; color:var(--bridge-text); font-size:18px; letter-spacing:.12em; }.mission-station p:not(.station-indicator) { font-size:var(--bridge-body-size); color:var(--bridge-muted); }.station-indicator { margin:0 0 22px; font-size:var(--bridge-label-size); letter-spacing:.1em; color:var(--bridge-muted); text-transform:uppercase; }
.command-bridge .bridge-primary { display:flex; align-items:center; justify-content:center; gap:14px; width:100%; min-height:84px; margin-top:28px; padding:16px; background:var(--bridge-highlight); border:2px solid #f5cda0; border-radius:2px; color:var(--bridge-background); box-shadow:0 5px 0 #725632,0 0 28px #e2ae4315; font-size:clamp(20px,1.6vw,23px); font-weight:750; letter-spacing:.06em; }.bridge-primary svg { width:25px; height:25px; flex-shrink:0; }.command-bridge .bridge-primary:hover { background:#f4bf86; color:var(--bridge-background); }.command-bridge .bridge-primary:active { box-shadow:0 2px 0 #725632; transform:translateY(3px); }
.mission-reserve { height:23px; }.ship-station .station-screen,.music-station .station-screen { padding:20px 16px; }.track-label { color:var(--bridge-muted); font-size:var(--bridge-label-size); letter-spacing:.08em; text-transform:uppercase; }.bridge-track { font-size:var(--bridge-body-size); margin:8px 0; min-height:40px; line-height:1.25; color:var(--bridge-text); overflow-wrap:anywhere; }.bridge-audio-status { min-height:30px; color:var(--bridge-muted); font-size:var(--bridge-body-size); line-height:1.35; }.bridge-music-buttons { display:grid; grid-template-columns:1fr 1fr; gap:7px; margin:10px 0 17px; }.bridge-music-buttons button { border-radius:2px; min-height:44px; padding:8px 4px; background:#183345; border-color:#3b657a; font-size:var(--bridge-body-size); }
.music-station label { display:flex; justify-content:space-between; gap:12px; color:var(--bridge-muted); font-size:var(--bridge-body-size); }.shell-dialog label { display:flex; justify-content:space-between; gap:12px; color:#a9c6d1; font-size:12px; }.command-bridge input[type=range],.shell-dialog input[type=range] { width:100%; min-height:32px; margin:6px 0 0; accent-color:#84cbd7; }.command-bridge input[type=range] { accent-color:var(--bridge-accent); }
.bridge-footer { position:relative; text-align:center; margin-top:12px; color:var(--bridge-muted); font-size:var(--bridge-label-size); letter-spacing:.05em; }
.shell-dialog { width:min(530px,calc(100vw - 28px)); max-height:calc(100dvh - 32px); overflow:auto; padding:26px; border:1px solid #557d91; background:#132435; color:#e4edf0; border-radius:7px; }.shell-dialog::backdrop { background:#020a13cb; }.shell-dialog h2 { color:#aedce5; margin:0 0 18px; font-size:18px; letter-spacing:.06em; }.shell-dialog h3 { font-size:14px; margin:22px 0 10px; }.shell-dialog p { margin:10px 0 18px; }.shell-dialog label { margin-top:18px; }.shell-dialog button { min-height:44px; }.shell-dialog>button:last-child { width:100%; margin-top:22px; }.shell-music-credits { white-space:pre-line; overflow-wrap:anywhere; font-size:12px; color:#aec4cd; }
@media (max-width:900px) { .command-bridge { padding:18px 18px 12px; }.bridge-stations { grid-template-columns:minmax(160px,1fr) minmax(220px,1.3fr) minmax(195px,1fr); gap:10px; padding:0 0 16px; }.station-screen,.ship-station .station-screen,.music-station .station-screen { padding:17px 12px; }.mission-station .station-screen { padding:24px 14px 12px; }.bridge-window { margin-left:0; margin-right:0; } }
@media (max-width:680px) { .bridge-window { height:260px; margin-top:18px; }.bridge-stations { grid-template-columns:1fr; max-width:450px; gap:12px; margin-top:4px; }.mission-station { grid-row:1; }.mission-station .station-screen { padding:20px 18px 10px; }.mission-station .station-indicator { margin-bottom:12px; }.command-bridge .bridge-primary { margin-top:18px; min-height:70px; }.mission-reserve { height:15px; }.ship-station nav { grid-template-columns:1fr; }.bridge-station { padding:12px 12px 21px; }.bridge-station::after { margin-top:12px; }.bridge-architecture { opacity:.7; }.bridge-planet { right:4%; top:28%; }.bridge-tagline { max-width:260px; margin:18px auto 0; font-size:var(--bridge-body-size); }.bridge-kicker { letter-spacing:.12em; }.bridge-masthead { display:grid; grid-template-columns:1fr; gap:6px; text-align:center; letter-spacing:.08em; }.bridge-footer { margin:12px 0 6px; } }
@media (max-height:500px) and (min-width:681px) { .command-bridge { padding-top:12px; }.bridge-window { height:210px; margin-top:10px; }.bridge-kicker { margin-bottom:12px; }#bridge-title { font-size:42px; }.bridge-tagline { margin-top:14px; }.bridge-stations { margin-top:0; }.station-indicator { margin-bottom:12px; }.command-bridge .bridge-primary { min-height:65px; margin-top:16px; } }
@media (max-width:600px), (hover:none) and (pointer:coarse) { [data-developer-only="true"] { display:none!important; } }
.bridge-stations { z-index:0; }.bridge-stations::before { content:''; position:absolute; z-index:-1; inset:24% -4% 0; background:linear-gradient(#31485c,#192b40 45%,#0b1828); border-top:2px solid #4a6477; clip-path:polygon(5% 0,95% 0,100% 100%,0 100%); }
@media (max-width:680px) { .bridge-stations::before { display:none; } }

/* Shared popup typography, scoped away from briefing/debrief. */
.bridge-popup { box-sizing:border-box; width:min(720px,calc(100vw - 28px)); max-height:calc(100dvh - 28px); padding:26px; overflow:auto; background:#121E31; color:#F5F7FF; font-size:16px; line-height:1.6; }
.bridge-popup h2 { margin:0 0 20px; color:#65D6F5; font-size:24px; line-height:1.25; letter-spacing:.04em; }
.bridge-popup h3 { margin:28px 0 10px; color:#65D6F5; font-size:19px; line-height:1.35; }
.bridge-popup p { margin:0 0 18px; line-height:inherit; }
.bridge-popup .hint { font-size:16px; line-height:inherit; color:inherit; }
.bridge-popup label { font-size:14px; color:#b3c3d7; margin-top:22px; }
.bridge-popup button { font-size:16px; min-height:44px; }
.bridge-popup a { color:#65D6F5; overflow-wrap:anywhere; }
.bridge-popup :focus-visible { outline:2px solid #65D6F5; outline-offset:3px; }
.bridge-popup .help-heading { background:#121E31; top:-26px; z-index:1; flex-wrap:wrap; }
.bridge-popup .help-heading h2 { margin:0; }
.bridge-popup .credits-contributor { margin:30px 0; }
.bridge-popup .credits-role { color:#b3c3d7; font-size:14px; margin-bottom:10px; }
.bridge-popup .credits-motto { color:#E9AD67; }
.bridge-popup .credits-music { border-top:1px solid #344f67; margin-top:30px; padding-top:4px; color:#b3c3d7; font-size:14px; }
.bridge-popup .credits-music h3 { font-size:16px; }
.bridge-popup .credits-music p { margin-bottom:10px; }
#credits-dialog>button:last-child { position:sticky; bottom:-26px; background:#1c3547; border-color:#557d91; }
@media (max-width:480px) { .bridge-popup { padding:18px; }.bridge-popup .help-heading { top:-18px; }#credits-dialog>button:last-child { bottom:-18px; } }
/* Milestone 32.1: tactical workstation, sharing the Command Bridge palette. */
.command-console { --background:#080F1D; --panel:#121E31; --text:#F5F7FF; --accent:#65D6F5; --muted:#b3c3d7; background:var(--background); color:var(--text); padding:10px; gap:8px; grid-template-rows:42px minmax(0,1fr) 170px; }
.command-console .console-header { min-height:0; gap:18px; border-bottom:1px solid #344f67; }
.command-console .console-brand { font-size:12px; }
.command-console .phase-readout { margin-left:0; gap:10px; }
.command-console #hostile-signatures { color:#ff7d88; font-size:17px; font-weight:750; margin:auto; }
.command-console #hostile-signatures-mobile { display:none; }
.command-console .mission-mode { font-size:11px; max-width:240px; }
.command-console .console-workspace { grid-template-columns:164px minmax(0,1fr) 178px; gap:8px; }
.command-console .console-panel { border-color:#344f67; border-radius:3px; }
.command-console .squad-display,.command-console .command-display { padding:10px; }
.command-console #squad-title,.command-console #squad-note,.command-console #commands-title,.command-console #selected-order { display:none; }
.command-console #squad-panel { gap:10px; }
.command-console .squad-card { padding:9px; gap:7px; background:#101c2e; border-color:#344f67; }
.command-console .squad-card[aria-pressed="true"] { border-color:#65D6F5; box-shadow:inset 0 0 0 1px #65D6F5; }
.operative-portrait { display:grid; place-items:center; height:55px; background:linear-gradient(135deg,#233c51,#0b1423); color:#65D6F5; font-size:34px; border-bottom:1px solid #344f67; }
.command-console .operative-name { text-transform:uppercase; font-size:16px; }
.command-console .operative-role { font-size:12px; }
.command-console .card-resources { display:grid; grid-template-columns:1fr 1fr; gap:5px; font-size:12px; }
.command-console .operative-health { background:linear-gradient(to right,#245e47 0 var(--hp,100%),#101923 var(--hp,100%) 100%); color:#c3ffda; border-color:#3a795b; }
.command-console .operative-ap { background:linear-gradient(to right,#205985 0 var(--ap,100%),#101923 var(--ap,100%) 100%); color:#ceeaff; border-color:#3c7db0; }
.command-console .squad-card[data-injured="true"] .operative-health { color:#c3ffda; }

.command-console .operative-order { font-size:12px; max-height:54px; overflow:auto; }
.command-console .skill-button { font-size:12px; min-height:34px; text-transform:uppercase; }
.command-console .skill-description { display:none; }
.command-console .tactical-display { grid-template-rows:auto auto minmax(0,1fr); gap:4px; }
.command-console .tactical-legend { margin:0; font-size:11px; }
.command-console .canvas-stage { border-color:#243b51; background:#080F1D; }
.command-console .command-display { gap:6px; }
.command-console .command-display button { font-size:12px; min-height:34px; padding:7px 6px; }
.command-console .context-prompt { font-size:12px; max-height:70px; min-height:0; }
.command-console .edit-controls { padding-top:7px; gap:6px; }
.command-console .mission-deck { grid-template-columns:minmax(0,1fr) 150px minmax(0,1fr); gap:8px; padding-left:172px; padding-right:186px; }
.execute-station { display:flex; align-items:flex-start; justify-content:center; }
#execute { width:100%; min-height:64px; font-size:18px; letter-spacing:.08em; background:#27634e; border:1px solid #80e3ad; }
#execute:hover { background:#358467; }
.command-console .readout-scroll { overflow:auto; }
.command-console .objective-display p,.command-console .chat-display p { font-size:13px; line-height:1.5; }
#dev-ops-dialog .audio-controls { display:none; }
#dev-ops-dialog .mission-controls { margin:20px 0; }
#dev-ops-dialog select { max-width:100%; }
@media (max-width:1000px) { .command-console .console-brand,#round-clock { display:none; }.command-console .mission-deck { padding:0; }.command-console .console-workspace { grid-template-columns:148px minmax(0,1fr) 155px; }.command-console #hostile-signatures { font-size:14px; } }
@media (max-width:600px) { .command-console { height:auto; min-height:100dvh; grid-template-rows:auto auto auto; }.command-console .console-header { flex-wrap:wrap; padding-bottom:8px; }.command-console .mission-mode { display:none; }.command-console .console-workspace { grid-template-columns:minmax(0,1fr); }.command-console .tactical-display { grid-row:1; min-height:340px; }.command-console #squad-panel { grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; }.command-console .squad-card { padding:5px; }.command-console .operative-portrait { height:40px; }.command-console .operative-name { font-size:13px; }.command-console .card-resources { grid-template-columns:1fr; }.command-console .command-display { display:grid; grid-template-columns:1fr 1fr; }.command-console .context-prompt,.command-console .edit-controls { grid-column:1/-1; }.command-console .mission-deck { grid-template-columns:minmax(0,1fr); }.command-console .info-tabs { grid-template-columns:1fr 1fr; }.execute-station { grid-row:1; }.command-console .mission-deck .console-panel { height:190px; } }
/* 32.1.1: remove informational chrome; retain accessible diagnostics/handlers. */
.command-console .console-header { justify-content:space-between; }
.command-console .phase-readout { flex:none; }
.command-console #hostile-signatures { margin:0 auto; }
.command-console .mission-mode { max-width:none; white-space:nowrap; font-size:11px; flex:none; }
.command-console .tactical-display { grid-template-rows:minmax(0,1fr); gap:0; }
.command-console .monitor-heading { display:none; }
.command-console #squad-panel { height:100%; grid-template-rows:repeat(3,minmax(0,1fr)); gap:8px; }
.command-console .operative-card { display:flex; flex-direction:column; min-height:0; }
.command-console .squad-card { flex:1; min-height:0; grid-template-rows:minmax(45px,1fr) auto auto; gap:6px; }
.command-console .operative-portrait { height:100%; min-height:45px; }
.command-console .card-heading { flex-direction:row; align-items:baseline; gap:5px; white-space:nowrap; }
.command-console .operative-name { font-size:14px; }
.command-console .operative-role { font-size:11px; }
.command-console .skill-button { white-space:nowrap; min-height:32px; }
.command-console .execute-station { flex-direction:column; gap:6px; justify-content:flex-start; }
.execute-station>button { width:100%; }
.tactical-music { display:grid; gap:8px; border-bottom:1px solid #344f67; padding-bottom:12px; margin:4px 0; }
#tactical-track { color:#b3c3d7; font-size:13px; overflow-wrap:anywhere; }
.tactical-music label { display:flex; justify-content:space-between; font-size:12px; color:#b3c3d7; }
.tactical-music input { width:100%; accent-color:#65D6F5; }
.visually-hidden { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
@media (max-width:600px) { .command-console #squad-panel { grid-template-rows:none; height:auto; }.command-console .card-heading { flex-wrap:wrap; white-space:normal; }.command-console .operative-portrait { height:70px; }.command-console .squad-card { flex:auto; }.command-console .execute-station { flex-direction:column; } }

/* Keep developer access below every player-facing utility. */
.command-console #open-dev-ops { margin-top:auto; }

/* Compact below 1100px width or 610px height; shared with tacticalLayoutMode.
   M33: phone composition. Desktop rules above remain authoritative outside this query. */
.mobile-only { display:none; }
@media (max-width:1099px), (max-height:609px) {
  .command-console { box-sizing:border-box; height:100dvh; min-height:420px; padding:max(5px,env(safe-area-inset-top)) max(5px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) max(5px,env(safe-area-inset-left)); display:grid; grid-template-rows:28px minmax(0,1fr) 104px 44px; gap:5px; overflow:hidden; }
  .command-console[hidden] { display:none; }
  .command-console .console-header { padding:0; border:0; }
  .command-console .phase-readout,.command-console .mission-mode,.command-console #hostile-signatures,.command-console #next-operative,.command-console .info-tabs,.command-console .chat-display,.command-console .operative-portrait,.command-console .operative-role,.command-console .skill-description,.command-console .squad-display .skill-button,.command-console [data-developer-only] { display:none; }
  .command-console #hostile-signatures-mobile { display:block; margin:0; color:#ff7d88; text-align:center; font-size:13px; font-weight:bold; }
  .command-console .console-workspace { display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:82px minmax(0,1fr); gap:5px; min-height:0; }
  .command-console .squad-display { padding:0; border:0; min-height:0; }
  .command-console #squad-panel { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); grid-template-rows:minmax(0,1fr); height:100%; gap:5px; }
  .command-console .squad-card { display:flex; flex-direction:column; justify-content:center; align-items:stretch; gap:3px; padding:5px; width:100%; height:100%; }
  .command-console .card-heading { justify-content:center; }
  .command-console .operative-name { font-size:12px; }
  .command-console .card-resources { grid-template-columns:1fr; gap:2px; font-size:12px; }
  .command-console .tactical-display { grid-row:2; min-height:0; height:100%; }
  .command-console .canvas-stage { min-height:0; height:100%; touch-action:none; }
  .command-console .command-display,.command-console .objective-display { display:none; }
  .command-console .mission-deck { display:block; padding:0; min-height:0; }
  .command-console .execute-station { display:grid; grid-template-columns:1fr 1fr; grid-template-rows:44px 54px; gap:5px; }
  .command-console #mobile-skill { display:block; grid-column:1; grid-row:1; }
  .command-console #clear-order { grid-column:2; grid-row:1; }
  .command-console #execute { grid-column:1/-1; grid-row:2; min-height:54px; }
  .command-console .execute-station #hostile-signatures-mobile { position:absolute; top:max(5px,env(safe-area-inset-top)); left:0; right:0; pointer-events:none; }
  #mobile-navigation { display:grid; grid-template-columns:1fr 1fr; gap:5px; }
  .command-console button { min-height:44px; font-size:14px; }
  #mobile-panel { max-height:calc(100dvh - 16px); }
  #mobile-panel-close { position:sticky; top:0; z-index:1; min-height:44px; }
  #mobile-panel .command-display,#mobile-panel .objective-display { display:grid; height:auto; gap:10px; }
  #mobile-panel .mission-mode { display:block; white-space:normal; }
  #mobile-panel [data-developer-only] { display:none; }
  #mobile-panel .camera-controls { display:flex; gap:6px; }
  #mobile-panel button { min-height:44px; font-size:14px; }
  #mobile-panel input[type=range] { min-height:44px; }
  .bridge-station button { min-height:44px; }
}
@media (max-width:1099px) and (orientation:landscape), (max-height:609px) and (orientation:landscape) {
  .command-console { min-height:320px; grid-template-columns:104px minmax(0,1fr) 132px; grid-template-rows:minmax(0,1fr) 44px; }
  .command-console .console-header { display:none; }
  .command-console .console-workspace { display:contents; }
  .command-console .squad-display { grid-column:1; grid-row:1/-1; }
  .command-console #squad-panel { grid-template-columns:1fr; grid-template-rows:repeat(3,minmax(0,1fr)); }
  .command-console .tactical-display { grid-column:2; grid-row:1/-1; }
  .command-console .mission-deck { grid-column:3; grid-row:1; }
  .command-console .execute-station { display:flex; height:100%; gap:5px; }
  .command-console .execute-station #hostile-signatures-mobile { position:static; font-size:12px; padding:6px 0; }
  .command-console .execute-station>button { flex:1; min-height:44px; }
  #mobile-navigation { grid-column:3; grid-row:2; }
  #mobile-navigation button { padding:4px; font-size:12px; }

}

/* M33.1: use the visible phone viewport, without a reserved empty header track. */
@media (max-width:1099px), (max-height:609px) {
  .command-console { height:100vh; height:100dvh; min-height:0; grid-template-rows:minmax(0,1fr) 104px 44px; position:relative; }
  .command-console .console-header { display:none; }
  .command-console .squad-display { overflow:visible; }
  .command-console .operative-card { min-height:0; }
  .command-console .execute-station #hostile-signatures-mobile { top:92px; left:auto; right:8px; z-index:1; background:#080f1de8; border-radius:3px; padding:2px 5px; }
}
@media (max-width:1099px) and (orientation:landscape), (max-height:609px) and (orientation:landscape) {
  .command-console { grid-template-rows:minmax(0,1fr) 44px; gap:4px; }
  .command-console .squad-card { padding:3px 5px; gap:2px; }
  .command-console .card-resources span { padding:1px 4px; }
  .command-console .execute-station { gap:4px; }
  .command-console .execute-station>button { flex:1 1 44px; padding:5px; min-height:44px; }
  .command-console #execute { min-height:44px; }
  .command-console .execute-station #hostile-signatures-mobile { position:static; padding:2px 0; font-size:12px; line-height:1.2; }
}

/* M33.2: compact modal content, isolated from tactical rail sizing. */
@media (max-width:1099px), (max-height:609px) {
  #mobile-panel { padding:12px; overflow:hidden; max-height:calc(100dvh - 16px); }
  #mobile-panel[open] { display:flex; flex-direction:column; gap:10px; }
  #mobile-panel .mobile-panel-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; flex:none; }
  #mobile-panel-title { font-size:18px; margin:0; }
  #mobile-panel-close { position:static; flex:none; padding:6px 12px; }
  #mobile-panel-content { overflow:auto; min-height:0; overscroll-behavior:contain; }
  #mobile-panel .mobile-metadata { font-size:12px; color:#b3c3d7; margin:0 0 8px; }
  #mobile-panel .command-display { display:flex; flex-direction:column; gap:8px; padding:8px; overflow:visible; }
  #mobile-panel .camera-controls { display:none; }
  #mobile-panel .tactical-music { display:grid; grid-template-columns:minmax(0,1fr); gap:6px; margin:0; padding-bottom:8px; }
  #mobile-panel .tactical-music label { margin:0; }
  #mobile-panel .tactical-music input { margin:0; }
  #mobile-panel .command-display button { flex:none; height:auto; min-height:44px; }
  .command-console .execute-station #hostile-signatures-mobile { left:50%; right:auto; transform:translateX(-50%); white-space:nowrap; }
}
@media (max-width:1099px) and (orientation:landscape), (max-height:609px) and (orientation:landscape) {
  .command-console .execute-station #hostile-signatures-mobile { transform:none; }
  #mobile-panel .tactical-music { grid-template-columns:1fr 1fr; column-gap:16px; }
  #mobile-panel #tactical-track,#mobile-panel .paired-controls,#mobile-panel #tactical-audio-mute { grid-column:1/-1; }
  #mobile-panel label[for="tactical-music-volume"] { grid-column:1; grid-row:3; }
  #mobile-panel #tactical-music-volume { grid-column:1; grid-row:4; }
  #mobile-panel label[for="tactical-sfx-volume"] { grid-column:2; grid-row:3; }
  #mobile-panel #tactical-sfx-volume { grid-column:2; grid-row:4; }
}

/* Retain existing Bridge behavior independently of tactical breakpoints. */
@media (max-width:1000px) and (max-height:600px) and (orientation:landscape) { .command-bridge { height:auto; min-height:100dvh; overflow:visible; } }
@media (orientation:landscape) and (max-height:650px) { .command-bridge .eyebrow { display:none; } }

/* M34.1: contain the supplied square art inside the existing portrait footprint. */
.operative-portrait { position:relative; overflow:hidden; }
.operative-portrait-image { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; background:#0b1423; }

/* M35.1: visual assignment cards; tactical/debrief layouts are unchanged. */
#briefing-dialog { width:min(720px,calc(100vw - 24px)); background:#121e31; }
#briefing-dialog .debrief-heading,#briefing-dialog .debrief-controls { background:#101c2e; }
#briefing-dialog .debrief-body { padding:16px; }
#briefing-dialog #briefing-outcome { font-size:18px; margin-bottom:6px; }
#briefing-dialog #briefing-explanation { color:#b3c3d7; font-size:14px; }
.briefing-objectives { list-style:none; padding:0; margin:10px 0 14px; display:grid; gap:10px; }
.briefing-objectives li { display:grid; grid-template-columns:96px minmax(0,1fr); align-items:center; gap:12px; padding:8px; border:1px solid #344f67; border-radius:4px; background:#0b1523; }
.briefing-objectives canvas { width:96px; height:96px; max-width:100%; cursor:default; pointer-events:none; touch-action:auto; }
#briefing-dialog .briefing-objectives h4 { margin:0 0 5px; font-size:15px; letter-spacing:.02em; color:#f5f7ff; }
.briefing-objectives p { font-size:14px; overflow-wrap:anywhere; }

#briefing-dialog .command-message { font-size:14px; }
#briefing-dialog .briefing-controls { grid-template-columns:1fr 1fr; }
@media (max-width:420px) { .briefing-objectives li { grid-template-columns:76px minmax(0,1fr); gap:8px; }.briefing-objectives canvas { width:76px; height:76px; } }
@media (max-height:450px) { #briefing-dialog .debrief-heading { padding:10px 16px; }#briefing-dialog .debrief-controls { padding:8px 16px; } }

/* M35.2: compact progress rows inside the existing desktop panel/mobile overlay. */
.objective-checklist { list-style:none; margin:0; padding:0; display:grid; gap:8px; }
.objective-checklist li { display:grid; grid-template-columns:52px minmax(0,1fr); gap:8px; align-items:start; padding:5px 0; border-bottom:1px solid #344f67; }
.objective-checklist canvas { width:52px; height:52px; pointer-events:none; touch-action:auto; }
.objective-checklist h3 { font-size:13px; line-height:1.3; color:#f5f7ff; margin:0 0 3px; overflow-wrap:anywhere; }
.command-console .objective-checklist p { font-size:12px; line-height:1.4; overflow-wrap:anywhere; }
.objective-checklist [data-state="completed"] h3 { color:#a7ebba; }
.objective-checklist [data-state="locked"] h3,.objective-checklist [data-state="unavailable"] h3 { color:#e9bd75; }
#mobile-panel .objective-checklist h3 { font-size:15px; }
#mobile-panel .objective-checklist p { font-size:14px; }
#mobile-panel .objective-checklist li { grid-template-columns:64px minmax(0,1fr); }
#mobile-panel .objective-checklist canvas { width:64px; height:64px; }

/* M35.3: shared welcome/Story panel; no tactical layout changes. */
#story-dialog { padding:0; max-height:calc(100dvh - 24px); overflow:hidden; }
#story-dialog[open] { display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
#story-dialog header,#story-dialog footer { padding:18px 22px; background:#101c2e; }
#story-dialog header { border-bottom:1px solid #344f67; }
#story-dialog h2 { margin:0; font-size:22px; line-height:1.3; overflow-wrap:anywhere; }
#story-dialog .story-body { padding:20px 22px; overflow:auto; min-height:0; }
#story-dialog .story-body p:last-child { margin-bottom:0; }
#story-dialog .story-motto { color:#e9ad67; }
#story-dialog footer { border-top:1px solid #344f67; }
#close-story { width:100%; min-height:44px; }
@media (max-height:450px) { #story-dialog header,#story-dialog footer { padding:10px 16px; }#story-dialog h2 { font-size:18px; }#story-dialog .story-body { padding:14px 16px; } }

/* M36.2.3: small subheadings within the existing scrolling Help popup. */
#help-dialog h4 { margin:18px 0 8px; color:#65d6f5; font-size:16px; }
#help-dialog section>p:last-child { margin-bottom:0; }
