/* ════════════════════════════════════════════════════════════════════════════
   VOIDRUNNER — interface
   Cold instrument panel over a black shaft. Everything is monospace, thin,
   and slightly luminous, as though it were being projected onto the inside
   of a visor by something that is running out of power.
   ════════════════════════════════════════════════════════════════════════════ */

:root {
  --ink:      #dceaf5;
  --dim:      #7d94a8;
  --faint:    #4a5c6e;
  --cyan:     #59e0ff;
  --amber:    #ffb455;
  --red:      #ff3b5c;
  --green:    #7dffb0;
  --panel:    rgba(6, 12, 20, 0.90);
  --edge:     rgba(89, 224, 255, 0.28);
  --mono:     ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
              "Liberation Mono", "Roboto Mono", monospace;
  --pad-t:    env(safe-area-inset-top, 0px);
  --pad-b:    env(safe-area-inset-bottom, 0px);
  --pad-l:    env(safe-area-inset-left, 0px);
  --pad-r:    env(safe-area-inset-right, 0px);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: #05080e;
  color: var(--ink);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
}
body { position: fixed; inset: 0; user-select: none; -webkit-user-select: none; }

#cv {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
}

/* A faint scanline + grain wash over everything. Purely atmospheric. */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 60; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom,
      rgba(255,255,255,0.028) 0px, rgba(255,255,255,0.028) 1px,
      rgba(0,0,0,0) 1px, rgba(0,0,0,0) 3px);
  mix-blend-mode: overlay;
  opacity: 0.55;
}

/* ── HUD ────────────────────────────────────────────────────────────────── */
.hud {
  position: absolute; inset: 0; z-index: 10;
  pointer-events: none;
  padding: calc(var(--pad-t) + 10px) calc(var(--pad-r) + 12px)
           calc(var(--pad-b) + 10px) calc(var(--pad-l) + 12px);
  display: flex; flex-direction: column;
  opacity: 0; transition: opacity .45s ease;
}
body.playing .hud { opacity: 1; }

.hud-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.hud-left { min-width: 0; }
.depth {
  font-size: clamp(20px, 5.6vw, 30px); font-weight: 600; letter-spacing: .04em;
  color: #fff; text-shadow: 0 0 18px rgba(89,224,255,.55);
  line-height: 1;
}
.depth span { font-variant-numeric: tabular-nums; }
.deckname {
  margin-top: 4px; font-size: 10px; letter-spacing: .22em;
  color: var(--cyan); opacity: .85; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hud-right { display: flex; align-items: center; gap: 10px; }
.salv {
  font-size: 13px; color: var(--amber); letter-spacing: .08em;
  font-variant-numeric: tabular-nums; text-shadow: 0 0 12px rgba(255,180,85,.5);
}
#btn-pause {
  pointer-events: auto;
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--edge); background: rgba(6,14,24,.7);
  color: var(--cyan); font-family: var(--mono); font-size: 11px;
  cursor: pointer; line-height: 1;
}
#btn-pause:active { background: rgba(89,224,255,.18); }

.hud-bars { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.bar.hull { display: flex; gap: 4px; }
.bar.hull i {
  width: 16px; height: 7px; border-radius: 2px;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.16);
  transition: background .18s, box-shadow .18s;
}
.bar.hull i.on {
  background: var(--green); border-color: var(--green);
  box-shadow: 0 0 10px rgba(125,255,176,.7);
}
.cellbar {
  flex: 1; max-width: 190px; height: 7px; border-radius: 4px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(89,224,255,.22); overflow: hidden;
}
.cellbar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #2b8fd0, var(--cyan));
  box-shadow: 0 0 12px rgba(89,224,255,.7);
  transition: width .08s linear;
}

.deckprog {
  margin-top: 8px; height: 2px; background: rgba(255,255,255,.07); border-radius: 2px;
}
.deckprog i {
  display: block; height: 100%; background: var(--cyan); opacity: .55;
  box-shadow: 0 0 8px rgba(89,224,255,.6);
}

