/* Aether Foundation — Planetary Survey Console
   Retrofuturistic 2000s CD-ROM skin: glossy white plastic, brushed gold,
   beveled chrome, LED clusters, an inset viewscreen with glass and scanlines.
   Type is the Bebe's PC pixel system: Press Start 2P labels, VT323 body. */

@font-face {
  font-family: "Press Start 2P";
  src: url("../assets/fonts/PressStart2P.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "VT323";
  src: url("../assets/fonts/VT323.ttf") format("truetype");
  font-display: swap;
}

:root {
  --space: #04060e;
  --space-2: #0a1020;
  --plastic: #f1eee4;
  --plastic-hi: #fdfcf8;
  --plastic-lo: #ddd8c6;
  --plastic-edge: #b7b09a;
  --ink: #2e2f36;
  --ink-dim: #6f7078;
  --gold: #c9a84c;
  --gold-pale: #ecdda6;
  --gold-deep: #8a6d2f;
  --gold-dark: #5f4b1e;
  --aqua: #7fd4e8;
  --aqua-deep: #2f97b4;
  --lcd-bg: #101613;
  --lcd-ink: #7dffc8;
  --hairline: rgba(138, 109, 47, 0.5);
  --ring: 4px;             /* viewscreen bezel, drawn outside the box */
  --panel-w: 392px;        /* dossier panel; the audio dock offset derives from it */
  --well: #e6e1cf;        /* recessed panel wells */
  --well-2: #eae5d4;      /* inset chips and fact boxes */
  --edge-strong: #837c64; /* floating panel borders */
  --surround: #cfc8b0;    /* viewscreen bezel ring */
  --emboss: rgba(255, 255, 255, .85);
  --chassis-shadow: rgba(0, 0, 0, .6);
  --page-bg: #14151c;
  --dish-hi: #fdfcf6;
  --dish-lo: #9a927a;
  --pin-ring: #fff;
  --warp-core: rgba(255, 255, 255, 1);
  --warp-edge: rgba(252, 248, 238, .97);
  --paper-hi: #fffef9;    /* survey blueprint stock */
  --paper-mid: var(--plastic);
  --paper-lo: #e5e0cf;
  --bp-ink: rgba(46, 47, 54, .8);
  --bp-emboss: rgba(255, 255, 255, .9);
  --px: "Press Start 2P", monospace;
  --vt: "VT323", monospace;
  --display: var(--px);
  --body: var(--vt);
  --mono: var(--vt);

  /* raised plastic */
  --bevel-out:
    inset 0 1px 0 rgba(255,255,255,.95),
    inset 0 -2px 3px rgba(80,70,40,.18),
    0 2px 5px rgba(10,10,20,.35);
  /* recessed well */
  --bevel-in:
    inset 0 2px 5px rgba(60,50,25,.3),
    inset 0 -1px 0 rgba(255,255,255,.85);
}

/* Night configuration: the same console cast in dark graphite. Gold trim and
   the LCD stay as they are — only the plastic changes, so the chassis reads
   as the same machine after hours. */
body[data-theme="dark"] {
  --plastic: #2b2d36;
  --plastic-hi: #3b3e4a;
  --plastic-lo: #202229;
  --plastic-edge: #14161c;
  --ink: #e6e3d8;
  --ink-dim: #8f9099;
  --gold-deep: #d9bb66;
  --gold-dark: #12140f;
  --aqua-deep: #6fd0e8;
  --hairline: rgba(201, 168, 76, 0.32);
  --well: #1c1e25;
  --well-2: #23252d;
  --edge-strong: #101218;
  --surround: #3a3d47;
  --emboss: rgba(255, 255, 255, .07);
  --chassis-shadow: rgba(0, 0, 0, .85);
  --page-bg: #0a0b10;
  --dish-hi: #565a67;
  --dish-lo: #0e1015;
  --pin-ring: #10121a;
  --warp-core: rgba(226, 236, 255, .96);
  --warp-edge: rgba(150, 180, 220, .9);
  /* blueprint becomes a backlit drafting screen rather than paper */
  --paper-hi: #23262f;
  --paper-mid: #191b22;
  --paper-lo: #101218;
  --bp-ink: rgba(226, 216, 178, .62);
  --bp-emboss: rgba(0, 0, 0, .5);

  --bevel-out:
    inset 0 1px 0 rgba(255,255,255,.10),
    inset 0 -2px 3px rgba(0,0,0,.5),
    0 2px 5px rgba(0,0,0,.5);
  --bevel-in:
    inset 0 2px 5px rgba(0,0,0,.65),
    inset 0 -1px 0 rgba(255,255,255,.07);
}

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

html, body { height: 100%; }

body {
  font-family: var(--body);
  background: var(--page-bg);
  color: var(--ink);
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; }

/* gold trim texture used on rails and title strips */
.gold-brush, .p-head::before {
  background:
    repeating-linear-gradient(90deg,
      rgba(255,255,255,.22) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #dcc06a 0%, var(--gold) 45%, #a9883a 100%);
}

/* ---------- console chassis ---------- */

#console {
  position: fixed; inset: 8px;
  display: flex; flex-direction: column;
  border-radius: 14px;
  background: linear-gradient(170deg, var(--plastic-hi) 0%, var(--plastic) 40%, var(--plastic-lo) 100%);
  border: 1px solid var(--plastic-edge);
  box-shadow:
    inset 0 2px 0 var(--emboss),
    inset 0 -3px 6px rgba(0,0,0,.22),
    0 10px 40px var(--chassis-shadow);
  padding: 10px 12px 8px;
}

/* ---------- boot loader ---------- */

#boot {
  position: fixed; inset: 0; z-index: 60;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.02) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 100% 100% at 50% 40%, #232636, #101119 75%);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .7s ease, visibility .7s;
}
#boot.done { opacity: 0; visibility: hidden; }
.boot-window {
  width: min(400px, calc(100vw - 40px));
  border-radius: 8px;
  background: linear-gradient(175deg, var(--plastic-hi), var(--plastic) 60%, var(--plastic-lo));
  border: 1px solid var(--edge-strong);
  box-shadow: var(--bevel-out), 0 16px 50px rgba(0,0,0,.7);
  overflow: hidden;
}
.boot-titlebar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 8px 4px 10px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.2) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #dcc06a, var(--gold) 50%, #a9883a);
  border-bottom: 1px solid var(--gold-dark);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}
