/* ============================================================
   PACT // SUBSPACE LINK  — visual system
   ============================================================ */

:root {
  /* base — deep space slate */
  --slate-0:  #0c1014;
  --slate-1:  #161c24;
  --slate-2:  #1e2630;
  --slate-3:  #29333f;
  --line:     rgba(194,163,107,0.14);

  /* aged brass */
  --brass:        #c2a36b;
  --brass-bright: #d4b87f;
  --brass-deep:   #8c7344;

  /* stone text */
  --stone:    #d8dee6;
  --stone-dim:#8e99a6;
  --stone-faint: #5b6672;

  /* breach palette — warm amber + soft teal */
  --amber:    #f0c06a;
  --amber-hot:#ffd485;
  --teal:     #6fd0c0;
  --teal-deep:#3f9b8f;
  --warm-bg-0:#2a2017;
  --warm-bg-1:#3a2c1c;

  /* glitch channels */
  --rgb-r: #ff2e63;
  --rgb-c: #14e0ff;

  /* gauges + panel (overridden per reveal tone) */
  --gauge-arc: #f0c06a;
  --gauge-track: rgba(212,184,127,0.16);
  --panel-bg: linear-gradient(180deg, rgba(58,44,28,0.42), rgba(28,20,12,0.5));

  /* alert red (lost connection) */
  --red: #e0564f;
  --red-bright: #ff6a5e;
  --red-deep: #7a1f1a;

  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;

  --ease: cubic-bezier(0.4, 0.0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #000;
  color: var(--stone);
  font-family: var(--mono);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { position: fixed; inset: 0; }

/* ============================================================
   STAGE  — layered compositing
   ============================================================ */
#stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 50%, var(--slate-1) 0%, var(--slate-0) 70%, #05080b 100%);
  transition: background 1.4s var(--ease);
}

/* breach tint applied to stage */
#stage.breach {
  background:
    radial-gradient(120% 90% at 50% 45%, #241a10 0%, #140d08 70%, #060402 100%);
}
#stage.warm {
  background:
    radial-gradient(130% 100% at 50% 38%, #322415 0%, #1d1409 65%, #0a0703 100%);
}

/* canvas tunnel/starfield */
#fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* content layer */
#scene {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vmin, 56px);
}

/* ---- overlays: scanlines / crt / vignette / grain ---- */
.overlay { position: absolute; inset: 0; pointer-events: none; }

#scanlines {
  z-index: 6;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.18) 3px,
    rgba(0,0,0,0.18) 4px);
  mix-blend-mode: multiply;
  opacity: 0.55;
}
#vignette {
  z-index: 7;
  background: radial-gradient(120% 100% at 50% 50%,
    rgba(0,0,0,0) 55%, rgba(0,0,0,0.55) 100%);
}
#flicker {
  z-index: 8;
  background: rgba(255, 240, 210, 0.018);
  animation: flicker 5.5s steps(60) infinite;
}
@keyframes flicker {
  0%,100% { opacity: 0.5; }
  3% { opacity: 0.18; }
  6% { opacity: 0.7; }
  9% { opacity: 0.32; }
  50% { opacity: 0.55; }
  52% { opacity: 0.85; }
  54% { opacity: 0.4; }
}

/* heavy glitch container state — toggled by JS */
#stage.glitching #fx { animation: stageshake 0.18s steps(2) infinite; }
@keyframes stageshake {
  0% { transform: translate(0,0); }
  25% { transform: translate(-2px, 1px); }
  50% { transform: translate(2px, -1px); }
  75% { transform: translate(-1px, -2px); }
  100% { transform: translate(1px, 2px); }
}

/* tearing bar that sweeps during anomaly */
#tear {
  position: absolute;
  left: 0; right: 0;
  height: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.0),
    rgba(255,255,255,0.06) 40%,
    rgba(20,224,255,0.10) 50%,
    rgba(255,46,99,0.10) 60%,
    rgba(255,255,255,0.0));
  mix-blend-mode: screen;
}

/* ============================================================
   GATE
   ============================================================ */