/* the Unmaking gauge sits low, where the threat is */
.gaugewrap { margin-top: auto; margin-bottom: 8px; }
.gaugelab {
  font-size: 9px; letter-spacing: .3em; color: var(--faint); margin-bottom: 4px;
}
.gauge {
  height: 4px; background: rgba(255,255,255,.07); border-radius: 3px; overflow: hidden;
}
.gauge i {
  display: block; height: 100%; background: var(--cyan);
  transition: width .1s linear, background .3s;
  box-shadow: 0 0 10px currentColor;
}
#h-warn.on .gaugelab { color: var(--red); animation: blip .55s steps(2) infinite; }
@keyframes blip { 50% { opacity: .25; } }

/* ── comms line ─────────────────────────────────────────────────────────── */
.comms {
  --wc: var(--cyan);
  min-height: 2.6em;
  font-size: clamp(11px, 3.1vw, 13px); line-height: 1.45;
  color: var(--ink); letter-spacing: .01em;
  border-left: 2px solid var(--wc);
  padding: 4px 8px 4px 10px;
  background: linear-gradient(90deg, rgba(6,14,24,.82), rgba(6,14,24,0));
  opacity: 0; transform: translateY(6px);
  transition: opacity .3s ease, transform .3s ease;
  max-width: 44em;
}
.comms.show { opacity: 1; transform: none; }
.comms.amb { color: var(--dim); font-style: italic; border-left-color: var(--faint); }
.comms.frag {
  color: #fff; border-left-color: #fff;
  background: linear-gradient(90deg, rgba(255,255,255,.14), rgba(6,14,24,0));
  text-shadow: 0 0 14px rgba(255,255,255,.45);
}
.comms.deck { color: var(--cyan); letter-spacing: .14em; font-weight: 600; }

/* ── overlay screens ────────────────────────────────────────────────────── */
.screens {
  position: absolute; inset: 0; z-index: 40;
  display: none;
  background: radial-gradient(ellipse at 50% 30%, rgba(10,22,36,.72), rgba(2,4,8,.94) 70%);
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
  overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--pad-t) + 18px) calc(var(--pad-r) + 14px)
           calc(var(--pad-b) + 24px) calc(var(--pad-l) + 14px);
}
.screens.show { display: flex; }
/* margin:auto rather than align-items:center — centring a flex item that is
   taller than its scroll container clips the top, and these panels get tall. */
.screens.show > .panel { margin: auto; }
.screens.scroll > .panel { margin: 0 auto; }

.panel {
  width: min(560px, 100%);
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 22px 20px 20px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 24px 70px rgba(0,0,0,.7),
              inset 0 1px 0 rgba(255,255,255,.05);
  animation: rise .35s cubic-bezier(.2,.9,.3,1);
}
.panel.wide { width: min(760px, 100%); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.panel h2 {
  font-size: clamp(17px, 4.6vw, 22px); letter-spacing: .2em; font-weight: 600;
  margin-bottom: 10px;
}
.panel h2 em { font-style: normal; color: var(--dim); letter-spacing: .1em; font-size: .72em; }
.panel h2.fail { color: var(--red); text-shadow: 0 0 24px rgba(255,59,92,.55); }
.panel h2.ok   { color: var(--green); text-shadow: 0 0 24px rgba(125,255,176,.5); }

.sec-label {
  font-size: 9px; letter-spacing: .34em; color: var(--faint);
  margin: 18px 0 8px; text-transform: uppercase;
}
.lede { font-size: 12px; color: var(--dim); line-height: 1.6; margin-bottom: 6px; }

/* title */
.title .logo { text-align: center; margin: 4px 0 20px; }
.logo .l1, .logo .l2 {
  font-size: clamp(30px, 11vw, 54px); font-weight: 700; letter-spacing: .1em; line-height: 1;
}
.logo .l1 { color: #fff; text-shadow: 0 0 30px rgba(89,224,255,.5); }
.logo .l2 { color: var(--cyan); text-shadow: 0 0 34px rgba(89,224,255,.75); }
.logo .tag {
  margin-top: 10px; font-size: 10px; letter-spacing: .22em; color: var(--dim);
}

.howto { display: grid; gap: 8px; margin: 4px 0 4px; }
.howto > div { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--dim); }
.howto kbd {
  flex: 0 0 auto; min-width: 62px; text-align: center;
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
  padding: 6px 8px; border-radius: 6px;
  border: 1px solid var(--edge); background: rgba(89,224,255,.08); color: var(--cyan);
}
.howto .warn2 kbd { border-color: rgba(255,59,92,.4); background: rgba(255,59,92,.1); color: var(--red); }

.sec-label s { text-decoration: none; float: right; letter-spacing: .18em; opacity: .8; }

.carousel { display: flex; align-items: stretch; gap: 6px; }
.arrow {
  flex: 0 0 34px; border-radius: 9px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.03);
  color: var(--cyan); font-family: var(--mono); font-size: 20px; line-height: 1;
  transition: .16s;
}
.arrow:hover { background: rgba(89,224,255,.1); border-color: var(--edge); }
.arrow:active { transform: scale(.94); }