.boot-titletext {
  font-family: var(--px); font-size: 8px;
  letter-spacing: 0; color: #fff;
  text-shadow: 0 1px 1px rgba(95, 75, 30, .8);
}
.boot-titlebtns { display: flex; gap: 4px; }
.boot-titlebtns i {
  width: 11px; height: 11px; border-radius: 3px;
  background: linear-gradient(180deg, var(--plastic-hi), var(--plastic-lo));
  border: 1px solid var(--gold-dark);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}
.boot-body {
  padding: 26px 30px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center;
}
.boot-mark { width: 50px; height: 50px; margin-bottom: 4px; }
.boot-mark img {
  width: 100%; height: 100%;
  image-rendering: pixelated;
  filter: drop-shadow(0 1px 0 var(--emboss)) drop-shadow(0 2px 3px rgba(0,0,0,.4));
}
.boot-title {
  font-family: var(--px);
  font-size: 22px;
  letter-spacing: 0;
  /* the name stacks over two lines at this width; keep it reading as one mark */
  line-height: 1.15;
  background: linear-gradient(180deg, #e6cc7e 8%, #a9883a 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 var(--emboss)) drop-shadow(0 2px 2px rgba(0,0,0,.35));
}
.boot-sub {
  font-family: var(--vt);
  font-size: 15px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--ink-dim);
}
.boot-bar {
  width: 100%; height: 16px; margin-top: 14px;
  border-radius: 4px;
  background: var(--well);
  box-shadow: var(--bevel-in);
  border: 1px solid var(--plastic-edge);
  overflow: hidden;
  padding: 2px;
}
#boot-fill {
  display: block; height: 100%; width: 0%;
  background:
    repeating-linear-gradient(90deg, transparent 0 7px, var(--plastic) 7px 9px),
    linear-gradient(180deg, #e6cc7e, var(--gold) 55%, #a9883a);
  border-radius: 2px;
  transition: width .3s steps(6);
}
.boot-status {
  font-family: var(--vt); font-size: 15px; letter-spacing: 1px;
  color: var(--gold-deep);
  margin-top: 2px;
  min-height: 16px;
}
#boot-enter {
  margin-top: 14px;
  padding: 10px 20px;
  font-size: 8px;
  animation: boot-enter-in .35s ease-out;
}
#boot-enter[hidden] { display: none; }
@keyframes boot-enter-in {
  from { opacity: 0; transform: translateY(4px); }
}

/* ---------- top plate ---------- */

#topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 8px 14px 9px;
  border-radius: 9px;
  background: linear-gradient(180deg, var(--plastic-hi), var(--plastic) 55%, var(--plastic-lo));
  border: 1px solid var(--plastic-edge);
  box-shadow: var(--bevel-out);
  position: relative;
  z-index: 30;
}
.medallion {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, var(--dish-hi), var(--plastic-lo) 55%, var(--dish-lo));
  border: 1px solid var(--plastic-edge);
  box-shadow: var(--bevel-in);
  display: flex; align-items: center; justify-content: center;
}
.medallion img {
  width: 25px; height: 25px;
  image-rendering: pixelated;
  filter: drop-shadow(0 1px 0 var(--emboss));
}
/* Both pixel faces leave a lot of slack in their line boxes; line-height 1
   plus an explicit gap keeps the two lines reading as one lockup beside the
   medallion instead of two stacked labels. */
.brand-text {
  display: flex; flex-direction: column;
  line-height: 1;
  gap: 5px;
  white-space: nowrap;   /* the lockup must never wrap; it drives bar height */
  flex-shrink: 0;
}
.brand-org {
  font-family: var(--px);
  font-size: 11px; letter-spacing: 0; text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 1px 0 var(--emboss);
}
.brand-project {
  font-family: var(--vt);
  font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--gold-deep);
}
.crumbline {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 14px;
  border-radius: 7px;
  background: var(--well);
  box-shadow: var(--bevel-in);
}
#crumb {
  font-family: var(--px);
  font-size: 8px; letter-spacing: 0; text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink);
  text-shadow: 0 1px 0 var(--emboss);
}

.af-btn {
  background: linear-gradient(180deg, var(--plastic-hi) 0%, var(--plastic) 45%, var(--plastic-lo) 100%);
  border: 1px solid var(--gold-deep);
  border-radius: 6px;
  color: var(--gold-deep);
  font-family: var(--px);
  font-size: 7px; letter-spacing: 0; text-transform: uppercase;
  white-space: nowrap;
  padding: 7px 13px;
  box-shadow: var(--bevel-out);
  text-shadow: 0 1px 0 var(--emboss);
  transition: filter .12s;
}
@media (hover: hover) { .af-btn:hover { filter: brightness(1.05); } }
.af-btn:active {
  box-shadow: var(--bevel-in);
  background: linear-gradient(180deg, var(--plastic-lo), var(--plastic));
}
.af-btn.mini { padding: 5px 9px; }
#theme-toggle[aria-pressed="true"] { box-shadow: var(--bevel-in); }
body[data-mode="globe"] #back-to-orbit { display: none; }

.cluster { margin-left: auto; display: flex; align-items: center; gap: 14px; }
/* The LED cluster is the first thing to go when the plate gets tight. The
   selector needs #topbar: the unconditional .leds block below is later in
   the file, and at equal specificity it silently wins inside the query. */