#gate {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: clamp(14px, 2.6vmin, 26px);
  background: radial-gradient(120% 90% at 50% 50%, #11161d 0%, #07090d 75%);
  text-align: center;
  padding: 24px;
}
#gate .mark {
  font-family: var(--mono);
  letter-spacing: 0.42em;
  font-size: clamp(11px, 1.4vmin, 14px);
  color: var(--brass);
  text-indent: 0.42em;
}
#gate .tap {
  font-family: var(--mono);
  font-size: clamp(20px, 4.4vmin, 40px);
  letter-spacing: 0.22em;
  color: var(--stone);
  text-indent: 0.22em;
  position: relative;
  animation: breathe 2.6s var(--ease) infinite;
}
#gate .tap::after {
  content: '';
  display: inline-block;
  width: 0.55em; height: 1.05em;
  margin-left: 0.18em;
  background: var(--brass-bright);
  vertical-align: -0.16em;
  animation: blink 1.05s steps(1) infinite;
  box-shadow: 0 0 14px rgba(212,184,127,0.55);
}
#gate .sub {
  font-size: clamp(10px, 1.3vmin, 13px);
  letter-spacing: 0.3em;
  color: var(--stone-faint);
  text-indent: 0.3em;
}
@keyframes breathe { 0%,100%{opacity:.62} 50%{opacity:1} }
@keyframes blink { 0%,49%{opacity:1} 50%,100%{opacity:0} }

#gate .ring {
  width: clamp(120px, 22vmin, 200px);
  height: clamp(120px, 22vmin, 200px);
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  position: relative;
}
#gate .ring::before, #gate .ring::after {
  content:''; position:absolute; inset:-1px; border-radius:50%;
  border: 1px solid transparent;
}
#gate .ring::before {
  border-top-color: var(--brass);
  border-right-color: rgba(194,163,107,0.4);
  animation: spin 7s linear infinite;
}
#gate .ring::after {
  inset: 14%;
  border-bottom-color: rgba(111,208,192,0.5);
  animation: spin 4.5s linear infinite reverse;
}
#gate .ring .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brass-bright);
  box-shadow: 0 0 18px 3px rgba(212,184,127,0.6);
  animation: breathe 2.6s var(--ease) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   TERMINAL TEXT (acts 0/1/2/4)
   ============================================================ */
#terminal {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: min(880px, 94vw);
  max-height: 84vh;
  overflow: hidden;
  font-size: clamp(12px, 1.85vmin, 18px);
  line-height: 1.85;
  letter-spacing: 0.02em;
  color: var(--stone);
  text-shadow: 0 0 18px rgba(120,150,180,0.08);
}
#terminal.masked {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 9%, #000 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 9%, #000 100%);
}
.t-line { white-space: pre-wrap; display: block; }
.t-line .lbl { color: var(--brass); }
.t-line .val { color: var(--stone); }
.t-line .dim { color: var(--stone-dim); }
.t-line .faint { color: var(--stone-faint); }
.t-line .warn { color: var(--amber-hot); }
.t-line .ok { color: var(--teal); }
.t-line .hex { color: var(--brass-deep); letter-spacing: 0.04em; }
.t-line.indent { padding-left: 2.2em; }

/* live caret appended to active typing line */
.caret {
  display: inline-block;
  width: 0.56em; height: 1.05em;
  background: var(--brass-bright);
  vertical-align: -0.16em;
  margin-left: 0.05em;
  animation: blink 1.05s steps(1) infinite;
  box-shadow: 0 0 10px rgba(212,184,127,0.5);
}

/* glitch text — RGB split + clip jitter */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0;
  width: 100%; height: 100%;
  overflow: hidden;
}
.glitch::before { color: var(--rgb-r); z-index: -1; animation: gl-r 2.1s steps(8) infinite; }
.glitch::after  { color: var(--rgb-c); z-index: -2; animation: gl-c 1.7s steps(7) infinite; }
@keyframes gl-r {
  0%,100% { transform: translate(0,0); clip-path: inset(0 0 0 0); }
  20% { transform: translate(-2px,-1px); clip-path: inset(20% 0 50% 0); }
  40% { transform: translate(2px,1px);   clip-path: inset(60% 0 10% 0); }
  60% { transform: translate(-1px,1px);  clip-path: inset(10% 0 75% 0); }
  80% { transform: translate(2px,-1px);  clip-path: inset(45% 0 35% 0); }
}
@keyframes gl-c {
  0%,100% { transform: translate(0,0); clip-path: inset(0 0 0 0); }
  25% { transform: translate(2px,1px);   clip-path: inset(70% 0 8% 0); }
  50% { transform: translate(-2px,-1px); clip-path: inset(15% 0 60% 0); }
  75% { transform: translate(1px,2px);   clip-path: inset(50% 0 30% 0); }
}
.glitch.hard::before { animation-duration: 0.4s; }
.glitch.hard::after  { animation-duration: 0.33s; }

