/* =====================================================================
   WARMATCH — shell styles
   16-bit military action. Pixel/CRT aesthetic, stencilled metal chrome.
   No external assets, no external fonts.

   THE PALETTE
   -----------
   Six ramps, mirroring js/pixel.js exactly so canvas art and DOM chrome
   never drift apart:

     OLIVE   --olive-d  --olive   --olive-l     materiel, plating, panels
     STEEL   --steel-d  --steel   --steel-l  --chrome
     AMBER   --amber    --amber-l --amber-hot   every lit readout
     BLOOD   --blood-d  --blood   --alert  --flame
     SAND    --earth-d  --earth   --sand   --sand-l
     SIGNAL  --signal-d --signal                phosphor, radar, GO states

   The legacy names (--cyan, --pink, --yellow …) are kept as ALIASES onto
   the new ramps. Two thousand lines of shell CSS read them; re-pointing
   them re-skins all of it at once, and new rules use the ramp names.
===================================================================== */
:root {
  /* ---------- OLIVE: materiel ---------- */
  --olive-d: #2c3d18;
  --olive: #4a6323;
  --olive-l: #6f8f34;

  /* ---------- STEEL: hardware ---------- */
  --steel-d: #1c2228;
  --steel: #3c4650;
  --steel-l: #5a6774;
  --chrome: #8a97a3;

  /* ---------- AMBER: every lit readout. The hero colour. ---------- */
  --amber: #ffb020;
  --amber-l: #ffe07a;
  --amber-hot: #ffee9e;

  /* ---------- BLOOD: alarms, fire, tracer ---------- */
  --blood-d: #7a1410;
  --blood: #8f1d12;
  --alert: #e03a1c;
  --flame: #ff7a3d;
  --flame-l: #ff9a5c;

  /* ---------- SAND: brass, ammunition, dust, paper ---------- */
  --earth-d: #3a2c18;
  --earth: #6b512c;
  --sand: #a8814a;
  --brass: #e6be6e;
  --sand-l: #f0dbae;

  /* ---------- SIGNAL: phosphor, radar, GO ---------- */
  --signal-d: #14652a;
  --signal: #39ff6e;

  /* ---------- structure ---------- */
  --deep: #070a08;
  --void: #0d1410;
  --panel: #141d16;
  --panel-2: #26331f;
  --ink: #05070a;
  --bone: #eef2ea;

  /* ---------- legacy aliases (do not use in new rules) ---------- */
  --pink: var(--alert);
  --pink-l: var(--flame-l);
  --cyan: var(--amber);
  --cyan-l: var(--amber-l);
  --yellow: var(--brass);
  --orange: var(--flame);
  --green: var(--signal);
  --green-d: #123a1c;
  --lav: #8fa38a;
  --purple: var(--steel);
  --red: var(--blood);
  --grey: #7d867c;

  --font: "Lucida Console", "Consolas", "DejaVu Sans Mono", monospace;

  /* ---- PORTRAIT (ВЕРТИКАЛЬНА) STAGE (scale v5, див. scale.js) ----
     Сцена має ФІКСОВАНУ пропорцію 440×900 (≈1:2); масштабується ЦІЛКОМ під
     в'юпорт (contain + letterbox). На телефонах scale ≈ 0.9…1.0, тож 1 stage-px ≈
     1 фізичний px — розміри «чесні». --vw = 1% ширини сцени, --vh = 1% висоти.
     Значення нижче — стартові; --stage-w/--vw/--vh/--scale перевизначає scale.js. */
  --dh: 900px;
  --stage-w: 440px;
  --vw: 4.4px;   /* = --stage-w / 100, оновлюється з JS */
  --vh: 9px;     /* = --dh / 100, оновлюється з JS */
  --scale: 1;    /* виставляється з JS (scale.js) під в'юпорт */

  /* ---- ДИЗАЙН-ТОКЕНИ (stage-px ≈ фізичні px на телефоні) ----
     Типографічна шкала: жоден текст не менший за --fs-micro. */
  --fs-micro: 11px;  /* мікропідписи: рейл, бейджі, мета — АБСОЛЮТНИЙ мінімум */
  --fs-xs: 12px;     /* вторинні лейбли */
  --fs-sm: 13px;     /* дрібний основний текст, кнопки-привиди */
  --fs-md: 15px;     /* ОСНОВНИЙ текст: діалоги, термінал, рядки списків */
  --fs-lg: 18px;     /* заголовки панелей/секцій */
  --fs-xl: 24px;     /* заголовки екранів */
  --fs-2xl: 32px;    /* великі неонові заголовки */

  /* Тач-цілі та ритм */
  --tap: 44px;       /* мінімальна тач-ціль (Apple HIG) */
  --tap-lg: 52px;    /* первинні дії */
  --row: 56px;       /* висота рядка списку */
  --hud-h: 48px;     /* висота HUD-смуги */
  --hud-chip: 38px;  /* єдина висота HUD-чіпів: лічильники, кнопки, профіль */

  /* Відступи */
  --sp1: 4px; --sp2: 8px; --sp3: 12px; --sp4: 16px; --sp5: 24px;

  /* Safe-area (нотчі телефонів у landscape) */
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --edge: max(12px, var(--safe-l));
  --edge-r: max(12px, var(--safe-r));
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  /* letterbox around the stage: sheet metal, not flat black. The diagonal
     hatch reads as the inside of a vehicle once the stage is centred on it. */
  background:
    repeating-linear-gradient(135deg, rgba(90,103,116,.05) 0 2px, rgba(0,0,0,0) 2px 8px),
    radial-gradient(120% 100% at 50% 50%, #0e130f 0%, #070a08 55%, #020403 100%);
  color: var(--amber-l);
  font-family: var(--font);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* the whole UI is a fixed-size stage, scaled uniformly to fit the viewport.
   position:fixed → не додає документного скролу навіть при scale>1 (десктоп). */
#app {
  position: fixed;
  top: 50%; left: 50%;
  width: var(--stage-w); height: var(--dh);
  transform: translate(-50%, -50%) scale(var(--scale));
  transform-origin: center center;
  overflow: hidden;
  background: var(--deep);
}

/* ---------- landscape: rotate-to-PORTRAIT prompt ---------- */
#rotate {
  position: fixed; inset: 0; z-index: 12000; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  background: radial-gradient(90% 80% at 50% 45%, #131a14 0%, #060a07 60%, #000 100%);
  text-align: center; padding: 24px;
}
:root.landscape #rotate { display: flex; }
:root.landscape #app { visibility: hidden; }
/* phone icon is now wide→tall to hint "turn to vertical" */
#rotate .rot-ico {
  width: 96px; height: 60px;
  border: 4px solid var(--cyan); border-radius: 12px;
  box-shadow: 0 0 0 4px var(--ink), 0 0 24px rgba(255,176,32, 0.5);
  animation: rotSpin 2.4s ease-in-out infinite;
}
@keyframes rotSpin { 0%,40% { transform: rotate(0); } 60%,100% { transform: rotate(90deg); } }
#rotate .rot-title { color: var(--cyan-l); font-size: var(--fs-xl); letter-spacing: 3px; text-shadow: 0 0 10px var(--cyan); text-transform: uppercase; }
#rotate .rot-sub { color: var(--yellow); font-size: var(--fs-sm); letter-spacing: 2px; }

canvas { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ---------- screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.screen.active { display: flex; }

/* full-bleed background canvas for a screen */
.bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* content sits above the canvas */
.layer { position: relative; z-index: 2; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }

@keyframes flick { 0% { opacity: 1; } 50% { opacity: 0.86; } 100% { opacity: 1; } }

/* ---------- stencilled text ----------
   Military lettering is SPRAYED THROUGH A PLATE, so the shadow is a hard
   1px offset (paint bleed), not a soft blur. The blur is kept only as a
   faint second layer for the things that are genuinely lit — readouts,
   lamps, tracer — so "lit" and "painted" stay visually distinct. */
.px-text {
  font-family: var(--font);
  letter-spacing: 2px;
  text-transform: uppercase;
  line-height: 1.5;
}
.glow-c { color: var(--amber-l); text-shadow: 1px 1px 0 var(--ink), 0 0 8px rgba(255,176,32,.55); }
.glow-p { color: var(--flame-l); text-shadow: 1px 1px 0 var(--ink), 0 0 10px rgba(224,58,28,.6); }
.glow-g { color: var(--signal); text-shadow: 1px 1px 0 var(--ink), 0 0 10px rgba(57,255,110,.45); }
.glow-y { color: var(--brass); text-shadow: 1px 1px 0 var(--ink), 0 0 8px rgba(255,122,61,.5); }

/* Paint stencilled onto metal: no glow at all, just bleed and a lit top edge. */
.stencil {
  color: var(--sand-l);
  text-shadow: 1px 1px 0 var(--ink), 2px 2px 0 rgba(5,7,10,.55), 0 -1px 0 rgba(240,219,174,.25);
  letter-spacing: 3px;
}

/* ---------- stamped-plate button ----------
   A WarMatch button is a piece of painted steel bolted to the panel.
   Anatomy, from the outside in:
     · a hard black bed (the bolt shadow) offset DOWN — the plate stands
       proud of the surface, so pressing it must move it down into the bed;
     · the plate itself, a vertical bevel: lit along the top, dark at the
       bottom, because the light in this game comes from above;
     · a 2px ink outline so it survives on any backdrop;
     · corner rivets, drawn with a repeating radial-gradient.
   Pressing recoils it 4px and swaps the bevel — the plate is pushed in. */
.px-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap-lg); box-sizing: border-box;
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--bone);
  text-shadow: 1px 1px 0 rgba(5,7,10,.85);
  background:
    linear-gradient(180deg, rgba(255,255,255,.16) 0 34%, rgba(0,0,0,0) 34% 62%, rgba(0,0,0,.30) 62% 100%),
    var(--olive);
  border: 0;
  padding: 12px 24px;
  cursor: pointer;
  image-rendering: pixelated;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  box-shadow:
    0 0 0 2px var(--ink),
    0 0 0 4px rgba(5,7,10,.55),
    0 6px 0 0 rgba(5,7,10,.75);
  transition: transform .05s steps(1), background-color .1s linear;
}
/* rivets: one plate, four heads */
.px-btn::before {
  content: ""; position: absolute; inset: 4px; pointer-events: none;
  background:
    radial-gradient(circle at 3px 3px, rgba(255,255,255,.45) 0 1px, rgba(0,0,0,0) 1.5px),
    radial-gradient(circle at calc(100% - 3px) 3px, rgba(255,255,255,.30) 0 1px, rgba(0,0,0,0) 1.5px),
    radial-gradient(circle at 3px calc(100% - 3px), rgba(0,0,0,.5) 0 1px, rgba(0,0,0,0) 1.5px),
    radial-gradient(circle at calc(100% - 3px) calc(100% - 3px), rgba(0,0,0,.5) 0 1px, rgba(0,0,0,0) 1.5px);
}
.px-btn:hover { background-color: var(--olive-l); }
.px-btn:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px rgba(5,7,10,.55), 0 2px 0 0 rgba(5,7,10,.75);
  background-image: linear-gradient(180deg, rgba(0,0,0,.35) 0 40%, rgba(0,0,0,0) 40% 70%, rgba(255,255,255,.12) 70% 100%);
}

/* PRIMARY — amber, the one thing on screen that is genuinely lit. */
.px-btn.cyan {
  background-color: var(--amber); color: var(--ink); text-shadow: 0 1px 0 rgba(255,238,158,.6);
  box-shadow:
    0 0 0 2px var(--ink), 0 0 0 4px rgba(5,7,10,.55),
    0 6px 0 0 rgba(5,7,10,.75), 0 0 22px rgba(255,176,32,.35);
}
.px-btn.cyan:hover { background-color: var(--amber-l); }

/* GO — signal green, for confirmations. */
.px-btn.green {
  background-color: var(--signal); color: var(--ink); text-shadow: 0 1px 0 rgba(255,255,255,.4);
  box-shadow:
    0 0 0 2px var(--ink), 0 0 0 4px rgba(5,7,10,.55),
    0 6px 0 0 rgba(5,7,10,.75), 0 0 22px rgba(57,255,110,.3);
}

/* DANGER — blood red. */
.px-btn.danger { background-color: var(--alert); color: var(--bone); }

/* GHOST — an unpainted bracket, for secondary and back actions. */
.px-btn.ghost {
  background: rgba(13,20,16,.72); color: var(--amber-l);
  clip-path: none;
  box-shadow: 0 0 0 2px var(--amber) inset, 0 0 0 2px var(--ink);
  padding: 8px 14px; font-size: var(--fs-sm); min-height: var(--tap); letter-spacing: 1.5px;
  text-shadow: 1px 1px 0 var(--ink);
}
.px-btn.ghost::before { display: none; }
.px-btn.ghost:hover, .px-btn.ghost:active { color: var(--amber-hot); background: rgba(255,176,32,.16); }
.px-btn.ghost:active { transform: translateY(2px); }
.px-btn:disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(0.8); }
.px-btn:disabled::before { display: none; }