.runner {
  flex: 1; min-width: 0;
  text-align: left; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--cyan); background: rgba(89,224,255,.09);
  box-shadow: 0 0 0 1px rgba(89,224,255,.2), 0 0 26px rgba(89,224,255,.14);
  color: var(--ink); font-family: var(--mono);
  min-height: 128px; touch-action: pan-y;
}
.runner b { display: block; font-size: 13px; letter-spacing: .1em; color: var(--cyan); }
.runner em { display: block; font-style: normal; font-size: 9.5px; color: var(--faint); margin: 3px 0 8px; letter-spacing: .08em; }
.runner span { display: block; font-size: 10.5px; color: var(--dim); line-height: 1.5; }
.runner .trait {
  margin-top: 8px; color: var(--green); font-size: 10px;
  border-top: 1px solid rgba(255,255,255,.09); padding-top: 8px;
}
.runner .trait.lock { color: var(--amber); }
.runner.locked { border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.03); box-shadow: none; }
.runner.locked b { color: var(--faint); }

.dots { display: flex; gap: 5px; justify-content: center; margin-top: 9px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.18); }
.dots i.on { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.dots i.lk { border: 1px solid rgba(255,180,85,.4); background: transparent; }
.dots i.on.lk { background: var(--amber); box-shadow: 0 0 8px var(--amber); }

.big:disabled { filter: grayscale(1) brightness(.55); cursor: not-allowed; box-shadow: none; }

.big, .small {
  display: block; width: 100%; margin-top: 14px; cursor: pointer;
  font-family: var(--mono); letter-spacing: .2em; border-radius: 10px;
  transition: .16s;
}
.big {
  padding: 14px; font-size: 13px; font-weight: 600;
  color: #04121a; background: linear-gradient(180deg, #8ceaff, var(--cyan));
  border: none; box-shadow: 0 0 26px rgba(89,224,255,.36);
}
.big:hover { filter: brightness(1.12); }
.big:active { transform: translateY(1px); }
.small {
  padding: 10px; font-size: 10.5px;
  color: var(--dim); background: transparent; border: 1px solid rgba(255,255,255,.12);
}
.small:hover { color: var(--ink); border-color: var(--edge); }
.row { display: flex; gap: 8px; }
.row .small { flex: 1; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 16px; }
.stats > div, .tally > div { text-align: center; padding: 8px 4px; border-radius: 8px; background: rgba(255,255,255,.04); }
.stats b, .tally b { display: block; font-size: 15px; color: var(--cyan); font-variant-numeric: tabular-nums; }
.stats em, .tally em { display: block; font-style: normal; font-size: 8.5px; letter-spacing: .14em; color: var(--faint); margin-top: 3px; }

/* junction */
.jhead s { display: block; text-decoration: none; font-size: 9px; letter-spacing: .3em; color: var(--faint); margin-bottom: 6px; }
.beat { font-size: 13px; line-height: 1.66; color: var(--ink); margin: 10px 0; }
.personal {
  font-size: 12px; line-height: 1.6; color: var(--dim); font-style: italic;
  border-left: 2px solid rgba(255,255,255,.14); padding-left: 12px; margin: 12px 0;
}
.warden { font-size: 12px; line-height: 1.6; color: var(--wc, var(--cyan)); margin: 12px 0; }

.boons { display: grid; gap: 8px; }
.boon {
  text-align: left; padding: 12px 13px; border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.035);
  color: var(--ink); font-family: var(--mono); transition: .16s;
  position: relative; overflow: hidden;
}
.boon s { display: block; text-decoration: none; font-size: 8.5px; letter-spacing: .28em; color: var(--faint); }
.boon b { display: block; font-size: 13px; letter-spacing: .11em; margin: 4px 0 4px; color: var(--cyan); }
.boon span { display: block; font-size: 11px; color: var(--dim); line-height: 1.45; }
.boon:hover { border-color: var(--edge); background: rgba(89,224,255,.08); transform: translateX(2px); }
.boon.t3 b { color: #c98bff; }
.boon.risk { border-color: rgba(255,59,92,.35); }
.boon.risk b, .boon.risk s { color: var(--red); }
.boon.risk:hover { background: rgba(255,59,92,.09); border-color: var(--red); }

.nextdeck { margin-top: 16px; font-size: 10px; letter-spacing: .16em; color: var(--faint); }
.nextdeck b { color: var(--ink); }
.nextdeck em { font-style: normal; color: var(--faint); }

/* death / win */
.bigdepth {
  font-size: clamp(44px, 15vw, 72px); font-weight: 700; line-height: 1;
  color: #fff; text-shadow: 0 0 34px rgba(89,224,255,.4); margin: 6px 0 4px;
  font-variant-numeric: tabular-nums;
}
.bigdepth em { font-size: .3em; font-style: normal; color: var(--dim); letter-spacing: .1em; margin-left: 6px; }
.tally { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 16px 0; }
.frags { list-style: none; display: grid; gap: 6px; }
.frags li {
  font-size: 11px; line-height: 1.5; color: var(--dim);
  padding-left: 14px; position: relative;
}
.frags li::before { content: "▚"; position: absolute; left: 0; color: #fff; opacity: .6; }
.seedline { margin-top: 14px; font-size: 9px; letter-spacing: .16em; color: var(--faint); }

/* archive */
.truth { border-top: 1px solid rgba(255,255,255,.09); padding: 16px 0; }
.truth h3 { font-size: 12.5px; letter-spacing: .16em; color: var(--cyan); display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.truth h3 s { text-decoration: none; font-size: 9px; color: var(--faint); letter-spacing: .12em; white-space: nowrap; }
.truth p { font-size: 11.5px; color: var(--dim); margin: 7px 0 10px; line-height: 1.5; }
.truth ul { list-style: none; display: grid; gap: 5px; }
.truth li {
  font-size: 10.5px; line-height: 1.5; color: var(--faint);
  padding-left: 13px; position: relative; word-break: break-word;
}
.truth li::before { content: "·"; position: absolute; left: 2px; }
.truth li.got { color: var(--ink); }
.truth li.got::before { content: "▚"; color: #fff; opacity: .6; }
.truth.dark h3 { color: var(--faint); }
.truth blockquote {
  margin-top: 12px; padding: 10px 12px; border-radius: 8px;
  background: rgba(125,255,176,.07); border-left: 2px solid var(--green);
  font-size: 11.5px; line-height: 1.6; color: var(--ink);
}

/* landscape phones: keep the panels reachable */
@media (max-height: 520px) {
  .panel { padding: 16px 16px 14px; }
  .logo .l1, .logo .l2 { font-size: clamp(24px, 7vw, 34px); }
  .title .logo { margin-bottom: 12px; }
  .howto { display: none; }
  .stats { margin-top: 10px; }
  .gaugewrap { margin-bottom: 4px; }
  .comms { min-height: 1.6em; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; transition-duration: .05s !important; }
  body::after { display: none; }
}
