@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:ital,wght@0,400;0,500;0,600;0,700;1,600;1,700&family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  --bar: 56px;
  --bg: #0b0c16;
  --panel: #121423;
  --panel-2: #181a2b;
  --line: #2a2c40;
  --muted: #a3a7bd;
  --text: #f2f1f7;
  --lime: #c0f879;
  --violet: #b5a0ed;
  --blast: #ff6b5b;
  --keep: #a5efc8;
  --archive: #c8a8ff;
  --scan: #9de5ff;
  --amber: #ffd394;
  --body: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  --display: 'Chakra Petch', 'Avenir Next', Arial, sans-serif;
  --mail: 'Space Grotesk', 'Avenir Next', Arial, sans-serif;
  --dock-offset: 128px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 14px; }
body { min-height: 100dvh; overflow-x: hidden; }
[hidden] { display: none !important; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .38; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
a { color: inherit; }
kbd { font: 600 9px var(--body); border: 1px solid #ffffff2e; border-radius: 3px; padding: 1px 4px; letter-spacing: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.eyebrow { font: 600 10px var(--display); letter-spacing: 1.8px; color: var(--muted); margin: 0; text-transform: uppercase; }

/* Top bar */
.topbar { height: var(--bar); padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); background: #0b0c16; position: relative; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; white-space: nowrap; }
.brand-logo { width: 34px; height: 34px; flex: none; overflow: visible; color: var(--lime); filter: drop-shadow(0 0 6px #c0f87940); }
.logo-lock { transform-box: view-box; transform-origin: 50% 50%; transition: transform .25s ease-out; animation: lock-on .6s cubic-bezier(.2, .9, .3, 1.3) backwards; }
.brand:hover .logo-lock, .brand:focus-visible .logo-lock { transform: scale(.86); }
@keyframes lock-on { from { transform: scale(1.35); opacity: 0; } }
.brand-name { font: italic 700 18px/1 var(--display); letter-spacing: 1.2px; color: var(--text); }
.brand-name span { color: var(--lime); }
.top-actions { display: flex; align-items: center; gap: 14px; }
.mode-badge { color: var(--lime); border: 1px solid #c0f87944; border-radius: 5px; padding: 6px 8px; font: 600 9px var(--display); letter-spacing: 1.2px; white-space: nowrap; }
.mode-badge.live { color: var(--keep); border-color: #a5efc855; }
.connect-button { border: 1px solid #a6cb784f; border-radius: 7px; background: #bbf27b12; color: #d9efc2; padding: 8px 12px; font: 500 12px var(--body); white-space: nowrap; }
.connect-button:hover:not(:disabled) { background: #bbf27b24; }
.icon-button { border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; font-size: 16px; padding: 6px 2px; }
.icon-button span { font-size: 12px; }
.icon-button:hover:not(:disabled) { color: var(--text); }
.icon-button.round { border: 1px solid var(--line); border-radius: 50%; width: 30px; height: 30px; justify-content: center; font-size: 13px; }

/* Stage */
.stage { position: relative; height: calc(100dvh - var(--bar)); min-height: 520px; overflow: hidden; outline: none; user-select: none; -webkit-user-select: none; background: #0b0c16; }
.stage:focus-visible { outline: 2px solid #c0f87955; outline-offset: -3px; }
#stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage.playing { cursor: none; touch-action: none; }
.stage.playing :is(button, .scanner) { cursor: pointer; }

/* HUD */
.hud { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.hud button, .hud .scanner { pointer-events: auto; }
.hud-top { position: absolute; top: 0; left: 0; right: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: start; gap: 18px; padding: 14px 18px 26px; background: linear-gradient(#0b0c16f0, #0b0c1600); }
.hud-wave { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.hud-wave .eyebrow { color: #d6d3e8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wave-progress { width: min(240px, 100%); height: 3px; background: #ffffff1c; border-radius: 2px; overflow: hidden; }
.wave-progress > div { height: 100%; width: 0; background: var(--lime); transition: width .3s; }
.hud-small { font-size: 11px; color: var(--muted); }
.hud-score { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.hud-score strong { font: 700 28px/1 var(--display); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.combo { font: 700 10px var(--display); letter-spacing: 1.2px; color: #9ea2b7; transition: color .15s, transform .15s; }
.combo.hot { color: var(--lime); }
.combo.bump { transform: scale(1.18); }
.combo.broken { color: #ff9c8f; }
.hud-actions { position: absolute; display: flex; gap: 8px; }
.hud-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; min-width: 40px; padding: 0 13px; border-radius: 9px; border: 1px solid #ffffff24; background: #12142299; backdrop-filter: blur(6px); color: #d9d6e8; font: 600 12px var(--body); white-space: nowrap; }
.hud-button i { font-style: normal; font-size: 15px; line-height: 1; }
#pause-button i { font-size: 10px; letter-spacing: -1px; }
.hud-button kbd { font-size: 8px; opacity: .6; }
.hud-button:hover:not(:disabled) { background: #1f2236; border-color: #ffffff4a; color: #fff; }
.stage[data-hud="wide"] .hud-actions { right: 150px; bottom: 26px; }
.stage:not([data-hud="wide"]) .hud-actions { top: 12px; right: 14px; }
.stage:not([data-hud="wide"]) .hud-button { width: 38px; height: 38px; padding: 0; }
.stage:not([data-hud="wide"]) .hud-button :is(span, kbd) { display: none; }
.stage:not([data-hud="wide"]) .hud-top { padding-right: 160px; background: linear-gradient(#0b0c16 0 70%, #0b0c1600); }

.scanner { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: min(540px, calc(100% - 620px)); min-height: 62px; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 2px 12px; align-items: center; text-align: left; padding: 8px 14px; border: 1px solid #9de5ff40; border-radius: 12px; background: #0f1222f2; backdrop-filter: blur(8px); color: var(--text); box-shadow: 0 10px 30px #0006; z-index: 2; }
.scanner:hover { border-color: #9de5ff88; }
.scanner-avatar { grid-row: span 3; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font: 700 14px var(--mail); color: #24232e; }
.scanner-line { display: flex; gap: 8px; align-items: baseline; min-width: 0; font-size: 12px; }
.scanner-line strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scanner-line span { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scanner-subject { font: 600 13px/1.35 var(--mail); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scanner-meta { font-size: 11px; color: #9de5ffcc; }
.scanner-meta b { color: #d9f5ff; font-weight: 600; }
@media (max-width: 1100px) { .scanner { left: 12px; right: 150px; width: auto; transform: none; } }

.wave-banner { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; animation: banner 2.2s ease-out forwards; width: min(92%, 640px); }
.wave-banner strong { display: block; font: italic 700 clamp(28px, 5.4vw, 52px)/1.05 var(--display); letter-spacing: -.5px; text-shadow: 0 4px 24px #000c; }
.wave-banner span { display: block; margin-top: 10px; color: #d9d5ea; font-size: 14px; text-shadow: 0 2px 10px #000; }
.wave-banner .eyebrow { color: var(--lime); margin-bottom: 10px; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -40%) scale(.96); } 12%, 72% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -58%); } }

.hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--dock-offset) + 30px); width: max-content; max-width: min(580px, calc(100% - 32px)); margin: 0; padding: 9px 16px; border-radius: 999px; background: #10131fe0; border: 1px solid #c0f87944; color: #e7f7d3; font-size: 12px; line-height: 1.45; text-align: center; backdrop-filter: blur(6px); animation: hint-in .4s ease-out; }
.hint b { font: 700 9px var(--display); letter-spacing: 1.4px; color: var(--lime); margin-right: 7px; }
@keyframes hint-in { from { opacity: 0; transform: translate(-50%, 6px); } }
/* Wide screens: tips sit on the tool bar, below the dock line, clear of the cards. */
.stage[data-hud="wide"] .hint { left: 20px; bottom: 92px; transform: none; max-width: min(520px, calc(50% - 130px)); text-align: left; animation-name: hint-in-wide; }
@keyframes hint-in-wide { from { opacity: 0; transform: translateY(6px); } }
.dock-label { position: absolute; left: 18px; bottom: calc(var(--dock-offset) + 9px); display: flex; align-items: baseline; gap: 10px; font-size: 11px; color: #a5efc8a0; pointer-events: none; }
.dock-label b { font: 700 10px var(--display); letter-spacing: 1.8px; color: var(--keep); }
.stage[data-hud="compact"] .dock-label span { display: none; }

/* Tools: bottom-left on wide and medium screens, a full-width row on phones. */
.toolbar { position: absolute; display: grid; gap: 8px; }
.stage[data-hud="wide"] .toolbar { left: 20px; bottom: 22px; grid-template-columns: repeat(4, 126px); }
.stage[data-hud="medium"] .toolbar { left: 16px; bottom: 14px; grid-template-columns: repeat(2, 132px); gap: 7px; }
.stage[data-hud="compact"] .toolbar { left: 0; right: 0; bottom: 0; height: 64px; padding: 7px 8px 8px; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; background: #0b0c16f0; border-top: 1px solid #ffffff14; }
.tool { --tool: var(--blast); position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; row-gap: 2px; align-content: center; align-items: center; height: 58px; padding: 0 10px; text-align: left; border-radius: 11px; border: 1px solid #ffffff1f; background: linear-gradient(180deg, #181b2ce6, #0f111de6); backdrop-filter: blur(6px); color: #cfccdf; box-shadow: inset 0 1px 0 #ffffff0d; transition: border-color .15s, background .15s, box-shadow .15s, transform .1s; }
.tool i { grid-row: 1 / 3; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 16px; line-height: 1; color: var(--tool); background: color-mix(in srgb, var(--tool) 12%, transparent); border: 1px solid color-mix(in srgb, var(--tool) 38%, transparent); }
.tool-name { font: 700 13px/1 var(--display); letter-spacing: 1.2px; text-transform: uppercase; color: #eceaf6; align-self: end; }
.tool-key { font-size: 10px; line-height: 1.2; color: #8d91a8; align-self: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-count { position: absolute; top: -9px; right: -7px; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; font: 700 11px/1 var(--display); color: #0d0e17; background: var(--tool); box-shadow: 0 0 12px color-mix(in srgb, var(--tool) 55%, transparent); }
.tool-count.bump, .vault-label b.bump { animation: gauge-bump .35s ease-out; }
@keyframes gauge-bump { 40% { transform: scale(1.35); } }
.tool[data-tool="tractor"] { --tool: var(--archive); }
.tool[data-tool="shield"] { --tool: var(--keep); }
.tool[data-tool="scan"] { --tool: var(--scan); }
.tool:hover { border-color: #ffffff45; background: linear-gradient(180deg, #1f2236e6, #141726e6); }
.tool:active { transform: translateY(1px); }
.tool[aria-pressed="true"] { border-color: var(--tool); background: linear-gradient(180deg, color-mix(in srgb, var(--tool) 22%, #151827), color-mix(in srgb, var(--tool) 8%, #0f111d)); box-shadow: 0 0 22px color-mix(in srgb, var(--tool) 30%, transparent), inset 0 1px 0 #ffffff17; }
.tool[aria-pressed="true"] i { background: var(--tool); border-color: var(--tool); color: #0f1019; }
.tool[aria-pressed="true"] .tool-name { color: #fff; }
.stage[data-hud="medium"] .tool { height: 46px; }
.stage[data-hud="compact"] .tool { height: 49px; grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: 0 4px; row-gap: 4px; }
.stage[data-hud="compact"] .tool i { grid-row: auto; width: 24px; height: 24px; font-size: 13px; }
.stage[data-hud="compact"] .tool-name { font-size: 10px; letter-spacing: .6px; align-self: auto; }
.stage[data-hud="compact"] .tool-key { display: none; }
.stage[data-hud="compact"] .tool-count { top: -7px; right: -3px; height: 18px; min-width: 18px; padding: 0 5px; font-size: 10px; }

/* The number sits in the vault portal drawn on the canvas. */
.vault-label { position: absolute; left: calc(var(--vault-x) - 40px); top: calc(var(--vault-y) - 12px); width: 80px; text-align: center; color: #eadcff; pointer-events: none; }
.vault-label b { display: block; font: 700 20px/24px var(--display); font-variant-numeric: tabular-nums; }
.vault-label span { position: absolute; left: 0; right: 0; top: calc(12px + var(--vault-r) + 7px); font: 700 9px var(--display); letter-spacing: 1.8px; color: #c8a8ffc0; }
.stage[data-hud="compact"] .vault-label b { font-size: 15px; }
.stage[data-hud="compact"] .vault-label span { top: calc(12px + var(--vault-r) + 3px); font-size: 7px; letter-spacing: 1px; }

/* Screens */
.screen { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); justify-items: center; padding: 24px 16px; background: radial-gradient(ellipse at center, #0b0c1699, #0b0c16e6 70%); overflow: auto; }
.screen:empty { display: none; }
.screen.title { background: radial-gradient(ellipse at center, #0b0c1655, #0b0c16a8 75%); }
.panel { width: min(640px, 100%); max-height: 100%; overflow: auto; background: #111322f2; border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: 0 30px 80px #000a; animation: panel-in .35s ease-out; }
@keyframes panel-in { from { opacity: 0; transform: translateY(12px); } }
.panel h1, .panel h2 { font-family: var(--display); font-weight: 700; letter-spacing: -.5px; margin: 10px 0 12px; outline: 0; }
.panel h2 { font-size: 30px; line-height: 1.15; }
.panel-note { color: #c0c1d2; font-size: 13px; line-height: 1.7; margin: 0 0 18px; }
.panel-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; align-items: center; }
.start-button, .secondary-button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 0 26px; border-radius: 8px; font: 700 13px/1 var(--display); letter-spacing: 1.8px; text-transform: uppercase; white-space: nowrap; transition: background .18s, border-color .18s, box-shadow .18s, color .18s, transform .1s; }
.start-button { min-width: 230px; color: #f5f4fb; border: 1px solid #c0f87970; background: linear-gradient(180deg, #1b1f2f, #11131f); box-shadow: inset 0 1px 0 #ffffff14, inset 0 0 22px #c0f8790f, 0 0 26px #c0f8791a; }
.start-button::before, .start-button::after { content: ''; position: absolute; width: 11px; height: 11px; border: 2px solid var(--lime); pointer-events: none; transition: transform .18s ease-out; }
.start-button::before { top: -5px; left: -5px; border-right: 0; border-bottom: 0; }
.start-button::after { bottom: -5px; right: -5px; border-left: 0; border-top: 0; }
.start-button:hover:not(:disabled) { border-color: var(--lime); background: linear-gradient(180deg, #212a2a, #141a1c); box-shadow: inset 0 1px 0 #ffffff1c, inset 0 0 28px #c0f8791f, 0 0 36px #c0f87938; }
.start-button:hover:not(:disabled)::before { transform: translate(-3px, -3px); }
.start-button:hover:not(:disabled)::after { transform: translate(3px, 3px); }
.secondary-button { color: #dcdaee; border: 1px solid #ffffff2e; background: linear-gradient(180deg, #1a1c2c, #121421); box-shadow: inset 0 1px 0 #ffffff0f; }
.secondary-button:hover:not(:disabled) { color: #fff; border-color: #ffffff5c; background: linear-gradient(180deg, #222539, #161829); }
.start-button:active:not(:disabled), .secondary-button:active:not(:disabled) { transform: translateY(1px); }
.text-button { border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 6px 0; text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover:not(:disabled) { color: var(--text); }

.title-panel { width: min(700px, 100%); text-align: center; background: #0f1120d8; backdrop-filter: blur(10px); }
.title-panel h1 { font-size: clamp(40px, 7.4vw, 70px); font-style: italic; font-weight: 700; line-height: 1; margin: 14px 0 18px; letter-spacing: -1px; }
.title-panel h1 span { color: var(--lime); }
.title-panel .lead { color: #cfcde0; font-size: 15px; line-height: 1.7; max-width: 540px; margin: 0 auto 24px; }
.title-panel .panel-actions { justify-content: center; }
.title-panel .eyebrow { color: var(--lime); }
.legend { list-style: none; padding: 0; margin: 26px 0 6px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; font-size: 12px; color: var(--muted); }
.legend b { color: var(--text); font-weight: 600; }
.legend .c-blast { color: var(--blast); } .legend .c-archive { color: var(--archive); } .legend .c-keep { color: var(--keep); }
.fine { font-size: 11px; color: #8a8ea6; margin: 18px 0 0; }
.fine a { color: #c8a8ff; text-underline-offset: 3px; }
.best { font-size: 12px; color: var(--muted); margin-top: 12px; }

/* Mission report */
.debrief { width: min(720px, 100%); display: flex; flex-direction: column; overflow: hidden; }
.debrief .report-list { overflow-y: auto; min-height: 0; flex: 1 1 auto; overscroll-behavior: contain; }
.debrief .panel-actions { flex: 0 0 auto; margin-top: 16px; }
.fate-totals { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.fate-total { border-radius: 999px; padding: 7px 12px; font-size: 12px; background: #ffffff0b; border: 1px solid #ffffff18; }
.fate-total b { font: 700 14px var(--display); margin-right: 3px; }
.fate-total.fate-blast { color: #ffc8c0; border-color: #ff6b5b55; }
.fate-total.fate-archive { color: #e3d3ff; border-color: #c8a8ff55; }
.fate-total.fate-keep { color: #caf5dd; border-color: #a5efc855; }
.report-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.report-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.report-avatar { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font: 700 13px var(--mail); color: #25242f; }
.report-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.report-text strong { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-text span { font-size: 12px; color: #c9c8d6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-text small { font-size: 10px; color: #858aa3; }
.fate-switch { border: 0; margin: 0; padding: 2px; display: flex; gap: 2px; background: #0b0c16; border-radius: 9px; border: 1px solid #ffffff14; }
.fate-option { position: relative; }
.fate-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.fate-option span { display: flex; align-items: center; gap: 5px; padding: 7px 10px; border-radius: 7px; font: 600 11px var(--body); color: #8e92a8; white-space: nowrap; }
.fate-option i { font-style: normal; }
.fate-option input:focus-visible + span { outline: 2px solid var(--lime); outline-offset: 1px; }
.fate-option input:checked + span { color: #10111b; }
.fate-blast input:checked + span { background: var(--blast); }
.fate-archive input:checked + span { background: var(--archive); }
.fate-keep input:checked + span { background: var(--keep); }
.fate-option:hover input:not(:checked) + span { color: var(--text); background: #ffffff0d; }

/* Applying + results */
.apply-list { list-style: none; margin: 0 0 6px; padding: 0; max-height: 44vh; overflow: auto; }
.apply-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.apply-list li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #d2d0e0; }
.apply-list li small { color: var(--muted); font-size: 11px; }
.apply-list .state-done small { color: var(--keep); }
.apply-list .state-skipped small { color: var(--amber); }
.apply-list .state-failed small { color: #ff9c8f; }
.apply-list .state-applying { background: #ffffff08; }
.apply-bar { height: 4px; background: #ffffff18; border-radius: 3px; overflow: hidden; margin: 6px 0 16px; }
.apply-bar div { height: 100%; background: var(--lime); transition: width .25s; }
.results { text-align: center; width: min(600px, 100%); }
.medal { position: relative; width: 150px; height: 150px; margin: -6px auto 2px; }
.medal img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 14px #0008); }
.medal b { position: absolute; left: 50%; top: 43%; transform: translate(-50%, -50%); font: 700 40px/1 var(--display); color: #e4ffc5; text-shadow: 0 0 14px #bff57b90, 0 2px 1px #070a0c; }
.results h2 { margin-top: 4px; }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0; }
.result-stats div { background: #ffffff08; border: 1px solid #ffffff12; border-radius: 12px; padding: 12px 6px; display: flex; flex-direction: column; gap: 4px; }
.result-stats strong { font: 600 22px var(--display); font-variant-numeric: tabular-nums; }
.result-stats span { font-size: 10px; color: var(--muted); letter-spacing: .5px; }
.impact { font-size: 13px; color: #d5d3e3; line-height: 1.7; }
.impact b { color: var(--lime); }
.new-best { display: inline-block; margin-left: 6px; color: var(--amber); font: 700 10px var(--display); letter-spacing: 1px; }
.results .panel-actions { justify-content: center; }

/* Toast */
.toast { position: absolute; top: 76px; left: 50%; transform: translateX(-50%); z-index: 20; max-width: min(560px, calc(100% - 32px)); padding: 10px 16px; border-radius: 10px; background: #171a2cf2; border: 1px solid #ffffff22; color: #dfe6f2; font-size: 12px; line-height: 1.5; box-shadow: 0 10px 30px #0008; text-align: center; }
.toast.error { border-color: #ffb3a066; background: #2a1b1ef2; color: #ffd9cf; }

/* Dialogs */
dialog { max-width: 560px; width: calc(100% - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 26px; }
dialog::backdrop { background: #070810b8; backdrop-filter: blur(6px); }
.modal-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.modal-heading h2 { font: 700 23px/1.3 var(--display); letter-spacing: -.3px; margin: 0; }
.modal-heading .icon-button { font-size: 24px; padding: 0 4px; }
.modal-intro { font-size: 13px; line-height: 1.75; color: #c3c4d4; margin: 16px 0; }
.help-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 16px; margin: 18px 0; align-items: start; }
.help-grid dt { font: 700 12px var(--display); color: var(--lime); white-space: nowrap; }
.help-grid dd { margin: 0; font-size: 12.5px; color: #c9c9d8; line-height: 1.6; }
.help-grid dd strong { color: var(--text); }
.demo-disclosure { border: 1px solid #b5a0ed33; background: #b5a0ed0a; border-radius: 10px; padding: 14px 16px; margin-top: 16px; font-size: 12px; }
.demo-disclosure strong { font-weight: 600; color: #d8c8f6; }
.demo-disclosure p { line-height: 1.7; color: var(--muted); margin: 6px 0 0; }
.demo-disclosure a, .privacy-note a, .setup-note a { color: #c8a8ff; text-underline-offset: 3px; }
.reader-meta { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 2px 12px; align-items: center; margin: 16px 0 12px; }
.reader-meta .scanner-avatar { width: 38px; height: 38px; }
.reader-meta strong { font-size: 13px; }
.reader-meta span { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.reader-subject { font: 600 19px/1.35 var(--mail); margin: 0 0 12px; overflow-wrap: anywhere; }
.reader-body { background: #f2f1ee; color: #2a2a33; border-radius: 10px; padding: 16px; font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 42vh; overflow: auto; }
.reader-note { font-size: 11px; color: #9a96b0; margin: 10px 0 0; }
.reader-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.reader-actions button { flex: 1; min-width: 120px; border-radius: 9px; padding: 12px; font: 600 13px var(--body); border: 1px solid; background: transparent; }
.reader-actions .do-keep { color: var(--keep); border-color: #a5efc877; }
.reader-actions .do-archive { color: var(--archive); border-color: #c8a8ff77; }
.reader-actions .do-back { color: var(--text); border-color: #ffffff33; }
.reader-actions button:hover { background: #ffffff0d; }

/* Gmail connection dialogs */
.connected-account { color: var(--keep); font-size: 12px; overflow-wrap: anywhere; }
.connection-status { color: #e1d4f6; font-size: 12px; line-height: 1.6; min-height: 1em; }
.connection-promise { display: grid; gap: 10px; margin: 20px 0; font-size: 13px; color: #d9d3e7; }
.privacy-note { font-size: 11px; color: #aaa6bd; line-height: 1.75; margin: 16px 0; }
.mission-choices { display: grid; gap: 10px; margin: 18px 0; }
.mission-option { border: 1px solid #71628066; background: #b29ae607; border-radius: 10px; text-align: left; padding: 16px 18px; display: grid; gap: 6px; }
.mission-option:hover:not(:disabled), .mission-option.selected { border-color: var(--archive); background: #c8a8ff12; }
.mission-option strong { font: 600 17px var(--display); }
.mission-option span { font-size: 11px; color: #aaa6bd; }
.mail-tools { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.setup-note { padding: 16px; background: #b5a0ed0c; border: 1px solid #b5a0ed44; border-radius: 10px; margin: 18px 0; font-size: 13px; }
.setup-note p { font-size: 12px; color: #c5bdd5; line-height: 1.7; }
.setup-note label { display: block; font-size: 11px; margin-top: 14px; }
.setup-note input { display: block; width: 100%; border: 1px solid #686277; background: #141620; border-radius: 6px; color: #fff; padding: 11px; margin: 8px 0 12px; font: 12px var(--body); }
.history-list { max-height: 45vh; overflow-y: auto; margin-bottom: 18px; }
.history-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.history-symbol { font-size: 20px; width: 24px; text-align: center; }
.history-row > div { min-width: 0; }
.history-row strong { font-size: 12px; font-weight: 600; }
.history-row p { font-size: 11px; color: var(--muted); line-height: 1.5; margin: 3px 0 0; overflow-wrap: anywhere; }
.history-row small { font-size: 10px; color: var(--muted); display: block; line-height: 1.6; }
.history-row .text-button, .history-label { margin-left: auto; white-space: nowrap; font-size: 11px; color: var(--muted); }
.empty-log { text-align: center; color: var(--muted); padding: 26px 0; font-size: 12px; }

/* Compact screens */
@media (max-width: 640px) {
  :root { --bar: 52px; --dock-offset: 112px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand { gap: 7px; }
  .brand-logo { width: 28px; height: 28px; }
  .brand-name { font-size: 14px; letter-spacing: .6px; }
  .top-actions { gap: 8px; }
  .icon-button span { display: none; }
  .mode-badge { display: none; }
  .connect-button { font-size: 11px; padding: 7px 9px; }
  .stage { min-height: 480px; }
  .hud-top { padding: 10px 12px 16px; gap: 10px; }
  .hud-score strong { font-size: 21px; }
  .wave-progress { width: 120px; }
  .scanner { top: 6px; left: 8px; right: 124px; min-height: 52px; padding: 6px 10px; grid-template-columns: 28px minmax(0, 1fr); }
  .scanner-avatar { width: 28px; height: 28px; font-size: 12px; }
  .scanner-subject { font-size: 12px; }
  .scanner-meta { display: none; }
  .scanner-line span { display: none; }
  .hint { font-size: 11px; padding: 8px 12px; border-radius: 12px; bottom: calc(var(--dock-offset) + 26px); }
  .panel { padding: 22px 18px; border-radius: 16px; }
  .panel h2 { font-size: 24px; }
  .title-panel .lead { font-size: 13px; }
  .start-button { min-width: 0; width: 100%; }
  .panel-actions > * { flex: 1 1 auto; }
  .report-row { grid-template-columns: 26px minmax(0, 1fr); }
  .report-avatar { width: 26px; height: 26px; }
  .fate-switch { grid-column: 1 / -1; }
  .fate-option { flex: 1; }
  .fate-option span { justify-content: center; }
  .result-stats { grid-template-columns: repeat(2, 1fr); }
  .legend { display: none; }
}
@media (max-width: 380px) { .connect-button { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