@media (max-width: 1180px) { #topbar .leds { display: none; } }
/* Tight plates drop the crumb text but never the crumbline itself in the
   survey view — it carries the Orbit button, the only way back out. */
@media (max-width: 900px) {
  #crumb { display: none; }
  body[data-mode="globe"] .crumbline { display: none; }
  .crumbline { padding: 0; background: none; box-shadow: none; }
}
/* below this the telemetry LCD no longer fits beside the brand */
@media (max-width: 800px) { #coords { display: none; } }
.leds { display: flex; gap: 10px; }
.led {
  display: flex; align-items: center; gap: 4px;
  font-family: var(--px); font-size: 6px; letter-spacing: 0;
  color: var(--ink-dim);
}
.led i {
  width: 8px; height: 8px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, var(--gold) 60%, #7a5f24);
  border: 1px solid #6d5620;
  box-shadow: 0 0 5px rgba(201,168,76,.8), inset 0 1px 1px rgba(255,255,255,.6);
}
.led.blink i { animation: led-blink 2.4s steps(1) infinite; }
.led.flicker i {
  background: radial-gradient(circle at 35% 30%, #c8f4ff, var(--aqua-deep) 60%, #1a5b70);
  border-color: #17505f;
  box-shadow: 0 0 5px rgba(63,168,196,.8), inset 0 1px 1px rgba(255,255,255,.6);
  animation: led-flicker 1.1s steps(2) infinite;
}
@keyframes led-blink { 0%, 72% { opacity: 1; } 73%, 100% { opacity: .25; } }
@keyframes led-flicker { 0%, 40% { opacity: 1; } 41%, 55% { opacity: .3; } 56%, 100% { opacity: 1; } }

.readout {
  font-family: var(--vt); font-size: 16px; letter-spacing: 1px;
  color: var(--lcd-ink);
  text-shadow: 0 0 4px rgba(125,255,200,.55);
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.04) 0 1px, transparent 1px 3px),
    var(--lcd-bg);
  border: 1px solid #000;
  border-radius: 4px;
  /* Not --bevel-in: that carries a bright inner lip along the bottom, which
     is right for raised plastic and reads as a second, offset frame on a
     recessed dark screen. The highlight belongs outside, on the plate. */
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,.85),
    inset 0 0 12px rgba(0,0,0,.7),
    0 1px 0 var(--emboss);
  /* line-height 1 so the frame hugs the glyphs; VT323 otherwise reserves
     descender room this readout never uses */
  line-height: 1;
  padding: 6px 12px 5px;
  min-width: 216px; text-align: right;
  white-space: pre;
}
body[data-mode="region"] .readout { color: #2c4438; text-shadow: none; }

/* ---------- stages ---------- */

main { flex: 1; position: relative; margin-top: 8px; min-height: 0; }

#globe-stage, #region-stage { position: absolute; inset: 0; }

/* The viewscreen bezel is painted outside its box, so without this the screen
   overhangs every neighbour by --ring and halves the gap beside it. */
#globe-stage { inset: var(--ring); }
#region-screen { margin: var(--ring) 0 var(--ring) var(--ring); }

/* the viewscreen: recessed dark glass */
#globe-stage {
  border-radius: 10px;
  border: 1px solid #1a1408;
  box-shadow:
    0 0 0 3px var(--surround),
    0 0 0 4px var(--plastic-edge),
    inset 0 0 34px rgba(0,0,0,.85);
  overflow: hidden;
  background:
    radial-gradient(ellipse 120% 90% at 68% 38%, var(--space-2) 0%, var(--space) 62%),
    var(--space);
}
#globe-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
#globe-canvas:active { cursor: grabbing; }

/* CRT glass: scanlines, vignette, glare sweep */
.screen-glass {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 6;
  background:
    linear-gradient(115deg, rgba(255,255,255,.09) 0%, rgba(255,255,255,.03) 24%, transparent 38%),
    repeating-linear-gradient(0deg, rgba(0,0,0,.1) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 108% 108% at 50% 50%, transparent 62%, rgba(0,0,0,.4) 100%);
}
body[data-mode="globe"] #region-stage { display: none; }
body[data-mode="region"] #globe-stage { display: none; }

/* ---------- globe labels ---------- */

#globe-labels {
  position: absolute; inset: 0;
  overflow: hidden; pointer-events: none;
  z-index: 8;
}
.globe-label {
  position: absolute; top: 0; left: 0;
  opacity: 0;
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(180deg, var(--plastic-hi), var(--plastic) 55%, var(--plastic-lo));
  border: 1px solid var(--gold-dark);
  border-radius: 5px;
  padding: 5px 9px 4px 7px;
  font-family: var(--px);
  font-size: 7px; letter-spacing: 0; text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 1px 0 var(--emboss);
  box-shadow: var(--bevel-out);
  transition: opacity .15s linear, filter .15s;
  will-change: transform, opacity;
}
@media (hover: hover) { .globe-label:hover { filter: brightness(1.06); } }
/* a pin with nothing behind it yet: still hoverable, just not an invitation */
.globe-label.locked { cursor: default; opacity: .72; }
.globe-label.locked:hover { filter: none; }
.globe-label .tick {
  width: 7px; height: 7px; flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, var(--gold) 65%, #7a5f24);
  border: 1px solid var(--gold-dark);
  transform: rotate(45deg);
}
.globe-label.home .tick {
  background: radial-gradient(circle at 35% 30%, #c8f4ff, var(--aqua-deep) 65%, #1a5b70);
  border-color: #17505f;
  box-shadow: 0 0 6px rgba(63,168,196,.9);
}

/* ---------- hover dossier card ---------- */

#hover-card {
  position: absolute; top: 16px; right: 16px; width: 246px;
  z-index: 9;
  background: linear-gradient(175deg, var(--plastic-hi), var(--plastic) 65%, var(--plastic-lo));
  border: 1px solid var(--edge-strong);
  border-radius: 7px;
  box-shadow: var(--bevel-out), 0 8px 26px rgba(0,0,0,.55);
  opacity: 0; transform: translateY(-6px);
  transition: opacity .18s, transform .18s;
  pointer-events: none;
  overflow: hidden;
}
#hover-card.on { opacity: 1; transform: none; }
#hover-card::before {
  content: "INCOMING DATABASE";
  display: block;
  padding: 5px 12px 4px;
  font-family: var(--px);
  font-size: 7px; letter-spacing: 0; color: #fff;
  text-shadow: 0 1px 1px rgba(95,75,30,.8);
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.2) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #dcc06a, var(--gold) 50%, #a9883a);
  border-bottom: 1px solid var(--gold-dark);
}
.hc-kind {
  font-family: var(--vt);
  font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--gold-deep);
  margin: 12px 14px 4px;
}
.hc-name {
  font-family: var(--px);
  font-size: 13px;
  margin: 0 14px;
  text-shadow: 0 1px 0 var(--emboss);
}
.hc-meta { font-family: var(--vt); font-size: 14px; color: var(--ink-dim); margin: 6px 14px 0; }
.hc-hint {
  margin: 11px 0 0;
  padding: 7px 14px 9px;
  border-top: 1px dashed var(--hairline);
  font-family: var(--px);
  font-size: 6px; letter-spacing: 0; text-transform: uppercase;
  color: var(--aqua-deep);
}

/* ---------- layer dock ---------- */

