/* ============================================================================
 *  JUPITER 2011 — STYLES  (css/style.css)
 * ============================================================================
 *  Look: recovered VHS footage on a dead terminal. Black screen, off-white
 *  captions, one signal red for the Kies.
 *
 *  Colours are defined once below (:root). Change them there.
 *  Colour is never the only signal: affordable buttons also get a bright
 *  border and a "BUY" label, unaffordable ones say how much is missing.
 * ========================================================================== */

/* ------------------------------------------------------------------ FONTS */
@font-face { font-family: 'Silkscreen'; src: url('../fonts/silkscreen-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Silkscreen'; src: url('../fonts/silkscreen-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('../fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('../fonts/ibm-plex-mono-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

/* ----------------------------------------------------------------- TOKENS */
:root {
  --bg: #060608;          /* the void */
  --bg-1: #0c0c10;        /* panels */
  --bg-2: #15151b;        /* buttons */
  --bg-3: #1e1e26;        /* hover / affordable buttons */
  --line: #2a2a33;
  --line-2: #44444f;
  --text: #ece7da;        /* VHS caption off-white */
  --dim: #a39f93;
  --faint: #6c6a63;
  --kies: #ff3b2f;        /* signal red */
  --kies-dim: #7d1d17;
  --amber: #ffb547;       /* echoes / jupiter */
  --pale: #d6ecff;        /* pale souls */
  --eye-white: #cfc8b6;
  --eye-iris: #1a0a09;
  --lid: #2b1d1a;         /* eyelids (Stillness) */

  --font-head: 'Silkscreen', 'Courier New', monospace;
  --font-body: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;

  --gutter: 16px;
  --radius: 0;            /* hard corners everywhere */
  color-scheme: dark;
}

html { font-size: 16px; }
html[data-size="s"] { font-size: 14px; }
html[data-size="l"] { font-size: 18px; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 500;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font: inherit; color: inherit; }
::selection { background: var(--kies); color: var(--bg); }

:focus-visible {
  outline: 2px solid var(--pale);
  outline-offset: 2px;
}

.dim { color: var(--dim); }
.label {
  font-family: var(--font-head);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--dim);
}
.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;
}
.skip-link {
  position: absolute; left: 8px; top: -40px; z-index: 100;
  background: var(--text); color: var(--bg); padding: 6px 10px; text-decoration: none;
}
.skip-link:focus { top: 8px; }

/* ----------------------------------------------------------------- LAYOUT */
.app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh;
}

.columns {
  display: grid;
  grid-template-columns: minmax(260px, 310px) minmax(420px, 1fr) minmax(280px, 380px);
  min-height: 0;
}

.col {
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  padding: var(--gutter);
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.col:last-child { border-right: 0; }

/* Phone-only pieces: hidden on bigger screens (see PHONES at the end). */
.m-status, .m-nav, .m-eye { display: none; }

/* Tablets (portrait): eye and log on the left, the tabs on the right. */
@media (min-width: 701px) and (max-width: 1000px) and (min-height: 600px) {
  .topbar { flex-wrap: wrap; gap: 6px 18px; }
  .subtitle { display: none; }
  .columns {
    grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1.5fr) minmax(0, 1fr);
  }
  .col-left { grid-column: 1; grid-row: 1; border-bottom: 1px solid var(--line); }
  .col-right { grid-column: 1; grid-row: 2; border-right: 1px solid var(--line); }
  .col-mid { grid-column: 2; grid-row: 1 / 3; border-right: 0; }
}

/* ---------------------------------------------------------------- TOP BAR */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px var(--gutter);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.brand { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.title {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.55rem;
  letter-spacing: 0.06em;
  line-height: 1;
  position: relative;
  text-shadow: 1.5px 0 0 rgba(255, 59, 47, 0.75), -1.5px 0 0 rgba(120, 220, 255, 0.35);
}
.subtitle { color: var(--faint); font-size: 0.8rem; white-space: nowrap; }
.subtitle.us { color: #c4544b; }
.file-label {
  margin-left: auto;
  font-family: var(--font-head);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.file-num { color: var(--kies); }
.osd {
  display: flex; gap: 14px; align-items: center;
  font-family: var(--font-head);
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
  text-shadow: 0 0 6px rgba(236, 231, 218, 0.35);
}
.rec { display: inline-flex; align-items: center; gap: 6px; }
.rec-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--kies);
  box-shadow: 0 0 6px var(--kies);
  animation: rec-blink 2s steps(1) infinite;
}
@keyframes rec-blink { 50% { opacity: 0.15; } }
.osd-counter { color: var(--dim); min-width: 7ch; text-align: right; }

/* ---------------------------------------------------------- LEFT COLUMN */
.col-left {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  background: radial-gradient(ellipse at 50% 32%, rgba(255, 59, 47, 0.07), transparent 60%);
}
.souls-block { text-align: center; }
.souls-big {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 2.3rem;
  line-height: 1.1;
  letter-spacing: 0.02em;
  word-break: break-all;
}
.souls-rate { font-size: 1rem; }
.souls-rate #sps { font-weight: 700; }

/* THE EYE */
.eye {
  display: block;
  width: min(230px, 80%);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  --hunger: 0;
}
.eye { position: relative; }
.eye-art { display: block; width: 100%; height: 100%; }
.eye-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.eye-aura { opacity: calc(0.35 + var(--hunger) * 0.65); transition: opacity 0.3s; }
.eye-iris { transition: transform 0.25s ease-out; }
.eye-ring { transform-origin: 120px 120px; animation: iris-spin 40s linear infinite; }
.eye-pupil { filter: drop-shadow(0 0 calc(2px + var(--hunger) * 8px) var(--kies)); }
@keyframes iris-spin { to { transform: rotate(360deg); } }
.eye-svg { animation: eye-breathe 5s ease-in-out infinite; transform-origin: 50% 50%; }
@keyframes eye-breathe { 50% { transform: scale(1.025); } }
.eye.pulse .eye-svg { animation: eye-pulse 0.16s ease-out; }
@keyframes eye-pulse { 0% { transform: scale(0.93, 0.9); } 100% { transform: scale(1); } }
.eye.blink .eye-svg { animation: eye-blink 0.22s ease-in-out; }
@keyframes eye-blink { 50% { transform: scaleY(0.05); } }
.eye:focus-visible { outline-offset: 6px; }

.per-click { text-align: center; font-size: 0.95rem; margin-top: -6px; }

/* Meters (hunger, stillness) */
.meters { display: flex; flex-direction: column; gap: 10px; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; }
.meter-val { font-family: var(--font-head); font-size: 0.85rem; }
.meter-bar {
  height: 10px;
  margin-top: 3px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  position: relative;
}
.meter-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--kies); }
.meter-still .meter-fill { background: var(--pale); }
.meter-help { font-size: 0.72rem; color: var(--faint); margin-top: 2px; }
.meter.full .meter-val { color: var(--kies); }
.meter-still.full .meter-val { color: var(--pale); }

.secondary { display: flex; flex-direction: column; gap: 6px; }
.res-row {
  display: grid;
  grid-template-columns: 20px auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: var(--bg-1);
}
.res-icon { width: 18px; height: 18px; display: block; }
.res-icon svg { width: 100%; height: 100%; }
#echo-row .res-icon, #echo-row .res-val { color: var(--amber); }
#world-row .res-icon { color: var(--text); }
.res-val { font-weight: 700; text-align: right; }