/* gear settings button (lobby): a square HUD chip, unified with the counters */
.px-btn.gear-btn {
  width: var(--hud-chip); height: var(--hud-chip); min-width: var(--hud-chip); min-height: 0;
  padding: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1; letter-spacing: 0;
  box-shadow: none; border: 2px solid var(--cyan); background: rgba(10,16,11, 0.7); color: var(--cyan-l);
}
.px-btn.gear-btn:hover, .px-btn.gear-btn:active { color: #fff; background: rgba(255,176,32, 0.14); }

/* shop button (lobby HUD): same chip shape as the gear button, icon fitted to size */
.px-btn.gear-btn.shop-btn canvas { display: block; image-rendering: pixelated; }
.px-btn.gear-btn.shop-btn .new-badge {
  position: absolute; left: -10px; top: -10px; z-index: 3;
  background: var(--pink); color: #fff; font-size: var(--fs-micro); letter-spacing: 0.5px;
  padding: 2px 4px; box-shadow: 0 0 0 2px var(--ink);
  animation: bob 0.8s steps(2) infinite;
}

/* ---------- armour plate / dialog ----------
   Panels are welded plate: a dark olive field under a fine diagonal mill
   finish, an amber weld seam, and a black bed. The corner marks are
   BRACKETS rather than dots — the same corner language as the HUD. */
.px-panel {
  position: relative;
  background:
    repeating-linear-gradient(135deg, rgba(138,151,163,.045) 0 1px, rgba(0,0,0,0) 1px 6px),
    linear-gradient(180deg, rgba(111,143,52,.14) 0%, rgba(0,0,0,0) 38%),
    rgba(13, 20, 16, 0.95);
  box-shadow:
    0 0 0 2px var(--amber),
    0 0 0 5px var(--ink),
    0 0 30px rgba(255,176,32, 0.20),
    inset 0 1px 0 rgba(255,224,122,.22),
    inset 0 -2px 0 rgba(5,7,10,.6);
  padding: 16px 18px;
}
.px-panel.pink {
  box-shadow:
    0 0 0 2px var(--alert), 0 0 0 5px var(--ink), 0 0 30px rgba(224,58,28, 0.24),
    inset 0 1px 0 rgba(255,154,92,.22), inset 0 -2px 0 rgba(5,7,10,.6);
}

/* corner brackets — top-left and bottom-right, mirrored on the pseudo pair */
.px-panel::before, .px-panel::after {
  content: ""; position: absolute; width: 12px; height: 12px; pointer-events: none;
}
.px-panel::before { left: 3px; top: 3px; border-left: 2px solid var(--amber); border-top: 2px solid var(--amber); }
.px-panel::after { right: 3px; bottom: 3px; border-right: 2px solid var(--amber); border-bottom: 2px solid var(--amber); }
.px-panel.pink::before { border-color: var(--alert); }
.px-panel.pink::after { border-color: var(--alert); }

/* ---------- typewriter caret ---------- */
.caret::after {
  content: "\2588";
  animation: blink 0.7s steps(1) infinite;
  margin-left: 2px;
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* =====================================================================
   CUTSCENE
===================================================================== */
#cutscene { background: #000; }
/* the hand-drawn frame — CONTAIN so nothing is cropped; letterbox bars fill the
   rest of the portrait screen (top & bottom) */
#cutImg {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%; object-fit: contain;
  image-rendering: pixelated; image-rendering: crisp-edges;
  transform-origin: center;
}
/* slow push-in; restarted per beat by toggling the class */
#cutImg.kb { animation: kenburns 9s linear both; }
@keyframes kenburns { from { transform: scale(1.0); } to { transform: scale(1.07); } }
/* transparent fx layer stacked over the frame */
#cutscene .cut-stage {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2;
  background: transparent;
}
/* PORTRAIT: text spans the FULL width across the bottom (over the letterbox bar) */
#cutscene .cut-text {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  transform: none;
  width: 100%; max-width: 100%;
  height: fit-content; min-height: 0;
  white-space: normal;
  padding: 12px calc(14px + var(--edge-r)) calc(14px + var(--safe-l)) calc(14px + var(--edge));
  text-align: center;
  z-index: 3;
  font-size: var(--fs-md);
  line-height: 1.35;
  color: var(--cyan-l);
  text-shadow: 0 0 8px rgba(255,176,32, 0.55);
  background: linear-gradient(0deg, rgba(7,10,8, 0.96) 70%, rgba(7,10,8, 0));
  border-top: 3px solid var(--cyan);
  text-transform: none;
  letter-spacing: 0.5px;
}
#cutscene .cut-text .who {
  display: block; color: var(--pink-l); font-size: var(--fs-sm); letter-spacing: 2px;
  text-transform: uppercase; margin-bottom: 2px; line-height: 1.15; text-shadow: 0 0 8px var(--pink);
}
#cutscene .skip {
  position: absolute; right: var(--edge-r); top: 14px; z-index: 4;
}
#cutscene .prompt-next {
  position: absolute; right: max(16px, var(--edge-r)); bottom: 96px; z-index: 4;
  color: var(--yellow); font-size: var(--fs-sm); letter-spacing: 1px;
  background: rgba(7,10,8, 0.8); padding: 4px 8px;
  animation: bob 0.9s steps(2) infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

/* =====================================================================
   MENU
===================================================================== */
#menu .layer { justify-content: space-between; padding: calc(4 * var(--vh)) 0; }
#menu .title-wrap { text-align: center; flex: 0 0 auto; }
#menu .t1 {
  font-size: clamp(26px, calc(4.4 * var(--vw)), 52px);
  font-weight: 700;
  letter-spacing: 5px;
  color: #fff;
  text-shadow:
    0 0 0 #000,
    3px 3px 0 var(--pink),
    -3px -3px 0 var(--cyan),
    0 0 26px rgba(224,58,28, 0.7);
  animation: hover1 3.4s ease-in-out infinite;
}
@keyframes hover1 { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

#menu .menu-bottom {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 12px;
}

/* =====================================================================
   CRT TERMINAL (green screen)
===================================================================== */
#crt { background: radial-gradient(90% 80% at 50% 40%, #131a14 0%, #060a07 60%, #000 100%); }
/* WIDESCREEN fullscreen terminal: the phosphor screen fills the whole stage.
   #crt keeps a Zoras column on the right (only while she speaks); .hacked-os
   fills edge to edge. */
#crt .crt-stage, .hacked-os .crt-stage {
  position: relative; z-index: 2;
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
  gap: var(--sp2); padding: 8px var(--edge-r) 8px var(--edge);
}

/* the "case" is now just a full-size container — the beige micro chrome is gone
   so the green screen goes edge to edge (widescreen, not a square tube). */
.pc-case {
  flex: 1 1 auto; min-width: 0;
  width: auto; height: 100%;
  background: none; padding: 0; box-shadow: none;
  display: flex; flex-direction: column;
}
.pc-top, .pc-chin { display: none; }   /* hide the beige microcomputer chrome */
.pc-bezel {
  flex: 1 1 auto; min-height: 0;
  background: none; padding: 0; box-shadow: none;
  display: flex;
}
.pc-brand, .pc-led, .pc-vents, .pc-drive { display: none; }

#crt .monitor, .hacked-os .monitor {
  position: relative;
  width: 100%; height: 100%;
  background: #05170b;
  box-shadow: inset 0 0 120px rgba(57,255,110, 0.10), 0 0 0 2px rgba(57,255,110,.35), 0 0 40px rgba(57,255,110, 0.18);
  border-radius: 4px;
  padding: 12px 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.crt-baud { font-size: var(--fs-micro); letter-spacing: 1px; opacity: 0.6; }

/* Zoras — BOTTOM row beneath the fullscreen screen, shown once she has something
   to say. When hidden, the terminal expands to the full height. */
#crt .crt-zoras { display: none; flex: 0 0 auto; width: 100%; padding: 0; flex-direction: row; align-items: flex-end; justify-content: center; gap: var(--sp2); }
#crt .crt-zoras.show { display: flex; }
#crt .crt-zoras .zoras-frame { flex: 0 0 auto; }
#crt .crt-zoras .zoras-frame img, #crt .crt-zoras .zoras-frame video { height: clamp(96px, 14 * var(--vh), 128px); width: auto; }
#crt .crt-zoras .zoras-box { flex: 1 1 auto; min-height: 60px; max-height: 130px; font-size: 13px; line-height: 1.45; padding: 10px 18px 14px 12px; }
#crt .crt-zoras .zoras-box .who { font-size: 11px; margin-bottom: 5px; }
#crt .monitor::after, .hacked-os .monitor::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.3) 3px 4px);
}
/* ---- CX-64 monitor content: DENSE. The phosphor screen is a small
   "screen-within-a-screen", so its type & controls are much smaller than the
   full-screen UI — several messages fit at once and buttons don't dominate. ---- */
#crt .crt-head, .hacked-os .crt-head {
  display: flex; justify-content: space-between; align-items: center; gap: var(--sp2);
  color: var(--green); font-size: 12px; letter-spacing: 1px;
  border-bottom: 2px solid rgba(57,255,110, 0.35); padding-bottom: 8px; margin-bottom: 10px;
  flex: 0 0 auto;
}
/* leave room at top-left for the case exit (door) icon overlaid fixed */
#crt .crt-head { padding-left: 46px; }
/* compact icon-only buttons (skip ⏭ etc.) */
.px-btn.icon-only { font-size: 18px; line-height: 1; letter-spacing: 0; min-width: 0; padding: 6px 10px; }
#crt .crt-head .px-btn.icon-only, .hacked-os .crt-head .px-btn.icon-only { font-size: 18px; min-height: 30px; padding: 3px 10px; }
#crt .crt-body, .hacked-os .crt-body {
  flex: 1 1 auto; overflow-y: auto; overflow-x: hidden;
  color: var(--green);
  font-size: 14px;
  line-height: 1.5;
  text-shadow: 0 0 6px rgba(57,255,110, 0.65);
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--green) transparent;
}
#crt .crt-body::-webkit-scrollbar { width: 6px; }
#crt .crt-body::-webkit-scrollbar-thumb { background: rgba(57,255,110,.4); }
#crt .crt-foot, .hacked-os .crt-foot { flex: 0 0 auto; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; gap: var(--sp2); }
/* terminal buttons (ДАЛІ / ПРОПУСТИТИ / ВІДКЛЮЧИТИСЬ / os-back) — readable now */
#crt .crt-head .px-btn, #crt .crt-foot .px-btn,
.hacked-os .crt-head .px-btn, .hacked-os .crt-foot .px-btn {
  min-height: 30px; font-size: 11px; padding: 6px 12px; letter-spacing: 1px;
}
.crt-baud { font-size: 10px; }