#layer-dock {
  position: absolute; left: 16px; bottom: 16px;
  z-index: 9;
  width: 172px;
  padding: 10px 11px 11px;
  border-radius: 8px;
  background: linear-gradient(175deg, var(--plastic-hi), var(--plastic) 60%, var(--plastic-lo));
  border: 1px solid var(--edge-strong);
  box-shadow: var(--bevel-out), 0 8px 26px rgba(0,0,0,.55);
  display: flex; flex-direction: column; gap: 6px;
}
.dock-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-bottom: 6px; margin-bottom: 2px;
  border-bottom: 1px solid var(--hairline);
}
.dock-title {
  font-family: var(--px);
  font-size: 6.5px; letter-spacing: 0; text-transform: uppercase;
  color: var(--gold-deep);
  text-shadow: 0 1px 0 var(--emboss);
}
.dock-body { display: flex; flex-direction: column; gap: inherit; }

/* collapsed: the header alone, so the panel reads as a closed drawer */
.dock[data-collapsed="true"] .dock-body { display: none; }
/* IDs set the open width, so the shrink has to match that specificity */
#layer-dock[data-collapsed="true"],
#audio-dock[data-collapsed="true"] { width: auto; }
.dock[data-collapsed="true"] .dock-head {
  padding-bottom: 0; margin-bottom: 0; border-bottom: none;
}

.dock-collapse {
  flex-shrink: 0;
  width: 15px; height: 13px;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  border: 1px solid var(--gold-deep);
  border-radius: 3px;
  background: linear-gradient(180deg, var(--plastic-hi), var(--plastic) 55%, var(--plastic-lo));
  box-shadow: var(--bevel-out);
}
@media (hover: hover) { .dock-collapse:hover { filter: brightness(1.06); } }
.dock-collapse:active { box-shadow: var(--bevel-in); }
/* a drawn triangle rather than a glyph — the pixel faces have no chevron */
.dock-collapse::before {
  content: "";
  width: 0; height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-bottom: 4px solid var(--gold-deep);
  transition: transform .18s ease;
}
.dock[data-collapsed="true"] .dock-collapse::before { transform: rotate(180deg); }
.af-switch {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--plastic-edge);
  border-radius: 5px;
  background: linear-gradient(180deg, var(--plastic-hi), var(--plastic) 60%, var(--plastic-lo));
  box-shadow: var(--bevel-out);
  font-family: var(--px);
  font-size: 6.5px; letter-spacing: 0; text-transform: uppercase;
  color: var(--ink-dim);
  padding: 6px 8px;
  text-shadow: 0 1px 0 var(--emboss);
}
.af-switch:active { box-shadow: var(--bevel-in); }
.af-switch i {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, #d8d3c0, #a8a28c 65%, #6d685a);
  background-color: #a8a28c;
  border: 1px solid #6d6854;
  box-shadow: inset 0 1px 1px rgba(255,255,255,.5);
}
.af-switch[aria-pressed="true"] { color: var(--ink); }
.af-switch[aria-pressed="true"] i {
  background: radial-gradient(circle at 35% 30%, #ffe9a8, var(--gold) 60%, #7a5f24);
  border-color: #6d5620;
  box-shadow: 0 0 6px rgba(201,168,76,.9), inset 0 1px 1px rgba(255,255,255,.6);
}

/* ---------- zone readout: names the area under the cursor ---------- */

/* The screen itself is notched: every ring of the bezel follows the cut, so
   the frame turns the corner around it instead of running straight past.
   The cut-out is real chassis, not a plate drawn over the glass. */
/* The terminal keeps the page's own 8px gap to everything it meets: the topbar
   above, the bezel below, and the slant to its right, whose lean it repeats so
   that gap holds down the whole run. Its top and left sit on the screen's
   painted edge, which puts it 13px off the console wall like every other
   element -- nothing stands between it and the wall to gap against. */
:root {
  --notch-w: 248px;        /* cut width, measured along its top edge */
  --notch-h: 40px;
  --notch-cut: 26px;       /* how far the cut's right edge leans over its run */
  --slant-tan: .65;        /* --notch-cut / --notch-h */
  --slant-k: .45731;       /* tan + 1 - 1/cos: the slant's share of an offset */

  --term-x: calc(var(--ring) * -1); --term-y: calc(var(--ring) * -1 + 1px);
  --term-w: 240px; --term-h: 32px;
  --term-cut: calc(var(--term-h) * var(--slant-tan));
}

#zone-readout {
  position: absolute; z-index: 8;
  left: var(--term-x); top: var(--term-y);
  width: var(--term-w); height: var(--term-h);
  display: flex; align-items: center;
  pointer-events: none;
  padding: 0 13px;
  border-radius: 3px;
  background: #000;        /* reads as the 1px rim around ::before */
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--term-cut)) 100%, 0 100%);
}
#zone-readout::before {
  content: ""; position: absolute; inset: 1px;
  border-radius: 2px;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.05) 0 1px, transparent 1px 3px),
    var(--lcd-bg);
  box-shadow: inset 0 2px 6px rgba(0,0,0,.85);
  /* .84px is the same lean correction the bezel needs, at 1px instead of 4 */
  clip-path: polygon(0 0, calc(100% - .84px) 0,
    calc(100% - .84px - var(--term-cut) + 2px * var(--slant-tan)) 100%, 0 100%);
}
#zone-readout span {
  display: block; min-width: 0;
  position: relative;      /* the LCD face is a positioned ::before; outrank it */
  font-family: var(--px);
  font-size: 12px; letter-spacing: 0; text-transform: uppercase;
  line-height: 1;
  color: var(--lcd-ink);
  text-shadow: 0 0 6px rgba(125,255,200,.5);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-height: 12px;
}
/* the notch is permanent; only its contents change */
#zone-readout[data-on="no"] span::after {
  content: "\2014";
  color: rgba(125,255,200,.3);
}

/* ---------- audio levels: mirrors the layer dock, opposite corner ---------- */

#audio-dock {
  position: absolute; right: 16px; bottom: 16px;
  z-index: 9;
  width: 168px;
  padding: 10px 11px 12px;
  border-radius: 8px;
  background: linear-gradient(175deg, var(--plastic-hi), var(--plastic) 60%, var(--plastic-lo));
  border: 1px solid var(--edge-strong);
  box-shadow: var(--bevel-out), 0 8px 26px rgba(0,0,0,.55);
  display: flex; flex-direction: column; gap: 7px;
}
/* Clear the dossier panel when the survey view is open, and then hold the same
   11px off the bezel that #region-dock keeps on the opposite side: the 392px
   panel, the stage's 8px + --ring gap, and the viewport's 1px inset put the
   screen's right edge here. Clearing the panel alone left it 3px off the
   bezel, near enough to read as touching it. */
body[data-mode="region"] #audio-dock {
  right: calc(var(--panel-w) + 8px + var(--ring) + 1px + 11px);
}