/* signal bars */
.signal { display: inline-flex; align-items: flex-end; gap: 3px; height: 1.3em; vertical-align: -0.25em; }
.signal i {
  width: 4px; background: var(--brass-deep); border-radius: 1px;
  transition: height .3s var(--ease), background .3s var(--ease);
}
.signal i.on { background: var(--brass-bright); box-shadow: 0 0 8px rgba(212,184,127,0.5); }

/* waveform svg stroke */
.wave path { fill: none; stroke: var(--brass); stroke-width: 1.4; filter: drop-shadow(0 0 6px rgba(194,163,107,0.5)); }

/* progress block bars ▓░ rendered via spans */
.prog { color: var(--brass-deep); letter-spacing: 1px; }
.prog b { color: var(--amber-hot); font-weight: 400; }

/* tagline flicker */
.tagline {
  margin-top: 1.4em;
  color: var(--brass-bright);
  letter-spacing: 0.22em;
  font-size: 0.92em;
  animation: tagflick 3.4s steps(40) infinite;
}
@keyframes tagflick {
  0%,100%{opacity:.9} 8%{opacity:.3} 9%{opacity:.95} 40%{opacity:.85} 41%{opacity:.45} 42%{opacity:1} }

/* ============================================================
   ACT 3 — REVEAL DASHBOARD (warm)
   ============================================================ */
#reveal {
  width: min(1120px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  color: var(--stone);
  font-family: var(--sans);
  -ms-overflow-style: none;
  scrollbar-width: thin;
  scrollbar-color: var(--brass-deep) transparent;
  padding: 2px;
}
#reveal::-webkit-scrollbar { width: 7px; }
#reveal::-webkit-scrollbar-thumb { background: var(--brass-deep); border-radius: 4px; }

.rv-head {
  font-family: var(--mono);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6em 1.1em;
  padding-bottom: 0.7em;
  margin-bottom: 1.3em;
  border-bottom: 1px solid var(--line);
}
.rv-head .title {
  font-size: clamp(15px, 2.5vmin, 26px);
  letter-spacing: 0.16em;
  color: var(--amber-hot);
  text-shadow: 0 0 22px rgba(240,192,106,0.35);
}
.rv-head .meta { font-size: clamp(9px, 1.2vmin, 12px); letter-spacing: 0.22em; color: var(--teal); }
.rv-head .live {
  margin-left: auto; font-size: clamp(9px,1.2vmin,12px); letter-spacing: 0.2em;
  color: var(--amber); display: inline-flex; align-items: center; gap: 0.5em;
}
.rv-head .live .pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--teal);
  box-shadow: 0 0 10px var(--teal); animation: pulse 1.3s var(--ease) infinite;
}
@keyframes pulse { 0%,100%{opacity:1; transform:scale(1)} 50%{opacity:.35; transform:scale(.7)} }

.rv-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(12px, 1.6vmin, 22px);
}
@media (max-width: 760px) { .rv-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel-bg);
  border: 1px solid rgba(212,184,127,0.18);
  border-radius: 4px;
  padding: clamp(12px, 1.8vmin, 20px);
  position: relative;
  backdrop-filter: blur(1px);
}
.panel::before {
  content: ''; position: absolute; left: 0; top: 0; width: 22px; height: 22px;
  border-top: 1px solid var(--brass); border-left: 1px solid var(--brass);
  border-top-left-radius: 4px; opacity: 0.7;
}
.panel::after {
  content: ''; position: absolute; right: 0; bottom: 0; width: 22px; height: 22px;
  border-bottom: 1px solid var(--brass); border-right: 1px solid var(--brass);
  border-bottom-right-radius: 4px; opacity: 0.7;
}
.panel.span2 { grid-column: 1 / -1; }

.panel h3 {
  font-family: var(--mono); font-weight: 500;
  font-size: clamp(10px, 1.25vmin, 13px);
  letter-spacing: 0.3em; color: var(--brass-bright);
  margin-bottom: 1em; text-indent: 0.3em;
  display: flex; align-items: center; gap: 0.7em;
}
.panel h3 .ix { color: var(--teal-deep); font-size: 0.85em; letter-spacing: 0.1em; }