.crt-line { white-space: pre-wrap; word-break: break-word; }
.crt-line.dim { color: rgba(57,255,110, 0.55); }
.crt-line.warn { color: var(--yellow); text-shadow: 0 0 6px var(--orange); }
.crt-line.alert { color: #ff5b3a; text-shadow: 0 0 8px var(--red); }
.crt-line.sp { height: 10px; }
.crt-line.zoras-recall { color: rgba(255,140,80, 0.72); font-style: italic; }

/* ---- client profile scan (offer intro) ---- */
.profile-scan { position: relative; border: 1px solid rgba(255,176,32,.4); background: rgba(0,40,50,.28); border-radius: 6px; padding: 10px 12px; margin: 8px 0; overflow: hidden; }
.profile-scan .ps-head { font-size: .82em; letter-spacing: 1px; color: var(--cyan-l); margin-bottom: 8px; }
.profile-scan.scanning { min-height: 64px; }
.ps-scanline { position: absolute; left: 0; right: 0; height: 26px; top: 0; background: linear-gradient(180deg, transparent, rgba(255,176,32,.22), transparent); animation: psScan 1s linear infinite; }
@keyframes psScan { 0%{ transform: translateY(0);} 100%{ transform: translateY(64px);} }
.ps-row { display: flex; gap: 12px; align-items: flex-start; }
.ps-photo-fr { flex: 0 0 auto; border: 2px solid rgba(255,176,32,.5); border-radius: 4px; padding: 2px; background: #0a1410; }
.ps-photo { display: block; width: 88px; height: 88px; object-fit: cover; image-rendering: auto; border-radius: 2px; cursor: pointer; }
.ps-fields { display: flex; flex-direction: column; gap: 4px; font-size: .92em; }
.ps-field { display: flex; gap: 6px; }
.ps-field .ps-k { color: rgba(255,176,32,.7); min-width: 96px; }
.ps-field .ps-v { color: #d8ffe4; }

/* ---- case board: culprit box (dark), split + accusable ---- */
.slot.culprit { z-index: 3; }
.slot.culprit .culprit-q,
.slot.culprit .culprit-split { width: clamp(84px, calc(11 * var(--vw)), 116px); height: clamp(84px, calc(11 * var(--vw)), 116px); border: 2px solid #6b7266; background: repeating-linear-gradient(45deg, #121810, #121810 6px, #171f18 6px, #171f18 12px); box-shadow: inset 0 0 24px rgba(0,0,0,.6); }
.slot.culprit .culprit-q { display: flex; align-items: center; justify-content: center; font-size: 44px; color: #8b937f; font-weight: 700; }
.culprit-split { display: flex; overflow: hidden; }
.culprit-split .cs-half { flex: 1; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; position: relative; }
.culprit-split .cs-half.left { background: linear-gradient(180deg, rgba(74,99,35,.22), rgba(28,34,40,.45)); border-right: 1px dashed rgba(200,40,28,.6); }
.culprit-split .cs-half.right { background: linear-gradient(180deg, rgba(170,60,30,.18), rgba(70,26,14,.35)); }
.culprit-split .cs-name { font-size: clamp(9px, calc(1 * var(--vw)), 12px); color: #e6ecdf; text-align: center; text-shadow: 0 1px 2px #000; }
.slot.culprit.accusable { cursor: pointer; }
.slot.culprit.accusable .culprit-split { border-color: var(--red); box-shadow: 0 0 16px rgba(200,40,28,.7), inset 0 0 20px rgba(200,40,28,.25); animation: culpritPulse 1.3s ease-in-out infinite; }
@keyframes culpritPulse { 0%,100%{ box-shadow: 0 0 12px rgba(200,40,28,.5), inset 0 0 20px rgba(200,40,28,.2);} 50%{ box-shadow: 0 0 22px rgba(200,40,28,.95), inset 0 0 24px rgba(200,40,28,.35);} }
.slot.culprit.accusable .cap { color: #ff8a6a; text-shadow: 0 0 6px var(--red); }

/* ---- HackedOS photo ---- */
.osr-photo { display: block; max-width: 100%; max-height: 320px; margin-top: 8px; border: 1px solid rgba(57,255,110,.4); border-radius: 4px; cursor: pointer; }
.fc-photo { display: block; max-width: 100%; max-height: 260px; margin-top: 6px; border: 1px solid rgba(57,255,110,.4); border-radius: 4px; cursor: pointer; }

/* ---- media viewer (fullscreen photo/video) ---- */
.media-viewer { position: fixed; inset: 0; z-index: 9990; display: none; align-items: center; justify-content: center; background: rgba(4,6,5,.94); }
.media-viewer.show { display: flex; }
.media-viewer .mv-close { position: absolute; top: 16px; right: 20px; z-index: 2; width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255,255,255,.4); background: rgba(0,0,0,.5); color: #fff; font-size: 20px; cursor: pointer; }
.mv-stage { max-width: calc(94 * var(--vw)); max-height: calc(92 * var(--vh)); display: flex; align-items: center; justify-content: center; }
.mv-img { max-width: calc(94 * var(--vw)); max-height: calc(92 * var(--vh)); object-fit: contain; }
.mv-video { max-width: calc(94 * var(--vw)); max-height: calc(92 * var(--vh)); }

/* ---- reward fly overlay (over the lobby): tap → icons fly to the counters ---- */
.reward-fly { position: fixed; inset: 0; z-index: 9995; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 42%, rgba(12,5,34,.66), rgba(4,6,5,.93)); opacity: 0; transition: opacity .35s; pointer-events: none; }
.reward-fly.show { opacity: 1; pointer-events: auto; }
.rf-panel { display: flex; flex-direction: column; align-items: center; gap: 16px; transform: scale(.88); transition: transform .35s cubic-bezier(.3,1.4,.5,1); }
.reward-fly.show .rf-panel { transform: scale(1); }
.rf-title { font-family: var(--font); font-size: 20px; letter-spacing: 5px; color: var(--yellow); text-shadow: 0 0 14px var(--orange); }
.rf-chips { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.rf-chip { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 20px;
  background: rgba(9,14,10,.9); box-shadow: 0 0 0 2px currentColor, 0 0 26px rgba(0,0,0,.55); will-change: transform, opacity; }
.rf-chip.k-hack { color: var(--green); }
.rf-chip.k-credits { color: var(--pink); }
.rf-chip.k-xp { color: var(--cyan); }
.rf-ic { font-size: 34px; line-height: 1; text-shadow: 0 0 16px currentColor; }
.rf-amt { font-family: var(--font); font-size: 22px; font-weight: 700; color: #fff; }
.rf-lab { font-family: var(--font); font-size: 10px; letter-spacing: 1.5px; color: var(--cyan-l); }
.rf-hint { font-family: var(--font); font-size: 12px; letter-spacing: 2px; color: var(--cyan-l); opacity: .85; margin-top: 4px; animation: rfBlink 1.1s steps(2) infinite; }
.reward-fly.go .rf-hint, .reward-fly.go .rf-title { opacity: 0; transition: opacity .2s; }
@keyframes rfBlink { 50% { opacity: .3; } }
.counter-pop { display: inline-block; animation: counterPop .34s ease; }
@keyframes counterPop { 0%,100% { transform: scale(1); } 45% { transform: scale(1.55); filter: brightness(1.7); } }

/* ---- gallery grid ---- */
.gallery-screen { position: fixed; inset: 0; z-index: 55; display: none; flex-direction: column; background: #070b08; }
.gallery-screen.show { display: flex; }
.gal-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid rgba(255,140,80,.3); }
.gal-title { color: var(--pink); letter-spacing: 2px; font-size: 1.1em; }
/* fixed column + row tracks (was minmax 1fr + aspect-ratio: the auto row track
   didn't grow to the aspect-ratio height, so rows overlapped the next row) */
.gal-grid { flex: 1; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, 160px); grid-auto-rows: 160px; gap: 12px; padding: 18px; align-content: start; justify-content: center; }
.gal-empty { grid-column: 1/-1; text-align: center; color: rgba(255,255,255,.5); padding: 40px; }
.gal-cell { position: relative; border: 1px solid rgba(255,176,32,.3); border-radius: 6px; overflow: hidden; background: #0c110d; cursor: pointer; padding: 0; width: 100%; height: 100%; }
.gal-cell .gal-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal-cell .gal-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 34px; color: #fff; text-shadow: 0 2px 8px #000; pointer-events: none; }
.gal-cell .gal-cap { position: absolute; left: 0; right: 0; bottom: 0; font-size: .72em; color: #e6ecdf; background: rgba(0,0,0,.6); padding: 3px 5px; text-align: left; }

/* ---- COLLECTIONS HUB (fullscreen category chooser: photo / video / music) ---- */
#collections {
  position: fixed; inset: 0; z-index: 54; display: none;
  flex-direction: column;
  background: radial-gradient(130% 100% at 50% 20%, #131b14 0%, #080d09 55%, #030604 100%);
}
#collections.show { display: flex; }
#collections::after {
  content: ""; position: absolute; inset: 0; z-index: 6; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.17) 3px 4px);
}
.col-topbar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 14px max(16px, env(safe-area-inset-right,0px)) 12px max(16px, env(safe-area-inset-left,0px));
  border-bottom: 2px solid rgba(255,176,32,.22); position: relative; z-index: 2;
}
.col-title { font-size: 22px; letter-spacing: 4px; }
.col-grid {
  flex: 1 1 auto; min-height: 0; position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: stretch; justify-content: center;
  gap: 18px; padding: 20px max(18px, env(safe-area-inset-right,0px)) 28px max(18px, env(safe-area-inset-left,0px));
}
.col-card {
  position: relative; flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 128px; padding: 22px 18px; cursor: pointer; font-family: var(--font);
  color: var(--cyan-l); background: rgba(12,18,13, 0.9);
  box-shadow: 0 0 0 3px var(--cyan), 0 0 0 6px var(--ink), 0 0 26px rgba(255,176,32, 0.22);
  transition: transform 0.08s steps(1), filter 0.12s;
}
.col-card:hover, .col-card:active { transform: translateY(-3px); filter: brightness(1.15); }
.col-card.video { box-shadow: 0 0 0 3px var(--pink), 0 0 0 6px var(--ink), 0 0 26px rgba(224,58,28, 0.28); color: var(--pink-l); }
.col-card .col-ic { font-size: 44px; line-height: 1; text-shadow: 0 0 16px currentColor; }
.col-card .col-name { font-size: 22px; letter-spacing: 4px; color: #fff; }
.col-card .col-sub { font-size: 11px; letter-spacing: 2px; color: var(--grey); }

/* ---- LEADERBOARD (fullscreen: per-game boards + one combined overall board) ---- */
#leaderboard {
  position: fixed; inset: 0; z-index: 54; display: none;
  flex-direction: column;
  background: radial-gradient(130% 100% at 50% 20%, #131b14 0%, #080d09 55%, #030604 100%);
}
#leaderboard.show { display: flex; }
.lb-tabs { flex: 0 0 auto; display: flex; gap: 10px; padding: 12px 16px 0; }
.lb-tab {
  flex: 1 1 auto; padding: 11px 6px; font-family: var(--font); font-size: 13px; font-weight: 700; letter-spacing: 1px;
  color: #cbd2c4; background: rgba(12,18,13, 0.9); line-height: 1.25;
  box-shadow: 0 0 0 2px rgba(255,176,32, 0.35), 0 0 0 4px var(--ink); cursor: pointer;
}
.lb-tab.active { color: #fff; box-shadow: 0 0 0 2px var(--cyan), 0 0 0 4px var(--ink), 0 0 16px rgba(255,176,32, 0.35); }
.lb-gamepicker { flex: 0 0 auto; display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; }
.lb-chip {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 9px 11px; background: rgba(12,18,13, 0.9); color: #cbd2c4; cursor: pointer;
  box-shadow: 0 0 0 2px rgba(255,176,32, 0.25), 0 0 0 4px var(--ink);
}
.lb-chip.active { color: #fff; box-shadow: 0 0 0 2px var(--cyan), 0 0 0 4px var(--ink), 0 0 14px rgba(255,176,32, 0.3); }
.lb-chip-ic { width: 28px; height: 28px; image-rendering: pixelated; }
.lb-chip-name { font-size: 11px; font-weight: 700; letter-spacing: 0.3px; white-space: nowrap; }
.lb-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 16px 24px; }
.lb-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; margin-bottom: 4px;
  background: rgba(19,27,20, 0.65); font-size: 13px; color: var(--ink-l, #f2f0e4);
}
.lb-row .lb-rank { flex: 0 0 30px; color: var(--grey); font-weight: 700; text-align: center; }
.lb-row .lb-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .lb-score { flex: 0 0 auto; color: var(--yellow); font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-row.top1 { box-shadow: 0 0 0 2px var(--yellow), 0 0 14px rgba(230,190,110, 0.35); }
.lb-row.top2 { box-shadow: 0 0 0 2px #cbd3c6, 0 0 12px rgba(203,211,198, 0.3); }
.lb-row.top3 { box-shadow: 0 0 0 2px var(--orange), 0 0 12px rgba(255,122,61, 0.3); }
.lb-row.me { box-shadow: 0 0 0 2px var(--pink), 0 0 16px rgba(224,58,28, 0.35); background: rgba(44,20,10, 0.75); }
.lb-row.me .lb-name { color: var(--pink-l); font-weight: 700; }
.lb-sep { text-align: center; color: var(--grey); padding: 4px 0; letter-spacing: 4px; }

/* ---- SHOP (fullscreen storefront: currency / xp / hack-point packs) ---- */
#shop {
  position: fixed; inset: 0; z-index: 54; display: none;
  flex-direction: column;
  background: radial-gradient(130% 100% at 50% 20%, #131b14 0%, #080d09 55%, #030604 100%);
}
#shop.show { display: flex; }
#shop::after {
  content: ""; position: absolute; inset: 0; z-index: 6; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.17) 3px 4px);
}
.shop-balance {
  flex: 0 0 auto; text-align: center; padding: 12px 16px; font-size: 14px; letter-spacing: 1px;
  color: #d6dbd0; position: relative; z-index: 2;
}
.shop-balance b { color: #fff; font-size: 17px; font-weight: 800; }
.shop-grid {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; position: relative; z-index: 1;
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  padding: 10px max(16px, env(safe-area-inset-right,0px)) 28px max(16px, env(safe-area-inset-left,0px));
  align-content: start;
}
.shop-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 22px 12px 16px; background: rgba(12,18,13, 0.92); color: #fff; font-family: var(--font);
  box-shadow: 0 0 0 3px var(--cyan), 0 0 0 6px var(--ink), 0 0 22px rgba(255,176,32, 0.2);
}
.shop-card.gold { box-shadow: 0 0 0 3px var(--yellow), 0 0 0 6px var(--ink), 0 0 22px rgba(230,190,110, 0.25); }
.shop-card.pink { box-shadow: 0 0 0 3px var(--pink), 0 0 0 6px var(--ink), 0 0 22px rgba(224,58,28, 0.25); }
.shop-card.bought { opacity: 0.55; filter: grayscale(0.4); }
.shop-card .sc-tag {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: var(--pink); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.5px;
  padding: 4px 10px; box-shadow: 0 0 0 2px var(--ink); z-index: 2;
}
.shop-card.gold .sc-tag { background: var(--yellow); color: #1a1004; }
.shop-card .sc-unit { font-size: 26px; line-height: 1; margin-top: 6px; text-shadow: 0 0 10px currentColor; }
.shop-card .sc-amount { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; color: #fff; }
.shop-card .sc-bonus { font-size: 11px; color: #7dffa6; font-weight: 700; letter-spacing: 0.3px; text-align: center; }
.shop-card .sc-buy {
  margin-top: 10px; width: 100%; border: 0; padding: 12px 6px; font-family: inherit; font-size: 15px;
  font-weight: 800; letter-spacing: 1px; color: #05070a; background: var(--green); cursor: pointer;
  box-shadow: 0 0 0 2px var(--green) inset, 0 0 0 4px var(--ink), 0 4px 0 rgba(0,0,0,.4);
}
.shop-card .sc-buy:active { transform: translateY(2px); box-shadow: 0 0 0 2px var(--green) inset, 0 0 0 4px var(--ink); }
.shop-card .sc-buy[disabled] { background: var(--grey); box-shadow: 0 0 0 2px var(--grey) inset, 0 0 0 4px var(--ink); cursor: default; }

/* ---- SHOP: КОМПЛЕКСИ (combo bundle cards — full-width, all 3 resources listed) ---- */
.bundle-grid { grid-template-columns: 1fr; gap: 16px; }
.shop-card.bundle {
  grid-column: 1 / -1; box-shadow: 0 0 0 3px var(--yellow), 0 0 0 6px var(--ink), 0 0 26px rgba(230,190,110, 0.22);
  padding: 24px 20px 18px; align-items: stretch;
}
.bn-title { text-align: center; font-size: 12px; letter-spacing: 3px; color: var(--yellow); font-weight: 800; margin-bottom: 4px; }
.bn-rows { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 2px; }
.bn-row { display: flex; align-items: baseline; gap: 10px; padding: 8px 12px; background: rgba(255,255,255,0.04); }
.bn-row .bn-ic { font-size: 20px; line-height: 1; text-shadow: 0 0 8px currentColor; flex: 0 0 auto; }
.bn-row .bn-num { font-size: 20px; font-weight: 900; color: #fff; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.bn-row .bn-lbl { font-size: 12px; color: #bcc2b3; letter-spacing: 0.5px; }
.bn-row.gold .bn-ic { color: var(--yellow); }
.bn-row.cyan .bn-ic { color: var(--cyan); }
.bn-row.pink .bn-ic { color: var(--pink); }
.bn-bonus { text-align: center; font-size: 11px; color: #7dffa6; font-weight: 700; letter-spacing: 0.5px; margin-top: 2px; }

/* ---- SHOP: БУСТЕРИ ІГОР (named booster chips so the pack means something) ---- */
.shop-card.boost { padding-top: 26px; }
.bo-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0 2px; }
.bo-chip {
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px; color: #ffe0a8;
  background: rgba(255,176,32, 0.12); padding: 4px 9px; box-shadow: 0 0 0 1px rgba(255,176,32, 0.4);
}

/* ---- SHOP: subscription tab (single hero card, green-terminal x neon) ---- */
.lb-tab.sub-tab.active { box-shadow: 0 0 0 2px var(--yellow), 0 0 0 4px var(--ink), 0 0 16px rgba(230,190,110, 0.35); }
.sub-grid { grid-template-columns: 1fr; }
.sub-card {
  grid-column: 1 / -1; background: #05170b; color: var(--green);
  box-shadow: inset 0 0 60px rgba(57,255,110, 0.1), 0 0 0 3px var(--pink), 0 0 0 6px var(--ink), 0 0 30px rgba(224,58,28, 0.25);
  padding: 26px 20px; text-align: center; font-family: var(--font8, var(--font));
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.sub-card-title { font-size: 20px; letter-spacing: 3px; color: #fff; text-shadow: 0 0 10px var(--green); }
.sub-card-price { font-size: 13px; letter-spacing: 1px; color: var(--yellow); text-shadow: 0 0 8px var(--orange); }
.sub-card-list { list-style: none; text-align: left; font-size: 13px; line-height: 1.9; color: var(--green); text-shadow: 0 0 6px rgba(57,255,110,.5); }
.sub-card .sc-buy { max-width: 280px; }

/* ---- SUBSCRIPTION PROMO (boot-time takeover: old-PC terminal + retrowave) ---- */
#subPromo {
  position: fixed; inset: 0; z-index: 9800; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(4,6,5, 0); transition: background 0.25s;
  font-family: var(--font8, var(--font));
}
#subPromo.show { background: rgba(4,6,5, 0.86); }
.sp-crt {
  width: 100%; max-width: 340px; background: #05170b; color: var(--green);
  box-shadow: inset 0 0 80px rgba(57,255,110, 0.12), 0 0 0 3px var(--cyan), 0 0 0 6px var(--ink), 0 0 40px rgba(255,176,32, 0.3);
  transform: scale(0.92) translateY(10px); opacity: 0; transition: transform 0.25s, opacity 0.25s;
  position: relative; overflow: hidden;
}
#subPromo.show .sp-crt { transform: scale(1) translateY(0); opacity: 1; }
.sp-crt::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.22) 3px 4px);
}
.sp-head {
  font-size: 10px; letter-spacing: 2px; padding: 8px 14px; color: var(--green);
  border-bottom: 1px solid rgba(57,255,110, 0.3); text-transform: uppercase;
}
.sp-blink { color: var(--pink); animation: sp-blink 1s steps(1) infinite; }
@keyframes sp-blink { 50% { opacity: 0; } }
.sp-body { padding: 20px 20px 22px; text-align: center; position: relative; z-index: 1; }
.sp-title { font-size: 22px; letter-spacing: 3px; color: #fff; text-shadow: 0 0 12px var(--cyan); margin-bottom: 8px; }
.sp-price { font-size: 12px; letter-spacing: 1px; color: var(--yellow); text-shadow: 0 0 8px var(--orange); margin-bottom: 16px; }
.sp-list { list-style: none; text-align: left; font-size: 13px; line-height: 2; color: var(--green); text-shadow: 0 0 6px rgba(57,255,110,.5); margin-bottom: 18px; }
.sp-cta {
  display: block; width: 100%; border: 0; padding: 12px 10px; font-family: inherit; font-size: 13px;
  font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: #05070a; background: var(--pink);
  box-shadow: 0 0 0 2px var(--pink) inset, 0 0 0 4px var(--ink), 0 6px 0 rgba(0,0,0,.4); cursor: pointer;
}
.sp-cta:active { transform: translateY(2px); box-shadow: 0 0 0 2px var(--pink) inset, 0 0 0 4px var(--ink); }
.sp-cta[disabled] { background: var(--grey); box-shadow: 0 0 0 2px var(--grey) inset, 0 0 0 4px var(--ink); }
.sp-skip { display: block; width: 100%; margin-top: 10px; border: 0; background: transparent; cursor: pointer; color: var(--grey); font-family: inherit; font-size: 11px; letter-spacing: 1px; padding: 6px; }
.sp-skip:hover, .sp-skip:active { color: #fff; }

/* ---- Zoras overlay dock: comments OVER the current screen (board, etc.) ---- */
.zoras-overlay { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9700; display: none; padding: 0 16px 14px; pointer-events: none; }
.zoras-overlay.show { display: block; }
.zoras-overlay .zoras-dock { pointer-events: auto; max-width: 940px; margin: 0; padding: 0 14px 12px; gap: 12px; }
/* компактний банер, щоб не перекривати дошку під час коментаря */
.zoras-overlay .zoras-frame img, .zoras-overlay .zoras-frame video { height: 132px; }
.zoras-overlay .zoras-box { min-height: 0; padding: 12px 16px 30px; font-size: 15px; }

/* ---- accusation popup ---- */
.accuse-overlay { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; background: rgba(6,9,7,.86); backdrop-filter: blur(3px); }
.accuse-overlay.show { display: flex; }
.acc-card { width: min(920px, calc(94 * var(--vw))); max-height: calc(92 * var(--vh)); overflow: auto; background: #0c110d; border: 2px solid var(--red); border-radius: 10px; padding: 18px; box-shadow: 0 0 40px rgba(200,40,28,.4); }
.acc-title { text-align: center; color: #ff8a6a; letter-spacing: 2px; margin-bottom: 14px; text-shadow: 0 0 8px var(--red); }
.acc-grid { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.acc-susp { flex: 1 1 340px; max-width: 420px; background: rgba(18,24,16,.7); border: 1px solid rgba(255,140,80,.35); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.acc-face { width: 100%; height: 150px; object-fit: cover; border-radius: 5px; border: 1px solid rgba(255,176,32,.3); }
.acc-name { font-size: var(--fs-lg); color: var(--cyan-l); letter-spacing: 1px; }
.acc-doss { font-size: var(--fs-md); line-height: 1.4; color: #d6dccb; flex: 1; }
.acc-btn { align-self: stretch; }

/* ---- cutscene overlay (image frames) ---- */
.cutscene-overlay { position: fixed; inset: 0; z-index: 65; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: #030604; padding: calc(3 * var(--vh)) calc(4 * var(--vw)); }
.cutscene-overlay.show { display: flex; }
.cut-img { max-width: min(1100px, calc(92 * var(--vw))); max-height: calc(62 * var(--vh)); object-fit: contain; border: 2px solid rgba(255,176,32,.35); border-radius: 6px; box-shadow: 0 0 40px rgba(0,0,0,.7); }
.cut-text { max-width: min(900px, calc(90 * var(--vw))); min-height: 3.2em; color: #e6ecdf; font-size: clamp(14px, calc(1.8 * var(--vw)), 18px); line-height: 1.5; text-align: center; white-space: pre-wrap; }
.cut-next { min-width: 160px; }

/* ---- standalone photo sent in the thread ---- */
.th-image { margin: 8px 0; max-width: 320px; }
.th-image .thi-img { display: block; width: 100%; max-width: 320px; border: 2px solid rgba(255,140,80,.45); border-radius: 4px; cursor: pointer; image-rendering: auto; }
.th-image .thi-cap { font-size: .82em; color: rgba(255,140,80,.8); margin-top: 3px; }

/* chat log inside the terminal — portraits are tinted to the phosphor */
.chat { margin: 6px 0; padding-left: 7px; border-left: 3px solid rgba(57,255,110,.35); display: flex; gap: 8px; align-items: flex-start; }
.chat .face {
  width: 38px; height: 38px; flex: 0 0 auto;
  object-fit: cover; image-rendering: pixelated;
  box-shadow: 0 0 0 2px rgba(57,255,110,.6);
  filter: grayscale(1) sepia(1) hue-rotate(58deg) saturate(3.4) brightness(1.15) contrast(1.1);
}
.chat.b .face { box-shadow: 0 0 0 2px rgba(255,224,122,.6); }
.chat .chat-text { flex: 1 1 auto; min-width: 0; }
.chat .nick { color: var(--cyan-l); text-shadow: 0 0 6px var(--cyan); }
.chat.b .nick { color: var(--pink-l); text-shadow: 0 0 6px var(--pink); }
.chat .msg { color: var(--green); }

/* video attachment inside a chat line */
.chat-video {
  display: inline-block; margin-top: 8px;
  font-family: var(--font); font-size: 11px; letter-spacing: 1px;
  color: var(--cyan-l); background: rgba(255,176,32, 0.08);
  border: 0; padding: 8px 12px; cursor: pointer;
  box-shadow: 0 0 0 2px var(--cyan), 0 0 0 4px var(--ink);
  text-shadow: 0 0 6px var(--cyan);
}
.chat-video:hover { background: rgba(255,176,32, 0.2); color: #fff; }

/* case-file caller portrait */
.crt-portrait { display: flex; justify-content: center; margin: 3px 0 8px; }
.crt-portrait img {
  width: 72px; height: auto; image-rendering: pixelated;
  box-shadow: 0 0 0 3px rgba(57,255,110, 0.7), 0 0 20px rgba(57,255,110, 0.25);
  filter: grayscale(1) sepia(1) hue-rotate(58deg) saturate(3) brightness(1.1);
}

/* hack progress bar */
.hackbar { width: 100%; height: 22px; background: #06210d; box-shadow: inset 0 0 0 2px rgba(57,255,110,.5); position: relative; }
.hackbar > i { display: block; height: 100%; width: 0%; background: var(--green); box-shadow: 0 0 12px var(--green); transition: width .25s steps(8); }
/* percent stays legible over BOTH the dark track and the green fill:
   white text with a dark outline, not dark-on-dark */
.hackbar > span { position: absolute; inset: 0; display: grid; place-items: center; font-size: var(--fs-xs); color: #eafff0; letter-spacing: 2px; font-weight: 700; text-shadow: 0 0 2px #000, 0 0 4px #000, 1px 1px 0 #05170b; }

/* =====================================================================
   LOBBY (PORTRAIT): HUD → Zoras (top) → game tiles → feature rail (bottom).
   Ordered with flex `order` so the DOM stays intact but Zoras rides at the top.
===================================================================== */
#lobby .layer { flex-direction: column; justify-content: flex-start; padding: 0; gap: 2px; }

/* HUD: compact top band. Meter (tutorial) / currency (free-roam) on the left,
   icon buttons on the right; nothing overlaps, safe-area padded. */
.lobby-top {
  order: 0; flex: 0 0 auto;
  width: 100%; padding: 10px var(--edge-r) 8px var(--edge);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp2);
  z-index: 3; min-height: var(--hud-h);
}
#btnAudio, #devReset { flex: 0 0 auto; }
.hack-meter { flex: 1 1 auto; max-width: 560px; }
.hack-meter .hm-label {
  font-size: var(--fs-sm); letter-spacing: 2px; color: var(--cyan-l);
  margin-bottom: 5px; display: flex; justify-content: space-between;
  text-shadow: 0 0 8px rgba(255,176,32, 0.4);
}
.hack-meter .hm-label #hmNum { color: var(--yellow); font-size: 1.1em; text-shadow: 0 0 8px var(--orange); }
.hack-meter .hm-bar { height: 22px; background: rgba(6,9,7, 0.85); box-shadow: 0 0 0 3px var(--cyan), 0 0 0 6px var(--ink); position: relative; overflow: hidden; }
.hack-meter .hm-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--pink), var(--cyan)); box-shadow: 0 0 14px var(--cyan); transition: width 0.45s steps(12); }
.hack-meter .hm-bar::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,.35) 0 2px, transparent 2px 6px);
}

.lobby-mid {
  order: 2; flex: 1 1 auto; min-height: 0; width: 100%; z-index: 3;
  display: flex; align-items: stretch; justify-content: center;
  padding: 4px var(--edge) 4px var(--edge);
}

/* the decryption nodes: a GRID that scales to N games — real nodes first,
   then dashed "coming soon" placeholders so the capacity for more is visible */
.zone {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 10px; width: 100%; min-height: 0;
  overflow-x: hidden; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,176,32,.4) transparent;
  padding-bottom: 10px;
}
.zone::-webkit-scrollbar { width: 6px; }
.zone::-webkit-scrollbar-thumb { background: rgba(255,176,32,.4); border-radius: 3px; }
.zone-title {
  font-size: var(--fs-sm); font-weight: 400; letter-spacing: 3px; text-transform: uppercase;
  color: var(--cyan-l); opacity: 0.85; text-shadow: 0 0 8px rgba(255,176,32, 0.5);
  flex: 0 0 auto;
}
.zone-nodes {
  flex: 0 0 auto; min-height: 0; width: 100%; max-width: 384px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: var(--sp4) var(--sp2); align-content: start; justify-items: center;
  overflow: visible;
  padding: 8px 4px 10px;
}
.zone-title-rebuses { margin-top: 6px; color: var(--yellow); }

/* placeholder slot for a future game/feature — dashed icon-sized box */
.node.placeholder {
  cursor: default; width: 68px; height: 68px; min-height: 68px; padding: 0;
  background: rgba(12,18,13, 0.35);
  box-shadow: none; border: 2px dashed rgba(255,176,32, 0.28);
  align-items: center; justify-content: center;
}
.node.placeholder:hover, .node.placeholder:active { transform: none; }
.node.placeholder .ph-mark { font-size: 32px; color: rgba(255,176,32, 0.4); line-height: 1; }
.node.placeholder .ph-txt { display: none; }

/* ---------- bottom nav bar: primary features (inbox / board / collections…) ----
   A fixed row along the bottom of the portrait stage; scrolls horizontally if it
   ever overflows so every visible feature stays reachable. ---------- */
.side-rail {
  order: 3; flex: 0 0 auto;
  width: 100%; z-index: 4;
  display: flex; flex-direction: row; align-items: stretch; justify-content: center;
  gap: var(--sp2);
  overflow-x: auto; overflow-y: hidden;
  padding: 6px var(--edge) calc(6px + var(--safe-l)) var(--edge);
  background: linear-gradient(0deg, rgba(7,11,8,0.92), rgba(7,11,8,0.0));
  border-top: 2px solid rgba(255,176,32, 0.18);
  scrollbar-width: none;
}
.side-rail::-webkit-scrollbar { height: 0; width: 0; }
.rail-node {
  position: relative;
  flex: 0 0 auto;   /* never squish in the scrolling row */
  width: 74px; min-height: var(--tap); padding: 5px 4px;
  background: rgba(12,18,13, 0.9);
  box-shadow: 0 0 0 2px var(--cyan), 0 0 0 4px var(--ink), 0 0 16px rgba(255,176,32, 0.15);
  border: 0; cursor: pointer; font-family: var(--font);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  transition: transform 0.08s steps(1);
}
.rail-node:hover, .rail-node:active { transform: translateY(-4px); }
.rail-node canvas { width: 30px; height: 30px; }
.rail-node .rn-name {
  font-size: 9px; letter-spacing: 0.2px; line-height: 1.12; text-align: center;
  color: var(--cyan-l); text-transform: uppercase;
  /* long target labels (e.g. a case name) must never spill past the tile */
  max-width: 100%; overflow-wrap: anywhere; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rail-node.hot {
  box-shadow: 0 0 0 2px var(--pink), 0 0 0 4px var(--ink), 0 0 22px rgba(224,58,28, 0.6);
  animation: pulseHot 1.1s steps(2) infinite;
}
.rail-node.locked { cursor: not-allowed; box-shadow: 0 0 0 2px #333a30, 0 0 0 4px var(--ink); }
.rail-node.locked canvas { filter: grayscale(1) brightness(0.6); }
/* dim the label with a VISIBLE colour, not a darkening filter (was near-black,
   invisible on the dark background) */
.rail-node.locked .rn-name { color: rgba(255,224,122, 0.5); }
.rail-node.locked::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, rgba(0,0,0,.45) 0 6px, rgba(0,0,0,.15) 6px 12px);
}
.rail-node .lock-badge { position: absolute; right: 3px; top: 3px; z-index: 2; }
.rail-node .new-badge { position: absolute; left: -6px; top: -7px; z-index: 3; animation: bob 0.8s steps(2) infinite; }

/* icon-ONLY tiles: no frame, no caption — just the pixel-art picture, compact,
   so 2–3 rows of them fit and the grid scales to more games */
.node {
  position: relative;
  width: 100%; max-width: 92px; min-height: 0;
  background: none; box-shadow: none; padding: 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.08s steps(1);
}
.node:hover, .node:active { transform: translateY(-3px); }
.node canvas, .node img {
  width: 96px; height: 96px;
  object-fit: contain;
  image-rendering: pixelated;
}
/* portrait: show a compact label under the game tile (like a level card) */
.node .node-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-top: 3px; max-width: 100%;
  font-size: 9px; letter-spacing: 0.4px; line-height: 1.1; text-align: center;
  color: var(--cyan-l); text-transform: uppercase; text-shadow: 0 0 6px rgba(255,176,32,.4);
}
.node .node-sub { display: none; }

/* icon-only: state is shown on the picture itself (no frame) */
.node.locked { cursor: not-allowed; }
.node.locked canvas, .node.locked img { filter: grayscale(1) brightness(0.6); }
.node.locked::after {
  content: ""; position: absolute; inset: 4px;
  background: repeating-linear-gradient(45deg, rgba(0,0,0,.45) 0 6px, rgba(0,0,0,.15) 6px 12px);
}
.node.locked .lock-badge { position: absolute; right: 2px; top: 2px; z-index: 2; }

/* available game: soft neon glow on the icon + gentle pulse, no boxy frame */
.node.hot canvas, .node.hot img { filter: drop-shadow(0 0 8px rgba(224,58,28, 0.7)); }
.node.hot { animation: pulseHot 1.4s steps(2) infinite; }
@keyframes pulseHot { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.22); } }

.node .new-badge {
  position: absolute; left: -8px; top: -10px; z-index: 3;
  background: var(--pink); color: #fff; font-size: var(--fs-micro); letter-spacing: 1px;
  padding: 3px 6px; box-shadow: 0 0 0 2px var(--ink);
  animation: bob 0.8s steps(2) infinite;
}

/* AI assistant dock — shared by the hub and the terminal.
   Compact: fits within ~30% of the 400-tall stage, no overflow. */
.zoras-dock {
  flex: 0 0 auto;
  width: 100%; display: flex; align-items: flex-end; gap: var(--sp3); z-index: 3;
  padding: 0 var(--edge-r) 10px var(--edge);
}
/* лоббі (ВЕРТИКАЛЬНЕ): док Зори — ЗВЕРХУ, одразу під HUD (order:1).
   FLEX row: компактний портрет ліворуч + бокс праворуч. */
#lobby .zoras-dock, #btPandaHost .zoras-dock{
  position: relative; order: 1; left: auto; right: auto; bottom: auto; width: 100%;
  flex: 0 0 auto;
  display: flex; flex-direction: row; align-items: stretch; gap: var(--sp2);
  padding: 2px var(--edge-r) 4px var(--edge); z-index: 5;
}
#lobby .zoras-frame, #btPandaHost .zoras-frame{ position: relative; flex: 0 0 auto; z-index: 6; align-self: flex-end; }
#lobby .zoras-frame img, #btPandaHost .zoras-frame img, #lobby .zoras-frame video, #btPandaHost .zoras-frame video{ display: block; height: 128px; width: auto; max-width: 116px; object-fit: contain; object-position: bottom; }
#lobby .zoras-box, #btPandaHost .zoras-box{ flex: 1 1 auto; min-width: 0; margin-left: 0; align-self: center; max-height: 128px; }
/* idle: hide the box, keep the big portrait (tap it to bring Zoras back) */
#lobby .zoras-dock.idle, #btPandaHost .zoras-dock.idle{ pointer-events: none; }
#lobby .zoras-dock.idle .zoras-box, #btPandaHost .zoras-dock.idle .zoras-box{ display: none; }
#lobby .zoras-dock.idle .zoras-frame, #btPandaHost .zoras-dock.idle .zoras-frame{ pointer-events: auto; cursor: pointer; }
/* Сержант Булочка — жива істота, а не голограма: ніякого сканлайн-серпанку
   й ніякої рамки. Ролик іде з альфа-каналом (VP9), тож фону за ним
   немає взагалі, і на екрані стоїть сам персонаж. Тінь під ним —
   drop-shadow по силуету, тому вона повторює контур, а не коробку. */
.zoras-frame { position: relative; flex: 0 0 auto; }
.zoras-frame img, .zoras-frame video {
  display: block;
  height: 104px;
  width: auto;
  object-fit: contain; object-position: bottom center;
  filter: drop-shadow(0 5px 9px rgba(0,0,0,.6));
}
/* «говорить» — легке дихання силуету, синхронно з друком тексту */
.zoras-frame.talking img, .zoras-frame.talking video { animation: zTalk 1.1s ease-in-out infinite; }
@keyframes zTalk {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-3px) scale(1.015); }
}

/* Хмарка. Це реально хмарка, а не панель інтерфейсу: вона належить
   персонажеві, тому має хвостик у його бік (див. css/base.css) і
   з'являється/зникає разом із ним. */
.zoras-box {
  position: relative;
  flex: 1 1 auto; min-height: 78px; max-height: 118px; overflow-y: auto; max-width: 1100px;
  background: rgba(7,10,8, 0.94);
  box-shadow: 0 0 0 2px var(--amber), 0 0 0 4px var(--ink), 0 6px 18px rgba(0,0,0,.55);
  padding: 11px 22px 14px 16px;
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--sand-l);
  text-shadow: 1px 1px 0 rgba(0,0,0,.6);
  cursor: pointer;
}
.zoras-box .who { display: block; color: var(--amber); font-size: var(--fs-xs); letter-spacing: 2px; text-transform: uppercase; margin-bottom: 6px; text-shadow: 1px 1px 0 var(--ink); }
/* tap-to-continue affordance (bubble is tappable; the ДАЛІ button is gone) */
.zoras-box::after {
  content: "▸"; position: absolute; right: 7px; bottom: 4px; z-index: 2;
  color: var(--yellow); font-size: 13px; text-shadow: 0 0 8px var(--orange);
  animation: bob 0.9s steps(2) infinite; pointer-events: none;
}

/* "ДАЛІ" button removed — the whole speech bubble is tappable to advance/skip.
   (kept hidden so old markup/JS that toggles it does nothing.) */
.dlg-next, .dlg-next.show { display: none !important; }

/* pointing hand hint */
#hand {
  position: absolute; z-index: 50; width: 42px; height: 48px;
  pointer-events: none; display: none;
  filter: drop-shadow(0 0 8px rgba(230,190,110, 0.9));
  animation: tapHint 1.05s steps(3) infinite;
}
#hand.show { display: block; }
@keyframes tapHint { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(0, 12px); } }

/* floating "+100" */
.float-pts {
  position: absolute; z-index: 60; pointer-events: none;
  font-size: 20px; letter-spacing: 2px; color: var(--green);
  text-shadow: 0 0 10px var(--green);
  animation: floatUp 1.2s ease-out forwards;
}
@keyframes floatUp { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-70px); opacity: 0; } }

/* romance: floating heart gain/loss, centered over the terminal */
.float-pts.heart-fx { font-size: 34px; font-weight: 900; letter-spacing: 0; animation: heartFx 1.3s ease-out forwards; }
.float-pts.heart-fx.gain { color: var(--pink); text-shadow: 0 0 16px var(--pink); }
.float-pts.heart-fx.loss { color: #9aa392; text-shadow: 0 0 10px rgba(143,163,138,.6); }
@keyframes heartFx {
  0% { transform: translate(-50%, 0) scale(0.5); opacity: 0; }
  18% { transform: translate(-50%, -10px) scale(1.25); opacity: 1; }
  35% { transform: translate(-50%, -14px) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -90px) scale(1); opacity: 0; }
}

/* toast */
#toast {
  position: fixed; left: 50%; top: 12%; transform: translate(-50%, -14px);
  z-index: 8000; padding: 10px 16px; font-size: 12px; letter-spacing: 1px;
  background: rgba(7,10,8, 0.95); color: var(--yellow);
  box-shadow: 0 0 0 3px var(--yellow), 0 0 0 6px var(--ink);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =====================================================================
   PUZZLE HOST (iframe)
===================================================================== */
/* #puzzle lives OUTSIDE #app at the real viewport (not the scaled stage), so the
   mini-games get the full device size. Sized in vh/vw units (there is no --scale
   here) so the slim host bar stays proportional on any screen. */
#puzzle { position: fixed; inset: 0; z-index: 10000; background: #050806; }
#puzzle.screen { display: none; }
#puzzle.screen.active { display: block; }   /* children are absolute; skip flex-centering */
/* slim "cartridge shell" bar; the game runs in the screen BELOW it */
#puzzle .puz-head {
  position: absolute; top: 0; left: 0; right: 0; height: max(44px, 7vh); z-index: 5;
  display: flex; align-items: center; justify-content: flex-start; gap: max(8px, 1.6vw);
  padding: 0 max(12px, 2vw) 0 max(12px, env(safe-area-inset-left, 0px) + 2vw);
  background: rgba(7,10,8, 0.96); border-bottom: 2px solid rgba(255,176,32, 0.25);
}
/* header buttons scale with the viewport (no stage transform out here) */
#puzzle .puz-head .px-btn { min-height: max(40px, 6vh); font-size: max(12px, 2.1vh); letter-spacing: 1.5px; padding: 0 max(12px, 1.4vw); }
/* ONE exit, and it lives out here.

   This used to read "the embedded game provides its own back button, so the
   host bar hides its own". Only five of the thirteen games actually do:
   games/common/floramenta-skin.css hides #backBtn / #shellExit in the other
   eight, on the matching assumption that the HOST draws the exit. Both sides
   deferring meant neither drew one, and the only way out was the "← ЛОБІ" in
   the injected SYS bar — which is precisely the duplicated chrome that bar was
   removed for.

   So the host owns it. #puzBack sits outside the iframe, so it is in the same
   place, at the same size, for every game, and it cannot be covered by one.
   The games' own exits are hidden while embedded — see
   games/common/shell-chrome.css. */