/* Match the observation-layer dock's gap to the bezel. That dock is a child of
   #globe-stage, which sits --ring plus its own 1px border in from main, while
   this one is a child of main -- so identical offsets land it 5px nearer the
   frame. The survey view needs no such correction: #region-dock's stage is
   flush with main, so the two already agree there. */
body[data-mode="globe"] #audio-dock {
  right: calc(16px + var(--ring) + 1px);
  bottom: calc(16px + var(--ring) + 1px);
}

/* the survey view's own dock, mirroring the observation layers */
#region-dock {
  position: absolute; left: 16px; bottom: 16px;
  z-index: 9;
  width: 168px;
  padding: 10px 11px 12px;
  border-radius: 8px;
  background: linear-gradient(175deg, var(--plastic-hi), var(--plastic) 60%, var(--plastic-lo));
  border: 1px solid var(--edge-strong);
  box-shadow: var(--bevel-out), 0 8px 26px rgba(0,0,0,.55);
  display: flex; flex-direction: column; gap: 6px;
}
#region-dock[data-collapsed="true"] { width: auto; }
#region-world[data-city-markers="off"] .poi[data-kind="city"],
#region-world[data-route-markers="off"] .poi[data-kind="route"] { display: none; }

/* each slider sits directly under the switch it belongs to */
#audio-dock .af-switch + .vol { margin: -1px 0 4px; }

/* a recessed slot with a beveled key riding in it */
input[type="range"].vol {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 14px;
  background: transparent;
  cursor: pointer;
}
input[type="range"].vol::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: var(--well);
  border: 1px solid var(--plastic-edge);
  box-shadow: var(--bevel-in);
}
input[type="range"].vol::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 11px; height: 17px;
  margin-top: -6px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--plastic-hi), var(--plastic) 55%, var(--plastic-lo));
  border: 1px solid var(--gold-deep);
  box-shadow: var(--bevel-out);
}
input[type="range"].vol:active::-webkit-slider-thumb {
  background: linear-gradient(180deg, var(--gold-pale), var(--gold));
}
input[type="range"].vol::-moz-range-track {
  height: 8px; border-radius: 4px;
  background: var(--well);
  border: 1px solid var(--plastic-edge);
}
input[type="range"].vol::-moz-range-thumb {
  width: 9px; height: 15px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--plastic-hi), var(--plastic-lo));
  border: 1px solid var(--gold-deep);
}

/* ---------- status bar ---------- */

#statusbar {
  margin-top: 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 9px 14px 9px 22px;
  border-radius: 7px;
  background: var(--well);
  box-shadow: var(--bevel-in);
  border: 1px solid var(--plastic-edge);
  position: relative;
}
#status-hint {
  font-family: var(--px);
  font-size: 7px; letter-spacing: 0;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--gold-deep);
  text-shadow: 0 1px 0 var(--emboss);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#credits-open { flex-shrink: 0; }

/* ---------- analogue tape overlay ---------- */

/* Real VHS noise laid over the whole console. The footage is near-black with
   bright grain and dropout specks, so `screen` drops the black entirely and
   only the artefacts land on the UI. The filter crushes the base further —
   the source floor is about 14/255, not true black, which would otherwise
   wash the whole interface a flat grey. */
#vhs {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 45;              /* over the console, under dialogs and the boot loader */
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: .3;
  filter: contrast(1.75) brightness(.72) saturate(.55);
}

/* a full-screen flicker is exactly what this preference is for */
@media (prefers-reduced-motion: reduce) {
  #vhs { display: none; }
}

/* ---------- credits dialog ---------- */

#credits {
  position: fixed; inset: 0; z-index: 55;
  display: flex; align-items: center; justify-content: center;
}
#credits[hidden] { display: none; }
.dialog-scrim {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px),
    rgba(4, 6, 14, .72);
}
.dialog {
  position: relative;
  width: min(520px, calc(100vw - 48px));
  max-height: min(680px, calc(100vh - 80px));
  display: flex; flex-direction: column;
  border-radius: 8px;
  background: linear-gradient(175deg, var(--plastic-hi), var(--plastic) 60%, var(--plastic-lo));
  border: 1px solid var(--edge-strong);
  box-shadow: var(--bevel-out), 0 20px 60px rgba(0,0,0,.7);
  overflow: hidden;
  animation: dialog-in .18s ease-out;
}
@keyframes dialog-in {
  from { transform: translateY(8px) scale(.98); opacity: 0; }
}
.dialog-titlebar {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 6px 4px 10px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.2) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #dcc06a, var(--gold) 50%, #a9883a);
  border-bottom: 1px solid var(--gold-dark);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}
.dialog-titletext {
  font-family: var(--px); font-size: 8px;
  color: #fff;
  text-shadow: 0 1px 1px rgba(95, 75, 30, .8);
}
.dialog-titlebtns button {
  width: 22px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--plastic-hi), var(--plastic-lo));
  border: 1px solid var(--gold-dark);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 var(--emboss);
  color: var(--ink);
  font-family: var(--vt); font-size: 22px; line-height: 1;
  padding-bottom: 3px;
}
.dialog-titlebtns button:hover { filter: brightness(1.08); }
.dialog-titlebtns button:active { box-shadow: var(--bevel-in); }
.dialog-body {
  padding: 20px 24px 26px;
  overflow-y: auto;
}

.cr-hero {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 16px; margin-bottom: 4px;
  border-bottom: 1px solid var(--hairline);
}
.cr-hero img { image-rendering: pixelated; flex-shrink: 0; }
.cr-wordmark {
  font-family: var(--px); font-size: 17px;
  background: linear-gradient(180deg, #e6cc7e 8%, #a9883a 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1px 0 var(--emboss));
}
.cr-version {
  font-family: var(--vt); font-size: 14px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--ink-dim);
  margin-top: 5px;
}
.cr-sec {
  font-family: var(--px); font-size: 7px; text-transform: uppercase;
  color: var(--gold-deep);
  text-shadow: 0 1px 0 var(--emboss);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--hairline);
}
#credits p {
  font-family: var(--vt); font-size: 16px; line-height: 1.4;
  color: var(--ink);
  margin-bottom: 6px;
}
#credits p b { color: var(--gold-deep); font-weight: normal; }
.cr-list { display: grid; grid-template-columns: 128px 1fr; gap: 8px 14px; }
.cr-list dt {
  font-family: var(--px); font-size: 6px; text-transform: uppercase;
  color: var(--ink-dim);
  padding-top: 4px;
  line-height: 1.6;
}
.cr-list dd {
  font-family: var(--vt); font-size: 15px; line-height: 1.35;
  color: var(--ink);
}
.cr-list dd b { color: var(--gold-deep); font-weight: normal; }
.cr-note {
  font-size: 15px !important;
  color: var(--ink-dim) !important;
  margin-bottom: 12px !important;
}
.cr-legal {
  font-size: 14px !important;
  color: var(--ink-dim) !important;
}
#credits a {
  color: var(--aqua-deep);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}
