:root {
  color-scheme: dark;
  --bg: #05070b;
  --panel: rgba(11, 15, 24, .94);
  --panel-2: rgba(16, 21, 33, .96);
  --line: rgba(179, 194, 221, .14);
  --line-strong: rgba(179, 194, 221, .28);
  --text: #edf2ff;
  --muted: #8f9ab1;
  --purple: #8d72ff;
  --magenta: #ff4f88;
  --cyan: #67d9ff;
  --red: #ff5d69;
  --green: #60e2a7;
  --amber: #ffc86b;
  --topbar-h: 76px;
  --bottom-h: 70px;
  --side-left: 280px;
  --side-right: 276px;
  --gap: 14px;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  background: #05070b;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.noise, .scanline { position: fixed; inset: 0; pointer-events: none; z-index: 999; }
.noise { opacity: .04; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E"); }
.scanline { opacity: .035; background: repeating-linear-gradient(to bottom, transparent 0 2px, #fff 3px, transparent 4px); }

.pc-guard { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, #151927, #030406 70%); }
.pc-guard-card { width: min(540px, 90vw); border: 1px solid var(--line-strong); background: rgba(7,10,16,.96); padding: 42px; border-radius: 24px; text-align: center; box-shadow: 0 30px 100px rgba(0,0,0,.55); }
.pc-guard-mark { width: 76px; height: 76px; display: grid; place-items: center; margin: 0 auto 22px; border-radius: 50%; border: 1px solid var(--purple); color: var(--purple); font-weight: 900; letter-spacing: .12em; }
.pc-guard h1 { margin: 0 0 12px; }
.pc-guard p { color: var(--muted); line-height: 1.7; }
.guard-readout { margin-top: 24px; padding: 14px 16px; display: flex; justify-content: space-between; background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 14px; }

.game-shell, .screen { width: 100%; height: 100%; }
.screen { display: none; }
.screen.active { display: block; }

.boot-screen {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(102, 74, 194, .18), transparent 28%),
    radial-gradient(circle at 50% 50%, #111522 0%, #080a10 44%, #030405 100%);
}
.boot-grid { position: absolute; inset: 0; opacity: .16; background-image: linear-gradient(rgba(141,114,255,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(141,114,255,.18) 1px, transparent 1px); background-size: 54px 54px; transform: perspective(700px) rotateX(68deg) translateY(36%); transform-origin: center bottom; }
.boot-terminal { position: absolute; inset: 50% auto auto 50%; width: min(820px, 78vw); min-height: 470px; transform: translate(-50%, -50%); border: 1px solid rgba(141,114,255,.26); border-radius: 26px; background: linear-gradient(180deg, rgba(9,12,20,.86), rgba(5,7,12,.96)); box-shadow: 0 40px 120px rgba(0,0,0,.6), inset 0 1px rgba(255,255,255,.04); padding: 34px 40px; overflow: hidden; }
.boot-terminal::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; top: -4px; background: linear-gradient(90deg, transparent, var(--cyan), transparent); animation: scan 4.8s linear infinite; }
.boot-status { display: flex; align-items: center; gap: 10px; color: var(--red); font-weight: 800; letter-spacing: .14em; font-size: 12px; }
.boot-status span { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 16px var(--red); animation: blink 1.2s infinite; }
.boot-log { margin: 28px 0 0; min-height: 220px; color: #b7c6dc; line-height: 1.8; font-family: "JetBrains Mono", Consolas, monospace; white-space: pre-wrap; }
.boot-identity { text-align: center; animation: reveal .7s ease both; }
.boot-identity h1 { margin: 8px 0; font-size: clamp(46px, 6vw, 82px); letter-spacing: .04em; }
.boot-identity p { color: var(--muted); }
.boot-actions { margin-top: 28px; display: flex; justify-content: center; gap: 12px; }
.boot-orbit { position: absolute; inset: 50% auto auto 50%; width: 980px; height: 980px; transform: translate(-50%,-50%); border: 1px solid rgba(141,114,255,.06); border-radius: 50%; pointer-events: none; }
.boot-orbit i { position: absolute; inset: 10%; border: 1px solid rgba(103,217,255,.08); border-radius: 50%; animation: spin 18s linear infinite; }
.boot-orbit i:nth-child(2) { inset: 22%; animation-direction: reverse; animation-duration: 12s; }
.boot-orbit i:nth-child(3) { inset: 34%; animation-duration: 8s; }

.main-screen { background: linear-gradient(180deg, #080b12, #05070b); }
.topbar { height: var(--topbar-h); display: grid; grid-template-columns: minmax(280px, 1fr) auto minmax(260px, 1fr); align-items: center; gap: 22px; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(7,10,16,.95); }
.case-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.archive-mark { width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(141,114,255,.6); background: rgba(141,114,255,.08); color: var(--text); font-weight: 900; letter-spacing: .1em; }
.case-lockup h1 { margin: 2px 0 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eyebrow { margin: 0; color: var(--cyan); font-size: 10px; letter-spacing: .18em; font-weight: 900; }
.top-status-grid { display: grid; grid-template-columns: repeat(3, minmax(130px, 1fr)); gap: 8px; }
.status-chip { min-width: 130px; padding: 10px 12px; border: 1px solid var(--line); background: rgba(255,255,255,.025); border-radius: 12px; }
.status-chip span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.status-chip strong { display: block; margin-top: 3px; font-size: 13px; }
.status-chip.alert strong { color: var(--amber); }
.top-actions { display: flex; justify-content: flex-end; gap: 8px; }
.icon-btn, .ghost-btn, .primary-btn, .danger-btn { border-radius: 11px; border: 1px solid var(--line); padding: 10px 13px; color: var(--text); font-weight: 800; font-size: 11px; letter-spacing: .08em; background: rgba(255,255,255,.035); }
.icon-btn:hover, .ghost-btn:hover { border-color: var(--line-strong); background: rgba(255,255,255,.06); }
.primary-btn { background: linear-gradient(90deg, #7456ef, #d44378); border-color: transparent; box-shadow: 0 12px 28px rgba(116,86,239,.22); }
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:disabled { opacity: .35; cursor: not-allowed; }
.danger-btn { width: 100%; background: rgba(255,93,105,.1); border-color: rgba(255,93,105,.3); color: #ff9ba4; }
.full { width: 100%; }

.content-frame { height: calc(100vh - var(--topbar-h) - var(--bottom-h)); display: grid; grid-template-columns: var(--side-left) minmax(0, 1fr) var(--side-right); gap: var(--gap); padding: var(--gap); overflow: hidden; }
.echo-panel, .objective-panel, .stage { min-width: 0; min-height: 0; }
.echo-panel, .objective-panel { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); overflow: hidden; }
.echo-panel { display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 3px 0 0; font-size: 18px; }
.signal-badge { font-size: 9px; letter-spacing: .12em; color: var(--green); border: 1px solid rgba(96,226,167,.25); padding: 6px 8px; border-radius: 999px; }
.echo-feed { overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.echo-message { border-left: 2px solid var(--purple); background: rgba(141,114,255,.06); padding: 11px 12px; border-radius: 0 12px 12px 0; line-height: 1.55; }
.echo-message.system { border-left-color: var(--cyan); background: rgba(103,217,255,.05); }
.echo-message small { display: block; margin-top: 6px; color: var(--muted); }
.dialogue-choices { padding: 12px; display: grid; gap: 8px; border-top: 1px solid var(--line); }
.dialogue-choice { text-align: left; border: 1px solid var(--line); background: rgba(255,255,255,.025); color: var(--text); border-radius: 10px; padding: 10px; }
.dialogue-choice:hover { border-color: rgba(141,114,255,.45); }

.stage { position: relative; border: 1px solid var(--line); border-radius: 20px; background: #090c13; overflow: hidden; }
.view { display: none; width: 100%; height: 100%; }
.view.active { display: block; }
.hub-ambient { position: absolute; inset: 0; background: radial-gradient(circle at 50% 47%, rgba(141,114,255,.13), transparent 28%), linear-gradient(180deg, rgba(255,255,255,.02), transparent 30%), repeating-linear-gradient(90deg, transparent 0 58px, rgba(255,255,255,.012) 59px); }
.hub-header { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; padding: 22px 24px 0; }
.hub-header h2 { margin: 6px 0 4px; font-size: 26px; }
.hub-header p { margin: 0; color: var(--muted); }
.hub-clock { text-align: right; }
.hub-clock span { display:block; color: var(--muted); font-size: 9px; letter-spacing: .14em; }
.hub-clock strong { display:block; margin-top: 5px; font-family: Consolas, monospace; letter-spacing: .1em; }
.sector-orbit { position: absolute; inset: 88px 20px 64px; }
.core-reactor { position: absolute; left: 50%; top: 49%; width: 260px; height: 260px; transform: translate(-50%,-50%); display: grid; place-items: center; }
.core-ring { position: absolute; border-radius: 50%; border: 1px solid rgba(141,114,255,.3); animation: spin 18s linear infinite; }
.ring-one { inset: 0; border-style: dashed; }
.ring-two { inset: 24px; border-color: rgba(103,217,255,.24); animation-direction: reverse; animation-duration: 12s; }
.ring-three { inset: 48px; border-color: rgba(255,79,136,.2); animation-duration: 8s; }
.core-center { width: 130px; height: 130px; border-radius: 50%; display: grid; place-items: center; align-content: center; background: radial-gradient(circle, rgba(141,114,255,.35), rgba(10,13,21,.95) 68%); border: 1px solid rgba(141,114,255,.55); box-shadow: 0 0 55px rgba(141,114,255,.22); }
.core-center span { color: var(--cyan); font-size: 10px; letter-spacing: .25em; }
.core-center strong { margin-top: 4px; letter-spacing: .12em; }
.core-center small { margin-top: 6px; color: var(--muted); font-size: 8px; }
.sector-node { position: absolute; left: var(--x); top: var(--y); width: 164px; min-height: 82px; border-radius: 16px; padding: 12px 14px; text-align: left; color: var(--text); background: rgba(16,21,33,.88); border: 1px solid var(--line); transition: transform .2s, border-color .2s, background .2s; }
.sector-node:hover { transform: translateY(-3px); }
.sector-node.available { border-color: rgba(96,226,167,.3); background: linear-gradient(145deg, rgba(96,226,167,.08), rgba(16,21,33,.94)); }
.sector-node.available:hover { border-color: rgba(96,226,167,.6); }
.sector-node.locked { opacity: .62; }
.sector-node.unlocked { border-color: rgba(103,217,255,.34); }
.sector-index { display:inline-grid; place-items:center; width:28px; height:28px; border-radius:50%; background:rgba(255,255,255,.05); color:var(--cyan); font-size:10px; }
.sector-node strong, .sector-node small { display:block; }
.sector-node strong { margin-top:8px; }
.sector-node small { margin-top:3px; color:var(--muted); font-size:10px; }
.hub-footer-strip { position:absolute; left:22px; right:22px; bottom:16px; height:48px; display:grid; grid-template-columns:180px minmax(0,1fr) 160px; gap:10px; }
.hub-footer-strip > div { display:flex; flex-direction:column; justify-content:center; padding:0 14px; border:1px solid var(--line); background:rgba(7,10,16,.75); border-radius:12px; }
.hub-footer-strip span { color:var(--muted); font-size:9px; text-transform:uppercase; letter-spacing:.1em; }
.hub-footer-strip strong { margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.room-view { position:relative; }
.room-scene { position:absolute; inset:0 0 54px; overflow:hidden; background:linear-gradient(180deg,#0e121b 0%,#090b10 66%,#050609 100%); perspective:900px; }
.room-wall { position:absolute; top:0; bottom:26%; background:linear-gradient(180deg,#141a24,#090c12); border:1px solid rgba(255,255,255,.04); }
.wall-left { left:-6%; width:38%; transform:skewY(3deg); }
.wall-center { left:30%; width:44%; }
.wall-right { right:-6%; width:38%; transform:skewY(-3deg); }
.room-floor { position:absolute; left:-10%; right:-10%; bottom:-20%; height:54%; background:repeating-linear-gradient(90deg,transparent 0 90px,rgba(255,255,255,.025) 91px),linear-gradient(180deg,#11151d,#050608); transform:perspective(500px) rotateX(60deg); transform-origin:top; }
.room-light { position:absolute; border-radius:50%; filter:blur(40px); opacity:.28; }
.light-a { width:360px; height:220px; left:8%; top:8%; background:var(--cyan); }
.light-b { width:420px; height:240px; right:4%; top:4%; background:var(--purple); }
.reception-desk { position:absolute; left:35%; bottom:20%; width:32%; height:22%; background:linear-gradient(180deg,#202a38,#0c1017); border:1px solid rgba(255,255,255,.08); clip-path:polygon(6% 0,94% 0,100% 100%,0 100%); box-shadow:0 28px 42px rgba(0,0,0,.45); }
.terminal-prop { position:absolute; left:46%; bottom:43%; width:12%; height:13%; background:radial-gradient(circle at 50% 50%,rgba(103,217,255,.26),#070a0e 70%); border:1px solid rgba(103,217,255,.3); transform:skewY(-2deg); }
.door-prop { position:absolute; right:8%; bottom:20%; width:16%; height:55%; background:linear-gradient(90deg,#111821,#273240 48%,#0f141c 52%); border:1px solid rgba(255,255,255,.08); }
.camera-prop { position:absolute; right:28%; top:15%; width:5%; height:4%; background:#1c2531; border:1px solid rgba(255,255,255,.08); transform:rotate(-12deg); }
.badge-prop { position:absolute; left:54%; bottom:30%; width:34px; height:22px; border-radius:4px; background:linear-gradient(135deg,#d6d7dd,#6b707b); transform:rotate(12deg); }
.message-prop { position:absolute; left:37%; bottom:28%; width:46px; height:30px; background:#b9b8a8; transform:rotate(-6deg); }
.hotspot { position:absolute; background:rgba(103,217,255,.08); border:1px solid rgba(103,217,255,.2); color:var(--text); border-radius:999px; width:24px; height:24px; padding:0; box-shadow:0 0 0 8px rgba(103,217,255,.03); transition:.2s; }
.hotspot::before { content:""; position:absolute; inset:5px; border-radius:50%; background:var(--cyan); box-shadow:0 0 14px var(--cyan); }
.hotspot span { position:absolute; left:50%; top:34px; transform:translateX(-50%); width:max-content; max-width:170px; padding:7px 9px; border-radius:8px; background:rgba(4,7,12,.95); border:1px solid var(--line); opacity:0; pointer-events:none; color:var(--text); font-size:10px; }
.hotspot:hover { transform:scale(1.15); }
.hotspot:hover span, .room-scene.highlight .hotspot span { opacity:1; }
.room-scene.highlight .hotspot { box-shadow:0 0 0 12px rgba(103,217,255,.08),0 0 22px rgba(103,217,255,.45); }
.hotspot-terminal { left:51%; bottom:49%; }
.hotspot-badge { left:55%; bottom:33%; }
.hotspot-message { left:39%; bottom:32%; }
.hotspot-camera { right:29%; top:16%; }
.hotspot-door { right:15%; bottom:46%; }
.room-title-card { position:absolute; left:22px; top:22px; width:260px; padding:16px; border:1px solid var(--line); background:rgba(7,10,16,.72); backdrop-filter:blur(10px); border-radius:14px; }
.room-title-card h2 { margin:5px 0 4px; }
.room-title-card p:last-child { color:var(--muted); margin:0; }
.room-toolbar { position:absolute; left:0; right:0; bottom:0; height:54px; display:grid; grid-template-columns:1fr auto 1fr; gap:12px; align-items:center; padding:0 14px; border-top:1px solid var(--line); background:rgba(7,10,16,.96); }
.room-toolbar button:last-child { justify-self:end; }
.room-position { text-align:center; }
.room-position span { display:block; color:var(--muted); font-size:8px; letter-spacing:.14em; }
.room-position strong { display:block; margin-top:2px; font-size:11px; }

.workspace-view { padding:18px; overflow:hidden; }
.workspace-header { height:56px; display:flex; align-items:flex-start; justify-content:space-between; }
.workspace-header h2 { margin:4px 0 0; }
.evidence-layout { height:calc(100% - 56px); display:grid; grid-template-columns:150px minmax(0,1fr) 250px; gap:12px; min-width:0; }
.evidence-filters, .theory-panel { border:1px solid var(--line); background:var(--panel); border-radius:14px; padding:12px; overflow:auto; }
.evidence-filters { display:flex; flex-direction:column; gap:8px; }
.filter-btn, .terminal-nav { text-align:left; border:1px solid transparent; background:transparent; color:var(--muted); border-radius:9px; padding:10px; }
.filter-btn.active, .filter-btn:hover, .terminal-nav.active, .terminal-nav:hover { color:var(--text); background:rgba(141,114,255,.08); border-color:rgba(141,114,255,.18); }
.evidence-canvas { position:relative; overflow:hidden; border:1px solid var(--line); border-radius:14px; background:radial-gradient(circle at 50% 50%,rgba(141,114,255,.07),transparent 34%),linear-gradient(rgba(255,255,255,.018) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.018) 1px,transparent 1px),#080b11; background-size:auto,32px 32px,32px 32px,auto; }
.evidence-card { position:absolute; width:180px; min-height:112px; padding:12px; border-radius:12px; border:1px solid var(--line); background:rgba(18,23,35,.97); box-shadow:0 18px 34px rgba(0,0,0,.32); user-select:none; }
.evidence-card.selected { border-color:rgba(141,114,255,.7); box-shadow:0 0 0 3px rgba(141,114,255,.12),0 18px 34px rgba(0,0,0,.32); }
.evidence-card .evidence-type { color:var(--cyan); font-size:8px; letter-spacing:.14em; }
.evidence-card h4 { margin:7px 0 5px; }
.evidence-card p { margin:0; color:var(--muted); font-size:11px; line-height:1.4; }
.theory-panel { display:flex; flex-direction:column; gap:12px; }
.theory-card, .deduction-builder { border:1px solid var(--line); border-radius:12px; padding:13px; background:rgba(255,255,255,.025); }
.theory-card h3, .deduction-builder h3 { margin:6px 0 8px; }
.theory-card p:last-child, .deduction-builder p { color:var(--muted); line-height:1.5; }
.theory-meter, .objective-progress { height:8px; border-radius:999px; background:rgba(255,255,255,.06); overflow:hidden; }
.theory-meter span, .objective-progress span { display:block; height:100%; width:0; background:linear-gradient(90deg,var(--purple),var(--magenta)); transition:width .4s; }
.selected-evidence { min-height:74px; margin:12px 0; border:1px dashed var(--line); border-radius:10px; padding:10px; color:var(--muted); }
.deduction-history { display:grid; gap:8px; overflow:auto; }
.deduction-entry { padding:9px 10px; border-left:2px solid var(--green); background:rgba(96,226,167,.06); border-radius:0 9px 9px 0; font-size:11px; }

.terminal-view { padding:18px; }
.terminal-shell { width:100%; height:100%; display:grid; grid-template-columns:170px minmax(0,1fr); border:1px solid var(--line); border-radius:16px; overflow:hidden; background:#06090d; }
.terminal-sidebar { padding:14px; border-right:1px solid var(--line); background:#0a0e15; display:flex; flex-direction:column; gap:6px; }
.terminal-brand { display:flex; align-items:center; gap:10px; padding:6px 8px 16px; margin-bottom:8px; border-bottom:1px solid var(--line); }
.terminal-brand span { width:30px; height:30px; display:grid; place-items:center; border-radius:50%; border:1px solid var(--purple); color:var(--purple); font-size:10px; font-weight:900; }
.terminal-main { min-width:0; display:grid; grid-template-rows:42px minmax(0,1fr) auto; }
.terminal-topline { display:flex; align-items:center; justify-content:space-between; padding:0 14px; border-bottom:1px solid var(--line); color:var(--muted); font-family:Consolas,monospace; font-size:11px; }
.terminal-topline strong { color:var(--green); }
.terminal-content { overflow:auto; padding:18px; font-family:Consolas,monospace; line-height:1.65; }
.file-row, .log-row, .message-row { display:grid; grid-template-columns:110px minmax(0,1fr) auto; gap:12px; align-items:center; padding:10px 12px; border-bottom:1px solid rgba(255,255,255,.05); }
.file-row:hover, .log-row:hover, .message-row:hover { background:rgba(255,255,255,.025); }
.terminal-command-area { border-top:1px solid var(--line); background:#080c12; padding:10px 12px; }
.command-suggestions { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:8px; }
.command-chip { border:1px solid rgba(103,217,255,.18); background:rgba(103,217,255,.05); color:#c9f2ff; padding:7px 9px; border-radius:8px; font-size:10px; }
.terminal-input-line { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:10px; align-items:center; }
.terminal-input-line input { width:100%; background:transparent; border:0; color:var(--text); font-family:Consolas,monospace; }
.terminal-input-line button { border:1px solid var(--line); background:rgba(255,255,255,.04); color:var(--text); border-radius:8px; padding:7px 10px; }

.message-archive { height:calc(100% - 56px); display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; overflow:auto; }
.archive-message { border:1px solid var(--line); border-radius:14px; background:var(--panel); padding:16px; }
.archive-message h3 { margin:6px 0; }
.archive-message p { color:var(--muted); line-height:1.6; }
.map-grid { position:relative; height:calc(100% - 56px); border:1px solid var(--line); border-radius:16px; background:radial-gradient(circle at 50% 50%,rgba(141,114,255,.08),transparent 28%),#080b11; }
.map-node { position:absolute; width:160px; height:88px; display:grid; place-items:center; align-content:center; border:1px solid var(--line); border-radius:14px; background:var(--panel); z-index:2; }
.map-node span { color:var(--cyan); font-size:10px; }
.map-node strong { margin-top:4px; }
.map-node small { margin-top:3px; color:var(--muted); }
.map-node:nth-child(1){left:5%;top:40%;}.map-node:nth-child(2){left:42%;top:5%;}.map-node:nth-child(3){right:5%;top:40%;}.map-node:nth-child(4){left:42%;bottom:5%;}.map-node:nth-child(5){left:8%;bottom:7%;}
.map-node.locked { opacity:.55; }
.map-node.unlocked { border-color:rgba(96,226,167,.3); }
.map-node.unknown { border-color:rgba(255,93,105,.3); }
.map-lines { position:absolute; inset:0; width:100%; height:100%; }
.map-lines path,.map-lines circle { fill:none; stroke:rgba(141,114,255,.22); stroke-width:2; stroke-dasharray:8 10; }
.map-center { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); width:146px; height:146px; border-radius:50%; display:grid; place-items:center; align-content:center; border:1px solid rgba(141,114,255,.38); background:rgba(12,16,25,.96); box-shadow:0 0 44px rgba(141,114,255,.14); z-index:3; }
.map-center span { color:var(--muted); font-size:9px; letter-spacing:.14em; }.map-center strong { margin-top:7px; font-size:26px; }

.objective-panel { padding:12px; display:flex; flex-direction:column; gap:10px; overflow:auto; }
.objective-card, .hint-card, .activity-card { border:1px solid var(--line); background:rgba(255,255,255,.025); border-radius:14px; padding:14px; }
.objective-card h2 { margin:7px 0 8px; font-size:18px; }
.objective-card p:not(.eyebrow), .hint-card p:not(.eyebrow) { color:var(--muted); line-height:1.55; }
.objective-progress { margin-top:12px; }
.case-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:7px; }
.case-stats div { min-width:0; padding:10px 6px; text-align:center; border:1px solid var(--line); border-radius:11px; background:rgba(255,255,255,.025); }
.case-stats span { display:block; color:var(--muted); font-size:8px; text-transform:uppercase; letter-spacing:.08em; overflow:hidden; text-overflow:ellipsis; }
.case-stats strong { display:block; margin-top:5px; }
.activity-feed { display:grid; gap:8px; margin-top:10px; }
.activity-entry { padding-left:10px; border-left:1px solid rgba(103,217,255,.3); font-size:10px; color:var(--muted); line-height:1.4; }
.activity-entry strong { color:var(--text); }

.bottom-nav { height:var(--bottom-h); display:grid; grid-template-columns:repeat(5,1fr); gap:8px; padding:8px 14px; border-top:1px solid var(--line); background:rgba(7,10,16,.97); }
.nav-btn { min-width:0; border:1px solid transparent; border-radius:12px; background:transparent; color:var(--muted); }
.nav-btn span,.nav-btn small { display:block; }
.nav-btn span { font-size:10px; font-weight:900; letter-spacing:.12em; }
.nav-btn small { margin-top:3px; font-size:9px; }
.nav-btn.active,.nav-btn:hover { color:var(--text); border-color:rgba(141,114,255,.24); background:rgba(141,114,255,.08); }

.modal-backdrop { position:fixed; inset:0; z-index:1200; display:grid; place-items:center; background:rgba(2,4,8,.82); backdrop-filter:blur(12px); }
.modal-backdrop[hidden] { display:none; }
.inspection-modal { width:min(980px,82vw); height:min(640px,78vh); display:grid; grid-template-columns:minmax(0,1.25fr) minmax(320px,.75fr); border:1px solid var(--line-strong); border-radius:22px; overflow:hidden; background:#090d14; box-shadow:0 30px 120px rgba(0,0,0,.7); }
.inspection-visual { position:relative; display:grid; place-items:center; overflow:hidden; background:radial-gradient(circle at 50% 50%,rgba(103,217,255,.08),transparent 35%),linear-gradient(180deg,#0e131d,#05070b); }
.inspection-object { width:280px; height:220px; display:grid; place-items:center; transform-style:preserve-3d; transition:transform .45s; }
.inspection-object::before { content:attr(data-symbol); font-size:110px; filter:drop-shadow(0 20px 30px rgba(0,0,0,.5)); }
.inspection-object.rotated { transform:rotateY(180deg) rotateX(8deg); }
.inspection-scanline { position:absolute; left:8%; right:8%; height:2px; top:-10px; background:linear-gradient(90deg,transparent,var(--cyan),transparent); opacity:0; }
.inspection-visual.scanning .inspection-scanline { opacity:1; animation:scanObject 1.7s ease-in-out; }
.object-controls { position:absolute; left:18px; bottom:18px; display:flex; gap:8px; }
.inspection-info { position:relative; padding:28px; border-left:1px solid var(--line); overflow:auto; }
.inspection-info h2 { margin:8px 0; font-size:28px; }
.inspection-meta { color:var(--cyan); font-family:Consolas,monospace; }
.inspection-description { margin-top:18px; color:#c5cee0; line-height:1.7; }
.inspection-actions { display:grid; gap:9px; margin-top:22px; }
.modal-close { position:absolute; top:14px; right:14px; width:34px; height:34px; border-radius:50%; border:1px solid var(--line); background:rgba(255,255,255,.04); color:var(--text); font-size:22px; }
.puzzle-modal, .settings-modal { position:relative; width:min(620px,70vw); border:1px solid var(--line-strong); border-radius:22px; background:#090d14; padding:30px; box-shadow:0 30px 120px rgba(0,0,0,.7); }
.puzzle-modal h2,.settings-modal h2 { margin:7px 0; }
.puzzle-modal > p:not(.eyebrow) { color:var(--muted); }
.puzzle-readout { margin:24px 0 18px; padding:18px; border:1px solid rgba(103,217,255,.24); border-radius:14px; text-align:center; font-family:Consolas,monospace; font-size:28px; letter-spacing:.4em; color:var(--cyan); background:rgba(103,217,255,.04); }
.keypad { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; max-width:360px; margin:auto; }
.keypad button { aspect-ratio:1.8; border:1px solid var(--line); border-radius:12px; background:rgba(255,255,255,.035); color:var(--text); font-weight:900; }
.keypad button:hover { border-color:rgba(141,114,255,.5); background:rgba(141,114,255,.08); }
.puzzle-feedback { min-height:28px; margin-top:16px; text-align:center; color:var(--muted); }
.settings-row { display:grid; grid-template-columns:1fr 180px; gap:14px; align-items:center; margin:14px 0; }
.settings-row select { width:100%; border:1px solid var(--line); border-radius:10px; background:#111722; color:var(--text); padding:10px; }

.toast { position:fixed; left:50%; bottom:90px; z-index:2000; transform:translate(-50%,20px); opacity:0; pointer-events:none; min-width:260px; max-width:520px; padding:12px 16px; border:1px solid var(--line-strong); border-radius:12px; background:rgba(8,11,17,.96); color:var(--text); text-align:center; transition:.25s; }
.toast.show { opacity:1; transform:translate(-50%,0); }
.toast.error { border-color:rgba(255,93,105,.45); color:#ffb1b8; }
.toast.success { border-color:rgba(96,226,167,.4); color:#bdf6dc; }

body.motion-reduced * { animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; }
body.highlight-strong .hotspot { width:30px; height:30px; box-shadow:0 0 0 13px rgba(103,217,255,.09),0 0 24px rgba(103,217,255,.45); }
body.text-large { font-size:16px; }

@keyframes blink { 50%{opacity:.35} }
@keyframes spin { to{transform:rotate(360deg)} }
@keyframes scan { from{top:-4px} to{top:100%} }
@keyframes scanObject { from{top:5%} to{top:95%} }
@keyframes reveal { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:none} }

@media (max-width: 1450px) {
  :root { --side-left: 250px; --side-right: 250px; --gap: 10px; }
  .topbar { grid-template-columns:minmax(240px,1fr) auto minmax(220px,1fr); gap:12px; padding:0 14px; }
  .status-chip { min-width:112px; }
  .content-frame { padding:10px; }
  .evidence-layout { grid-template-columns:130px minmax(0,1fr) 220px; }
  .sector-node { width:148px; }
}

@media (max-width: 1220px) {
  :root { --side-left: 220px; --side-right: 220px; }
  .top-status-grid { grid-template-columns:repeat(3,110px); }
  .top-actions .icon-btn { padding:9px 10px; font-size:9px; }
  .case-lockup h1 { max-width:170px; }
  .sector-node { width:138px; min-height:76px; }
  .core-reactor { width:220px; height:220px; }
  .core-center { width:116px; height:116px; }
  .evidence-layout { grid-template-columns:115px minmax(0,1fr) 200px; }
  .inspection-modal { width:90vw; }
}

/* Laptop-safe compact mode: supports computer windows down to 1024×600. */
@media (max-width: 1399px), (max-height: 799px) {
  :root {
    --topbar-h: 60px;
    --bottom-h: 56px;
    --side-left: 176px;
    --side-right: 176px;
    --gap: 8px;
  }

  body { font-size: 12px; }
  .topbar {
    grid-template-columns: 190px minmax(270px, 1fr) 190px;
    gap: 8px;
    padding: 0 10px;
  }
  .archive-mark { width: 34px; height: 34px; font-size: 10px; }
  .case-lockup { gap: 9px; }
  .case-lockup h1 { max-width: 132px; font-size: 13px; }
  .eyebrow { font-size: 8px; }
  .top-status-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .status-chip { min-width: 0; padding: 7px 8px; border-radius: 9px; }
  .status-chip span { font-size: 8px; letter-spacing: .07em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .status-chip strong { font-size: 11px; }
  .top-actions { gap: 5px; }
  .top-actions .icon-btn { padding: 8px 7px; font-size: 8px; letter-spacing: .04em; }

  .content-frame { padding: 8px; gap: 8px; }
  .echo-panel, .objective-panel { border-radius: 14px; }
  .panel-heading { padding: 11px; }
  .panel-heading h2 { font-size: 15px; }
  .signal-badge { padding: 5px 6px; font-size: 7px; }
  .echo-feed { padding: 9px; gap: 7px; }
  .echo-message { padding: 8px 9px; font-size: 10px; }
  .dialogue-choices { padding: 8px; gap: 6px; }
  .dialogue-choice { padding: 8px; font-size: 9px; }
  .objective-panel { padding: 8px; gap: 7px; }
  .objective-panel h3 { font-size: 12px; }

  .stage { border-radius: 16px; }
  .hub-header { padding: 14px 16px 0; }
  .hub-header h2 { font-size: 19px; margin-top: 4px; }
  .hub-header p { font-size: 10px; }
  .hub-clock { font-size: 9px; }
  .sector-orbit { inset: 70px 10px 52px; }
  .core-reactor { width: 168px; height: 168px; top: 48%; }
  .ring-two { inset: 16px; }
  .ring-three { inset: 32px; }
  .core-center { width: 92px; height: 92px; }
  .core-center span { font-size: 7px; }
  .core-center strong { font-size: 11px; }
  .core-center small { font-size: 6px; }
  .sector-node { width: 120px; min-height: 64px; padding: 8px 9px; border-radius: 12px; }
  .sector-index { width: 22px; height: 22px; font-size: 8px; }
  .sector-node strong { margin-top: 5px; font-size: 10px; }
  .sector-node small { margin-top: 2px; font-size: 8px; }
  .hub-footer-strip { left: 12px; right: 12px; bottom: 8px; height: 40px; grid-template-columns: 118px minmax(0, 1fr) 108px; gap: 6px; }
  .hub-footer-strip > div { padding: 0 8px; border-radius: 9px; }
  .hub-footer-strip span { font-size: 7px; }
  .hub-footer-strip strong { font-size: 9px; }

  .room-scene { inset: 0 0 44px; }
  .room-toolbar { height: 44px; padding: 0 9px; gap: 8px; }
  .room-toolbar .ghost-btn { padding: 7px 8px; font-size: 8px; }

  .evidence-view, .inventory-view, .map-view, .messages-view { padding: 10px; }
  .view-header { height: 44px; }
  .view-header h2 { font-size: 18px; }
  .evidence-layout { height: calc(100% - 44px); grid-template-columns: 92px minmax(0,1fr) 150px; gap: 7px; }
  .evidence-filters, .theory-panel { padding: 7px; border-radius: 10px; }
  .filter-btn, .terminal-nav { padding: 7px; font-size: 8px; }
  .theory-card, .deduction-builder { padding: 8px; }
  .theory-card h3, .deduction-builder h3 { font-size: 10px; }
  .evidence-card { width: 126px; }

  .terminal-view { padding: 10px; }
  .terminal-shell { grid-template-columns: 112px minmax(0,1fr); border-radius: 12px; }
  .terminal-sidebar { padding: 8px; gap: 3px; }
  .terminal-brand { padding: 4px 4px 9px; margin-bottom: 4px; }
  .terminal-content { padding: 11px; font-size: 10px; }
  .terminal-topline { height: 34px; padding: 0 9px; font-size: 9px; }
  .terminal-main { grid-template-rows: 34px minmax(0,1fr) auto; }
  .terminal-command-area { padding: 7px 8px; }

  .map-node { width: 112px; height: 62px; border-radius: 10px; }
  .map-node span, .map-node small { font-size: 7px; }
  .map-node strong { font-size: 9px; }
  .map-center { width: 104px; height: 104px; }
  .map-center strong { font-size: 17px; }

  .bottom-nav { gap: 5px; padding: 6px 9px; }
  .nav-btn { border-radius: 9px; }
  .nav-btn span { font-size: 8px; }
  .nav-btn small { display: none; }

  .inspection-modal { width: min(860px, 92vw); height: min(520px, 84vh); grid-template-columns: minmax(0, 1.1fr) minmax(270px, .9fr); }
  .inspection-object { width: 210px; height: 170px; }
  .inspection-object::before { font-size: 82px; }
  .inspection-info { padding: 18px; }
  .inspection-info h2 { font-size: 21px; }
  .puzzle-modal, .settings-modal { width: min(560px, 82vw); max-height: 86vh; overflow: auto; padding: 22px; }
  .puzzle-readout { margin: 16px 0 12px; padding: 12px; font-size: 21px; }
  .keypad { max-width: 300px; gap: 7px; }
  .settings-row { grid-template-columns: 1fr 145px; }

  .boot-terminal { width: min(760px, 82vw); min-height: 390px; padding: 24px 30px; }
  .boot-log { min-height: 175px; margin-top: 20px; font-size: 11px; }
  .boot-identity h1 { font-size: clamp(38px, 6vw, 62px); }
  .boot-orbit { width: 760px; height: 760px; }
}

@media (max-width: 1099px) {
  :root { --side-left: 164px; --side-right: 164px; }
  .topbar { grid-template-columns: 176px minmax(255px, 1fr) 178px; }
  .case-lockup h1 { max-width: 118px; }
  .top-actions .icon-btn { padding-inline: 6px; }
  .sector-node { width: 116px; }
  .evidence-layout { grid-template-columns: 86px minmax(0,1fr) 142px; }
}

/* --- Story Edition additions --- */
.bottom-nav { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); }
.builder-view { overflow:auto; }
.builder-grid { height:calc(100% - 56px); display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; overflow:auto; }
.builder-card { border:1px solid var(--line); background:var(--panel); border-radius:14px; padding:14px; display:flex; flex-direction:column; gap:12px; min-height:240px; }
.builder-span-2 { grid-column:1 / -1; }
.builder-card h3 { margin:2px 0 0; }
.builder-list { display:grid; gap:8px; overflow:auto; }
.builder-list-item { border:1px solid var(--line); background:rgba(255,255,255,.025); border-radius:10px; padding:10px; display:flex; justify-content:space-between; gap:10px; }
.builder-list-item small { color:var(--muted); }
.builder-flow { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.flow-node { min-width:120px; padding:12px; border-radius:12px; border:1px solid var(--line); background:rgba(255,255,255,.03); display:grid; gap:4px; }
.flow-node.active { border-color:rgba(141,114,255,.5); box-shadow:0 0 0 3px rgba(141,114,255,.12); }
.flow-node span { color:var(--cyan); font-size:10px; font-weight:900; }
.flow-arrow { color:var(--muted); font-size:18px; }

.room-scene { position:absolute; inset:0 0 54px; overflow:hidden; }
.room-bg-decal { position:absolute; inset:0; opacity:.18; pointer-events:none; background-image:linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size:56px 56px; mask-image:radial-gradient(circle at 50% 50%, black 0 60%, transparent 86%); }
.theme-intake { background:linear-gradient(180deg,#0e121b 0%,#090b10 66%,#050609 100%); }
.theme-archives { background:linear-gradient(180deg,#11141a 0%,#0b0d12 68%,#050608 100%); }
.theme-security { background:linear-gradient(180deg,#0a1017 0%,#06080d 64%,#030406 100%); }
.theme-research { background:linear-gradient(180deg,#081114 0%,#071014 62%,#030507 100%); }
.theme-core { background:radial-gradient(circle at 50% 45%, rgba(141,114,255,.14), transparent 28%), linear-gradient(180deg,#100e19 0%,#080912 62%,#030406 100%); }
.theme-archives .light-a, .theme-core .light-a { background:var(--purple); }
.theme-security .light-a { background:var(--cyan); }
.theme-research .light-a { background:var(--green); }
.theme-research .light-b { background:var(--cyan); }
.theme-core .light-b { background:var(--magenta); }

.room-prop { position:absolute; border:1px solid rgba(255,255,255,.08); box-shadow:0 24px 48px rgba(0,0,0,.42); }
.prop-desk { background:linear-gradient(180deg,#202a38,#0c1017); clip-path:polygon(6% 0,94% 0,100% 100%,0 100%); }
.prop-screen { background:radial-gradient(circle at 50% 50%,rgba(103,217,255,.28),#070a0e 72%); border-color:rgba(103,217,255,.3); }
.prop-door { background:linear-gradient(90deg,#111821,#273240 48%,#0f141c 52%); }
.prop-camera { background:#1c2531; transform:rotate(-12deg); }
.prop-note { background:#c8c7b7; transform:rotate(-6deg); border-color:rgba(255,255,255,.16); }
.prop-badge { background:linear-gradient(135deg,#d6d7dd,#6b707b); transform:rotate(12deg); border-radius:4px; }
.prop-rack { background:linear-gradient(180deg,#181d28,#0b0f15); }
.prop-board { background:linear-gradient(180deg,#2b2535,#111217); }
.prop-locker { background:linear-gradient(180deg,#151d28,#0b0f15); }
.prop-screen-wall { background:linear-gradient(180deg,#0d1822,#0d1218); border-color:rgba(103,217,255,.2); }
.prop-screen-wall::before { content:""; position:absolute; inset:10px; background:linear-gradient(90deg, rgba(103,217,255,.22), rgba(141,114,255,.14)); }
.prop-console { background:linear-gradient(180deg,#1b2230,#0b0f15); clip-path:polygon(5% 0,95% 0,100% 100%,0 100%); }
.prop-tube { background:linear-gradient(180deg,rgba(96,226,167,.38),rgba(10,16,20,.92)); border-color:rgba(96,226,167,.45); border-radius:18px; }
.prop-labtable { background:linear-gradient(180deg,#182127,#0b1015); }
.prop-vaultcase { background:linear-gradient(180deg,#1e1b27,#0c0f15); border-color:rgba(141,114,255,.28); border-radius:18px; }
.prop-reactor { background:radial-gradient(circle at 50% 42%, rgba(103,217,255,.18), rgba(9,12,18,.95) 72%); border-radius:50%; border-color:rgba(141,114,255,.36); }
.prop-pillars { background:linear-gradient(180deg,#131925,#080b11); }

.inspection-reveals { display:grid; gap:8px; margin:16px 0; }
.reveal-chip { border:1px solid var(--line); background:rgba(255,255,255,.03); border-radius:10px; padding:10px; font-size:12px; line-height:1.55; }
.reveal-chip.muted { color:var(--muted); }
.inspection-object.zoomed { transform:scale(1.2); }
.puzzle-modal.wide { width:min(900px, calc(100vw - 80px)); }
.puzzle-body { margin-top:18px; }
.puzzle-feedback.success { color:var(--green); }
.puzzle-feedback.error { color:var(--red); }
.timeline-puzzle { display:grid; gap:14px; }
.timeline-list { display:grid; gap:8px; }
.timeline-item { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:12px; align-items:center; padding:12px; border:1px solid var(--line); background:rgba(255,255,255,.03); border-radius:12px; }
.timeline-item span { width:30px; height:30px; border-radius:50%; display:grid; place-items:center; background:rgba(141,114,255,.12); color:var(--cyan); font-weight:900; }
.timeline-controls { display:flex; gap:8px; }
.timeline-controls button, .keypad button, .symbol-actions button { border:1px solid var(--line); background:rgba(255,255,255,.04); color:var(--text); border-radius:10px; padding:8px 10px; }
.choice-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.symbol-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.symbol-btn, .ending-btn { border:1px solid var(--line); background:rgba(255,255,255,.03); color:var(--text); border-radius:12px; padding:16px 14px; text-align:left; }
.symbol-btn:hover, .ending-btn:hover { border-color:rgba(141,114,255,.4); background:rgba(141,114,255,.08); }
.symbol-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:12px; }
.ending-choices { display:grid; gap:10px; margin-top:18px; }
.ending-btn strong { display:block; margin-bottom:5px; }
.ending-btn span { display:block; color:var(--muted); font-size:12px; line-height:1.5; }
.camera-feed { display:grid; gap:12px; }
.camera-frame { position:relative; height:220px; border-radius:14px; border:1px solid rgba(103,217,255,.22); overflow:hidden; background:linear-gradient(180deg,#071016,#0a121b); }
.camera-bar { position:absolute; inset:0; background:linear-gradient(180deg, transparent 0 72%, rgba(103,217,255,.05) 72% 74%, transparent 74% 100%); }
.camera-grid { position:absolute; inset:0; background-image:linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px); background-size:34px 34px; }
.camera-target { position:absolute; inset:50% auto auto 50%; width:110px; height:66px; border:1px solid rgba(103,217,255,.6); transform:translate(-50%,-50%); box-shadow:0 0 0 1px rgba(103,217,255,.15) inset; }
.camera-noise { position:absolute; inset:0; opacity:.1; background:repeating-linear-gradient(to bottom, transparent 0 3px, rgba(255,255,255,.2) 4px); animation:scan 5s linear infinite; }
.camera-frame strong, .camera-frame small { position:absolute; left:12px; font-family:Consolas, monospace; }
.camera-frame strong { top:12px; color:var(--cyan); }
.camera-frame small { right:12px; left:auto; top:12px; color:var(--green); }

@media (max-width: 1250px) {
  .choice-grid, .symbol-grid { grid-template-columns:1fr; }
  .builder-grid { grid-template-columns:1fr; }
  .builder-span-2 { grid-column:auto; }
}

/* --- Ultimate layout guardian and polish pass --- */
.top-actions { min-width:0; }
.top-actions .icon-btn { min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.content-frame > * { min-width:0; min-height:0; }
.echo-feed, .objective-panel, .terminal-content, .builder-grid, .message-archive, .evidence-filters, .theory-panel { overscroll-behavior:contain; scrollbar-gutter:stable; }
.file-row strong, .log-row strong, .message-row strong, .hub-footer-strip strong, .objective-card h2, .activity-entry { min-width:0; overflow-wrap:anywhere; }
.room-prop { pointer-events:none; }
.hotspot span { z-index:3; max-width:160px; white-space:normal; text-align:center; line-height:1.3; }
.hotspot.edge-left span { left:0; transform:none; }
.hotspot.edge-right span { left:auto; right:0; transform:none; }
.hotspot.edge-top span { top:auto; bottom:34px; }

body.echo-collapsed .content-frame { grid-template-columns:0 minmax(0,1fr) var(--side-right); }
body.objective-collapsed .content-frame { grid-template-columns:var(--side-left) minmax(0,1fr) 0; }
body.echo-collapsed.objective-collapsed .content-frame,
body.stage-focus .content-frame { grid-template-columns:0 minmax(0,1fr) 0; }
body.echo-collapsed #echoPanel,
body.stage-focus #echoPanel,
body.objective-collapsed .objective-panel,
body.stage-focus .objective-panel { visibility:hidden; opacity:0; pointer-events:none; border-width:0; }
#echoPanel, .objective-panel { transition:opacity .2s ease, visibility .2s ease; }
body.stage-focus .stage { border-color:rgba(141,114,255,.34); box-shadow:0 0 0 1px rgba(141,114,255,.08) inset; }
body.stage-focus .content-frame { padding-inline:12px; }

body.layout-tight { --side-left:154px; --side-right:154px; --gap:6px; }
body.layout-tight .top-status-grid { gap:4px; }
body.layout-tight .status-chip { padding-inline:6px; }
body.layout-tight .sector-node { width:108px; }
body.layout-tight .evidence-layout { grid-template-columns:80px minmax(0,1fr) 132px; }
body.layout-emergency { --side-left:0px; --side-right:0px; --gap:6px; }
body.layout-emergency #echoPanel,
body.layout-emergency .objective-panel { visibility:hidden; opacity:0; pointer-events:none; }
body.layout-emergency .content-frame { grid-template-columns:0 minmax(0,1fr) 0; }
body.layout-emergency .top-status-grid .status-chip:first-child,
body.layout-emergency .top-status-grid .status-chip:nth-child(2) { display:none; }
body.layout-emergency .top-status-grid { grid-template-columns:minmax(100px,1fr); }

.modal-backdrop { padding:16px; overflow:hidden; }
.inspection-modal,
.puzzle-modal,
.settings-modal { max-width:calc(100vw - 32px); max-height:calc(100vh - 32px); }
.puzzle-modal,
.settings-modal { overflow:auto; }
.inspection-modal { overflow:hidden; }
.inspection-info { min-width:0; min-height:0; overflow:auto; }
.inspection-visual { min-width:0; min-height:0; overflow:hidden; }
.puzzle-body { min-width:0; overflow:auto; }
.timeline-list, .choice-grid, .symbol-grid, .ending-choices { min-width:0; }
.timeline-item strong { min-width:0; overflow-wrap:anywhere; }
.puzzle-modal.wide { width:min(900px, calc(100vw - 32px)); }

.layout-modal { width:min(660px, calc(100vw - 32px)); }
.layout-status-card { margin:18px 0; display:grid; grid-template-columns:1fr auto; gap:5px 12px; align-items:center; padding:14px; border:1px solid var(--line); background:rgba(255,255,255,.025); border-radius:14px; }
.layout-status-card span { color:var(--muted); }
.layout-status-card strong { color:var(--green); }
.layout-status-card small { grid-column:1 / -1; color:var(--muted); line-height:1.5; }
.layout-control-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.keyboard-help { margin-top:18px; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.keyboard-help .eyebrow { grid-column:1 / -1; }
.keyboard-help > div { display:grid; grid-template-columns:36px minmax(0,1fr); align-items:center; gap:8px; padding:8px 10px; border:1px solid var(--line); border-radius:10px; background:rgba(255,255,255,.02); }
kbd { display:grid; place-items:center; min-width:28px; height:26px; border:1px solid var(--line-strong); border-bottom-width:2px; border-radius:6px; background:#111722; font:700 11px/1 Consolas,monospace; }

.builder-card input,
.builder-card select,
.settings-modal input,
.settings-modal select { min-width:0; max-width:100%; }
.builder-grid { align-content:start; }
.workspace-actions { min-width:0; display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.workspace-actions button { white-space:nowrap; }

.evidence-card { max-width:calc(100% - 8px); }
.evidence-canvas.layout-clamping::after { content:"Repositioning evidence…"; position:absolute; right:8px; bottom:8px; padding:6px 8px; border-radius:8px; background:rgba(7,10,16,.88); border:1px solid var(--line); color:var(--muted); font-size:9px; }

.ending-result { display:grid; gap:14px; }
.ending-result-card { padding:18px; border:1px solid var(--line); background:rgba(141,114,255,.06); border-radius:14px; }
.ending-result-card h3 { margin:0 0 8px; }
.ending-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
.ending-metrics > div { padding:10px; border:1px solid var(--line); border-radius:10px; background:rgba(255,255,255,.025); }
.ending-metrics span { display:block; color:var(--muted); font-size:9px; text-transform:uppercase; letter-spacing:.1em; }
.ending-metrics strong { display:block; margin-top:5px; }

@media (max-width: 1150px), (max-height: 680px) {
  body:not(.manual-panels) { --side-left:150px; --side-right:150px; --gap:6px; }
  .top-actions { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); width:100%; }
  .top-actions .icon-btn { padding-inline:4px; }
  .workspace-actions button { padding:7px 8px; font-size:8px; }
  .keyboard-help { grid-template-columns:1fr; }
  .ending-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width: 1040px), (max-height: 620px) {
  body:not(.manual-panels) { --side-left:138px; --side-right:138px; }
  .content-frame { padding:6px; }
  .echo-message { font-size:9px; }
  .objective-card p, .hint-card p, .activity-entry { font-size:9px; }
  .sector-node { width:104px; min-height:58px; }
  .core-reactor { width:150px; height:150px; }
  .core-center { width:82px; height:82px; }
  .hub-footer-strip { grid-template-columns:104px minmax(0,1fr) 92px; }
  .inspection-modal { grid-template-columns:minmax(0,1fr) minmax(245px,.85fr); }
}

.sector-orbit.hub-safe-stack .core-reactor { width:136px; height:136px; top:47%; }
.sector-orbit.hub-safe-stack .core-center { width:74px; height:74px; }
.sector-orbit.hub-safe-stack .sector-node { width:104px; min-height:56px; padding:7px 8px; }
.sector-orbit.hub-safe-stack .sector-node[data-sector="intake"] { left:1% !important; top:10% !important; }
.sector-orbit.hub-safe-stack .sector-node[data-sector="archives"] { left:auto !important; right:1% !important; top:8% !important; }
.sector-orbit.hub-safe-stack .sector-node[data-sector="security"] { left:auto !important; right:1% !important; top:auto !important; bottom:4% !important; }
.sector-orbit.hub-safe-stack .sector-node[data-sector="research"] { left:1% !important; top:auto !important; bottom:4% !important; }
.sector-orbit.hub-safe-stack .sector-node[data-sector="core"] { left:50% !important; top:auto !important; bottom:0 !important; transform:translateX(-50%); }
.sector-orbit.hub-safe-stack .sector-node[data-sector="core"]:hover { transform:translateX(-50%) translateY(-3px); }
.evidence-canvas { overflow:auto; }
.evidence-canvas::before { content:""; display:block; width:1px; height:var(--evidence-board-height, 100%); pointer-events:none; }