#puzBack { display: inline-flex; }

/* ---- живий статус зміни ----
   Був `display:none` — заголовок нікому не був потрібен, бо кожна гра
   малювала власну шапку. Тепер тут висить статус ЄДИНОЇ гри: локація,
   рахунок і ланцюг. Це зняло три рядки з верхньої смуги всередині гри й
   віддало їх ігровому полю (плитка виросла з 65-80 px до 98-120 px).
   min-width:0 обов'язковий: без нього flex-елемент не дає собі
   зменшитись, і на вузькому телефоні кнопки поряд виїжджають за екран. */
#puzTitle {
  display: flex; align-items: center; gap: max(8px, 1.4vw);
  flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap;
  font-size: max(11px, 1.9vh); letter-spacing: 2px;
}
#puzTitle .pt-loc {
  overflow: hidden; text-overflow: ellipsis;
  color: var(--sand-l, #e6be6e);
}
#puzTitle .pt-score { color: var(--amber, #ffb020); font-weight: 700; }
#puzTitle .pt-combo {
  padding: 2px 6px; font-weight: 700;
  color: #14100a; background: var(--amber-l, #ffe07a);
}

/* ---- the hint chip ----
   Same ghost frame as its two neighbours so the bar reads as one unified strip,
   but keyed yellow: it is the only control here that SPENDS something, and the
   little tag says what it will cost before it is tapped — a number while the
   player has hints banked, "AD" when the next one comes from a rewarded ad. */
