:root {
  /* Last year's terminal look: phosphor green on near-black, red for targets, pixel display type. */
  --bg: #050805;
  --panel: #0b120b;
  --line: #1d3a1f;
  --green: #00ff41;
  --green-dim: #7fd88f;
  --text: #c9f7d2;
  --muted: #73a37c;
  --red: #ff4141;
  --amber: #ffd23f;
  --display: 'VT323', ui-monospace, Menlo, monospace;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: var(--mono); font-size: 16px; line-height: 1.5; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }

.crt {
  position: fixed; inset: 0; pointer-events: none; z-index: 60;
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,.55) 100%),
    repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.22) 2px 3px);
}

#app {
  max-width: 560px; margin: 0 auto; min-height: 100dvh;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.screen { min-height: 100dvh; display: flex; flex-direction: column; }
.screen.center { justify-content: center; padding-block: max(24px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-bottom, 0px)); text-align: center; }

/* HUD frame with pulsing corner brackets (four corners from two elements) */
.hud { position: relative; padding: 28px 20px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 0 18px rgba(0,255,65,.12); }
.hud::before, .hud::after, .hud > .corners::before, .hud > .corners::after {
  content: ""; position: absolute; width: 26px; height: 26px; border: 0 solid var(--green); animation: corners 2.5s infinite;
}
.hud::before { top: -2px; left: -2px; border-width: 3px 0 0 3px; }
.hud::after { top: -2px; right: -2px; border-width: 3px 3px 0 0; }
.hud > .corners::before { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; }
.hud > .corners::after { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; }
@keyframes corners { 0%, 100% { border-color: var(--green); } 50% { border-color: var(--red); } }

.tag { font-family: var(--display); font-size: 22px; letter-spacing: .08em; text-transform: uppercase; color: var(--green); margin: 0 0 8px; }
.tag.red { color: var(--red); }
.label { font-family: var(--display); font-size: 20px; letter-spacing: .1em; text-transform: uppercase; color: var(--green-dim); margin: 26px 0 8px; }
.label.amber, .amber { color: var(--amber); }
.dim { color: var(--muted); }
.muted { color: var(--muted); margin: 8px 0; }
.small { font-size: 13px; }
.body-text { margin: 8px 0; }
.ok { color: var(--green); }
.error { color: var(--red); margin: 6px 0 0; }

.title { font-family: var(--display); font-weight: 400; font-size: clamp(72px, 24vw, 120px); line-height: .85; margin: 4px 0 16px; }
.rainbow {
  background-image: linear-gradient(-225deg, #ff4141 0%, #00ff41 29%, #ffff50 67%, #ff4141 100%);
  background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: slide 3s linear infinite;
}
@keyframes slide { to { background-position: 200% center; } }
.typed { font-family: var(--display); font-size: 25px; line-height: 1.2; min-height: 5em; text-transform: uppercase; margin: 0 0 20px; }
.typed::after { content: "▌"; color: var(--green); animation: blink .8s step-end infinite; }
.blink-text { animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.rec { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--red); vertical-align: 2px; animation: blink 1.2s step-end infinite; }

.btn {
  font-family: var(--display); font-size: 26px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--green); background: transparent; border: 2px solid var(--green);
  padding: 8px 22px; min-height: 48px; cursor: pointer; transition: background .15s, color .15s;
}
.btn:hover, .btn:active { background: var(--green); color: var(--bg); }
.btn.big { font-size: 30px; padding: 12px 26px; }
.btn.ghost { border-color: var(--line); color: var(--green-dim); }
.btn.ghost:hover, .btn.ghost:active { background: var(--line); color: var(--green); }
.btn:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px dashed var(--amber); outline-offset: 3px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }

.lurker { display: block; width: min(56%, 26vh); max-width: 300px; margin: 4px auto 0; opacity: 0; animation: lurk 7s ease-in-out infinite; }
.lurker.small { width: 46%; margin: 10px auto 0; }
@keyframes lurk { 0%, 100% { opacity: 0; } 50% { opacity: .3; } }

.progress { border: 1px solid var(--green); padding: 3px; background: #0f1a10; margin-top: 14px; }
.progress-fill { height: 28px; width: 0; background: var(--green); }
.decrypting .progress-fill { animation: load 3s linear forwards; }
@keyframes load { to { width: 100%; } }
.hex { font-family: var(--display); font-size: 18px; color: var(--muted); word-break: break-all; min-height: 3.6em; margin: 14px 0 0; }

/* main shell */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 0 10px; background: var(--bg);
  font-family: var(--display); font-size: 20px; letter-spacing: .08em; color: var(--green);
  border-bottom: 1px solid var(--line);
}
.badge { font-size: 16px; color: var(--bg); background: var(--amber); padding: 0 8px; }
.panels { flex: 1; padding: 18px 0 calc(96px + env(safe-area-inset-bottom, 0px)); }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
  max-width: 560px; margin: 0 auto; background: var(--bg); border-top: 1px solid var(--line);
  padding: 6px max(10px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
}
.tabs button {
  font-family: var(--display); font-size: 21px; letter-spacing: .05em; color: var(--muted); background: none; border: 0;
  min-height: 48px; cursor: pointer; border-top: 3px solid transparent;
}
.tabs button[aria-current="page"] { color: var(--green); border-top-color: var(--green); text-shadow: 0 0 8px rgba(0,255,65,.5); }