/* subject rows */
.subj { display: flex; align-items: center; gap: 0.9em; padding: 0.55em 0; }
.subj + .subj { border-top: 1px dashed rgba(212,184,127,0.12); }
.subj .av { flex: 0 0 auto; }
.subj .info { min-width: 0; flex: 1; }
.subj .nm { font-family: var(--mono); letter-spacing: 0.06em; color: var(--stone); font-size: clamp(12px,1.6vmin,16px); }
.subj .dz { font-size: clamp(10px,1.25vmin,12.5px); color: var(--stone-dim); letter-spacing: 0.02em; line-height: 1.5; }
.subj .dz b { color: var(--amber); font-weight: 600; }
.subj .tag {
  font-family: var(--mono); font-size: clamp(8.5px,1vmin,10.5px); letter-spacing: 0.14em;
  color: var(--teal); border: 1px solid rgba(111,208,192,0.3); border-radius: 2px;
  padding: 0.2em 0.55em; white-space: nowrap;
}

/* anniversary counter */
.anniv { text-align: center; padding: 0.4em 0 0.2em; }
.anniv .units { display: flex; justify-content: center; gap: clamp(6px,1.4vmin,16px); }
.anniv .u { display: flex; flex-direction: column; align-items: center; gap: 0.35em; }
.anniv .u .n {
  font-family: var(--mono); font-size: clamp(20px, 3.6vmin, 38px);
  color: var(--amber-hot); line-height: 1; letter-spacing: 0.02em;
  text-shadow: 0 0 20px rgba(255,212,133,0.3);
  font-variant-numeric: tabular-nums;
}
.anniv .u .k { font-family: var(--mono); font-size: clamp(8px,1vmin,10px); letter-spacing: 0.2em; color: var(--stone-faint); }
.anniv .stat { font-family: var(--mono); margin-top: 0.7em; font-size: clamp(10px,1.3vmin,13px); letter-spacing: 0.16em; color: var(--teal); }

/* telemetry gauges */
.gauges { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(10px,1.5vmin,18px); }
@media (max-width: 460px) { .gauges { grid-template-columns: 1fr; } }
.gauge { display: flex; align-items: center; gap: 0.85em; }
.gauge .ring { flex: 0 0 auto; position: relative; width: clamp(54px, 8vmin, 74px); height: clamp(54px,8vmin,74px); }
.gauge .ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.gauge .ring .arc { filter: drop-shadow(0 0 5px var(--gauge-arc)); transition: stroke-dashoffset 0.1s linear; }
.gauge .ring .ctr {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--mono); font-size: clamp(11px,1.5vmin,15px); color: var(--amber-hot);
  font-variant-numeric: tabular-nums;
}
.gauge .lab { flex: 1; min-width: 0; font-size: clamp(10px,1.3vmin,12.5px); color: var(--stone-dim); letter-spacing: 0.04em; line-height: 1.5; }
.gauge .lab b { display: block; font-family: var(--mono); color: var(--stone); letter-spacing: 0.08em; font-weight: 500; font-size: 1.05em; margin-bottom: 0.25em; }

/* simple counters (no ring) */
.counters { display: grid; gap: 0.85em; }
.counter { display: flex; align-items: baseline; justify-content: space-between; gap: 1em; }
.counter .k { font-size: clamp(10px,1.3vmin,12.5px); color: var(--stone-dim); letter-spacing: 0.02em; line-height: 1.4; }
.counter .k small { display: block; color: var(--stone-faint); letter-spacing: 0.06em; margin-top: 0.2em; font-size: 0.82em; }
.counter .v { font-family: var(--mono); font-size: clamp(15px,2.2vmin,22px); color: var(--amber-hot); font-variant-numeric: tabular-nums; }
.counter .v small { font-size: 0.55em; color: var(--stone-faint); letter-spacing: 0.1em; margin-left: 0.4em; }