#puzHint { position: relative; margin-left: auto; }
#puzHint .ph-tag {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; letter-spacing: .5px;
  color: #05070a; background: var(--green, #39ff6e);
  box-shadow: 0 0 0 2px var(--ink, #05070a);
}
#puzHint .ph-tag.ad { color: #fff; background: var(--pink, #e03a1c); }
#puzHint[disabled] { opacity: .45; }

/* dev-only auto-solve: hidden in production, shown when <body class="dev"> */
#puzDev { display: none; }
body.dev #puzDev { display: inline-flex; }
/* explicit height — an <iframe> is a replaced element and won't stretch from
   top+bottom insets alone (it falls back to its 150px intrinsic height) */
#puzzle iframe {
  position: absolute; top: max(44px, 7vh); left: 0;
  width: 100%; height: calc(100% - max(44px, 7vh));
  border: 0; z-index: 1; background: #050806;
}

/* =====================================================================
   AUDIO SETTINGS PANEL
===================================================================== */
#audioPanel {
  position: fixed; inset: 0; z-index: 9800; display: none;
  align-items: center; justify-content: center; background: rgba(5,8,6, 0.82);
}
#audioPanel.show { display: flex; }
#audioPanel .card { width: min(460px, calc(94 * var(--vw))); padding: 18px 20px; }
#audioPanel .ap-title { font-size: var(--fs-lg); letter-spacing: 3px; text-align: center; margin-bottom: 16px; }

.ap-row { display: flex; align-items: center; gap: var(--sp3); margin-bottom: 12px; cursor: pointer; min-height: var(--tap); }
.ap-label { flex: 0 0 96px; font-size: var(--fs-md); letter-spacing: 2px; color: var(--cyan-l); }
.ap-val { flex: 0 0 40px; text-align: right; font-size: var(--fs-md); color: var(--yellow); text-shadow: 0 0 8px var(--orange); }

/* chunky pixel slider — finger-sized track & thumb */
#audioPanel input[type="range"] {
  flex: 1 1 auto;
  -webkit-appearance: none; appearance: none;
  height: 26px; background: rgba(6,9,7, 0.9);
  box-shadow: 0 0 0 2px var(--cyan), 0 0 0 4px var(--ink);
  cursor: pointer;
}
#audioPanel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 40px; border: 0; border-radius: 0;
  background: var(--pink); box-shadow: 0 0 0 2px var(--ink), 0 0 12px var(--pink);
}
#audioPanel input[type="range"]::-moz-range-thumb {
  width: 22px; height: 40px; border: 0; border-radius: 0;
  background: var(--pink); box-shadow: 0 0 0 2px var(--ink), 0 0 12px var(--pink);
}
#audioPanel .ap-btns { display: flex; gap: var(--sp4); justify-content: center; margin-top: 18px; flex-wrap: wrap; }
#audioPanel .ap-btns .px-btn.muted { color: var(--yellow); box-shadow: 0 0 0 2px var(--yellow) inset, 0 0 0 4px var(--ink); }
/* reset is destructive → tint it so it reads apart from mute/close */
#audioPanel .ap-btns .px-btn.ap-reset { color: var(--orange); box-shadow: 0 0 0 2px var(--orange) inset, 0 0 0 4px var(--ink); }
#audioPanel .ap-btns .px-btn.ap-reset:hover, #audioPanel .ap-btns .px-btn.ap-reset:active { color: #fff; background: rgba(255,122,61, 0.16); }

/* reward splash after a puzzle */
#reward {
  position: fixed; inset: 0; z-index: 8500; display: none;
  align-items: center; justify-content: center; background: rgba(5,8,6, 0.86);
}
#reward.show { display: flex; }
#reward .card { text-align: center; padding: 30px 40px; }
#reward .big { font-size: clamp(28px, calc(5 * var(--vw)), 54px); letter-spacing: 4px; }
#reward .sub { margin-top: 10px; font-size: var(--fs-md); letter-spacing: 2px; color: var(--cyan-l); }

/* =====================================================================
   INVESTIGATION BOARD
===================================================================== */
#board { background: #0a0e0c; }
#board .board-head {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5; height: var(--hud-h);
  display: flex; align-items: center; justify-content: space-between; padding: 0 var(--edge-r) 0 var(--edge);
}
#board .board-title { font-size: var(--fs-md); letter-spacing: 2px; color: var(--pink-l); text-shadow: 0 0 10px var(--pink); }
/* case mode: the back button is the door icon */
#boardBack.icon-only { padding: 5px; line-height: 0; min-width: 0; }
#boardBack.icon-only canvas { display: block; width: 26px; height: 26px; image-rendering: pixelated; }
/* the wrap fills the screen between header and task strip; it's the pan/zoom
   VIEWPORT — clips the world, captures drag/wheel/pinch */
#board .board-wrap { position: absolute; left: 0; right: 0; top: var(--hud-h); bottom: 64px; z-index: 2; overflow: hidden; touch-action: none; cursor: grab; }
#board .board-wrap.grabbing { cursor: grabbing; }
/* the WORLD: fixed-size layer that board.js translates & scales (size set in JS) */
#boardWorld { position: absolute; top: 0; left: 0; transform-origin: 0 0; will-change: transform; }
#boardStrings { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
#boardSlots { position: absolute; inset: 0; z-index: 2; }