.buffs { display: flex; flex-direction: column; gap: 6px; }
.buff {
  border: 1px solid var(--pale);
  padding: 6px 8px;
  font-size: 0.85rem;
  display: flex; justify-content: space-between;
  background: rgba(214, 236, 255, 0.06);
}
.buff strong { font-family: var(--font-head); color: var(--pale); font-weight: 400; }

/* ----------------------------------------------------------- MIDDLE: TABS */
.col-mid { padding-top: 0; }
.tabs {
  position: sticky; top: 0; z-index: 2;
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 12px 0 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.tab {
  font-family: var(--font-head);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  padding: 6px 12px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  color: var(--dim);
  cursor: pointer;
}
.tab[aria-selected="true"] { color: var(--bg); background: var(--text); border-color: var(--text); }
.tab:not([aria-selected="true"]):hover { color: var(--text); border-color: var(--line-2); }
.tab-dot { color: var(--amber); }
.btn-small { font-size: 0.68rem; padding: 3px 8px; }
.tab[aria-selected="true"] .tab-dot { color: var(--kies-dim); }

.block { margin-bottom: 22px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.block-title {
  font-family: var(--font-head);
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  margin: 0 0 8px;
  color: var(--dim);
}
.block-head .block-title { margin: 0; }
.hint { color: var(--faint); font-size: 0.85rem; }
.panel-intro { color: var(--dim); margin-top: 0; }

/* Segmented buttons (buy amount, settings choices) */
.seg { display: inline-flex; flex-wrap: wrap; }
.seg button {
  font-family: var(--font-head);
  font-size: 0.75rem;
  padding: 5px 10px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  margin-left: -1px;
  color: var(--dim);
  cursor: pointer;
}
.seg button:first-child { margin-left: 0; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); position: relative; }

/* Shared "buyable" button look ------------------------------------------- */
.buyable {
  text-align: left;
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--dim);
  cursor: pointer;
  padding: 10px 12px;
  position: relative;
}
.buyable.can {
  color: var(--text);
  border-color: var(--text);
  background: var(--bg-3);
}
/* Buttons you can feel: a lip underneath, and they sink when pressed. */
.buyable, .btn { box-shadow: 0 3px 0 0 var(--line); transition: transform 0.06s ease-out, box-shadow 0.06s ease-out; }
.buyable.can { box-shadow: 0 3px 0 0 var(--line-2); }
.buyable.can:hover { box-shadow: 0 3px 0 0 var(--line-2), 0 0 0 1px var(--text), 0 0 18px rgba(236, 231, 218, 0.08); }
.buyable:active, .btn:not(:disabled):active { transform: translateY(3px); box-shadow: 0 0 0 0 var(--line); }
.tab:active, .seg button:active, .m-nav button:active { transform: translateY(1px); }
.gen-owned.bump { animation: count-bump 0.28s ease-out; }
@keyframes count-bump { 0% { transform: scale(1.35); color: var(--kies); } 100% { transform: scale(1); } }
.price { font-weight: 700; white-space: nowrap; }
.buyable .need { color: var(--faint); font-size: 0.78rem; white-space: nowrap; }
.buyable.can .buy-tag { color: var(--bg); background: var(--text); padding: 0 5px; font-family: var(--font-head); font-size: 0.7rem; }
.buyable:not(.can) .buy-tag { display: none; }

/* NEXT-UNLOCK HINT */
.next-hint {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: baseline;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--dim);
}
.hint-label { font-family: var(--font-head); font-size: 0.7rem; letter-spacing: 0.1em; color: var(--bg); background: var(--dim); padding: 1px 6px; }
.hint-bar { grid-column: 1 / -1; height: 3px; background: var(--bg-2); position: relative; }
.hint-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--dim); transition: width 0.4s; }

/* TRANSMISSIONS */
.tx-block .block-title { color: var(--pale); }
.tx-card { border: 1px solid var(--pale); background: rgba(214, 236, 255, 0.04); padding: 12px 14px; }
.tx-from { font-family: var(--font-head); font-size: 0.75rem; letter-spacing: 0.08em; color: var(--pale); }
.tx-text { font-size: 1.05rem; margin: 6px 0 12px; }
.tx-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.tx-choice { display: flex; flex-direction: column; gap: 3px; border-color: var(--pale) !important; }
.tx-label { font-weight: 700; }
.tx-effect { font-size: 0.8rem; color: var(--pale); }

/* CREW MANIFEST */
.crew { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); }
.crew-row {
  display: grid; grid-template-columns: 1.2fr 1.2fr auto; gap: 10px;
  padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 0.88rem;
}
.crew-row:last-child { border-bottom: 0; }
.crew-name { font-weight: 700; }
.crew-role { color: var(--dim); }
.crew-status { font-family: var(--font-head); font-size: 0.72rem; letter-spacing: 0.06em; }
.crew-row.taken .crew-name { text-decoration: line-through; color: var(--faint); }
.crew-row.taken .crew-status { color: var(--kies); }
.crew-row.escaped .crew-status { color: var(--pale); }
.crew-row.ground .crew-status { color: var(--dim); }
.crew-row.ground { border-top: 1px dashed var(--line-2); }