/* recovered fragments */
.frags { display: grid; gap: 0.2em; font-family: var(--mono); }
.frag {
  display: flex; gap: 0.8em; padding: 0.55em 0;
  font-size: clamp(10.5px,1.35vmin,13px); color: var(--stone-dim);
  letter-spacing: 0.01em; line-height: 1.55;
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.frag.in { opacity: 1; transform: translateY(0); }
.frag .ts { color: var(--teal-deep); flex: 0 0 auto; }
.frag .bd b { color: var(--amber); font-weight: 500; }
.frag .bd .audio { color: var(--teal); }

/* photo frame reconstruction */
.frame {
  position: relative; border: 1px solid rgba(212,184,127,0.3);
  border-radius: 4px; overflow: hidden; aspect-ratio: 16/10;
  background: #120c06; display: grid; place-items: center;
}
.frame .recon {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--mono); font-size: clamp(10px,1.4vmin,13px);
  letter-spacing: 0.22em; color: var(--brass-bright); z-index: 4;
  background: rgba(8,5,2,0.55); transition: opacity 1s var(--ease);
}
.frame.done .recon { opacity: 0; pointer-events: none; }
.frame .portrait { width: 100%; height: 100%; opacity: 0; transition: opacity 1.4s var(--ease) 0.2s, filter 1.4s var(--ease) 0.2s; filter: blur(8px) saturate(0.6); }
.frame.done .portrait { opacity: 1; filter: blur(0) saturate(1); }
.frame .scan-rec {
  position: absolute; left:0; right:0; height: 40%; z-index: 5;
  background: linear-gradient(180deg, rgba(255,212,133,0) 0%, rgba(255,212,133,0.12) 50%, rgba(255,212,133,0) 100%);
  animation: scanrec 2.2s linear infinite; pointer-events: none;
}
.frame.done .scan-rec { opacity: 0; }
@keyframes scanrec { 0%{ top:-40%; } 100%{ top:100%; } }
.frame .cap {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  font-family: var(--mono); font-size: clamp(8.5px,1.05vmin,11px); letter-spacing: 0.16em;
  color: var(--brass); padding: 0.6em 0.9em; text-align: center;
  background: linear-gradient(0deg, rgba(8,5,2,0.7), transparent);
  opacity: 0; transition: opacity 1s var(--ease) 0.8s;
}
.frame.done .cap { opacity: 1; }

/* reveal entrance for panels */
.rv-anim {
  opacity: 0; transform: translateY(14px) scale(0.985);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.rv-anim.in { opacity: 1; transform: none; }

/* ============================================================
   CONTROLS  (sound toggle, replay)
   ============================================================ */
#controls {
  position: absolute; z-index: 30;
  right: clamp(12px, 2.4vmin, 26px);
  top: clamp(12px, 2.4vmin, 26px);
  display: flex; gap: 10px;
}
.ctl {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  color: var(--brass); background: rgba(12,16,20,0.55);
  border: 1px solid var(--line); border-radius: 3px;
  padding: 0.55em 0.85em; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.55em;
  transition: border-color .25s, color .25s, background .25s;
  backdrop-filter: blur(3px); -webkit-tap-highlight-color: transparent;
}
.ctl:hover { border-color: var(--brass); color: var(--brass-bright); }
.ctl .led { width: 7px; height: 7px; border-radius: 50%; background: var(--stone-faint); transition: all .25s; }
.ctl.on .led { background: var(--teal); box-shadow: 0 0 9px var(--teal); }

#outro-cta {
  position: absolute; z-index: 30;
  left: 50%; bottom: clamp(18px, 4vmin, 40px); transform: translateX(-50%) translateY(10px);
  display: flex; flex-direction: column; align-items: center; gap: 0.85em;
  opacity: 0; pointer-events: none;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  width: min(380px, 86vw);
}
#outro-cta.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
#replay {
  font-family: var(--mono); font-size: clamp(11px,1.4vmin,14px); letter-spacing: 0.22em;
  color: var(--slate-0); background: var(--brass);
  border: none; border-radius: 3px; padding: 0.85em 1.6em; cursor: pointer;
  text-indent: 0.22em; box-shadow: 0 0 30px rgba(194,163,107,0.35);
  transition: background .25s, transform .25s; -webkit-tap-highlight-color: transparent;
}
#replay:hover { background: var(--brass-bright); transform: translateY(-2px); }
#hold { width: 100%; display: flex; flex-direction: column; gap: 0.5em; align-items: center; }
#hold .holdbar { width: 100%; height: 3px; background: rgba(194,163,107,0.14); border-radius: 2px; overflow: hidden; }
#hold .holdbar i { display: block; height: 100%; width: 100%; background: var(--brass); transition: width 0.12s linear, background 0.3s; }
#hold .holdbar i.crit { background: var(--red-bright); box-shadow: 0 0 10px var(--red-bright); }
#hold .holdtxt { font-family: var(--mono); font-size: 10px; letter-spacing: 0.22em; color: var(--stone-faint); }
#hold .holdtxt b { color: var(--brass-bright); }

/* utility */
.hidden { display: none !important; }
.center { text-align: center; }

/* ============================================================
   POTENTIAL GATE  (slider)
   ============================================================ */