.slot {
  position: absolute;
  /* bounded by BOTH axes so the tree of slots never overlaps on the short stage */
  width: clamp(96px, min(calc(26 * var(--vw)), calc(30 * var(--vh))), 150px);
  transform: translate(-50%, -50%);
  background: rgba(9,14,10, 0.92);
  box-shadow: 0 0 0 3px #6b7266, 0 0 0 6px var(--ink);
  padding: 7px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  cursor: grab;   /* clues can be grabbed and dragged around the board */
}
.slot.dragging { z-index: 20; cursor: grabbing; filter: brightness(1.18); box-shadow: 0 0 0 3px var(--cyan), 0 0 0 6px var(--ink), 0 0 28px rgba(255,176,32, 0.6); }
.slot.filled { box-shadow: 0 0 0 3px var(--cyan), 0 0 0 6px var(--ink), 0 0 26px rgba(255,176,32, 0.28); }
.slot.new { animation: slotIn .5s steps(4) both; }
@keyframes slotIn { 0% { transform: translate(-50%, -50%) scale(0.4); filter: brightness(3); } 100% { transform: translate(-50%, -50%) scale(1); filter: brightness(1); } }
.slot canvas, .slot img.photo { width: 100%; height: auto; display: block; image-rendering: pixelated; }
/* clue media is 16:9 (landscape), NOT square — keeps slots short so long
   captions don't stretch them into tall overlapping columns */
.slot img.photo { aspect-ratio: 16 / 9; object-fit: cover; }
.slot canvas { aspect-ratio: 16 / 9; height: auto; }

/* video evidence: looping preview with a play badge, taps to expand */
.slot .photo.vid { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; cursor: pointer; }
.slot .photo.vid video { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot .photo.vid .vid-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 28px; color: #fff; text-shadow: 0 0 10px var(--cyan);
  background: rgba(5,8,6, 0.28); pointer-events: none;
}
.slot .photo.vid:hover .vid-play { background: rgba(5,8,6, 0.12); }

/* ===================================================================
   FULLSCREEN VIDEO PLAYER
=================================================================== */
#videoModal {
  position: fixed; inset: 0; z-index: 9990; display: none;   /* above hacked-OS (9600) & zoras-overlay (9700) — else video opens BEHIND the PC */
  align-items: center; justify-content: center; background: rgba(3,5,4, 0.92);
}
#videoModal.show { display: flex; }
#videoModal .vm-frame { position: relative; width: min(1000px, calc(94 * var(--vw))); max-height: calc(90 * var(--vh)); }
#videoModal video {
  width: 100%; max-height: calc(82 * var(--vh)); display: block; background: #000;
  box-shadow: 0 0 0 3px var(--cyan), 0 0 0 6px var(--ink), 0 0 50px rgba(255,176,32, 0.3);
}
#videoModal .vm-close {
  position: absolute; top: -14px; right: -14px; width: 40px; height: 40px;
  font-size: 16px; font-family: var(--font); color: var(--cyan-l); cursor: pointer;
  background: rgba(7,10,8, 0.95); border: 0;
  box-shadow: 0 0 0 2px var(--cyan), 0 0 0 4px var(--ink);
}
#videoModal .vm-close:hover { color: #fff; background: rgba(255,176,32, 0.2); }
#videoModal .vm-full { position: absolute; left: 0; bottom: -46px; }

/* =====================================================================
   COLLECTIBLES — VHS deck & boombox (shared shell)
===================================================================== */
/* fullscreen collectible stage (no popup panel, no animated backdrop) */
.collect {
  position: fixed; inset: 0; z-index: 9600; display: none;
  flex-direction: column; overflow: hidden;
  background: radial-gradient(130% 110% at 50% 32%, #101610 0%, #070c08 55%, #030604 100%);
}
.collect.show { display: flex; }
.collect.vhs { --dev-w: min(260px, calc(78 * var(--vw))); --accent: var(--cyan); }
/* CRT scanlines over the whole screen, like the rest of the game */
.collect::after {
  content: ""; position: absolute; inset: 0; z-index: 6; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.17) 3px 4px);
}

.collect-topbar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: var(--sp3);
  padding: 8px var(--edge-r) 8px var(--edge); min-height: var(--hud-h);
  border-bottom: 2px solid color-mix(in srgb, var(--accent) 22%, transparent);
  position: relative; z-index: 2;
}
.collect-title { font-size: var(--fs-lg); letter-spacing: 3px; }
.collect-actions { display: flex; align-items: center; gap: var(--sp2); }
.collect-close {
  width: var(--tap); height: var(--tap); font-size: var(--fs-lg); font-family: var(--font);
  color: var(--cyan-l); background: rgba(7,10,8, 0.9); border: 0; cursor: pointer;
  box-shadow: 0 0 0 2px var(--cyan), 0 0 0 4px var(--ink);
}
.collect-close:hover, .collect-close:active { color: #fff; background: rgba(255,176,32, 0.2); }

/* PORTRAIT: device on TOP, cassette shelf BELOW (scrolls) */
.collect-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: var(--sp4); padding: 12px var(--edge-r) 14px var(--edge);
}
.shelf-spacer { display: none; }
/* device (TV+VCR or boombox+controls) — top, sized to available width */
.device-col {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp3);
  flex: 0 0 auto; min-width: 0;
}

/* ---- cassette gallery — below the device, scrollable ---- */
.shelf-section {
  flex: 0 0 auto; min-width: 0; max-width: 100%; width: 100%; align-self: stretch;
  padding: 0; display: flex; flex-direction: column; align-items: center; gap: var(--sp2);
  min-height: 0; justify-content: flex-start;
}
.shelf-label { flex: 0 0 auto; font-size: var(--fs-sm); letter-spacing: 3px; color: var(--cyan-l); opacity: 0.85; }
.cassette-shelf {
  display: flex; flex-flow: row wrap; align-content: flex-start; justify-content: center;
  gap: var(--sp3); width: 100%; padding: 6px;
}
.cassette {
  position: relative; width: 158px; padding: 0; border: 0; cursor: pointer;
  background: transparent; font-family: var(--font);
  transition: transform 0.08s steps(1);
}
.cassette:hover, .cassette:active { transform: translateY(-4px); }
.cassette .cs-body {
  background: #141d16; padding: 10px;
  box-shadow: 0 0 0 3px var(--cyan), 0 0 0 6px var(--ink), 0 6px 0 rgba(0, 0, 0, 0.5);
}
.cassette.pink .cs-body { box-shadow: 0 0 0 3px var(--pink), 0 0 0 6px var(--ink), 0 6px 0 rgba(0,0,0,.5); }
.cassette.green .cs-body { box-shadow: 0 0 0 3px var(--green), 0 0 0 6px var(--ink), 0 6px 0 rgba(0,0,0,.5); }
.cassette.yellow .cs-body { box-shadow: 0 0 0 3px var(--yellow), 0 0 0 6px var(--ink), 0 6px 0 rgba(0,0,0,.5); }
.cassette.orange .cs-body { box-shadow: 0 0 0 3px var(--orange), 0 0 0 6px var(--ink), 0 6px 0 rgba(0,0,0,.5); }
.cassette.purple .cs-body { box-shadow: 0 0 0 3px var(--lav), 0 0 0 6px var(--ink), 0 6px 0 rgba(0,0,0,.5); }
.cassette .cs-label {
  background: #f0e6cd; color: #262b23; padding: 7px 9px; margin-bottom: 8px;
  display: flex; flex-direction: column; gap: 3px; text-align: left;
}
.cassette .cs-name { font-size: var(--fs-sm); letter-spacing: 1px; font-weight: 700; }
.cassette .cs-tag { font-size: var(--fs-micro); letter-spacing: 1px; color: #6a5f4a; }
.cassette .cs-reels { display: flex; justify-content: space-around; padding: 3px 14px; }
.cassette .cs-reels span {
  width: 26px; height: 26px; border-radius: 50%;
  background: repeating-radial-gradient(circle, #05070a 0 3px, #26331f 3px 6px);
  box-shadow: 0 0 0 2px #05070a;
}
.cassette.active .cs-body { animation: csPulse 0.9s steps(2) infinite; }
@keyframes csPulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.35); } }
.cassette.active .cs-reels span { animation: csSpin 0.6s linear infinite; }
@keyframes csSpin { to { transform: rotate(360deg); } }
.cassette.locked { cursor: not-allowed; }
.cassette.locked .cs-body { box-shadow: 0 0 0 3px #333a30, 0 0 0 6px var(--ink); filter: grayscale(1) brightness(0.7); }
.cassette.locked .cs-label { background: #262c24; color: #6b7263; }

/* ---- VHS: pixel-art CRT TV (canvas frame + video through the screen hole) ---- */
.tv-wrap {
  position: relative; width: var(--dev-w); aspect-ratio: 80 / 72;
  filter: drop-shadow(0 8px 0 rgba(0,0,0,.45));
}
/* the pixel-art TV bezel, screen area is transparent so the video shows through */
.tv-art { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none;
  image-rendering: pixelated; image-rendering: crisp-edges; }
/* video + no-input sit in the screen hole — insets mirror SCR in collectibles.js */
.tv-wrap video, .tv-noinput {
  position: absolute; left: 10%; top: 8.33%; width: 70%; height: 63.9%; z-index: 1;
}
.tv-wrap video { object-fit: cover; display: none; background: #05120a; }
.tv-noinput {
  display: grid; place-items: center; gap: 4px; background: #05120a;
  color: #39ff6e; font-size: var(--fs-lg); letter-spacing: 2px; text-align: center;
  text-shadow: 0 0 10px rgba(57,255,110,.6);
}
.tv-noinput span { font-size: var(--fs-sm); letter-spacing: 1px; color: rgba(57,255,110,.85); }
.tv-scan { position: absolute; left: 10%; top: 8.33%; width: 70%; height: 63.9%; z-index: 3; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.30) 3px 4px); }

.vcr-wrap { width: var(--dev-w); aspect-ratio: 140 / 30; filter: drop-shadow(0 4px 0 rgba(0,0,0,.45)); }
.vcr-wrap canvas { width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }


.slot .cap { font-size: 9px; line-height: 1.25; color: var(--cyan-l); text-align: center; letter-spacing: .3px; word-break: break-word; }
.slot.empty .cap { color: #98a38e; letter-spacing: 1.5px; }
.slot.empty { opacity: .9; }
.slot .qmark { font-size: 30px; color: #8b937f; padding: 8px 0; }

#board .board-task {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 6;
  width: min(720px, calc(94 * var(--vw))); text-align: center; padding: 8px 14px;
  background: rgba(7,10,8, 0.94);
  box-shadow: 0 0 0 3px var(--yellow), 0 0 0 6px var(--ink);
  font-size: var(--fs-sm); color: var(--yellow); line-height: 1.5; letter-spacing: .6px;
}

/* =====================================================================
   SOCIAL / FRIENDS
===================================================================== */
#social { background: #070c08; }
#social .soc-wrap {
  width: min(920px, calc(96 * var(--vw))); max-height: calc(94 * var(--vh)); display: flex; flex-direction: column; z-index: 3;
  background: rgba(7,10,8, 0.9); padding: 12px var(--edge);
  box-shadow: 0 0 0 3px var(--cyan), 0 0 0 6px var(--ink), 0 0 30px rgba(255,176,32, 0.22);
}
#social .soc-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp2); margin-bottom: 10px; }
#social .soc-title { font-size: var(--fs-lg); letter-spacing: 2px; color: var(--cyan-l); text-shadow: 0 0 10px var(--cyan); }
/* min-height:0 lets the flex child actually scroll instead of overflowing the card */
#social .soc-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp2); padding: 2px 4px 2px 2px; }

.friend {
  display: flex; align-items: center; gap: var(--sp3); padding: 8px 12px; min-height: var(--row);
  background: rgba(12,18,13, 0.9);
  box-shadow: 0 0 0 2px var(--purple), 0 0 0 4px var(--ink);
}
.friend canvas { width: 48px; height: 48px; flex: 0 0 auto; }
.friend .f-info { flex: 1 1 auto; min-width: 0; }
.friend .f-name { font-size: var(--fs-md); letter-spacing: 1px; color: #fff; }
.friend .f-tag { font-size: var(--fs-micro); color: var(--grey); letter-spacing: 1px; margin-top: 3px; }
.friend .f-pow { font-size: var(--fs-micro); color: var(--green); letter-spacing: 1px; margin-top: 3px; }
.friend.added { box-shadow: 0 0 0 2px var(--green), 0 0 0 4px var(--ink); }
.friend .f-added { font-size: var(--fs-sm); letter-spacing: 1px; color: var(--green); padding: 0 10px; }

/* friends contributing to the bar */
.contrib {
  position: absolute; z-index: 70; pointer-events: none;
  font-size: 12px; letter-spacing: 1px; color: var(--cyan-l);
  text-shadow: 0 0 8px var(--cyan); white-space: nowrap;
  animation: contribFly 1.05s ease-out forwards;
}
@keyframes contribFly { 0% { transform: translateY(6px); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-42px); opacity: 0; } }

/* =====================================================================
   ARCHIVE — re-read machines we already cracked
===================================================================== */
#archive { background: #070c08; }
#archive .arc-wrap {
  width: min(920px, calc(96 * var(--vw))); max-height: calc(94 * var(--vh)); display: flex; flex-direction: column; z-index: 3;
  background: rgba(7,10,8, 0.9); padding: 12px var(--edge);
  box-shadow: 0 0 0 3px var(--cyan), 0 0 0 6px var(--ink), 0 0 30px rgba(255,176,32, 0.22);
}
#archive .arc-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp2); margin-bottom: 10px; }
#archive .arc-title { font-size: var(--fs-lg); letter-spacing: 2px; color: var(--cyan-l); text-shadow: 0 0 10px var(--cyan); }
#archive .arc-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp2); padding: 2px; }
#archive .arc-empty { text-align: center; padding: 26px 0; font-size: var(--fs-sm); letter-spacing: 2px; color: var(--grey); }

.arc-item {
  display: flex; align-items: center; gap: var(--sp3); padding: 8px 12px; min-height: var(--row);
  background: rgba(12,18,13, 0.9);
  box-shadow: 0 0 0 2px var(--green), 0 0 0 4px var(--ink);
}
.arc-face {
  width: 52px; height: 52px; flex: 0 0 auto; object-fit: cover; image-rendering: pixelated;
  box-shadow: 0 0 0 2px rgba(57,255,110, 0.6);
  filter: grayscale(1) sepia(1) hue-rotate(58deg) saturate(3.4) brightness(1.15);
}
.arc-info { flex: 1 1 auto; min-width: 0; }
.arc-name { font-size: var(--fs-md); letter-spacing: 1px; color: #fff; }
.arc-note { font-size: var(--fs-micro); color: var(--green); letter-spacing: 1px; margin-top: 4px; }
.arc-count { font-size: var(--fs-micro); color: var(--grey); letter-spacing: 1px; margin-top: 3px; }

/* =====================================================================
   DEMO END
===================================================================== */
/* sits low on the board so the freshly-revealed evidence stays visible */
#demoEnd {
  position: fixed; inset: 0; z-index: 8600; display: none;
  align-items: flex-end; justify-content: center; padding-bottom: calc(12 * var(--vh));
  background: rgba(5,8,6, 0.62);
}
#demoEnd.show { display: flex; }
#demoEnd .card { text-align: center; padding: 26px 34px; max-width: min(560px, calc(92 * var(--vw))); }
#demoEnd .de-title { font-size: clamp(24px, calc(4.6 * var(--vw)), 44px); letter-spacing: 6px; }
#demoEnd .de-sub { margin: 16px 0 22px; font-size: var(--fs-md); line-height: 1.7; color: var(--yellow); letter-spacing: 1px; text-transform: none; }
#demoEnd .de-btns { display: flex; gap: var(--sp4); justify-content: center; flex-wrap: wrap; }