/* SUBJUGATION */
.conquest { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; margin-bottom: 10px; }
.conquest-icon { width: 40px; height: 40px; color: var(--text); }
.conquest-icon svg { width: 100%; height: 100%; display: block; }
.conquest-main { display: flex; flex-direction: column; }
.conquest-name { font-weight: 700; font-size: 1.15rem; }
.conquest-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.conquest-locked, .conquest-done { border: 1px dashed var(--line-2); padding: 10px 12px; margin-bottom: 10px; font-size: 0.9rem; }
.jobs { display: grid; gap: 6px; margin-bottom: 10px; }
.job {
  display: grid; grid-template-columns: 90px 40px 1fr auto; gap: 10px; align-items: center;
  border: 1px solid var(--line); background: var(--bg-1); padding: 6px 10px; font-size: 0.88rem;
}
.job-name { font-family: var(--font-head); font-size: 0.78rem; letter-spacing: 0.08em; }
.job-count { font-weight: 700; font-size: 1.1rem; text-align: right; }
.job-desc { color: var(--dim); font-size: 0.8rem; }
.job-btns { display: flex; gap: 4px; }
.job-btn { padding: 2px 10px; font-family: var(--font-body); font-size: 1rem; }
.job-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.worlds-taken { font-size: 0.8rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.world-chip { border: 1px solid var(--line-2); padding: 1px 7px; color: var(--dim); }

/* PROJECTS */
.projects { display: grid; gap: 8px; }
.project { border-left: 4px solid var(--kies-dim); }
.project.can { border-left-color: var(--kies); }
.project-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.project-name { font-family: var(--font-head); font-size: 0.95rem; letter-spacing: 0.04em; color: inherit; }
.project-desc { font-size: 0.88rem; margin: 3px 0; }
.project-effect { font-size: 0.85rem; color: var(--kies); }
.project:not(.can) .project-effect { color: #d07068; }
.project-cost { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-top: 4px; }
.cost-echo { color: var(--amber); }

/* UPGRADES */
.upgrades { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.upgrade { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.upgrade-name { font-weight: 700; font-size: 0.88rem; }
.upgrade-effect { font-size: 0.82rem; }
.upgrade.can .upgrade-effect { color: var(--kies); }
.upgrade-desc { font-size: 0.75rem; color: var(--faint); font-style: italic; }
.upgrade-cost { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin-top: 3px; font-size: 0.85rem; }

/* BROODS (generators) */
.gens { display: grid; gap: 8px; outline: none; }
.gen-group {
  font-family: var(--font-head);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--faint);
  margin-top: 8px;
  border-bottom: 1px dashed var(--line-2);
  padding-bottom: 3px;
}
.gen-group:first-child { margin-top: 0; }
/* Broods from earlier FILEs: compact rows */
.gen.older { padding-top: 6px; padding-bottom: 6px; }
.gen.older .gen-desc { display: none !important; }
.gen.older .gen-icon { width: 34px; height: 34px; padding: 6px; }
.gen.older .gen-owned { font-size: 1.25rem; }
.gen {
  display: grid;
  grid-template-columns: 22px 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.gen-key { font-family: var(--font-head); font-size: 0.7rem; color: var(--faint); }
.gen-icon {
  width: 44px; height: 44px; padding: 8px;
  border: 1px solid var(--line-2);
  color: var(--kies);
  background: var(--bg);
}
.gen-icon svg { width: 100%; height: 100%; display: block; }
.gen-name { font-weight: 700; font-size: 1rem; }
.gen-desc { font-size: 0.8rem; color: var(--faint); margin: 1px 0 3px; }
.gen.can .gen-desc { color: var(--dim); }
.gen-stats { font-size: 0.8rem; }
.gen-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.gen-owned { font-family: var(--font-body); font-weight: 700; font-size: 1.6rem; line-height: 1; color: var(--text); }
.gen-price { display: flex; gap: 8px; align-items: baseline; font-size: 0.9rem; }
.gen-echo { color: var(--amber); }

/* New things bounce in */
.bounce-in { animation: bounce-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes bounce-in {
  0% { transform: translateY(14px) scale(0.96); opacity: 0; }
  60% { transform: translateY(-3px) scale(1.01); opacity: 1; }
  100% { transform: none; }
}

/* ---------------------------------------------------------------- LATTICE */
.lattice-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.lattice-echoes strong { color: var(--amber); font-size: 1.2rem; }
/* the draggable viewport and the large "world" inside it */
.lattice-view {
  position: relative;
  height: min(66vh, 720px);
  overflow: auto;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at center, rgba(255, 181, 71, 0.05), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0, transparent 39px, rgba(255, 255, 255, 0.025) 40px),
    repeating-linear-gradient(90deg, transparent 0, transparent 39px, rgba(255, 255, 255, 0.025) 40px),
    var(--bg);
  cursor: grab;
  touch-action: none;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.lattice-view.dragging { cursor: grabbing; user-select: none; }
.lattice-world { position: relative; }
.lattice-edges { position: absolute; inset: 0; pointer-events: none; }
.lattice-edges line { stroke: var(--line-2); stroke-width: 2; stroke-dasharray: 5 5; }
.lattice-edges line.lit { stroke: var(--amber); stroke-dasharray: none; }
.lattice-edges line.hidden-edge { display: none; }
.lattice-core {
  position: absolute; transform: translate(-50%, -50%);
  width: 130px; height: 130px; border-radius: 50%;
  border: 2px solid var(--amber);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: radial-gradient(circle, rgba(255, 181, 71, 0.18), var(--bg) 70%);
  text-align: center; font-size: 0.8rem;
}
.lattice-core strong { color: var(--amber); font-size: 1.05rem; }
.lattice-branch {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--font-head); font-size: 0.7rem; letter-spacing: 0.08em; pointer-events: none; white-space: nowrap;
}
.lattice-branch .dim { font-family: var(--font-body); font-size: 0.65rem; letter-spacing: 0; }
.lattice-branch { background: var(--bg); padding: 2px 8px; border: 1px solid var(--line); z-index: 1; }
.node { position: absolute; padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; min-height: 96px; background: var(--bg-2); z-index: 1; }
.lattice-view .node.owned { background: #1b160d; }
.lattice-view .node.can { background: var(--bg-3); }
.lattice-view .node.locked { background: var(--bg-1); }
.lattice-core { z-index: 1; }
.node-tag { font-family: var(--font-head); font-size: 0.6rem; letter-spacing: 0.08em; color: var(--faint); }
.node-name { font-weight: 700; font-size: 0.86rem; }
.node-effect { font-size: 0.78rem; }
.node-cost { font-size: 0.82rem; color: var(--amber); display: flex; justify-content: space-between; gap: 6px; }
.node.owned { border-color: var(--amber); color: var(--amber); cursor: default; background: rgba(255, 181, 71, 0.06); }
.node.owned .node-cost { color: var(--amber); }
.node.locked { border-style: dashed; color: var(--faint); cursor: not-allowed; }
.node.locked .node-cost { color: var(--faint); }
.node.can { border-color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); }
.node-link { width: 2px; height: 12px; background: var(--line-2); margin: 0 auto; }
.node-link.lit { background: var(--amber); }

/* ---------------------------------------------------------------- RECORDS */
.achievements { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.ach { border: 1px solid var(--line); padding: 8px 10px; background: var(--bg-1); }
.ach-name { font-weight: 700; font-size: 0.88rem; }
.ach-desc { font-size: 0.78rem; color: var(--faint); }
.ach.got { border-color: var(--amber); }
.ach.got .ach-name { color: var(--amber); }
.ach.got .ach-desc { color: var(--dim); }
.ach-mark { font-family: var(--font-head); font-size: 0.7rem; color: var(--faint); }
.ach.got .ach-mark { color: var(--amber); }

.stats { display: grid; grid-template-columns: auto 1fr; gap: 4px 18px; margin: 0; font-size: 0.9rem; }
.stats dt { color: var(--dim); }
.stats dd { margin: 0; font-weight: 700; text-align: right; }

/* -------------------------------------------------------------- ARCHIVE */
.archive { display: grid; gap: 6px; }
.archive-file { border: 1px solid var(--line); background: var(--bg-1); }
.archive-file summary { cursor: pointer; padding: 8px 10px; font-family: var(--font-head); font-size: 0.8rem; letter-spacing: 0.06em; }
.archive-list { display: flex; flex-direction: column; gap: 10px; padding: 4px 12px 12px; font-size: 0.88rem; }

/* ------------------------------------------------------------------ MAP */
.map-wrap { border: 1px solid var(--line); background: radial-gradient(ellipse at center, #0d0d14, var(--bg) 75%); }
.map { display: block; width: 100%; height: auto; }
.map .orbit { fill: none; stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 2 4; }
.map .belt { fill: none; stroke: var(--faint); stroke-width: 5; stroke-dasharray: 1 6; opacity: 0.5; }
.map .sun { fill: var(--amber); filter: drop-shadow(0 0 10px var(--amber)); }
.map .planet { fill: var(--dim); }
.map .planet.jupiter { fill: #c79a6a; }
.map .planet.taken, .map .star.taken { fill: var(--kies); filter: drop-shadow(0 0 5px var(--kies)); }
.map .star { fill: var(--text); }
.map .planet.nest { animation: nest-pulse 2.4s ease-in-out infinite; }
@keyframes nest-pulse { 50% { opacity: 0.4; } }
.map .next-ring { fill: none; stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 3 3; }
.map .route { fill: none; stroke: var(--pale); stroke-width: 1.5; stroke-dasharray: 6 5; opacity: 0.7; }
.map .ship path { fill: var(--pale); }
.map .map-label { font-family: var(--font-head); font-size: 11px; fill: var(--dim); letter-spacing: 0.06em; }
.map .map-label.moon { font-size: 9px; }
.map .map-label.taken { fill: var(--kies); }
.map .map-label.dim { fill: var(--faint); }
.map .ship-label { fill: var(--pale); }
.map .case-light circle { fill: var(--pale); filter: drop-shadow(0 0 6px var(--pale)); }
.map .case-light text { fill: var(--pale); }

/* -------------------------------------------------------------- VOYAGE */
.voyage { border: 1px solid var(--pale); padding: 10px 12px; background: rgba(214, 236, 255, 0.03); }
.voyage-line { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 0.9rem; flex-wrap: wrap; }
.voyage-bar { height: 6px; margin-top: 8px; border: 1px solid var(--line-2); position: relative; }
.voyage-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--pale); }
.voyage-date { font-family: var(--font-head); font-size: 0.82rem; letter-spacing: 0.04em; color: var(--pale); }
.voyage-text { margin: 8px 0 0; font-size: 0.88rem; color: var(--dim); }
.voyage-sleep { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.voyage-sleep .setting-help { margin: 0; }
.btn kbd, .sleep-skip kbd { font-family: var(--font-head); font-size: 0.7em; border: 1px solid currentColor; padding: 0 4px; margin-left: 6px; opacity: 0.7; }

/* ------------------------------------------------- THE SLEEP (FILE 02) */
.sleep-view {
  position: fixed; inset: 0; z-index: 45; background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px; opacity: 0; transition: opacity 1.2s ease;
}
.sleep-view.in { opacity: 1; }
.sleep-view.still { transition: none; }
.sleep-map { width: min(1000px, 100%); max-height: 70vh; opacity: 0; transition: opacity 1.6s ease 0.9s; }
.sleep-view.in .sleep-map { opacity: 0.92; }
.sleep-view.still .sleep-map { transition: none; }
.sleep-map .route-done { fill: none; stroke: var(--pale); stroke-width: 1.6; opacity: 0.9; }
.sleep-hud { position: absolute; top: max(18px, 4vh); left: 0; right: 0; text-align: center; pointer-events: none; }
.sleep-date { font-family: var(--font-head); font-size: clamp(1.4rem, 4.5vw, 2.4rem); letter-spacing: 0.08em; color: var(--text); }
.sleep-day { font-family: var(--font-head); font-size: 0.8rem; letter-spacing: 0.12em; color: var(--faint); margin-top: 4px; }
.sleep-dream {
  position: absolute; bottom: max(64px, 10vh); left: 16px; right: 16px; margin: 0 auto; max-width: 640px;
  text-align: center; font-size: 0.95rem; color: var(--dim); opacity: 0;
}
.sleep-dream.show { animation: dream 2.6s ease forwards; }
.sleep-view.still .sleep-dream.show { animation: none; opacity: 1; }
@keyframes dream { 0% { opacity: 0; filter: blur(3px); } 20% { opacity: 1; filter: blur(0); } 75% { opacity: 1; } 100% { opacity: 0.25; filter: blur(1px); } }
.sleep-skip {
  position: absolute; bottom: 18px; right: 16px; background: none; border: 1px solid var(--line-2);
  color: var(--faint); font-family: var(--font-head); font-size: 0.72rem; letter-spacing: 0.1em; padding: 6px 10px; cursor: pointer;
}
.sleep-skip:hover, .sleep-skip:focus-visible { color: var(--text); border-color: var(--text); }
body.sleeping .app { filter: brightness(0.25); transition: filter 1.2s ease; }
.anim #eye.wake { animation: eye-wake 1.4s ease-out; }
@keyframes eye-wake { 0% { transform: scaleY(0.05); filter: brightness(0.3); } 60% { transform: scaleY(1.08); } 100% { transform: none; filter: none; } }

/* -------------------------------------------------------------- FORMS */
.forms { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.form { display: flex; flex-direction: column; gap: 3px; position: relative; padding-left: 26px; }
.form-swatch { position: absolute; left: 9px; top: 12px; width: 10px; height: 10px; border-radius: 50%; }
.form-name { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.form-desc { font-size: 0.78rem; color: var(--faint); font-style: italic; }
.form-effect { font-size: 0.82rem; color: var(--kies); }
.form.worn { border-color: var(--kies); box-shadow: inset 0 0 0 1px var(--kies); }
.form.locked { cursor: not-allowed; border-style: dashed; }
.conquest-meta { font-size: 0.78rem; color: var(--dim); }

/* ------------------------------------------------ THE LAST SHIP (FILE 06) */
.boss-block .block-title { color: var(--kies); }
.boss { display: grid; grid-template-columns: 170px 1fr; gap: 14px; align-items: start; border: 1px solid var(--kies); background: rgba(255, 59, 47, 0.04); padding: 12px 14px; }
.boss-art { color: var(--pale); }
.boss-art svg { width: 100%; height: auto; display: block; }
.anim .caseship-light { animation: rec-blink 1.4s steps(2) infinite; }
.anim .phase-gun .caseship-gun { animation: gun-shake 0.12s linear infinite; }
@keyframes gun-shake { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(1.5px); } }
.boss-name { font-family: var(--font-head); font-size: 1.05rem; letter-spacing: 0.05em; }
.boss-desc { margin: 4px 0 10px; font-size: 0.88rem; color: var(--dim); }
.boss-bar-head { display: flex; justify-content: space-between; align-items: baseline; }
.boss-bar { height: 12px; border: 1px solid var(--kies); position: relative; margin: 4px 0 6px; }
.boss-fill { position: absolute; inset: 0 auto 0 0; width: 100%; background: var(--kies); transition: width 0.3s linear; }
.no-anim .boss-fill { transition: none; }
.boss-pressure { font-size: 0.82rem; color: var(--dim); margin-bottom: 8px; }
.boss-forms { display: flex; flex-direction: column; gap: 6px; }
.boss-note { font-size: 0.82rem; border: 1px dashed var(--line-2); padding: 5px 8px; }
.boss-note strong { font-family: var(--font-head); font-weight: 400; font-size: 0.72rem; letter-spacing: 0.06em; margin-right: 6px; }
.boss-seen.on { border: 1px solid var(--kies); color: var(--text); background: rgba(255, 59, 47, 0.1); }
.boss-seen.on strong { color: var(--kies); }
.boss-weak strong { color: var(--pale); }
.boss-weak.on { border: 1px solid var(--pale); }
.boss-faces { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.face-chip { display: inline-flex; align-items: center; gap: 6px; }
.face-chip .form-swatch { position: static; width: 8px; height: 8px; }
.face-chip[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.face-chip.seen { border-color: var(--kies); }
.face-chip.weak { border-color: var(--pale); }
.form.seen .form-effect { text-decoration: line-through; color: var(--faint); }
.form.seen { border-color: var(--kies) !important; border-style: dashed; }
.buy-tag.tag-seen { background: var(--kies) !important; color: var(--bg) !important; }
.buy-tag.tag-weak { background: var(--pale) !important; color: var(--bg) !important; }
.log-head.lh-seen { color: var(--kies); }
.ending-block .block-title { color: var(--pale); }
.ending-text { font-size: 1.05rem; margin: 0 0 12px; }
.ending-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.ending-choice { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-color: var(--pale) !important; }
.ending-choice .tx-label { font-family: var(--font-head); font-weight: 400; letter-spacing: 0.06em; }

/* --------------------------------------------------- KEYS (prestige) */
.keys-row { display: flex; align-items: center; gap: 10px; }
.keys-icon { width: 34px; height: 34px; color: var(--amber); }
.keys-icon svg, #key-icon svg { width: 100%; height: 100%; display: block; }
.keys-big { font-family: var(--font-head); font-size: 2rem; color: var(--amber); }
.keys-total { margin: 4px 0 0; color: var(--dim); font-size: 0.88rem; }
.fall-preview { font-size: 0.92rem; margin: 6px 0 10px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.memories { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.memory { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.memory.can .upgrade-effect { color: var(--amber); }
.memory.owned { border-color: var(--amber); opacity: 0.8; cursor: default; }
.memory.owned .price { color: var(--amber); font-family: var(--font-head); font-size: 0.7rem; }
.memory-soon { border: 1px dashed var(--line-2); background: repeating-linear-gradient(45deg, var(--bg-1) 0 8px, #101016 8px 16px); color: var(--faint); cursor: default; }
.memory-soon .upgrade-name { color: var(--dim); }
.memory-soon .price { font-family: var(--font-head); font-size: 0.7rem; letter-spacing: 0.08em; color: var(--amber); }
.recordings { display: flex; flex-direction: column; gap: 6px; }
.recording-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; border: 1px solid var(--line); padding: 6px 10px; font-size: 0.88rem; }
.rec-name { font-family: var(--font-head); font-size: 0.75rem; letter-spacing: 0.05em; }
#key-icon { color: var(--amber); }

/* ------------------------------------------------ MAP: voices, galaxy */
.map-choir { margin: -4px 0 8px; font-family: var(--font-head); font-size: 0.75rem; letter-spacing: 0.06em; color: var(--kies); }
.map .choir-glow { fill: var(--kies); opacity: 0.13; }
.anim .map .choir-glow { animation: choir-breathe 4s ease-in-out infinite; }
@keyframes choir-breathe { 0%, 100% { opacity: 0.1; } 50% { opacity: 0.2; } }
.map .map-voices { font-family: var(--font-body); font-size: 9px; fill: var(--kies); opacity: 0.85; }
.map .gal-halo { fill: rgba(236, 231, 218, 0.025); stroke: var(--line); stroke-dasharray: 2 5; }
.map .gal-dot { fill: var(--dim); opacity: 0.45; }
.map .gal-core { fill: var(--amber); opacity: 0.6; filter: drop-shadow(0 0 14px var(--amber)); }
.map .reach-ring { fill: rgba(255, 59, 47, 0.15); stroke: var(--kies); stroke-width: 1.5; }
.map .case-home circle { fill: var(--pale); }
.no-anim .map .choir-glow { animation: none !important; }

/* ---------------------------------------------------- BLACK BOX PLAYER */
.bb { position: fixed; inset: 0; z-index: 42; background: rgba(0, 0, 0, 0.94); display: flex; align-items: center; justify-content: center; padding: 30px; }
.bb-inner { width: min(780px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 10px; }
.bb-title { margin: 0; font-family: var(--font-head); font-weight: 400; letter-spacing: 0.08em; font-size: 1rem; color: var(--kies); }
.bb-tracks { display: flex; gap: 6px; flex-wrap: wrap; }
.bb-tracks .btn[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.bb-wave { width: 100%; height: 70px; border: 1px solid var(--line); }
.bb-time { font-family: var(--font-head); font-size: 0.8rem; color: var(--dim); }
.bb-lines { list-style: none; margin: 0; padding: 10px; border: 1px solid var(--line); background: var(--bg); min-height: 240px; max-height: 42vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.bb-line { display: grid; grid-template-columns: 58px 130px 1fr; gap: 10px; font-size: 0.92rem; animation: card-line 0.5s ease-out; }
.bb-ts { color: var(--faint); font-family: var(--font-head); font-size: 0.72rem; padding-top: 2px; }
.bb-who { color: var(--kies); font-family: var(--font-head); font-size: 0.75rem; padding-top: 2px; }
.bb-line.fx .bb-text { color: var(--dim); font-style: italic; }

/* --------------------------------------------------------------- SETTINGS */
.setting { margin-bottom: 14px; }
.setting-label { display: block; margin-bottom: 6px; }
.setting-help { font-size: 0.82rem; color: var(--faint); margin: 4px 0 0; }
.toggle {
  font-family: var(--font-body);
  font-weight: 700;
  padding: 6px 12px 6px 44px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  cursor: pointer;
  position: relative;
}
.toggle::before {
  content: 'OFF';
  position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-head); font-size: 0.6rem;
  width: 30px; text-align: center;
  border: 1px solid var(--line-2); color: var(--faint); padding: 1px 0;
}
.toggle[aria-pressed="true"]::before { content: 'ON'; background: var(--text); color: var(--bg); border-color: var(--text); }
input[type="range"] { width: 240px; max-width: 100%; accent-color: var(--kies); }
.btn {
  font-family: var(--font-head);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  padding: 7px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--text);
  cursor: pointer;
}
.btn:hover { border-color: var(--text); }
.btn-danger { border-color: var(--kies); color: var(--kies); }
.btn-danger:hover { background: var(--kies); color: var(--bg); }
.btn-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.code {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.75rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line-2);
  padding: 8px;
  resize: vertical;
  word-break: break-all;
}
.confirm { border: 1px solid var(--kies); padding: 10px 12px; margin: 8px 0; background: rgba(255, 59, 47, 0.06); }
.confirm p { margin: 0 0 6px; }
.msg { font-size: 0.85rem; min-height: 1.2em; }
.msg.err { color: var(--kies); }
.keys { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; font-size: 0.88rem; }
.keys dt { font-family: var(--font-head); font-size: 0.78rem; color: var(--text); }
.keys dd { margin: 0; color: var(--dim); }
.about p { font-size: 0.85rem; }
.cl-v { font-family: var(--font-head); font-weight: 400; font-size: 0.8rem; letter-spacing: 0.06em; margin: 10px 0 4px; color: var(--text); }
.cl-list { margin: 0; padding-left: 18px; font-size: 0.85rem; color: var(--dim); }
.cl-list li { margin-bottom: 3px; }
.cl-older summary { cursor: pointer; font-family: var(--font-head); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--faint); margin-top: 10px; }

/* --------------------------------------------------------------------- LOG */
.col-right { display: flex; flex-direction: column; }
.log {
  flex: 1;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.log-entry { margin: 0; }
.log-time { color: var(--faint); font-size: 0.75rem; display: block; font-family: var(--font-head); }
.log-line { display: block; color: var(--text); }
.log-line.sys { letter-spacing: 0.03em; font-weight: 700; }
.log-line.prompt { color: var(--kies); }
.log-head { display: block; font-family: var(--font-head); font-size: 0.82rem; letter-spacing: 0.04em; }
.log-head.lh-proj { color: var(--kies); }
.log-head.lh-ach { color: var(--amber); }
.log-head.lh-res { color: var(--amber); }
.log-head.lh-tx { color: var(--pale); }
.log-head.lh-conq { color: var(--text); }
.log-line.cvr { color: var(--kies); letter-spacing: 0.03em; font-weight: 700; }
.log-sub { display: block; color: var(--dim); font-size: 0.82rem; }
.log-entry.old .log-line { color: var(--dim); }
.caret {
  display: inline-block; width: 0.6em; height: 1em; vertical-align: text-bottom;
  background: var(--text); margin-left: 2px;
  animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* ------------------------------------------------------------------ TICKER */
.ticker {
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--line);
  background: var(--bg-1);
  height: 34px;
  font-size: 0.9rem;
}
.ticker-label {
  font-family: var(--font-head);
  font-size: 0.75rem;
  background: var(--kies);
  color: var(--bg);
  padding: 0 12px;
  display: flex; align-items: center;
  letter-spacing: 0.1em;
}
.ticker-track { position: relative; overflow: hidden; flex: 1; }
.ticker-text {
  position: absolute; top: 50%;
  white-space: nowrap;
  transform: translate(100vw, -50%);
  padding-left: 16px;
}
.ticker-text.scroll { animation: ticker-scroll linear forwards; }
@keyframes ticker-scroll {
  from { transform: translate(var(--from, 100%), -50%); }
  to { transform: translate(var(--to, -100%), -50%); }
}
.ticker-text.static { transform: translate(0, -50%); animation: ticker-fade 0.4s ease-out; }
@keyframes ticker-fade { from { opacity: 0; } }
.ticker-text.glitch { color: var(--kies); letter-spacing: 0.1em; }

/* -------------------------------------------------------------- PALE SOUL */
.pale-layer { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
.pale-soul {
  position: absolute;
  width: 64px; height: 80px;
  margin: -40px 0 0 -32px;
  padding: 0; border: 0; background: none;
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(0 0 14px var(--pale));
  animation: pale-float 3.2s ease-in-out infinite, pale-in 0.8s ease-out;
  touch-action: manipulation;
}
.pale-soul svg { width: 100%; height: 100%; display: block; }
.pale-soul:focus-visible { outline: 2px dashed var(--pale); outline-offset: 6px; }
@keyframes pale-float { 50% { transform: translate(6px, -14px) rotate(4deg); } }
@keyframes pale-in { from { opacity: 0; transform: scale(0.4); } }
.pale-label {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  font-family: var(--font-head); font-size: 0.65rem; color: var(--pale);
  white-space: nowrap; margin-top: 4px;
}

/* ------------------------------------------------------------------ TOASTS */
.toasts {
  position: fixed; bottom: 46px; left: 50%; transform: translateX(-50%);
  z-index: 30; display: flex; flex-direction: column; gap: 6px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--bg);
  border: 1px solid var(--amber);
  padding: 6px 12px;
  font-size: 0.82rem;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.7);
  animation: toast-in 0.3s ease-out;
  max-width: 460px;
  text-align: center;
}
.toast strong { font-family: var(--font-head); font-weight: 400; color: var(--amber); display: block; font-size: 0.75rem; letter-spacing: 0.1em; }
.toast.pale { border-color: var(--pale); }
.toast.pale strong { color: var(--pale); }
.toast.out { animation: toast-out 0.4s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* -------------------------------------------------------- CAPTION CARDS */
.card {
  position: fixed; inset: 0; z-index: 40;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.card-inner { max-width: 760px; max-height: 100%; overflow-y: auto; text-align: center; }
.card-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: 0.06em;
  margin: 0 0 24px;
  text-shadow: 2px 0 0 rgba(255, 59, 47, 0.7), -2px 0 0 rgba(120, 220, 255, 0.3);
}
.card-lines p { margin: 0 0 14px; font-size: 1.15rem; }
.card-lines p.sys { font-weight: 700; letter-spacing: 0.04em; }
.card-lines p.big { font-family: var(--font-head); font-size: 1.4rem; color: var(--kies); }
.card-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.anim .card-share { opacity: 0; animation: card-line 0.6s ease-out forwards; }
.report-support { font-size: 0.82rem; margin: 4px 0 0; }
.about a, .report-support a { color: var(--text); }
.card-skip {
  display: block; margin: 14px auto 0; background: none; border: 0; cursor: pointer;
  color: var(--faint); font-family: var(--font-head); font-size: 0.7rem; letter-spacing: 0.12em; text-decoration: underline;
}
.card-skip:hover, .card-skip:focus-visible { color: var(--text); }
/* The cold open: cockpit-recorder rows, left-aligned like a transcript */
.card-tape .card-title { color: var(--kies); font-size: clamp(1.4rem, 3.4vw, 2.2rem); }
.card-tape .card-lines p.cvr-row {
  display: grid; grid-template-columns: 3.4em 6.2em 1fr; gap: 10px;
  text-align: left; font-size: 1.02rem; margin: 0 0 10px;
}
.cvr-ts { color: var(--faint); font-family: var(--font-head); font-size: 0.78rem; padding-top: 3px; }
.cvr-who { color: var(--kies); font-family: var(--font-head); font-size: 0.8rem; padding-top: 3px; letter-spacing: 0.04em; }
.cvr-text { font-weight: 700; letter-spacing: 0.02em; }
.card-tape .card-lines p:not(.cvr-row):not(.big) { color: var(--dim); }
.card-tape .card-lines p.big { margin: 18px 0; }
@media (max-width: 560px) {
  .card { padding: 24px 18px; }
  .card-tape .card-lines p.cvr-row { grid-template-columns: 3em 1fr; gap: 2px 8px; font-size: 0.95rem; }
  .card-tape .cvr-text { grid-column: 2; }
}
.anim .card-lines p { opacity: 0; animation: card-line 1s ease-out forwards; }
.anim .card-continue { opacity: 0; animation: card-line 0.6s ease-out forwards; }
@keyframes card-line { from { opacity: 0; filter: blur(3px); } to { opacity: 1; filter: none; } }

/* --------------------------------------------------------- FLASH & SHAKE */
#flash { position: fixed; inset: 0; background: var(--text); opacity: 0; pointer-events: none; z-index: 35; }
#flash.on { animation: flash 0.7s ease-out; }
#flash.on.strong { animation: flash-strong 1.2s ease-out; }
@keyframes flash { 0% { opacity: 0.3; } 100% { opacity: 0; } }
@keyframes flash-strong { 0% { opacity: 0.55; } 100% { opacity: 0; } }
.shake { animation: shake 0.28s linear; }
@keyframes shake {
  20% { transform: translate(-3px, 1px); } 40% { transform: translate(3px, -1px); }
  60% { transform: translate(-2px, 0); } 80% { transform: translate(2px, 1px); }
}

#fx-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 25; }

/* -------------------------------------------------------------- CRT LAYER */
.crt { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.crt::before { /* scanlines */
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 2px, rgba(0, 0, 0, 0.22) 3px, transparent 4px);
}
.crt::after { /* vignette */
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}
.crt-grain {
  position: absolute; inset: -50%;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.6s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 25% { transform: translate(-7%, 4%); }
  50% { transform: translate(5%, -6%); } 75% { transform: translate(-3%, 8%); }
}
.no-crt .crt { display: none; }

/* ------------------------------------------------------------------ DEBUG */
.debug {
  position: fixed; left: 8px; bottom: 44px; z-index: 60;
  background: #111; border: 1px solid var(--amber); color: var(--text);
  padding: 8px; font-size: 0.75rem; width: 280px;
}
.debug h3 { margin: 0 0 6px; font-family: var(--font-head); font-size: 0.75rem; color: var(--amber); font-weight: 400; }
.debug button { font-size: 0.7rem; padding: 3px 6px; margin: 2px; background: #222; border: 1px solid #555; cursor: pointer; }
.debug button[aria-pressed="true"] { background: var(--amber); color: #000; }
.debug pre { margin: 6px 0 0; white-space: pre-wrap; color: var(--dim); max-height: 140px; overflow: auto; }

/* ============================================================================
 *  REDUCED MOTION / ANIMATIONS OFF
 *  The `no-anim` class is set by js/ui.js when Animations is off — which is
 *  the default when the system asks for reduced motion.
 * ========================================================================== */
.no-anim *, .no-anim *::before, .no-anim *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}
.no-anim .rec-dot, .no-anim .crt-grain, .no-anim .eye-ring, .no-anim .eye-svg, .no-anim .caret { animation: none !important; }
.no-anim .pale-soul { animation: none !important; }
.no-anim .map .planet.nest { animation: none !important; }

/* Phones: the fight picture sits above the numbers. */
@media (max-width: 640px) {
  .boss { grid-template-columns: 1fr; }
  .boss-art { max-width: 190px; }
  .recording-row { grid-template-columns: 1fr auto; }
  .recording-row .dim { grid-column: 1 / -1; grid-row: 2; }
}

/* ------------------------------------------------------- HANDS (auto-harvest) */
.sps-split { font-size: 0.72rem; margin-top: 2px; }
.hands-ring { position: absolute; inset: 0; pointer-events: none; }
.anim .hands-ring { animation: hands-orbit 120s linear infinite; }
@keyframes hands-orbit { to { transform: rotate(360deg); } }
.hand { position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px; color: var(--pale); transform: rotate(var(--rot)); }
.hand-i { display: block; width: 100%; height: 100%; opacity: 0.8; }
.hand-i svg { width: 100%; height: 100%; display: block; }
.hand.poke .hand-i { animation: hand-poke 0.17s ease-out; opacity: 1; }
@keyframes hand-poke { 50% { transform: translateY(-9px); } }
.hands-block { margin: 8px 0 4px; }
.hands-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 0.85rem; }
.hand-buy { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; margin-top: 4px; }
.hand-buy-label { font-family: var(--font-head); font-size: 0.72rem; letter-spacing: 0.05em; }
.hand-buy-side { display: flex; flex-direction: column; align-items: flex-end; font-size: 0.8rem; }
.hand-buy:disabled { opacity: 0.6; cursor: default; }
.title { cursor: default; }
.title.tapped { animation: title-tap 0.25s steps(2); }
@keyframes title-tap { 50% { transform: translateX(2px); color: var(--kies); } }

/* ------------------------------------------------- LATTICE: maximised, secret */
.lattice-btns { margin: 0; }
body.lattice-maxed #panel-lattice { position: fixed; inset: 0; z-index: 38; background: var(--bg); padding: 14px var(--gutter); display: flex; flex-direction: column; }
body.lattice-maxed #lattice-view { height: auto; flex: 1; }
body.lattice-maxed #lattice-intro { display: none; }
.lattice-view .node.secret-node:not(.owned) { border-style: dashed; opacity: 0.55; }
.lattice-view .node.secret-node.owned { border-color: var(--pale); color: var(--pale); }
.lattice-view .node { translate: 0 -50%; }

/* ---------------------------------------------- EVIDENCE, PHOTOS, REPORT (v0.6) */
.evidence { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ev-item { display: flex; flex-direction: column; gap: 4px; padding: 4px; text-align: left; }
.ev-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #000; }
.ev-item .ev-title { font-family: var(--font-head); font-size: 0.62rem; letter-spacing: 0.05em; }
.ev-item.locked { cursor: default; border-style: dashed; }
.ev-redacted { width: 100%; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; background: repeating-linear-gradient(45deg, #0c0c10 0 8px, #121218 8px 16px); color: var(--faint); font-family: var(--font-head); font-size: 0.62rem; }
.photo-view .bb-inner { width: min(720px, 100%); }
.photo-big { width: 100%; max-height: 62vh; object-fit: contain; background: #000; border: 1px solid var(--line); display: block; }
.photo-caption { margin: 0; font-size: 0.95rem; }
.photo-credit { margin: 0; font-size: 0.72rem; }
.card-photo { margin: 0 auto 18px; max-width: min(520px, 90vw); opacity: 0; animation: card-line 1.2s ease-out 0.2s forwards; }
.card-photo img { width: 100%; max-height: 38vh; object-fit: contain; display: block; border: 1px solid var(--line-2); background: #000; }
.card-photo figcaption { font-family: var(--font-head); font-size: 0.62rem; letter-spacing: 0.06em; color: var(--dim); margin-top: 6px; text-align: left; }
.no-anim .card-photo { opacity: 1; animation: none; }
.report-view .bb-inner { width: min(620px, 100%); overflow-y: auto; }
.report-ending { margin: 0; font-family: var(--font-head); font-size: 0.8rem; letter-spacing: 0.05em; color: var(--pale); }
.report-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.report-table th, .report-table td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.report-table th { font-family: var(--font-head); font-weight: 400; font-size: 0.66rem; letter-spacing: 0.06em; color: var(--dim); }
.report-table tr.total td { font-weight: 700; border-top: 1px solid var(--line-2); }
.report-table .best { color: var(--amber); }
.crew-row.missing .crew-status { color: var(--amber); }
.log-head.lh-card { color: var(--pale); }
.log-head.lh-away { color: var(--faint); }

/* ============================================================================
 *  PHONES (and short landscape screens)
 *  One screen at a time: EYE, HIVE or LOG, picked from the bar at the
 *  bottom (js/ui.js sets html[data-screen]). The souls stay in the top bar.
 *  Keep this query in step with `phoneQuery` in js/ui.js.
 * ========================================================================== */
@media (max-width: 700px), (max-width: 1000px) and (max-height: 599px) {
  :root { --gutter: 12px; }
  .app { grid-template-rows: auto minmax(0, 1fr) auto auto; }

  /* Top bar: two short rows. Title on the EYE screen, souls everywhere else. */
  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand brand gear" "file osd osd";
    gap: 2px 10px;
    padding: 6px var(--gutter);
    padding-top: max(6px, env(safe-area-inset-top));
    align-items: center;
  }
  .brand, .m-status { grid-area: brand; min-width: 0; }
  .title { font-size: 1.05rem; }
  .subtitle { display: none; }
  .file-label { grid-area: file; margin: 0; font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; }
  .osd { grid-area: osd; justify-content: flex-end; font-size: 0.66rem; gap: 6px; min-width: 0; overflow: hidden; }
  .osd .rec { font-size: 0; gap: 0; flex: none; }   /* just the red dot */
  .osd.live .rec { font-size: inherit; gap: 4px; }
  .osd.live #osd-date { display: none; }
  .osd-counter { display: none; }
  #osd-date { overflow: hidden; text-overflow: ellipsis; min-width: 0; color: var(--dim); }
  .m-status { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.95rem; }
  .m-souls { font-weight: 700; }
  html[data-screen="eye"] .m-status { display: none; }
  html:not([data-screen="eye"]) .brand { display: none; }
  .gear { grid-area: gear; }

  /* One column at a time, each scrolling on its own. */
  .columns { grid-template-columns: minmax(0, 1fr); position: relative; }
  .col { display: none; border: 0; padding: var(--gutter); }
  html[data-screen="eye"] .col-left { display: flex; }
  html[data-screen="hive"] .col-mid { display: block; padding-top: 0; }
  html[data-screen="log"] .col-right { display: flex; }
  .col-mid, .col-right { padding-bottom: 88px !important; }   /* room for the floating eye */

  /* EYE screen */
  .col-left { gap: 12px; }
  .eye { width: min(250px, 64vw, 48dvh); }

  /* The tab row scrolls sideways instead of wrapping. */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)) 12px; padding: 10px var(--gutter) 8px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; font-size: 0.78rem; padding: 8px 11px; }

  /* Brood rows: name and description get the full width; price goes underneath. */
  .gen {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    grid-template-areas: "icon main owned" "icon price need";
    gap: 4px 10px;
    align-items: start;
    padding: 9px 10px;
  }
  .gen-key { display: none; }
  .gen-icon { grid-area: icon; width: 38px; height: 38px; padding: 7px; }
  .gen-main { grid-area: main; }
  .gen-side { display: contents; }
  .gen-owned { grid-area: owned; font-size: 1.35rem; text-align: right; }
  .gen-price { grid-area: price; justify-content: flex-start; flex-wrap: wrap; gap: 6px; }
  .gen .need { grid-area: need; align-self: center; text-align: right; }
  .gen-desc { display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .gen.older .gen-desc { display: none !important; }
  .gen.older .gen-icon { width: 30px; height: 30px; padding: 5px; }
  .gen-name { font-size: 0.95rem; }

  .upgrades, .achievements, .memories, .forms { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .tx-choices, .ending-choices { grid-template-columns: 1fr; }
  .crew-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0; }
  .crew-role { grid-column: 1 / -1; grid-row: 2; font-size: 0.8rem; }
  .job { grid-template-columns: 70px 34px minmax(0, 1fr) auto; gap: 8px; }
  .job-desc { display: none; }
  .bb { padding: 14px; }
  .bb-line { grid-template-columns: 44px minmax(0, 1fr); gap: 2px 8px; }
  .bb-who, .bb-text { grid-column: 2; }
  .lattice-view { height: 58vh; }

  /* LOG screen */
  .col-right .log { font-size: 0.88rem; }

  /* Ticker: one thin line above the screen bar. */
  .ticker { height: 28px; font-size: 0.8rem; }
  .ticker-label { padding: 0 8px; font-size: 0.62rem; }

  /* The screen bar */
  .m-nav {
    display: grid; grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--line); background: var(--bg);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .m-nav button {
    height: 50px; background: none; border: 0; cursor: pointer; position: relative;
    font-family: var(--font-head); font-size: 0.78rem; letter-spacing: 0.12em; color: var(--faint);
    -webkit-tap-highlight-color: transparent;
  }
  .m-nav button[aria-pressed="true"] { color: var(--text); box-shadow: inset 0 2px 0 var(--kies); background: var(--bg-1); }
  .m-dot { position: absolute; top: 12px; margin-left: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--kies); box-shadow: 0 0 6px var(--kies); }

  /* The floating eye (HIVE and LOG screens) */
  .m-eye {
    position: absolute; right: 14px; bottom: 14px; z-index: 5;
    width: 62px; height: 62px; padding: 6px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 59, 47, 0.25), var(--bg) 70%);
    border: 1px solid var(--line-2); cursor: pointer;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.8);
  }
  .m-eye svg { width: 100%; height: 100%; display: block; }
  html:not([data-screen="eye"]) .m-eye { display: block; }
  .m-eye.pulse svg { animation: eye-pulse 0.16s ease-out; }

  /* Toasts: one short line under the top bar, only the newest. */
  .toasts { top: calc(62px + env(safe-area-inset-top)); bottom: auto; left: var(--gutter); right: var(--gutter); transform: none; }
  .toast {
    max-width: none; width: 100%; font-size: 0.74rem; padding: 4px 10px; text-align: left;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .toast strong { display: inline; margin-right: 8px; font-size: 0.66rem; }
  .toast:not(:last-child) { display: none; }
  @keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
  @keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

  .card { padding: 24px 18px; }
  .card-lines p { font-size: 1.02rem; }
  .debug { bottom: 90px; }
}

/* ============================================================================
 *  THE SCREEN GOES WRONG (v0.9) — classes set by js/ui.js (updateInfection)
 * ========================================================================== */
/* A label says something it shouldn't, for a moment. */
.glitching { position: relative; }
.glitching::after {
  content: attr(data-glitch);
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: inherit;
  background: var(--bg); color: var(--kies);
  font-family: var(--font-head); letter-spacing: 0.08em;
  overflow: hidden; white-space: nowrap;
  text-shadow: 2px 0 0 rgba(120, 220, 255, 0.45);
}
.tab.glitching::after, .label.glitching::after { justify-content: center; }

/* 07:20: main power failure. The lights flicker out, then come back red. */
.blackout .app { animation: blackout 2.1s steps(1) forwards; }
@keyframes blackout {
  0% { filter: brightness(1); } 6% { filter: brightness(0.06); } 12% { filter: brightness(0.75); }
  17% { filter: brightness(0.03); } 72% { filter: brightness(0.03); } 78% { filter: brightness(0.45) saturate(0.5); }
  84% { filter: brightness(0.1); } 100% { filter: brightness(0.9) saturate(0.75); }
}
.emergency .app { filter: brightness(0.9) saturate(0.75); }
.emergency .crt::after {
  background: radial-gradient(ellipse at center, rgba(255, 40, 30, 0.03) 35%, rgba(110, 0, 0, 0.55) 100%);
  animation: emergency 3.2s ease-in-out infinite;
}
@keyframes emergency { 50% { opacity: 0.55; } }

/* The crew's vitals (FILE 03): a heartbeat, until there isn't one. */
.crew-name::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 8px; vertical-align: 1px; background: var(--dim);
}
.crew-row.alive .crew-name::before { background: #7be08a; box-shadow: 0 0 5px #7be08a; animation: heartbeat 1.1s ease-in-out infinite; }
.crew-row.taken .crew-name::before { width: 12px; height: 2px; border-radius: 0; vertical-align: 3px; background: var(--kies); box-shadow: 0 0 4px var(--kies); }
.crew-row.missing .crew-name::before { background: var(--amber); animation: rec-blink 2.4s steps(1) infinite; }
.crew-row.escaped .crew-name::before { background: var(--pale); }
.crew-row.taken { opacity: 0.7; }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.5); } 24% { transform: scale(1); } 36% { transform: scale(1.3); } }

/* FILE 04: the hive is live. */
.osd.live .rec { color: var(--bg); background: var(--kies); padding: 1px 6px 1px 4px; gap: 5px; }
.osd.live .rec-dot { background: var(--bg); box-shadow: none; }
.osd-viewers { color: var(--kies); }


/* ============================================================================
 *  THE LAST WORDS (v1.0) — after the 'take' ending
 * ========================================================================== */
.finale-block .block-title { color: var(--pale); }
.finale-text { font-size: 1.05rem; margin: 0 0 10px; }
.finale-nick { color: var(--dim); font-style: italic; margin: 0 0 10px; }
.finale-left { font-family: var(--font-head); font-size: 0.75rem; letter-spacing: 0.08em; color: var(--faint); margin: 0 0 10px; }
.finale-btn { font-size: 0.95rem; padding: 12px 18px; border-color: var(--pale); color: var(--pale); }
.finale-btn:disabled { opacity: 0.35; cursor: default; }
/* Once it starts, the rest of the Hive goes away. */
.finale #panel-hive > .block:not(.finale-block), .finale #panel-hive > .next-hint,
.finale .col-left .meters, .finale .col-left .hands-block, .finale .col-left .buffs, .finale .ticker,
.finale .per-click, .finale #echo-row, .finale #world-row, .finale .sps-split { display: none !important; }
.eye.shut { cursor: default; }
.finale .m-eye { display: none !important; }
.log-head.lh-finale { color: var(--pale); }

/* Touch screens: no keyboard hints. */
@media (hover: none) and (pointer: coarse) {
  .kbd-hint, .gen-key, .pale-label, .btn kbd, .sleep-skip kbd { display: none !important; }
}

/* The settings gear (top bar, every screen size) */
.gear {
  width: 30px; height: 30px; padding: 5px; flex: none;
  background: none; border: 1px solid transparent; color: var(--faint); cursor: pointer;
}
.gear svg { width: 100%; height: 100%; display: block; }
.gear:hover, .gear:focus-visible { color: var(--text); border-color: var(--line-2); }