.gate-q {
  font-family: var(--mono);
  font-size: clamp(20px, 4.6vmin, 44px);
  letter-spacing: 0.14em; color: var(--stone);
  text-indent: 0.14em; text-shadow: 0 0 24px rgba(120,150,180,0.12);
}
.gate-hint { font-family: var(--mono); font-size: clamp(10px,1.4vmin,13px); letter-spacing: 0.18em; color: var(--stone-faint); }
.gate-hint b { color: var(--brass-bright); }
.pot-wrap { display: flex; flex-direction: column; align-items: center; gap: clamp(8px,1.6vmin,16px); width: min(440px, 84vw); margin-top: 0.4em; }
.pot-readout { font-family: var(--mono); font-size: clamp(34px, 8vmin, 72px); color: var(--brass-bright); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; transition: color 0.3s, text-shadow 0.3s; }
.pot-readout .pct { font-size: 0.4em; color: var(--stone-faint); margin-left: 0.15em; }
.pot-readout.hot { color: var(--teal); text-shadow: 0 0 30px rgba(111,208,192,0.5); }

/* range input — shared base */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 4px;
  background: rgba(194,163,107,0.12); outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brass-bright); border: 2px solid #0c1014;
  box-shadow: 0 0 14px rgba(212,184,127,0.6); cursor: grab;
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brass-bright); border: 2px solid #0c1014;
  box-shadow: 0 0 14px rgba(212,184,127,0.6); cursor: grab;
}
.gate.ready #potSlider::-webkit-slider-thumb { background: var(--teal); box-shadow: 0 0 18px rgba(111,208,192,0.7); }
.gate.ready #potSlider::-moz-range-thumb { background: var(--teal); box-shadow: 0 0 18px rgba(111,208,192,0.7); }

.gate-btn {
  font-family: var(--mono); font-size: clamp(11px,1.5vmin,14px); letter-spacing: 0.22em;
  color: var(--slate-0); background: var(--brass); border: none; border-radius: 3px;
  padding: 0.85em 1.8em; cursor: pointer; text-indent: 0.22em; margin-top: 0.3em;
  transition: background .25s, transform .2s, box-shadow .25s; -webkit-tap-highlight-color: transparent;
}
.gate-btn:hover { background: var(--brass-bright); transform: translateY(-2px); }
.gate.ready .gate-btn { background: var(--teal); box-shadow: 0 0 30px rgba(111,208,192,0.4); }
.gate-msg { font-family: var(--mono); font-size: clamp(11px,1.6vmin,15px); letter-spacing: 0.14em; color: var(--amber-hot); min-height: 1.4em; }
.gate-msg.shake { animation: msgShake 0.4s var(--ease); }
@keyframes msgShake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }

/* ============================================================
   AUTH  — Claude Mythos boot + Face ID device binding
   ============================================================ */
#auth {
  position: absolute; inset: 0; z-index: 22;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(16px, 3vmin, 30px);
  background: radial-gradient(120% 90% at 50% 45%, #10151c 0%, #07090d 78%);
  padding: 24px; text-align: center;
  opacity: 0; transition: opacity 0.6s var(--ease);
}
#auth.show { opacity: 1; }
.auth-head { font-family: var(--mono); font-size: clamp(10px,1.4vmin,13px); letter-spacing: 0.34em; color: var(--brass); text-indent: 0.34em; }

.face-reticle { position: relative; width: clamp(150px, 30vmin, 210px); height: clamp(150px, 30vmin, 210px); display: grid; place-items: center; }
.face-reticle .face { width: 64%; height: 64%; overflow: visible; }
.face .outline { stroke: var(--brass); stroke-width: 1.6; filter: drop-shadow(0 0 6px rgba(194,163,107,0.4)); transition: stroke 0.5s, filter 0.5s; }
.face .mesh { stroke: var(--brass-deep); stroke-width: 0.6; opacity: 0.35; }
.face .eye { fill: var(--brass-bright); transition: fill 0.5s; }
.face .mouth { stroke: var(--brass); stroke-width: 1.3; fill: none; stroke-linecap: round; transition: stroke 0.5s; }
.face .dots circle { fill: var(--brass); opacity: 0.26; transition: fill 0.5s, opacity 0.5s; }
.face .check { stroke: var(--teal); stroke-width: 3.2; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 90; stroke-dashoffset: 90; opacity: 0; }
.face-reticle.scanning .dots circle { animation: dotPulse 1.4s ease-in-out infinite; }
@keyframes dotPulse { 0%,100%{opacity:0.18} 50%{opacity:0.55} }
.face-reticle.matched .outline { stroke: var(--teal); filter: drop-shadow(0 0 9px rgba(111,208,192,0.55)); }
.face-reticle.matched .dots circle { fill: var(--teal); opacity: 0.7; }
.face-reticle.matched .eye, .face-reticle.matched .mouth { stroke: var(--teal); fill: var(--teal); }
.face-reticle.matched .check { opacity: 1; animation: checkDraw 0.55s var(--ease) forwards; }
@keyframes checkDraw { to { stroke-dashoffset: 0; } }