/* =====================================================================
   Small screens
===================================================================== */
/* ---- COMPACT: narrow OR short viewports (landscape phones, small windows) ----
   These screens are full-height "stages" with no natural room to grow, so on
   tight viewports we let them scroll top-to-bottom and shrink the biggest
   elements, instead of letting fixed pieces pile up on each other. */
@media (max-width: 0px) { /* DISABLED: стара система скейлінгу */
  /* LOBBY: stack and scroll instead of space-between */
  #lobby .layer { justify-content: flex-start; overflow-y: auto; gap: clamp(6px, calc(2 * var(--vh)), 16px); padding: 8px 0 12px; }
  .lobby-mid { flex: 0 0 auto; padding-bottom: 4px; }

  /* PUZZLE NODES: scale to the viewport so 3 fit a landscape phone */
  .zone-title { font-size: clamp(9px, calc(1.4 * var(--vw)), 12px); margin-bottom: 4px; }
  .zone-nodes { gap: clamp(6px, calc(2 * var(--vw)), 14px); flex-wrap: nowrap; }
  .node { padding: 6px 8px; gap: 4px; }
  /* icon canvases carry an INLINE px size from JS — override with !important */
  .node canvas, .node img { width: clamp(76px, min(calc(20 * var(--vw)), calc(22 * var(--vh))), 160px) !important; height: clamp(76px, min(calc(20 * var(--vw)), calc(22 * var(--vh))), 160px) !important; }
  .node .node-name { font-size: clamp(9px, calc(1.3 * var(--vw)), 13px); }
  .node .node-sub { font-size: clamp(8px, calc(1 * var(--vw)), 11px); }
  .rail-node canvas { width: 52px !important; height: 52px !important; }

  /* the rail becomes a row under the puzzles, in normal flow */
  .side-rail {
    position: static; transform: none;
    flex-direction: row; flex-wrap: wrap; justify-content: center;
    padding: 4px 12px;
  }
  .rail-node { width: 68px; }

  /* the meter row wraps; drop the balance spacer so it centres cleanly */
  .lobby-top { flex-wrap: wrap; justify-content: center; gap: 8px; }
  .lobby-top::before { display: none; }

  /* TERMINAL: scroll, and shrink the monitor + Zoras so both fit */
  #crt .crt-stage, .hacked-os .crt-stage { justify-content: flex-start; overflow-y: auto; gap: 8px; padding: 8px 10px; }
  #crt .monitor, .hacked-os .monitor { height: min(360px, calc(46 * var(--vh))); }
  #crt .crt-zoras .zoras-frame img, #crt .crt-zoras .zoras-frame video { height: clamp(72px, calc(15 * var(--vh)), 120px); }
  #crt .crt-zoras .zoras-box { min-height: 72px; padding: 10px 14px 34px; }

  /* BOARD: pull the header/task in, shrink slots + captions so the 3-row
     tree fits a landscape phone without slots touching */
  #board .board-wrap { top: 42px; bottom: 62px; }
  #board .board-task { padding: 7px 12px; font-size: clamp(9px, calc(1.3 * var(--vw)), 12px); }
  .slot { width: clamp(64px, min(calc(16 * var(--vw)), calc(16 * var(--vh))), 150px); padding: 5px; gap: 3px; }
  .slot .cap { font-size: 8px; line-height: 1.3; }
  .slot .qmark { font-size: 22px; padding: 6px 0; }

  /* Zoras dock shrinks so the lobby fits a landscape phone */
  .zoras-dock { gap: 10px; padding: 0 12px 10px; }
  .zoras-frame img, .zoras-frame video { height: clamp(90px, calc(20 * var(--vh)), 150px); }
  .zoras-box { min-height: 78px; padding: 11px 14px 34px; }

  /* fullscreen player: leave headroom so the close/fullscreen buttons,
     which sit just outside the frame, stay on-screen */
  #videoModal video { max-height: calc(62 * var(--vh)); }
  #videoModal .vm-full { bottom: -40px; font-size: 10px; padding: 6px 10px; }
}

@media (max-width: 0px) { /* DISABLED: стара система скейлінгу */
  .node { width: clamp(100px, calc(40 * var(--vw)), 140px); }
  .zoras-dock { gap: 10px; padding: 0 10px 12px; }
  .zoras-frame img, .zoras-frame video { height: auto; width: clamp(76px, calc(22 * var(--vw)), 110px); }
  .zoras-box { min-height: 104px; padding: 12px 14px 38px; }
}

/* =====================================================================
   NEW CASES — choices, endings, case select, exit
   (mechanics added on top of the tutorial: branching dialogue,
    clue interpretation, multiple endings)
===================================================================== */

/* ---------- choice overlay ---------- */
.choice-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(7,10,8, 0.82);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.choice-overlay.show { opacity: 1; pointer-events: auto; }

.choice-card {
  width: min(680px, calc(96 * var(--vw)));
  max-height: calc(92 * var(--vh));
  overflow-y: auto;
  background: var(--panel);
  padding: 20px 20px 22px;
  transform: translateY(10px);
  transition: transform 0.2s ease;
}
.choice-overlay.show .choice-card { transform: translateY(0); }

.choice-head {
  color: var(--cyan);
  letter-spacing: 2px;
  font-size: var(--fs-sm);
  text-transform: uppercase;
  text-shadow: 0 0 8px var(--cyan);
  margin-bottom: 10px;
}
.choice-prompt {
  color: var(--yellow);
  font-size: var(--fs-lg);
  line-height: 1.35;
  text-shadow: 0 0 8px var(--orange);
  margin-bottom: 6px;
}
.choice-sub {
  color: var(--grey);
  font-size: var(--fs-sm);
  margin-bottom: 14px;
}