#credits a:hover { color: var(--gold-deep); }

/* ---------- warp transition ---------- */

#warp {
  position: fixed; inset: 0; z-index: 50;
  pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  background:
    repeating-linear-gradient(0deg, rgba(200,220,255,.12) 0 2px, transparent 2px 5px),
    radial-gradient(circle at 50% 50%, var(--warp-core), var(--warp-edge) 55%, var(--warp-core));
  opacity: 0;
  transition: opacity .42s ease;
}
#warp.on { opacity: 1; }
#warp .ring {
  width: 90px; height: 90px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  opacity: 0;
}
#warp.on .ring { animation: warp-ring .55s ease-out; }
@keyframes warp-ring {
  0% { transform: scale(.3); opacity: .9; }
  100% { transform: scale(9); opacity: 0; }
}

/* ---------- region stage ---------- */

#region-stage { display: flex; gap: calc(8px + var(--ring)); }

/* The bezel is normally an outset box-shadow and the dark inner line a border,
   but a shadow only traces a rectangle and a border only draws on the box's
   own four sides -- neither can turn the corner into the notch. So every ring
   becomes a filled layer wearing the same clip, stacked outermost first:

     --e  4  plastic-edge   1px shows
          3  surround       3px shows
          0  #1a1408        1px shows   (was the border)
         -1  the glass itself

   A shape offset outward by N keeps the cut-out the same size in its own box,
   so one polygon serves them all -- but only for the square edges. Moving a
   box's origin diagonally shifts an axis-aligned edge by N and a leaning one
   by something else entirely, so the slant needs its own nudge of
   N * (tan + 1 - 1/cos) to land 4px out like every other edge. Without it the
   bezel came out 5.9px down the slant against 4px everywhere else. */
#region-screen { flex: 1; position: relative; }

#region-frame, #region-frame::before, #region-frame::after, #region-viewport {
  --screen-shape: polygon(
    0 var(--notch-h),
    calc(var(--notch-w) - var(--notch-cut) + var(--slant-k) * var(--e) * 1px) var(--notch-h),
    calc(var(--notch-w) + var(--slant-k) * var(--e) * 1px) 0,
    100% 0, 100% 100%, 0 100%);
  clip-path: var(--screen-shape);
}
#region-frame {
  --e: 4;
  position: absolute; inset: calc(var(--ring) * -1); pointer-events: none;
  border-radius: 14px;
  background: var(--plastic-edge);
}
#region-frame::before, #region-frame::after { content: ""; position: absolute; }
#region-frame::before { --e: 3; inset: 1px; border-radius: 13px; background: var(--surround); }
#region-frame::after  { --e: 0; inset: var(--ring); border-radius: 10px; background: #1a1408; }

#region-viewport {
  --e: -1;
  position: absolute; inset: 1px; overflow: hidden;
  cursor: grab;
  border-radius: 9px;
  box-shadow: inset 0 0 34px rgba(0,0,0,.85);
  background:
    radial-gradient(ellipse 110% 80% at 40% 30%, #101830 0%, var(--space) 70%),
    var(--space);
}
#region-viewport.dragging { cursor: grabbing; }
#region-world {
  position: absolute; top: 0; left: 0;
  transform-origin: 0 0;
}
.region-art {
  display: block;
  user-select: none; -webkit-user-drag: none;
}
.region-art.pixel { image-rendering: pixelated; }

/* survey-blueprint placeholder */
.blueprint {
  position: relative;
  background:
    repeating-linear-gradient(0deg, transparent 0 79px, rgba(201,168,76,.16) 79px 80px),
    repeating-linear-gradient(90deg, transparent 0 79px, rgba(201,168,76,.16) 79px 80px),
    repeating-linear-gradient(0deg, transparent 0 399px, rgba(201,168,76,.35) 399px 400px),
    repeating-linear-gradient(90deg, transparent 0 399px, rgba(201,168,76,.35) 399px 400px),
    linear-gradient(160deg, var(--paper-hi) 0%, var(--paper-mid) 55%, var(--paper-lo) 100%);
}
.bp-frame {
  position: absolute; inset: 26px;
  border: 1px dashed rgba(138, 109, 47, .5);
  pointer-events: none;
}
.bp-crest {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.bp-crest img {
  width: 40%; height: auto;
  image-rendering: pixelated;
  opacity: .08;
}
.bp-center {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  text-align: center; pointer-events: none;
}
.bp-region {
  font-family: var(--px);
  font-size: 44px;
  letter-spacing: 6px; text-transform: uppercase;
  color: var(--bp-ink);
  padding-left: 6px;
  text-shadow: 0 3px 0 var(--bp-emboss);
}
.bp-status {
  margin-top: 16px;
  font-family: var(--px);
  font-size: 8px; letter-spacing: 0; text-transform: uppercase;
  color: var(--gold-deep);
}
.bp-meta {
  margin-top: 8px;
  font-family: var(--vt);
  font-size: 16px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--ink-dim);
}
.bp-corner {
  position: absolute;
  font-family: var(--vt); font-size: 14px; letter-spacing: 1px;
  color: rgba(138, 109, 47, .65);
}
.bp-corner.tl { top: 34px; left: 38px; }
.bp-corner.tr { top: 34px; right: 38px; }
.bp-corner.bl { bottom: 34px; left: 38px; }
.bp-corner.br { bottom: 34px; right: 38px; }