.face-reticle .beam {
  position: absolute; left: 5%; right: 5%; height: 2px; top: 8%; opacity: 0;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
  box-shadow: 0 0 14px var(--teal); border-radius: 2px;
}
.face-reticle.scanning .beam { opacity: 1; animation: beamSweep 1.4s ease-in-out infinite; }
@keyframes beamSweep { 0%{top:8%} 50%{top:88%} 100%{top:8%} }

.cnr { position: absolute; width: 18px; height: 18px; border: 2px solid var(--brass); transition: border-color 0.5s; }
.cnr.tl { top: 0; left: 0; border-right: none; border-bottom: none; }
.cnr.tr { top: 0; right: 0; border-left: none; border-bottom: none; }
.cnr.bl { bottom: 0; left: 0; border-right: none; border-top: none; }
.cnr.br { bottom: 0; right: 0; border-left: none; border-top: none; }
.face-reticle.matched .cnr { border-color: var(--teal); }

.auth-status {
  font-family: var(--mono); font-size: clamp(10px,1.5vmin,13.5px); line-height: 1.85;
  width: min(460px, 90vw); min-height: 10em; text-align: left; color: var(--stone-dim);
}
.as-line { white-space: pre-wrap; }
.as-line.ok { color: var(--stone-faint); }
.as-line.dev { color: var(--brass-bright); letter-spacing: 0.03em; }
.as-line.scan { color: var(--amber-hot); }
.as-line.match { color: var(--teal); }
.as-line.id { color: var(--brass-bright); font-size: 1.18em; letter-spacing: 0.1em; }
.as-line.bound { color: var(--brass); letter-spacing: 0.16em; }
.as-line.whisper { color: var(--stone-faint); }

/* ============================================================
   EMPTY / GHOST registry rows + bond states
   ============================================================ */
.subj.ghost { opacity: 0.5; }
.subj.ghost .nm { color: var(--stone-faint); }
.emptyrow {
  font-family: var(--mono); font-size: clamp(10.5px,1.35vmin,13px);
  color: var(--stone-faint); letter-spacing: 0.04em; padding: 1.2em 0.4em; text-align: center;
  border-top: 1px dashed rgba(212,184,127,0.12); line-height: 1.6;
}
.anniv.frozen { opacity: 0.62; }
.anniv.frozen .units .n { color: var(--stone-dim); text-shadow: none; }
.anniv.frozen .stat { color: var(--amber); }
.anniv.none { padding: 0.8em 0 0.4em; }
.anniv.none .big { font-family: var(--mono); font-size: clamp(34px,6vmin,56px); color: var(--stone-faint); line-height: 0.7; }
.anniv.none .stat { font-family: var(--mono); margin-top: 0.6em; font-size: clamp(10px,1.3vmin,13px); letter-spacing: 0.16em; color: var(--stone-dim); }

/* ============================================================
   REVEAL TONES  (per branch)
   ============================================================ */
#reveal.tone-warm  { --gauge-arc: #f0c06a; --gauge-track: rgba(212,184,127,0.16); }
#reveal.tone-cold {
  --gauge-arc: #8fb4d6; --gauge-track: rgba(143,176,214,0.14);
  --amber-hot: #cfe0f0; --amber: #a9c4dd; --brass-bright: #b6c8da; --brass: #7d93a8;
  --teal: #9aa6b3; --teal-deep: #6c7682;
  --panel-bg: linear-gradient(180deg, rgba(34,44,56,0.42), rgba(16,22,30,0.55));
}
#reveal.tone-grief {
  --gauge-arc: #b79a72; --gauge-track: rgba(160,140,110,0.14);
  --amber-hot: #d8c4a4; --amber: #b79a72; --brass-bright: #c9b48f; --brass: #7a6a50;
  --teal: #9a8f7e; --teal-deep: #6c625a;
  --panel-bg: linear-gradient(180deg, rgba(36,32,26,0.5), rgba(16,13,9,0.6));
}
#reveal.tone-grief .rv-head .title { text-shadow: none; }
#reveal.tone-sick {
  --gauge-arc: #ff6ad5; --gauge-track: rgba(255,106,213,0.14);
  --amber-hot: #ff8ade; --amber: #ff6ad5; --brass-bright: #ff8ade; --brass: #b53f8f;
  --teal: #5be0ff; --teal-deep: #2f8fb5;
  --panel-bg: linear-gradient(180deg, rgba(48,16,52,0.45), rgba(20,8,28,0.55));
}