.choice-opts { display: flex; flex-direction: column; gap: var(--sp2); }
.choice-opt {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  min-height: var(--tap-lg);
  text-align: left;
  background: rgba(255,176,32, 0.05);
  border: 2px solid rgba(255,176,32, 0.28);
  color: var(--cyan-l);
  padding: 10px 14px;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.choice-opt:hover, .choice-opt:active { background: rgba(224,58,28, 0.14); border-color: var(--pink); color: #fff; }
.choice-opt:active { transform: translateY(2px); }
.co-num {
  flex: 0 0 auto;
  width: 28px; align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: var(--cyan);
  font-weight: bold;
}
.choice-opt:hover .co-num, .choice-opt:active .co-num { background: var(--pink); }
.co-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.co-label { font-size: var(--fs-md); line-height: 1.3; }
.co-desc { font-size: var(--fs-sm); color: var(--grey); }

/* ---------- ending / case-closed overlay ---------- */
.case-end {
  position: fixed;
  inset: 0;
  z-index: 9400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: radial-gradient(circle at 50% 40%, rgba(34,22,12, 0.9), rgba(7,10,8, 0.97));
}
.case-end.show { display: flex; }
.ce-card {
  width: min(720px, calc(96 * var(--vw)));
  max-height: calc(92 * var(--vh));
  overflow-y: auto;
  background: var(--panel);
  padding: 22px 22px 24px;
  text-align: left;
}
.ce-badge {
  color: var(--cyan);
  letter-spacing: 3px;
  font-size: var(--fs-sm);
  text-shadow: 0 0 8px var(--cyan);
  margin-bottom: 6px;
}
.ce-title {
  font-size: clamp(22px, calc(3.4 * var(--vw)), 32px);
  line-height: 1.1;
  margin-bottom: 14px;
}
.ce-body { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.ce-body .crt-line { color: var(--cyan-l); font-size: var(--fs-md); line-height: 1.45; }
.ce-card .px-btn { display: block; margin-left: auto; }

/* ---------- case select ---------- */
.case-select {
  position: fixed;
  inset: 0;
  z-index: 9300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(7,10,8, 0.94);
}
.case-select.show { display: flex; }
.cs-panel {
  width: min(760px, calc(96 * var(--vw)));
  max-height: calc(92 * var(--vh));
  display: flex;
  flex-direction: column;
  background: var(--panel);
  padding: 18px 18px 20px;
}
.cs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.cs-title { font-size: var(--fs-xl); }
.cs-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.cs-item {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  min-height: var(--row);
  text-align: left;
  background: rgba(255,176,32, 0.05);
  border: 2px solid rgba(255,176,32, 0.24);
  color: var(--cyan-l);
  padding: 10px 14px;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.12s, border-color 0.12s;
}
.cs-item:hover, .cs-item:active { background: rgba(224,58,28, 0.12); border-color: var(--pink); }
.cs-item.locked { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.6); }
.cs-item.solved { border-color: rgba(57,255,110, 0.5); }
.cs-num {
  flex: 0 0 auto;
  color: var(--yellow);
  font-size: var(--fs-sm);
  letter-spacing: 2px;
  min-width: 72px;
}
.cs-info { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-width: 0; }
.cs-name { font-size: var(--fs-md); color: #fff; }
.cs-meta { font-size: var(--fs-sm); color: var(--grey); }
.cs-tag { flex: 0 0 auto; color: var(--green); font-size: var(--fs-sm); }
.cs-item.solved .cs-tag { color: var(--green); }

/* ---------- in-case exit ---------- */
.case-exit {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 9200;
  display: none;
  padding: 5px;
  line-height: 0;
}
.case-exit canvas { display: block; width: 26px; height: 26px; image-rendering: pixelated; }
.case-exit.show { display: block; }

/* =====================================================================
   PROGRESSION HUD + hub extras (XP, credits, level, quest costs)
===================================================================== */
/* compact, inline in the HUD row (not a full-width band) */
.profile-hud {
  display: none;
  flex: 1 1 auto; min-width: 0; max-width: 420px;
  height: var(--hud-chip); box-sizing: border-box;
  align-items: center;
  gap: var(--sp2);
  padding: 0 12px;
  background: rgba(10,16,11, 0.7);
  border: 2px solid rgba(255,176,32, 0.3);
  font-size: var(--fs-sm);
}
.profile-hud.show { display: flex; }
.ph-lvl { color: var(--yellow); text-shadow: 0 0 6px var(--orange); letter-spacing: 1px; flex: 0 0 auto; }
.ph-xp {
  position: relative;
  flex: 1 1 auto;
  height: 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255,224,122, 0.35);
  min-width: 80px;
  overflow: hidden;
}
.ph-xp-fill { position: absolute; inset: 0; width: 0; background: linear-gradient(90deg, var(--cyan), var(--pink)); transition: width 0.4s ease; }
.ph-xp-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; text-shadow: 0 0 4px #000; font-size: 0.85em; }
.ph-stat { flex: 0 0 auto; color: var(--cyan-l); }
#phCred { color: var(--pink-l); }

.cs-note { color: var(--lav); font-size: clamp(10px, calc(1.3 * var(--vw)), 12px); margin-bottom: 10px; }
.cs-tag.poor { color: var(--orange); }

/* =====================================================================
   NEW NARRATIVE ENGINE — thread, files, inline choices, inbox, board
===================================================================== */

/* ---- system note in the thread ---- */
.th-note {
  margin: 12px auto; text-align: center;
  color: var(--yellow); text-shadow: 0 0 8px var(--orange);
  font-size: clamp(11px, calc(1.4 * var(--vw)), 13px); letter-spacing: 2px;
  border-top: 1px dashed rgba(230,190,110, 0.4);
  border-bottom: 1px dashed rgba(230,190,110, 0.4);
  padding: 6px 0; max-width: 80%;
}

/* ---- inline choices (NO popup) ---- */
.th-choices { margin: 10px 0 4px; display: flex; flex-direction: column; gap: 6px; }
.th-choice-prompt { color: var(--yellow); text-shadow: 0 0 6px var(--orange); font-size: 13px; margin-bottom: 4px; }
.th-choice-sub { color: var(--grey); font-size: 11px; margin-bottom: 8px; }
.th-choice {
  display: flex; align-items: stretch; gap: 10px; text-align: left;
  background: rgba(255,176,32, 0.06); border: 2px solid rgba(255,176,32, 0.3);
  color: var(--cyan-l); padding: 8px 10px; cursor: pointer; font-family: var(--font);
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.th-choice:hover, .th-choice:active { background: rgba(224,58,28, 0.14); border-color: var(--pink); color: #fff; }
.th-choice:active { transform: translateY(2px); }
.thc-num { flex: 0 0 auto; width: 20px; display: flex; align-items: center; justify-content: center; background: var(--cyan); color: var(--ink); font-weight: bold; align-self: stretch; padding: 2px 0; font-size: 13px; }
.th-choice:hover .thc-num { background: var(--pink); }
.thc-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.thc-label { font-size: 13px; line-height: 1.3; }
.thc-desc { font-size: 11px; color: var(--grey); }

/* ---- diegetic file card ---- */
.file-card {
  margin: 12px 0; border: 2px solid rgba(57,255,110, 0.35);
  background: rgba(6,20,8, 0.55); box-shadow: 0 0 0 1px rgba(0,0,0,.4) inset;
}
.file-card.email { border-color: rgba(255,176,32, 0.4); background: rgba(10,20,16, 0.55); }
.file-card.doc { border-color: rgba(143,163,138, 0.4); background: rgba(18, 24, 16, 0.55); }
.file-card.log { border-color: rgba(138, 151, 163, 0.4); background: rgba(12, 14, 12, 0.6); }
.file-card.sms { border-color: rgba(230,190,110, 0.4); background: rgba(24,18,4, 0.5); }
.fc-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 6px 10px; border-bottom: 1px solid rgba(255,255,255,.08); flex-wrap: wrap; }
.fc-kind { color: var(--ink); background: var(--green); padding: 2px 8px; font-size: 0.72em; letter-spacing: 2px; }
.file-card.email .fc-kind { background: var(--cyan); }
.file-card.doc .fc-kind { background: var(--lav); }
.file-card.log .fc-kind { background: var(--grey); }
.file-card.sms .fc-kind { background: var(--yellow); }
.fc-meta { color: var(--grey); font-size: clamp(10px, calc(1.2 * var(--vw)), 12px); text-align: right; }
.fc-subject { padding: 5px 10px 0; color: var(--cyan-l); font-size: 12px; }
.fc-body { padding: 6px 10px 8px; color: var(--green); white-space: pre-wrap; word-break: break-word; line-height: 1.5; font-size: 13px; }
.file-card.email .fc-body { color: var(--cyan-l); }
.file-card.doc .fc-body { color: var(--lav); }
.fc-body .crt-line.mono { color: rgba(220,255,214, 0.8); font-size: 0.95em; }
.chat.sm { margin: 6px 0; }
.chat.sm .face { width: 26px; height: 26px; }

/* ---- unread badge on inbox rail node ---- */
.unread-badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px;
  border-radius: 9px; background: var(--pink); color: #fff; font-size: 11px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
  box-shadow: 0 0 8px var(--pink); z-index: 3;
}

/* ---- inbox ---- */
.inbox { position: fixed; inset: 0; z-index: 9300; display: none; align-items: center; justify-content: center; padding: 18px; background: rgba(7,10,8, 0.94); }
.inbox.show { display: flex; }
.ib-panel { width: min(760px, calc(96 * var(--vw))); max-height: calc(92 * var(--vh)); display: flex; flex-direction: column; background: var(--panel); padding: 18px; }
.ib-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ib-title { font-size: clamp(8px, calc(1.2 * var(--vw)), 12px); }
.ib-sub { color: var(--lav); font-size: clamp(5px, calc(.65 * var(--vw)), 6px); margin-bottom: 12px; }
.ib-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.ib-item { display: flex; align-items: center; gap: 6px; text-align: left; background: rgba(255,176,32, 0.05); border: 2px solid rgba(255,176,32, 0.22); color: var(--cyan-l); padding: 6px 7px; cursor: pointer; font-family: var(--font); transition: background .12s, border-color .12s; }
.ib-item:hover { background: rgba(224,58,28, 0.12); border-color: var(--pink); }
.ib-item.active { border-color: var(--yellow); }
.ib-item.solved { opacity: 0.7; border-color: rgba(57,255,110, 0.4); }
.ib-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.15); }
.ib-dot.on { background: var(--pink); box-shadow: 0 0 8px var(--pink); }
.ib-info { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-width: 0; }
.ib-name { font-size: clamp(7px, calc(.95 * var(--vw)), 9px); color: #fff; }
.ib-meta { font-size: clamp(5px, calc(.6 * var(--vw)), 6px); color: var(--grey); }
.ib-tag { flex: 0 0 auto; color: var(--green); font-size: clamp(6px, calc(.7 * var(--vw)), 7px); }
.ib-empty { color: var(--grey); text-align: center; padding: 12px; }

/* ---- in-case chrome buttons ---- */
/* top-CENTRE so it never lands on the terminal header's ПРОПУСТИТИ (top-right) */
.case-board-btn { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 9200; display: none; font-size: 11px; padding: 6px 10px; }
.case-board-btn.show { display: block; }

/* ---- per-case board ---- */
.case-board { position: fixed; inset: 0; z-index: 9350; display: none; flex-direction: column; background: radial-gradient(circle at 50% 30%, #2a1f16, #140b06); }
.case-board.show { display: flex; }
.cb-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.cb-title { font-size: clamp(15px, calc(2.2 * var(--vw)), 22px); }
.cb-wrap { position: relative; flex: 1 1 auto; overflow: auto; }
#cbStrings { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
#cbSlots { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 22px; padding: 24px; align-content: flex-start; justify-content: center; }
.cb-card { position: relative; width: clamp(130px, calc(22 * var(--vw)), 180px); background: #ece2c8; color: #201a12; padding: 8px; box-shadow: 0 6px 14px rgba(0,0,0,.5); transform: rotate(-1deg); }
.cb-card:nth-child(even) { transform: rotate(1.5deg); }
.cb-pin { position: absolute; top: -7px; left: 50%; transform: translateX(-50%); width: 12px; height: 12px; border-radius: 50%; background: var(--red); box-shadow: 0 2px 4px rgba(0,0,0,.5); }
.cb-photo { width: 100%; height: 92px; object-fit: cover; background: #141d16; display: block; }
.cb-photo.ph { display: flex; align-items: center; justify-content: center; color: var(--cyan-l); font-size: 20px; }
.cb-cap { margin-top: 6px; font-size: clamp(11px, calc(1.4 * var(--vw)), 13px); line-height: 1.3; }

/* ---- file browser (complex clues) ---- */
.file-browser { margin: 12px 0; border: 2px solid rgba(255,176,32,.35); background: rgba(10,20,16,.5); }
.fb-title { padding: 6px 10px; color: var(--cyan); letter-spacing: 1px; font-size: clamp(11px,calc(1.4 * var(--vw)),13px); border-bottom: 1px solid rgba(255,176,32,.2); text-shadow: 0 0 6px var(--cyan); }
.fb-list { display: flex; flex-direction: column; }
.fb-item { display: flex; align-items: center; gap: 10px; text-align: left; background: transparent; border: 0; border-bottom: 1px solid rgba(255,255,255,.06); color: var(--cyan-l); padding: 9px 12px; cursor: pointer; font-family: var(--font); font-size: clamp(12px,calc(1.5 * var(--vw)),14px); transition: background .1s; }
.fb-item:hover { background: rgba(224,58,28,.12); color: #fff; }
.fb-item.done { color: var(--green); opacity: .7; }
.fb-ic { flex: 0 0 auto; width: 20px; text-align: center; }
.fb-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-state { flex: 0 0 auto; color: var(--pink); }
.fb-item.done .fb-state { color: var(--green); }

/* ---- file browser: folders + evidence/noise ---- */
.fb-folder { border-bottom: 1px solid rgba(255,255,255,.06); }
.fb-folder-head { width: 100%; display: flex; align-items: center; gap: 8px; background: rgba(255,176,32,.06); border: 0; color: var(--yellow); padding: 7px 10px; cursor: pointer; font-family: var(--font); font-size: clamp(11px,calc(1.4 * var(--vw)),13px); letter-spacing: 1px; }
.fb-folder-head:hover { background: rgba(224,58,28,.12); }
.fb-fic { width: 14px; }
.fb-fname { flex: 1 1 auto; text-align: left; }
.fb-fcount { color: var(--grey); font-size: .85em; }
.fb-folder-body { }
.fb-folder-body .fb-item { padding-left: 26px; }
.fb-item.evidence { color: var(--green); }
.fb-item.evidence .fb-state { color: var(--yellow); }
.fb-item.junk { color: var(--grey); opacity: .65; }
.fb-item.junk .fb-state { color: var(--grey); }

/* =====================================================================
   HACKED OS — окремий екран зламаного компʼютера (реф: Fallout термінали)
===================================================================== */
/* зламаний ПК — той самий ФІЗИЧНИЙ CX-64, що й діалоговий термінал */
.hacked-os { position: fixed; inset: 0; z-index: 9600; display: none; background: var(--bg, #070b08); }
.hacked-os.show { display: flex; }
.hacked-os .crt-stage { flex: 1 1 auto; width: 100%; height: 100%; }
.os-head { gap: var(--sp2); }
.os-machine { color: var(--green); text-shadow: 0 0 8px var(--green); letter-spacing: 1px; font-size: 12px; flex: 1 1 auto; }
.os-ev { color: var(--yellow); text-shadow: 0 0 6px var(--orange); font-size: 11px; white-space: nowrap; }
.os-disconnect { border-color: var(--grey); color: var(--grey); }
.os-disconnect.ready { border-color: var(--green); color: var(--green); box-shadow: 0 0 10px rgba(57,255,110,.4); }
.os-disconnect.ready:hover, .os-disconnect.ready:active { background: rgba(57,255,110,.14); }
/* disconnect is a critical action → keep it a comfortable tap target; the shared
   halved PC-button size (min-height 11px) was too small to hit reliably */
.hacked-os .crt-head .os-disconnect { min-height: 30px; font-size: 11px; padding: 6px 12px; letter-spacing: 1px; }
.os-body { overflow-y: auto; }
.os-line.dim { color: rgba(140,255,170,.6); }
.os-hint { color: rgba(140,255,170,.6); font-size: 12px; margin-bottom: 10px; }

/* desktop grid — app tiles */
.os-grid { display: flex; flex-wrap: wrap; gap: var(--sp3); justify-content: center; }
/* PORTRAIT: centre the desktop "file system" (category apps) vertically so it's
   easy to switch categories; message/letter lists & read panes stay top-aligned. */
.hacked-os .os-body:has(> .os-grid) { display: flex; flex-direction: column; justify-content: center; }
.os-app {
  position: relative; width: 96px; min-height: 78px;
  background: rgba(57,255,110,.05); border: 2px solid rgba(57,255,110,.3);
  color: var(--green); cursor: pointer; font-family: var(--font);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 8px;
  transition: background .12s, border-color .12s, transform .06s;
}
.os-app:hover, .os-app:active { background: rgba(57,255,110,.14); border-color: var(--green); transform: translateY(-2px); }
.os-app-ic { font-size: 24px; line-height: 1; }
.os-app-name { letter-spacing: 1px; font-size: 11px; }
.os-app-count { color: rgba(140,255,170,.5); font-size: 9px; }
.os-app-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 8px var(--pink); }

/* window bar */
.os-winbar { display: flex; align-items: center; gap: var(--sp2); margin-bottom: 10px; border-bottom: 1px solid rgba(57,255,110,.2); padding-bottom: 7px; }
.os-back { min-height: 28px; padding: 5px 10px; display: inline-flex; align-items: center; background: transparent; border: 0; color: var(--cyan); cursor: pointer; font-family: var(--font); font-size: 12px; }
.os-back:hover, .os-back:active { color: #fff; text-shadow: 0 0 6px var(--cyan); }
.os-wintitle { color: var(--yellow); letter-spacing: 1px; font-size: 12px; }
.os-evtag { margin-left: auto; color: var(--yellow); text-shadow: 0 0 6px var(--orange); font-size: 11px; }

/* item list */
.os-list { display: flex; flex-direction: column; }
.os-item {
  display: flex; align-items: center; gap: var(--sp2); text-align: left; min-height: 34px;
  background: transparent; border: 0; border-bottom: 1px solid rgba(57,255,110,.12);
  color: var(--green); padding: 7px 8px; cursor: pointer; font-family: var(--font); font-size: 13px;
}
.os-item:hover { background: rgba(57,255,110,.1); }
.os-item.read { color: rgba(140,255,170,.55); }
.os-item.read.ev { color: var(--yellow); }
.os-item-ic { flex: 0 0 auto; width: 22px; text-align: center; }
.os-item-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.os-item-state { flex: 0 0 auto; }
.os-item.read .os-item-state { color: var(--green); }
.os-item.read.ev .os-item-state { color: var(--yellow); }

/* read pane */
.os-read { line-height: 1.55; }
.osr-meta { color: rgba(140,255,170,.6); font-size: 11px; margin-bottom: 8px; }
.osr-subject { color: var(--cyan-l); font-size: 13px; margin-bottom: 8px; }
.osr-body { color: var(--green); white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.5; }
.osr-body.mono { font-size: 0.95em; color: rgba(220,255,214,.85); }
.os-read .chat.sm { margin: 6px 0; }

/* ---- inbox: full-screen mail client (not a popup card) ---- */
.inbox { padding: 0; align-items: stretch; justify-content: stretch; background: linear-gradient(160deg, #090e0a, #050906); }
.ib-panel { width: 100%; max-width: 100%; height: 100%; max-height: 100%; background: transparent; padding: 20px clamp(14px, calc(5 * var(--vw)), 90px); }
.ib-head { border-bottom: 2px solid rgba(255,176,32,.3); padding-bottom: 12px; margin-bottom: 6px; }
.ib-title { font-size: clamp(9px, calc(1.5 * var(--vw)), 15px); }
.ib-list { width: 100%; max-width: 920px; margin: 14px auto 0; gap: 10px; }
.ib-item { padding: 8px 10px; }
.ib-name { font-size: clamp(8px, calc(1.05 * var(--vw)), 10px); }
.ib-sub { text-align: left; max-width: 920px; margin: 0 auto; width: 100%; }

/* ---- currency counters (separate from progress bars) ---- */
.currency { display: none; align-items: center; gap: 8px; margin-left: auto; }
.cur-item { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--hud-chip); box-sizing: border-box; padding: 0 12px; background: rgba(10,16,11,.7); border: 2px solid rgba(255,176,32,.3); font-size: 14px; }
.cur-item b { color: #fff; }
.cur-item.hack { color: var(--cyan); border-color: rgba(255,176,32,.45); }
.cur-item.cred { color: var(--pink-l); border-color: rgba(224,58,28,.45); }
/* profile HUD = level + XP bar only now */
.profile-hud { justify-content: flex-start; }

/* ---- hack target card (locked/unlocked) ---- */
.hack-target { display: flex; align-items: center; gap: 14px; margin: 14px 0; padding: 14px 16px; border: 2px solid var(--green); background: rgba(6,20,8,.5); box-shadow: 0 0 14px rgba(57,255,110,.15); }
.hack-target.locked { border-color: var(--grey); background: rgba(18,22,18,.5); box-shadow: none; }
.ht-ic { font-size: 30px; line-height: 1; }
.hack-target.locked .ht-ic { filter: grayscale(1); opacity: .75; }
.ht-info { flex: 1 1 auto; min-width: 0; }
.ht-machine { color: var(--cyan-l); font-size: clamp(13px,calc(1.7 * var(--vw)),16px); letter-spacing: 1px; }
.ht-cost { color: rgba(255,224,122,.7); font-size: clamp(11px,calc(1.3 * var(--vw)),13px); margin-top: 3px; }
.hack-target.locked .ht-cost { color: var(--orange); }
.ht-btn { flex: 0 0 auto; border: 2px solid var(--green); background: rgba(57,255,110,.12); color: var(--green); padding: 9px 15px; cursor: pointer; font-family: var(--font); font-size: clamp(12px,calc(1.5 * var(--vw)),14px); }
.ht-btn.go:hover { background: var(--green); color: var(--ink); }
.ht-btn.grind { border-color: var(--orange); background: transparent; color: var(--orange); }
.ht-btn.grind:hover { background: rgba(255,122,61,.14); }

/* ---- inbox rendered inside the PC terminal (mail rows) ---- */
.mail-row { display: flex; align-items: center; gap: var(--sp2); width: 100%; min-height: 34px; text-align: left; background: rgba(255,176,32,.04); border: 1px solid rgba(57,255,110,.28); color: var(--green); padding: 6px 10px; margin: 5px 0; cursor: pointer; font-family: var(--font); transition: background .12s, border-color .12s; }
.mail-row:hover, .mail-row:active { background: rgba(224,58,28,.1); border-color: var(--pink); color: #fff; }
.mail-row.active { border-color: var(--yellow); }
.mail-row.solved { opacity: .7; }
.mail-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.15); }
.mail-dot.on { background: var(--pink); box-shadow: 0 0 8px var(--pink); }
.mail-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mail-name { color: #fff; font-size: 11px; }
.mail-sub { color: rgba(140,255,170,.6); font-size: 9px; }
.mail-tag { flex: 0 0 auto; color: var(--cyan); font-size: 9px; }

/* ---- romance rows: portrait + heart meter (0-6, half-heart steps) ---- */
.mail-row.romance { border-color: rgba(224,58,28,.4); }
.mail-face { flex: 0 0 auto; width: 34px; height: 34px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px var(--pink); }
.mail-hearts { display: flex; gap: 1px; }
.mh { position: relative; font-size: 10px; line-height: 1; color: #3a2e22; }
.mh.full { color: var(--pink); text-shadow: 0 0 4px var(--pink); }
.mh.half { background: linear-gradient(90deg, var(--pink) 50%, #3a2e22 50%); -webkit-background-clip: text; background-clip: text; color: transparent; }