.target-name { font-family: var(--display); font-weight: 400; font-size: clamp(60px, 19vw, 92px); line-height: .9; color: var(--red); margin: 2px 0 16px; text-transform: uppercase; text-shadow: 0 0 14px rgba(255,65,65,.35); overflow-wrap: anywhere; }
.cam { position: relative; margin: 0; border: 2px solid var(--green); background: #000; }
.cam img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; filter: grayscale(.35) contrast(1.08) brightness(.95); }
.cam::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0,255,65,.08), rgba(0,255,65,.08)), repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 3px, rgba(0,0,0,.18) 3px 4px); pointer-events: none; }
.cam figcaption { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; display: flex; justify-content: space-between; padding: 6px 10px; font-family: var(--display); font-size: 18px; color: var(--green); background: linear-gradient(transparent, rgba(0,0,0,.75)); }
.intel { font-family: var(--display); font-size: 23px; line-height: 1.25; color: var(--text); margin: 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.list .item { min-width: 0; overflow-wrap: anywhere; }
.list a { color: var(--green); font-size: 14px; }
.list .remove { flex: none; font-family: var(--display); font-size: 18px; color: var(--muted); background: none; border: 1px solid var(--line); padding: 2px 10px; min-height: 36px; cursor: pointer; }
.list .remove:hover { color: var(--red); border-color: var(--red); }
.list li.fresh { animation: fresh 1.2s ease-out; }
@keyframes fresh { from { background: rgba(0,255,65,.18); } to { background: transparent; } }

.form { display: grid; gap: 6px; margin: 14px 0 6px; }
.form label { font-family: var(--display); font-size: 19px; letter-spacing: .06em; color: var(--green-dim); text-transform: uppercase; margin-top: 6px; }
.form input { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line); padding: 12px; border-radius: 0; }
.form input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.form input::placeholder { color: #47684d; }
.form .btn { margin-top: 12px; justify-self: start; }

.orders, .steps { margin: 6px 0 0; padding-left: 1.4em; }
.orders li { font-family: var(--display); font-size: 23px; line-height: 1.2; margin: 0 0 10px; }
.steps li { margin: 0 0 8px; }
.countdown { margin-top: 18px; padding: 12px 14px; border: 1px dashed var(--line); }
.countdown .label { margin-top: 0; }
.clock { font-family: var(--display); font-size: 46px; line-height: 1; color: var(--amber); margin: 0; font-variant-numeric: tabular-nums; }
.intercept { margin-top: 18px; padding: 12px 14px; border: 1px dashed rgba(255,210,63,.35); }
.intercept .label { margin-top: 0; }
.feed { list-style: none; margin: 0 0 20px; padding: 0; }
.feed li { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.feed .when { font-family: var(--display); font-size: 17px; color: var(--muted); }
.feed .what { font-family: var(--display); font-size: 22px; color: var(--green); line-height: 1.1; }
.feed .body { margin: 2px 0 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .lurker { opacity: .25; }
}

.new-tag { display: inline-block; margin-left: 8px; padding: 0 6px; font-family: var(--display); font-size: 16px; line-height: 1.3; color: var(--bg); background: var(--amber); vertical-align: 1px; }
.label .dim { font-size: 16px; letter-spacing: .04em; }

/* ---------------- opening cutscene (cutscene.js) ---------------- */
html.cs-open, html.cs-open body { overflow: hidden; }
.gate-sound { margin: 14px 0 0; }
.cs { position: fixed; inset: 0; z-index: 100; background: #000; color: #f1ece1; overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; transition: opacity .45s ease; }
.cs.leaving { opacity: 0; }
.cs-canvas { position: absolute; inset: 0; display: block; }
.cs-grain { position: absolute; inset: -50%; pointer-events: none; z-index: 2; opacity: .6; background-repeat: repeat; animation: grain .5s steps(4) infinite; }
@keyframes grain { 0% { transform: translate(0, 0); } 25% { transform: translate(-5%, 3%); } 50% { transform: translate(4%, -6%); } 75% { transform: translate(-3%, 5%); } 100% { transform: translate(0, 0); } }
.cs-vignette { position: absolute; inset: 0; pointer-events: none; z-index: 2; background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0) 45%, rgba(0,0,0,.72) 100%); }
.cs-bars i { position: absolute; left: 0; right: 0; height: 0; background: #000; z-index: 6; transition: height 1.4s ease; }
.cs-bars i:first-child { top: 0; }
.cs-bars i:last-child { bottom: 0; }
.cs.bars-in .cs-bars i { height: 6vh; }
.cs-captions { position: absolute; z-index: 5; left: max(18px, env(safe-area-inset-left, 0px)); right: max(18px, env(safe-area-inset-right, 0px)); bottom: calc(6vh + 84px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; }
.cs-line { margin: 0; align-self: flex-start; max-width: 32ch; padding: 8px 12px; font-family: 'Special Elite', 'Courier New', Courier, monospace; font-size: clamp(19px, 5.3vw, 26px); line-height: 1.3; color: #f1ece1; background: rgba(4,5,9,.74); box-shadow: 0 0 0 1px rgba(241,236,225,.12); transition: opacity .4s ease; }
.cs-line.old { opacity: .5; }
.cs-tap { position: absolute; z-index: 5; right: max(20px, env(safe-area-inset-right, 0px)); bottom: calc(6vh + 22px + env(safe-area-inset-bottom, 0px)); font-family: var(--display); font-size: 20px; letter-spacing: .1em; color: transparent; pointer-events: none; }
.cs-tap.on { color: rgba(241,236,225,.7); animation: blink 1.2s step-end infinite; }
.cs-skip { position: absolute; z-index: 7; top: calc(6vh + 10px + env(safe-area-inset-top, 0px)); right: max(14px, env(safe-area-inset-right, 0px)); font-family: var(--display); font-size: 18px; letter-spacing: .08em; color: rgba(241,236,225,.55); background: rgba(0,0,0,.35); border: 1px solid rgba(241,236,225,.22); padding: 2px 10px; min-height: 36px; cursor: pointer; }
.cs-action { position: absolute; z-index: 6; left: 50%; bottom: calc(6vh + 18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); font-family: var(--display); font-size: 26px; letter-spacing: .06em; color: var(--green); background: rgba(0,0,0,.65); border: 2px solid var(--green); padding: 8px 22px; min-height: 50px; white-space: nowrap; cursor: pointer; box-shadow: 0 0 22px rgba(0,255,65,.25); animation: pulse-btn 2s ease-in-out infinite; }
.cs-action:hover, .cs-action:active { background: var(--green); color: var(--bg); }
@keyframes pulse-btn { 50% { box-shadow: 0 0 34px rgba(0,255,65,.5); } }
.cs-fade { position: absolute; inset: 0; z-index: 9; background: #000; opacity: 0; pointer-events: none; transition: opacity .6s ease; }
.cs-fade.on { opacity: 1; }
.cs-decrypt { position: absolute; z-index: 5; left: 50%; top: 42%; transform: translate(-50%, -50%); width: min(82vw, 360px); padding: 16px; text-align: center; font-family: var(--display); color: var(--green); background: rgba(5,8,5,.9); border: 1px solid var(--line); box-shadow: 0 0 24px rgba(0,255,65,.2); }
.cs-decrypt p { margin: 0 0 8px; font-size: 22px; letter-spacing: .08em; }
.cs-bar { border: 1px solid var(--green); padding: 3px; }
.cs-bar i { display: block; height: 18px; width: 0; background: var(--green); }
.cs-decrypt.run .cs-bar i { animation: load 2.3s linear forwards; }
.cs-decrypt .cs-hex { margin: 10px 0 0; font-size: 16px; color: var(--muted); word-break: break-all; min-height: 2.4em; }
.cs-photo { position: absolute; z-index: 3; margin: 0; padding: 8px 8px 30px; background: #e8e2d4; box-shadow: 0 20px 44px rgba(0,0,0,.65); opacity: 0; transform: translateY(36px) rotate(calc(var(--rot, -2.5deg) - 6deg)); transition: opacity .6s ease, transform .9s cubic-bezier(.2,.9,.3,1.15); }
.cs-photo.in { opacity: 1; transform: translateY(0) rotate(var(--rot, -2.5deg)); }
.cs-photo img { display: block; width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.3) brightness(.9); }
.cs-clip { position: absolute; top: -20px; left: calc(50% - 8px); width: 16px; height: 52px; border: 3px solid #aeb5be; border-radius: 9px; transform: rotate(4deg); box-shadow: 1px 2px 2px rgba(0,0,0,.35); }
.cs-clip::after { content: ""; position: absolute; left: 2px; right: 2px; top: 6px; bottom: 10px; border: 3px solid #aeb5be; border-top: 0; border-radius: 0 0 6px 6px; }
.cs-stamp { position: absolute; z-index: 4; padding: 2px 14px 0; font-family: 'Black Ops One', Impact, sans-serif; font-size: clamp(34px, 11vw, 58px); line-height: 1.1; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; color: #d42a2f; border: 4px solid currentColor; background: rgba(232,226,212,.08); opacity: 0; transform: translate(-50%, -50%) rotate(-8deg) scale(2.6); pointer-events: none; }
.cs-stamp.in { animation: stamp-in .22s cubic-bezier(.3,1.5,.5,1) forwards; }
@keyframes stamp-in { to { opacity: .95; transform: translate(-50%, -50%) rotate(-8deg) scale(1); } }
.cs.shake { animation: shake .35s; }
@keyframes shake { 20% { transform: translate(-5px, 2px); } 40% { transform: translate(4px, -3px); } 60% { transform: translate(-2px, 2px); } 80% { transform: translate(2px, 0); } }
.cs-end { position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); background: var(--bg); color: var(--text); }
.cs-end .hud { width: min(100%, 460px); text-align: center; }
.cs.ended .cs-canvas, .cs.ended .cs-grain, .cs.ended .cs-vignette, .cs.ended .cs-tap, .cs.ended .cs-skip, .cs.ended .cs-bars { display: none; }
.cs-file { display: grid; grid-template-columns: auto auto; justify-content: center; gap: 6px 16px; margin: 0; font-family: var(--display); font-size: 23px; line-height: 1.15; }
.cs-file dt { color: var(--muted); letter-spacing: .06em; text-align: right; }
.cs-file dd { margin: 0; color: var(--green); text-align: left; overflow-wrap: anywhere; }
.cs-trust { margin: 24px 0 20px; font-family: 'Black Ops One', Impact, sans-serif; font-size: 32px; color: var(--red); opacity: 0; transform: scale(1.7) rotate(-4deg); transform-origin: center; }
.cs-trust.in { animation: trust-in .24s cubic-bezier(.3,1.5,.5,1) forwards; }
@keyframes trust-in { to { opacity: 1; transform: scale(1) rotate(-4deg); } }
@media (prefers-reduced-motion: reduce) { .cs-grain, .cs-action, .cs.shake { animation: none; } }

/* first-visit HQ memo */
.memo { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); background: rgba(5,8,5,.88); animation: memo-in .35s ease; }
.memo .hud { width: min(100%, 460px); text-align: center; }
.memo .orders { padding-left: 0; list-style-position: inside; }
.memo .btn { margin-top: 8px; }
@keyframes memo-in { from { opacity: 0; } }

/* landing: the first tap is the hook */
.btn.pulse { animation: btn-pulse 1.6s ease-in-out infinite; }
@keyframes btn-pulse { 0%, 100% { box-shadow: 0 0 0 rgba(0,255,65,0); } 50% { box-shadow: 0 0 26px rgba(0,255,65,.55); } }
.btn.appear { animation: btn-appear .5s ease both; }
@keyframes btn-appear { from { opacity: 0; transform: translateY(8px); } }
.title.glitch { animation: glitch .11s steps(2) 10, slide 3s linear infinite; text-shadow: 3px 0 rgba(255,65,65,.8), -3px 0 rgba(0,255,65,.8); }
@keyframes glitch { 0% { transform: translate(0, 0) skewX(0); } 25% { transform: translate(-4px, 1px) skewX(-8deg); } 50% { transform: translate(3px, -2px) skewX(6deg); } 75% { transform: translate(-2px, 2px); } 100% { transform: translate(0, 0); } }

/* ---------------- the Grinch game (Part A) ---------------- */
.tabs { grid-template-columns: repeat(var(--tab-count, 4), 1fr); }
.tabs button { font-size: clamp(17px, 4.6vw, 21px); }
.panel > .hud + .hud, .panel > .banner + .hud { margin-top: 22px; }
.banner { padding: 14px 16px; border: 1px dashed var(--red); background: rgba(255,65,65,.06); margin-bottom: 18px; }
.brief-title { font-family: var(--display); font-weight: 400; font-size: clamp(40px, 12vw, 64px); line-height: .95; color: var(--red); margin: 6px 0 14px; text-shadow: 0 0 14px rgba(255,65,65,.35); }
.small-typed { font-size: 22px; min-height: 3.6em; }
.brief-rules { text-align: left; max-height: 46vh; overflow-y: auto; margin: 6px 0 16px; padding-right: 6px; }
.card-kind { font-family: var(--display); font-size: 22px; letter-spacing: .12em; color: var(--amber); margin: 6px 0 4px; }
.card-task { font-size: 17px; line-height: 1.5; margin: 0 0 6px; }
.card-keyword { font-family: var(--display); font-size: clamp(40px, 12vw, 60px); line-height: 1; color: var(--green); margin: 0; overflow-wrap: anywhere; text-shadow: 0 0 12px rgba(0,255,65,.35); }
.form select { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line); padding: 12px; border-radius: 0; }
.btn.armed { background: var(--red); border-color: var(--red); color: var(--bg); }
.ok-text { color: var(--green); }
.bad-text { color: var(--red); }
.hold { position: relative; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; transition: box-shadow .2s; }
.hold, .hold:hover, .hold:active { background: rgba(0,255,65,.05); color: var(--green); }
.hold .hold-fill { position: absolute; inset: 0; transform: scaleX(0); transform-origin: left center; background: linear-gradient(90deg, rgba(0,255,65,.08), rgba(0,255,65,.36) 96%, rgba(190,255,200,.95) 100%); pointer-events: none; }
.hold { box-shadow: 0 0 calc(var(--hold, 0) * 34px) rgba(0,255,65, calc(var(--hold, 0) * .7)); }
.hold.holding .hold-label { text-shadow: 0 0 calc(var(--hold, 0) * 12px) var(--green); }
.hold .hold-label { position: relative; pointer-events: none; }
.hold.flash { animation: hold-flash .45s ease-out; }
@keyframes hold-flash { 0% { background: var(--green); color: var(--bg); box-shadow: 0 0 40px rgba(0,255,65,.8); } 100% { background: transparent; } }
.private { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.role-line { font-family: var(--display); font-size: 34px; line-height: 1; margin: 4px 0 10px; }
.role-line.agent { color: var(--green); }
.role-line.grinch { color: #9dff3a; text-shadow: 0 0 16px rgba(157,255,58,.55); }
.role-card { margin: 16px 0; text-align: left; }
.role-card .role-line { font-size: clamp(42px, 13vw, 64px); text-align: center; }
.role-card ul, .private ul, .rules ul { margin: 6px 0 0; padding-left: 1.2em; }
.role-card li, .private li, .rules li { margin: 0 0 6px; }
.intercept-card { margin-top: 8px; padding: 10px 12px; border: 1px dashed rgba(157,255,58,.45); }
.rules h3 { font-family: var(--display); font-weight: 400; font-size: 24px; letter-spacing: .08em; color: var(--green); margin: 20px 0 4px; }
.rules h3:first-child { margin-top: 4px; }
.rules li { line-height: 1.45; }

/* mission tab: one part at a time */
.sub-nav { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 47px); z-index: 15; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0 0 16px; padding: 6px 0; background: var(--bg); }
.sub-nav button { font-family: var(--display); font-size: clamp(18px, 5vw, 22px); letter-spacing: .06em; color: var(--muted); background: transparent; border: 1px solid var(--line); min-height: 44px; cursor: pointer; }
.sub-nav button[aria-selected="true"] { color: var(--bg); background: var(--green); border-color: var(--green); }
.sub-mark { color: var(--amber); }
.sub-nav button[aria-selected="true"] .sub-mark { color: var(--bg); }


/* role reveal: the same staging and the same sound for both roles; only the emblem differs */
.reveal-stage { position: relative; width: 100%; max-width: 330px; aspect-ratio: 1 / .82; margin: 4px auto 14px; background: #000; border: 1px solid var(--line); overflow: hidden; }
.reveal-stage canvas, .reveal-stage .seal-wrap { position: absolute; inset: 0; width: 100%; height: 100%; }
.reveal-stage .seal-wrap { display: grid; place-items: center; color: var(--green); opacity: 0; background: radial-gradient(circle, rgba(0,255,65,.14), transparent 62%); }
.reveal-stage.go { animation: thud .4s ease-out .9s; }
@keyframes thud { 20% { transform: translateY(5px); } 50% { transform: translateY(-2px); } 100% { transform: none; } }
.reveal-stage .seal { width: 72%; filter: drop-shadow(0 0 14px rgba(0,255,65,.55)); }
.reveal-stage.go .seal-wrap { animation: seal-in 1.6s cubic-bezier(.2,.8,.2,1) .9s forwards; }
@keyframes seal-in { 0% { opacity: 0; transform: scale(1.9) rotate(-14deg); filter: blur(6px); } 70% { opacity: 1; transform: scale(.96) rotate(-3deg); filter: blur(0); } 100% { opacity: 1; transform: scale(1) rotate(-3deg); } }
.reveal-scan { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 22px; letter-spacing: .14em; color: var(--green); background: repeating-linear-gradient(to bottom, rgba(0,255,65,.06) 0 2px, transparent 2px 4px); z-index: 2; }
.reveal-scan::after { content: ""; position: absolute; left: 0; right: 0; height: 30%; top: -30%; background: linear-gradient(transparent, rgba(0,255,65,.35), transparent); animation: sweep .45s linear 2; }
@keyframes sweep { to { top: 100%; } }
.reveal-stage.go .reveal-scan { animation: scan-out .3s ease .9s forwards; }
@keyframes scan-out { to { opacity: 0; visibility: hidden; } }
.role-card .role-line.glitch { opacity: 0; animation: glitch-in .7s steps(6) 2.2s forwards; }
@keyframes glitch-in { 0% { opacity: 1; transform: translate(-6px, 2px) skewX(-12deg); text-shadow: 4px 0 var(--red), -4px 0 #7cc6ff; } 50% { transform: translate(5px, -2px) skewX(8deg); } 100% { opacity: 1; transform: none; text-shadow: 0 0 16px currentColor; } }
.role-card ul.later { opacity: 0; animation: fade-in .6s ease 2.8s forwards; }
@keyframes fade-in { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .reveal-stage .seal-wrap, .role-card .role-line.glitch, .role-card ul.later { opacity: 1; animation: none; } .reveal-scan { display: none; } }

.status-line { font-family: var(--display); font-size: 26px; letter-spacing: .04em; line-height: 1.1; margin: 2px 0 4px; }
.status-big { font-family: var(--display); font-size: clamp(34px, 10vw, 44px); letter-spacing: .04em; line-height: 1; margin: 4px 0 6px; }

.classified { font-family: var(--display); font-size: clamp(40px, 12vw, 56px); letter-spacing: .12em; color: var(--red); margin: 8px 0 6px; text-shadow: 0 0 14px rgba(255,65,65,.35); }

.sign-note { margin: 14px 0 0; padding: 10px 12px; border: 1px dashed var(--amber); color: var(--text); font-size: 14px; }
.sign-note b { color: var(--amber); font-weight: 600; }

/* overnight news */
.news { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; overflow: hidden; background: #000; }
.news #news-sky { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; }
.news-inner { position: relative; z-index: 2; width: min(92vw, 420px); text-align: center; padding: 24px 0 40px; }
.news-when { font-family: var(--display); font-size: 20px; color: var(--muted); margin: 0 0 14px; min-height: 1.2em; }
.news-stage { min-height: 250px; display: grid; place-items: center; margin: 4px 0 16px; }
.news-head { font-family: var(--display); font-weight: 400; font-size: clamp(30px, 9vw, 44px); line-height: 1.05; color: var(--green); margin: 0 0 10px; min-height: 1.05em; text-shadow: 0 0 14px rgba(0,255,65,.4); }
.news-body { color: var(--text); margin: 0 0 20px; opacity: 0; transition: opacity .6s ease; }
.news-body.in { opacity: 1; }
.news-skip { position: absolute; z-index: 3; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 14px; font-family: var(--display); font-size: 18px; color: var(--muted); background: none; border: 1px solid var(--line); padding: 4px 10px; min-height: 36px; cursor: pointer; }
/* frozen: their photo ices over, cracks, FROZEN stamp */
.frost { position: relative; width: min(58vw, 220px); aspect-ratio: 4 / 5; overflow: hidden; border: 1px solid #9fd8f0; box-shadow: 0 0 30px rgba(159,216,240,.35); }
.frost img { width: 100%; height: 100%; object-fit: cover; display: block; animation: frost-photo 2.2s ease .2s forwards; }
@keyframes frost-photo { to { filter: grayscale(1) brightness(1.1) sepia(.3) hue-rotate(165deg) saturate(2.4); } }
.frost-ice { position: absolute; inset: 0; opacity: 0; transform: scale(1.5); mix-blend-mode: screen;
  background: radial-gradient(ellipse at 0 0, rgba(225,247,255,.95), transparent 42%), radial-gradient(ellipse at 100% 0, rgba(225,247,255,.9), transparent 42%),
              radial-gradient(ellipse at 0 100%, rgba(225,247,255,.9), transparent 42%), radial-gradient(ellipse at 100% 100%, rgba(225,247,255,.95), transparent 42%),
              repeating-linear-gradient(55deg, rgba(255,255,255,.08) 0 2px, transparent 2px 9px);
  animation: frost-in 2s ease-out .3s forwards; }
@keyframes frost-in { to { opacity: 1; transform: scale(1); } }
.frost-crack { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: rgba(255,255,255,.9); stroke-width: 1.2; stroke-dasharray: 260; stroke-dashoffset: 260; animation: crack 0.35s ease-out 2.1s forwards; }
@keyframes crack { to { stroke-dashoffset: 0; } }
.frost-stamp { position: absolute; left: 50%; top: 78%; padding: 2px 12px 0; font-family: 'Black Ops One', Impact, sans-serif; font-size: clamp(30px, 10vw, 44px); color: #bfe9ff; border: 4px solid currentColor; background: rgba(0,20,40,.35); opacity: 0; transform: translate(-50%, -50%) rotate(-8deg) scale(2.6); animation: stamp-in .22s cubic-bezier(.3,1.5,.5,1) 2.2s forwards; }
.frost { animation: shake .35s 2.2s; }
/* bounced: an ice shard shatters on a shield */
.bounce { position: relative; width: 220px; height: 220px; color: var(--green); }
.bounce .shield { position: absolute; left: 50%; top: 50%; width: 130px; transform: translate(-50%, -50%); filter: drop-shadow(0 0 16px rgba(0,255,65,.6)); animation: shield-hit .5s ease-out .9s; }
@keyframes shield-hit { 25% { transform: translate(-46%, -50%) scale(1.06); filter: drop-shadow(0 0 40px rgba(220,255,230,1)); } 100% { transform: translate(-50%, -50%); } }
.bounce .shard { position: absolute; left: -40px; top: 50%; width: 70px; height: 14px; background: linear-gradient(90deg, transparent, #bfe9ff); clip-path: polygon(0 40%, 85% 0, 100% 50%, 85% 100%, 0 60%); transform: translateY(-50%); animation: shard-fly .9s cubic-bezier(.5,0,1,1) forwards; }
@keyframes shard-fly { 90% { left: 50px; opacity: 1; } 100% { left: 58px; opacity: 0; transform: translateY(-50%) scale(.3); } }
.bounce .spark { position: absolute; left: 92px; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: #e6fbff; opacity: 0; box-shadow: 0 0 30px 14px rgba(191,233,255,.9); animation: spark .5s ease-out .88s; }
@keyframes spark { 10% { opacity: 1; } 100% { opacity: 0; transform: scale(3); } }
/* new orders */
.orders-box { position: relative; width: min(70vw, 260px); height: 150px; border: 1px dashed var(--amber); display: grid; place-items: center; overflow: hidden; background: repeating-linear-gradient(to bottom, rgba(0,255,65,.05) 0 2px, transparent 2px 4px); }
.orders-scan { position: absolute; left: 0; right: 0; height: 35%; top: -35%; background: linear-gradient(transparent, rgba(0,255,65,.35), transparent); animation: sweep .5s linear 3; }
.orders-text { font-family: var(--display); font-size: 26px; letter-spacing: .12em; color: var(--amber); }
.quiet-night { font-size: 90px; color: #9fd8f0; opacity: .5; animation: fade-in 1.2s ease; }
@media (prefers-reduced-motion: reduce) { .frost img, .frost-ice, .frost-crack, .frost-stamp, .bounce .shield, .bounce .shard, .bounce .spark, .orders-scan { animation-duration: .01s; animation-delay: 0s; } }

.news-you { margin: -6px 0 20px; padding: 10px 12px; border: 1px solid var(--amber); color: var(--amber); font-size: 15px; animation: fade-in .6s ease both; opacity: 0; }

/* roundtable + finale screens on the phone */
.rt-wrap { max-width: 520px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px 48px; }
.rt-vote { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 14px; text-align: center; }
.rt-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 14px; }
.rt-pick button { background: none; border: 2px solid var(--line); padding: 6px 4px 4px; color: var(--text); cursor: pointer; }
.rt-pick button img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; margin-bottom: 4px; }
.rt-pick button span { font-family: var(--display); font-size: 20px; letter-spacing: .04em; }
.rt-pick button[aria-pressed="true"] { border-color: var(--amber); box-shadow: 0 0 16px rgba(255,210,63,.55); }
.rt-pick button[aria-pressed="true"] span { color: var(--amber); }
.rt-coal { border: 1px solid #555; background: #0d0d0d; padding: 10px 12px; margin: 0 0 14px; text-align: left; }
.rt-coal select { width: 100%; }
#rt-note { text-align: center; margin: 12px 0; }
#rt-continue, #fin-hq { display: block; margin: 18px auto 0; }
#rt.can-vote .rt-row.rt-dim, #rt.can-vote .rt .rt-sub { display: none; }
@media (max-width: 560px) {
  .fin-money li { grid-template-columns: 40px 1fr auto; gap: 8px; }
  .fin-money img { width: 40px; height: 40px; }
  .fin-money .bar span { font-size: 15px; white-space: nowrap; }
  .fin-money li.top .bar span::after { content: '  ★'; }
  .fin-money .usd { font-size: 24px; min-width: 3.2em; }
}

/* waiting for HQ to fire the briefing */
.awaiting { margin-top: 14px; padding: 14px; border: 1px dashed var(--green); text-align: center; }
.awaiting .sig { display: flex; justify-content: center; align-items: flex-end; gap: 5px; height: 34px; margin-bottom: 8px; }
.awaiting .sig i { width: 7px; background: var(--green); box-shadow: 0 0 8px rgba(0,255,65,.6); animation: sig 1.4s ease-in-out infinite; }
.awaiting .sig i:nth-child(1) { height: 20%; animation-delay: 0s; } .awaiting .sig i:nth-child(2) { height: 40%; animation-delay: .15s; }
.awaiting .sig i:nth-child(3) { height: 60%; animation-delay: .3s; } .awaiting .sig i:nth-child(4) { height: 80%; animation-delay: .45s; }
.awaiting .sig i:nth-child(5) { height: 100%; animation-delay: .6s; }
@keyframes sig { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
.awaiting .aw-h { font-family: var(--display); font-size: 28px; letter-spacing: .1em; color: var(--green); margin: 0 0 6px; animation: aw-blink 1.6s steps(1) infinite; }
@keyframes aw-blink { 50% { opacity: .55; } }

/* stamps on your own mission moments */
#mission-card { position: relative; }
.m-stamp { position: absolute; z-index: 3; right: -6px; top: 6px; padding: 2px 10px 0; white-space: nowrap; font-family: 'Black Ops One', Impact, sans-serif; font-size: 18px; letter-spacing: .03em; color: var(--green); border: 3px solid currentColor; background: rgba(0,0,0,.6); transform: rotate(8deg); pointer-events: none; }
.m-stamp.red { color: var(--red); } .m-stamp.grey { color: #bdbdbd; }
.m-stamp.slam { animation: m-slam .3s cubic-bezier(.3,1.5,.5,1) both; }
@keyframes m-slam { from { opacity: 0; transform: rotate(8deg) scale(3.2); } to { opacity: 1; transform: rotate(8deg) scale(1); } }
.co-result { text-align: center; }
.co-photo { position: relative; display: inline-block; margin: 6px 0 10px; }
.co-photo img { width: 150px; height: 150px; object-fit: cover; border: 2px solid var(--line); display: block; }
.co-result.hit .co-photo img { filter: grayscale(.7) contrast(1.1); }
.co-photo .m-stamp { left: 50%; right: auto; top: 50%; font-size: 30px; transform: translate(-50%, -50%) rotate(-10deg); }
.co-result.anim .co-photo img { animation: fade-in .4s ease both; }
.co-result.anim .co-photo .m-stamp { animation: co-slam .3s cubic-bezier(.3,1.5,.5,1) .6s both; }
@keyframes co-slam { from { opacity: 0; transform: translate(-50%, -50%) rotate(-10deg) scale(3); } to { opacity: 1; transform: translate(-50%, -50%) rotate(-10deg) scale(1); } }
.co-result.anim p { animation: fade-in .4s ease .9s both; }
.gift-moment { position: relative; text-align: center; padding: 10px 0 14px; margin-bottom: 10px; border-bottom: 1px dashed var(--line); color: var(--green); }
.gift-moment svg { width: 84px; filter: drop-shadow(0 0 12px rgba(0,255,65,.6)); animation: gift-in .6s cubic-bezier(.2,.9,.3,1.3) both; }
@keyframes gift-in { from { opacity: 0; transform: translateY(-30px) scale(.6); } }
.gift-moment .m-stamp { position: relative; right: auto; top: auto; display: inline-block; margin: 6px 0; font-size: 22px; transform: rotate(-4deg); animation-delay: .35s; }
.blown-hud { text-align: center; }
.blown-card { position: relative; margin: 14px auto; max-width: 320px; padding: 14px; border: 1px solid var(--line); background: rgba(0,0,0,.4); text-align: left; }
.blown-card .m-stamp { left: 50%; right: auto; top: 50%; font-size: 40px; opacity: 0; transform: translate(-50%, -50%) rotate(-12deg); }
.blown-card .m-stamp.slam { animation: blown-slam .3s cubic-bezier(.3,1.5,.5,1) forwards; }
@keyframes blown-slam { from { opacity: 0; transform: translate(-50%, -50%) rotate(-12deg) scale(3); } to { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(1); } }
.sealed { text-align: center; }
#card-stamp { top: auto; bottom: 58px; right: 2px; transform: rotate(-7deg); font-size: 20px; }
#card-stamp.slam { animation-name: m-slam-low; }
@keyframes m-slam-low { from { opacity: 0; transform: rotate(-7deg) scale(3.2); } to { opacity: 1; transform: rotate(-7deg) scale(1); } }

/* Nothing jumps while text arrives: these screens hang from the top and only ever grow downward,
   and the news headline has room for two lines before it types. */
.news { place-items: start center; }
.news-inner { padding-top: calc(env(safe-area-inset-top, 0px) + 8vh); }
.news-head { min-height: 2.1em; }
#brief.screen.center { justify-content: flex-start; padding-top: calc(env(safe-area-inset-top, 0px) + 6vh); }
.news-when { line-height: 1.3; min-height: 1.3em; height: 1.3em; overflow: hidden; }
#news-tag { white-space: nowrap; }

/* the curtain between scenes */
.curtain { position: fixed; inset: 0; z-index: 54; background: #000; opacity: 1; transition: opacity .45s ease; pointer-events: none; }
.curtain.lift { opacity: 0; }
.screen.leaving { opacity: 0; transition: opacity .38s ease; }

/* the landing screen's buttons share one slot, so swapping them never moves anything */
.gate-actions { min-height: 70px; display: grid; place-items: center; }

/* the shield roll slot under the card */
.dice-slot { margin-top: 14px; text-align: center; }
.dice-slot .btn.hold { margin-top: 6px; }
.dice-done { margin: 6px 0 0; }
#card-stamp { bottom: 2px; right: 0; font-size: 17px; }   /* the corner beside "MISSION DONE.", clear of the keyword */
#card-stamp { bottom: -14px; right: -4px; font-size: 16px; }   /* on the card's bottom edge, like a stamp over a page corner */

/* the ACCOMPLISHED / BLOWN stamp takes the DONE button's place in the card, so it never covers text */
.stamp-row { min-height: 0; }
#card-stamp { position: relative; display: inline-block; top: auto; bottom: auto; right: auto; left: auto; margin: 10px 0 4px; font-size: 22px; transform: rotate(-6deg); }
#card-stamp.slam { animation-name: m-slam-row; }
@keyframes m-slam-row { from { opacity: 0; transform: rotate(-6deg) scale(3); } to { opacity: 1; transform: rotate(-6deg) scale(1); } }

/* the one tap before a cutscene with sound (phones lock audio until a tap) */
.audio-gate { position: fixed; inset: 0; z-index: 71; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px 16px; text-align: center; }
.audio-gate h1 { margin: 0 0 6px; color: var(--green, #00ff41); font-family: 'VT323', monospace; font-size: 44px; letter-spacing: .04em; text-shadow: 0 0 12px rgba(0,255,65,.45); }
.audio-gate .tag { margin: 0; }

/* a shield arrived: the stage holds its height from the first frame */
.gift-hud { text-align: center; }
.gift-stage { position: relative; height: 300px; margin: 6px auto 4px; max-width: 420px; }
.gift-stage .gift-fallback { width: 120px; height: 140px; margin: 70px auto 0; color: #ffd23f; filter: drop-shadow(0 0 14px rgba(255,210,63,.45)); }
.gift-hud .brief-title { color: #ffd23f; text-shadow: 0 0 14px rgba(255,210,63,.35); }   /* a gift, not an alarm */