/* POI pins */
.poi {
  position: absolute;
  background: none; border: none;
  transform: translate(-50%, -50%) scale(var(--pin-scale, 1));
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  z-index: 3;
}
.poi-diamond {
  width: 13px; height: 13px;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, var(--gold) 65%, #7a5f24);
  border: 2px solid var(--pin-ring);
  box-shadow: 0 0 0 1px var(--gold-dark), 0 2px 6px rgba(8,12,26,.5);
  transform: rotate(45deg);
  transition: transform .15s;
}
.poi:hover .poi-diamond { transform: rotate(45deg) scale(1.3); }
.poi.active .poi-diamond {
  background: radial-gradient(circle at 35% 30%, #c8f4ff, var(--aqua-deep) 65%, #1a5b70);
  box-shadow: 0 0 0 1px #17505f, 0 0 12px rgba(63,168,196,.8);
}
.poi-name {
  font-family: var(--px);
  font-size: 7px; letter-spacing: 0; text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 1px 0 var(--emboss);
  background: linear-gradient(180deg, var(--plastic-hi), var(--plastic) 60%, var(--plastic-lo));
  border: 1px solid var(--gold-dark);
  border-radius: 4px;
  padding: 3px 8px;
  white-space: nowrap;
  box-shadow: var(--bevel-out);
}
.poi.active .poi-name { color: var(--aqua-deep); border-color: #17505f; }

/* dossier panel: console side plate */
#region-panel {
  width: var(--panel-w); flex-shrink: 0;
  border-radius: 9px;
  background: linear-gradient(175deg, var(--plastic-hi), var(--plastic) 55%, var(--plastic-lo));
  border: 1px solid var(--edge-strong);
  box-shadow: var(--bevel-out);
  overflow-y: auto;
  overflow-x: hidden;
}
#region-panel::-webkit-scrollbar { width: 14px; }
#region-panel::-webkit-scrollbar-track {
  background: var(--well);
  border-left: 1px solid var(--plastic-edge);
  box-shadow: inset 1px 0 3px rgba(60,50,25,.2);
}
#region-panel::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, var(--plastic-hi), var(--plastic) 50%, var(--plastic-lo));
  border: 1px solid var(--plastic-edge);
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}

.p-head {
  padding: 0 0 16px;
  border-bottom: 1px solid var(--hairline);
}
.p-head::before {
  content: "";
  display: block;
  height: 22px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--gold-dark);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}
.p-back {
  display: block;
  background: none; border: none;
  font-family: var(--px);
  font-size: 6.5px; letter-spacing: 0; text-transform: uppercase;
  color: var(--aqua-deep);
  margin: 0 22px 12px; padding: 0;
}
.p-back:hover { color: var(--ink); }
.p-kind {
  font-family: var(--vt);
  font-size: 14px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--gold-deep); margin: 0 22px 6px;
}
.p-name {
  font-family: var(--px);
  font-size: 16px; line-height: 1.4;
  margin: 0 22px;
  text-shadow: 0 1px 0 var(--emboss);
}
.p-tag { font-family: var(--vt); font-size: 15px; color: var(--ink-dim); margin: 7px 22px 0; }
.p-body { padding: 18px 22px 36px; }
.p-facts {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  margin-bottom: 18px;
}
.p-facts > div {
  background: var(--well-2);
  border: 1px solid var(--plastic-edge);
  border-radius: 6px;
  box-shadow: var(--bevel-in);
  padding: 8px 9px;
}
.p-facts dt {
  font-family: var(--px);
  font-size: 5.5px; letter-spacing: 0; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 5px;
}
.p-facts dd { font-family: var(--vt); font-size: 15px; }
.p-sec {
  font-family: var(--px);
  font-size: 7px; letter-spacing: 0; text-transform: uppercase;
  color: var(--gold-deep);
  text-shadow: 0 1px 0 var(--emboss);
  margin: 18px 0 9px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--hairline);
}
.p-sec:first-child { margin-top: 0; }
.p-body p { font-family: var(--vt); font-size: 16px; line-height: 1.4; margin-bottom: 10px; }
.p-body p.dim { color: var(--ink-dim); }
.badge {
  display: inline-block;
  font-family: var(--px);
  font-size: 6px; letter-spacing: 0; text-transform: uppercase;
  padding: 3px 6px 2px; margin-right: 5px;
  border-radius: 4px;
  vertical-align: 2px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.badge.canon { background: linear-gradient(180deg, #f2e6bc, var(--gold-pale)); color: var(--gold-deep); border: 1px solid var(--gold-deep); }
.badge.fanon { background: linear-gradient(180deg, #d8f2f8, #b8e4ee); color: var(--aqua-deep); border: 1px solid var(--aqua-deep); }
.p-sites { display: flex; flex-direction: column; gap: 6px; }
.site {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, var(--plastic-hi), var(--plastic) 60%, var(--plastic-lo));
  border: 1px solid var(--plastic-edge);
  border-radius: 6px;
  box-shadow: var(--bevel-out);
  padding: 8px 11px;
  font-family: var(--vt);
  font-size: 16px; color: var(--ink);
  text-align: left;
  text-shadow: 0 1px 0 var(--emboss);
  transition: filter .12s;
}
.site:hover { filter: brightness(1.05); }
.site:active { box-shadow: var(--bevel-in); }
.site-kind {
  font-family: var(--px);
  font-size: 5.5px; letter-spacing: 0; text-transform: uppercase;
  color: var(--gold-deep);
  background: var(--well-2);
  box-shadow: var(--bevel-in);
  border-radius: 4px;
  padding: 3px 6px;
  min-width: 62px; text-align: center;
}
/* ---------- region dossier: grouped lists, places, encounters ---------- */

.p-group + .p-group { margin-top: 16px; }
.p-group-head {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  background: none; border: none;
  border-bottom: 1px solid var(--hairline);
  padding: 0 0 6px;
  margin-bottom: 9px;
  font-family: var(--px);
  font-size: 8px; letter-spacing: 0; text-transform: uppercase;
  color: var(--gold-deep);
  text-shadow: 0 1px 0 var(--emboss);
}
.p-group-head i {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--gold-deep);
  transition: transform .18s ease;
}
.p-group[data-collapsed="true"] .p-group-head i { transform: rotate(-90deg); }
.p-group[data-collapsed="true"] .p-sites { display: none; }

.p-blurb {
  font-family: var(--vt); font-size: 15px; line-height: 1.4;
  color: var(--ink-dim);
  margin-bottom: 4px;
}

.p-places { display: flex; flex-direction: column; gap: 7px; }
.place {
  background: var(--well-2);
  border: 1px solid var(--plastic-edge);
  border-radius: 6px;
  box-shadow: var(--bevel-in);
  padding: 8px 10px 9px;
}
.place-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.place-kind {
  font-family: var(--px); font-size: 5.5px; text-transform: uppercase;
  color: var(--gold-deep);
  background: rgba(201,168,76,.16);
  border-radius: 3px;
  padding: 3px 5px 2px;
  flex-shrink: 0;
}
.place-kind.gym { color: var(--aqua-deep); background: rgba(63,168,196,.18); }
.place-name { font-family: var(--vt); font-size: 16px; color: var(--ink); }
.place-detail {
  font-family: var(--vt); font-size: 14px !important; line-height: 1.35;
  color: var(--ink-dim); margin: 0 !important;
}

.enc-method {
  font-family: var(--px); font-size: 6px; text-transform: uppercase;
  color: var(--ink-dim);
  margin: 12px 0 6px;
}
.enc-method:first-of-type { margin-top: 4px; }
.enc-table { display: flex; flex-direction: column; gap: 3px; }
.enc {
  display: grid;
  grid-template-columns: 30px 1fr auto auto;
  align-items: center; gap: 8px;
  background: var(--well-2);
  border: 1px solid var(--plastic-edge);
  border-radius: 5px;
  padding: 2px 9px 2px 3px;
}
.enc img { width: 30px; height: 30px; image-rendering: pixelated; }
.enc-name { font-family: var(--vt); font-size: 15px; color: var(--ink); }
.enc-lv {
  font-family: var(--vt); font-size: 14px; color: var(--ink-dim);
  white-space: nowrap;
}
.enc-rate {
  font-family: var(--px); font-size: 6px;
  color: var(--gold-deep);
  min-width: 26px; text-align: right;
}
.enc-source {
  font-family: var(--vt); font-size: 13px !important;
  color: var(--ink-dim); margin-top: 10px !important;
}

.mon-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.mon {
  display: flex; align-items: center; gap: 5px;
  background: var(--well-2);
  border: 1px solid var(--plastic-edge);
  border-radius: 6px;
  box-shadow: var(--bevel-in);
  padding: 3px 9px 3px 3px;
  font-family: var(--vt);
  font-size: 15px;
}
.mon img { width: 38px; height: 38px; image-rendering: pixelated; }

/* ---------- studio mode: the render, and nothing else ---------- */

/* Strips the console to the picture for clean captures. Everything that reads
   as furniture goes — chassis, bezel, topbar, statusbar, dossier panel, zone
   notch, screen glare, tape overlay — leaving the two docks, so layers and
   audio stay adjustable while framing a shot, and the one button needed to
   get back out. The docks are collapsible, so a fully bare frame is two more
   clicks away without giving up the controls entirely. */

body[data-chrome="off"] #console {
  inset: 0; padding: 0;
  border: 0; border-radius: 0;
  background: var(--space);
  box-shadow: none;
}
body[data-chrome="off"] main { margin-top: 0; }

/* The topbar goes out of flow rather than away, so the button it carries can
   hold the corner while everything beside it is dropped. */
body[data-chrome="off"] #topbar {
  position: fixed; top: 0; right: 0; left: auto;
  padding: 10px 12px; gap: 0;
  background: none; border: 0; box-shadow: none;
  z-index: 50;
}
body[data-chrome="off"] #topbar > *:not(#studio-toggle) { display: none; }

body[data-chrome="off"] #statusbar,
body[data-chrome="off"] #region-panel,
body[data-chrome="off"] #region-frame,
body[data-chrome="off"] #zone-readout,
body[data-chrome="off"] #hover-card,
body[data-chrome="off"] .screen-glass,
body[data-chrome="off"] #vhs { display: none; }

body[data-chrome="off"] #globe-stage {
  inset: 0;
  border: 0; border-radius: 0; box-shadow: none;
}