/* stage backgrounds while revealing each tone */
#stage.inreveal[data-tone="warm"]  { background: radial-gradient(130% 100% at 50% 38%, #322415 0%, #1d1409 65%, #0a0703 100%); }
#stage.inreveal[data-tone="cold"]  { background: radial-gradient(130% 100% at 50% 40%, #1a2430 0%, #0d141d 65%, #05080c 100%); }
#stage.inreveal[data-tone="grief"] { background: radial-gradient(130% 100% at 50% 40%, #201c16 0%, #12100b 65%, #060503 100%); }
#stage.inreveal[data-tone="sick"]  { background: radial-gradient(130% 100% at 50% 40%, #2a0e2e 0%, #160818 65%, #08030a 100%); }

/* ============================================================
   LOST CONNECTION  (red lock)
   ============================================================ */
#stage.lost { background: radial-gradient(130% 100% at 50% 45%, #2a0d0b 0%, #160605 70%, #060201 100%); }
#stage.lost #scanlines { background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px, rgba(60,0,0,0.28) 3px, rgba(60,0,0,0.28) 4px); }
#lost {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 90% at 50% 50%, rgba(40,8,6,0.5) 0%, rgba(8,2,2,0.86) 80%);
  padding: 24px; opacity: 0; transition: opacity 0.4s var(--ease);
}
#lost.show { opacity: 1; }
.lost-inner { text-align: center; display: flex; flex-direction: column; align-items: center; gap: clamp(12px,2.4vmin,24px); max-width: 540px; }
.lost-title {
  font-family: var(--mono); font-size: clamp(26px, 6.4vmin, 60px); letter-spacing: 0.16em;
  color: var(--red-bright); text-indent: 0.16em;
  text-shadow: 0 0 30px rgba(255,90,90,0.5);
  animation: lostFlicker 3s steps(30) infinite;
}
.lost-title.glitch::before { color: #ff2e2e; }
.lost-title.glitch::after { color: #14e0ff; }
@keyframes lostFlicker { 0%,100%{opacity:1} 7%{opacity:.4} 8%{opacity:1} 53%{opacity:.7} 54%{opacity:1} }
.lost-sub { font-family: var(--mono); font-size: clamp(9px,1.3vmin,12px); letter-spacing: 0.2em; color: var(--red); }
.lost-rec {
  margin-top: clamp(10px,2.4vmin,28px); width: min(420px, 84vw);
  display: flex; flex-direction: column; align-items: center; gap: clamp(8px,1.6vmin,16px);
  border-top: 1px solid rgba(255,90,90,0.2); padding-top: clamp(14px,3vmin,30px);
}
.rec-label { font-family: var(--mono); font-size: clamp(11px,1.6vmin,15px); letter-spacing: 0.24em; color: var(--red-bright); text-indent: 0.24em; }
.rec-instr { font-family: var(--mono); font-size: clamp(10px,1.4vmin,13px); letter-spacing: 0.1em; color: var(--stone-dim); }
.rec-instr b { color: var(--red-bright); }
#recSlider { width: 100%; background: rgba(255,90,90,0.12); }
#recSlider::-webkit-slider-thumb { background: var(--red-bright); box-shadow: 0 0 14px rgba(255,90,90,0.7); }
#recSlider::-moz-range-thumb { background: var(--red-bright); box-shadow: 0 0 14px rgba(255,90,90,0.7); }
.rec-readout { font-family: var(--mono); font-size: clamp(28px,6vmin,52px); color: var(--red-bright); line-height: 1; font-variant-numeric: tabular-nums; transition: color 0.25s, text-shadow 0.25s; }
.rec-readout .pct { font-size: 0.4em; color: var(--red-deep); margin-left: 0.1em; }
.rec-readout.hit { color: var(--teal); text-shadow: 0 0 30px rgba(111,208,192,0.6); }

@media (prefers-reduced-motion: reduce) {
  #stage.glitching #fx { animation: none; }
  #flicker { animation: none; opacity: 0.4; }
  .glitch::before, .glitch::after { animation: none; }
  .lost-title { animation: none; }
}