body[data-chrome="off"] #region-stage { gap: 0; }
body[data-chrome="off"] #region-screen { margin: 0; }
body[data-chrome="off"] #region-viewport {
  inset: 0;
  border-radius: 0; box-shadow: none;
  clip-path: none;          /* the notch it was cut around is gone */
}

/* Both of the audio dock's offsets are corrections for chrome that studio mode
   has just removed: the push left to clear the dossier panel, and the nudge in
   from the bezel. With the panel gone and the stages flush to main, plain 16px
   is what matches the layer docks again. */
body[data-chrome="off"] #audio-dock { right: 16px; bottom: 16px; }

/* CRT filter off: the glass keeps its glare sweep and vignette, since those
   are what make it read as a screen; only the scanlines are dropped. */
body[data-crt="off"] .screen-glass {
  background:
    linear-gradient(115deg, rgba(255,255,255,.09) 0%, rgba(255,255,255,.03) 24%, transparent 38%),
    radial-gradient(ellipse 108% 108% at 50% 50%, transparent 62%, rgba(0,0,0,.4) 100%);
}

/* ---------- small screens ----------
   House rules: menu groups stay rectangular blocks with even padding, buttons
   sharing a row share a height, nothing overlaps anything, and hover-raise
   effects only exist where hover does. */

/* Tablet band: the console survives intact, but the dossier panel gives some
   width back to the map, and the 6.5px pixel faces step up to 8 — Press Start
   is an 8px face, so 8 is also where it stops shimmering. */
@media (max-width: 1180px) {
  :root { --panel-w: 320px; }
  .dock-title, .af-switch { font-size: 8px; }
  .globe-label { font-size: 8px; }
  #status-hint { font-size: 8px; }
}

/* Mobile band. The topbar wraps to the Bebe's PC header pattern — brand row
   above an actions row — and the survey view stacks: screen on top, dossier
   below, each full width. Everything here is scoped out of studio mode, which
   wants the render alone at full viewport. */
@media (max-width: 720px) {
  #topbar { flex-wrap: wrap; gap: 12px; row-gap: 9px; }
  .af-btn { font-size: 8px; }

  body:not([data-chrome="off"]) #region-stage { flex-direction: column; }
  body:not([data-chrome="off"]) #region-screen {
    flex: none;
    height: var(--mob-screen-h);
    margin: var(--ring) var(--ring) 0 var(--ring);
  }
  body:not([data-chrome="off"]) #region-panel {
    width: auto; flex: 1 1 auto; min-height: 0;
  }
  :root { --mob-screen-h: 48vh; }

  /* The map docks normally pin to the stage's bottom corners, which is now
     the bottom of the dossier list. Anchor them to the map screen instead:
     top edge at the screen's bottom, pulled up by their own height. */
  body[data-mode="region"]:not([data-chrome="off"]) #region-dock,
  body[data-mode="region"]:not([data-chrome="off"]) #audio-dock {
    bottom: auto;
    top: calc(var(--ring) + var(--mob-screen-h));
    transform: translateY(calc(-100% - 12px));
  }
  body[data-mode="region"]:not([data-chrome="off"]) #region-dock { left: 12px; }
  body[data-mode="region"]:not([data-chrome="off"]) #audio-dock { right: 12px; }
}
