:root {
  --steel-0: #04070d;
  --steel-1: #08111c;
  --steel-2: #0f2033;
  --steel-3: #1a3349;
  --steel-4: #2a4d66;
  --steel-5: #4a7188;
  --cyan: #64f4ef;
  --cyan-dim: #1d94a6;
  --pink: #f0719f;
  --magenta: #c73bdc;
  --green: #7bffa6;
  --green-dim: #2f8a55;
  --amber: #ffb03a;
  --red: #ff3d52;
  --beige: #f1e6d2;
  --hud: clamp(64px, 12vh, 116px);
  --pip: calc(var(--hud) * 0.40);
  --ammo-h: 0.48;
  --dock-h: 0.64;
  --level-h: 0.74;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--steel-0);
  color: var(--beige);
  font-family: 'VT323', monospace;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overscroll-behavior: none;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #04070d;
}

#game-root {
  position: absolute;
  inset: 0;
}
#game-root canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

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

.hidden { display: none !important; }

/* ---------------- HUD ---------------- */

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--hud);
  z-index: 20;
  background-color: #0a1421;
  background-image:
    linear-gradient(180deg, #2a455c 0 2px, #16283b 2px 9px, #0d1b2b 9px 20px, #0a1421 20px 100%);
  border-bottom: 4px solid #03070c;
  box-shadow: 0 4px 0 #071019, 0 9px 14px rgba(0, 0, 0, 0.65);
  padding-top: env(safe-area-inset-top);
}
#hud::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: repeating-linear-gradient(90deg, #38566d 0 6px, #0e1c2a 6px 11px);
  opacity: 0.9;
}
#hud::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 5px;
  height: 2px;
  background: repeating-linear-gradient(90deg, #2d465b 0 2px, transparent 2px 30px);
  opacity: 0.7;
}
.hud-rivets {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background:
    repeating-linear-gradient(90deg, #0c1725 0 14px, #1d3348 14px 18px, #0c1725 18px 34px);
}
.hud-inner {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(4px, 1.1vw, 22px);
  padding: 0 clamp(4px, 1.4vw, 26px) 8px;
  padding-top: env(safe-area-inset-top);
}

.hud-mod { position: relative; flex: 0 0 auto; }
.hud-cap {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  font-family: 'Silkscreen', monospace;
  font-weight: 700;
  font-size: clamp(7px, 1.15vh, 10px);
  line-height: 1;
  letter-spacing: 1px;
  color: #a9cfdd;
  background: rgba(4, 11, 18, 0.92);
  border-top: 1px solid #2b5568;
  padding: 2px 5px 1px;
  white-space: nowrap;
  text-shadow: 1px 1px 0 #02060b;
  pointer-events: none;
}
#healthMod .hud-cap { top: calc(100% + var(--hud) * 0.17); }
#ammoMod .hud-cap { top: calc(100% + var(--hud) * 0.10); }
#dockMod .hud-cap { top: calc(100% + var(--hud) * 0.025); }
.hud-vent {
  position: absolute;
  top: 5px;
  width: 22px;
  height: 13px;
  background: repeating-linear-gradient(180deg, #06121c 0 2px, #1b3446 2px 4px);
  border: 1px solid #0a1b28;
  opacity: 0.6;
  z-index: 0;
}
.hv-l { left: 4px; }
.hv-r { right: 4px; }
.hud-serial {
  position: absolute;
  left: 31px;
  top: 3px;
  font-family: 'Silkscreen', monospace;
  font-size: 5px;
  letter-spacing: 1px;
  color: #3f6176;
  text-shadow: 1px 1px 0 #02060b;
}
.hud-bulbs {
  position: absolute;
  right: 34px;
  top: 5px;
  display: flex;
  gap: 3px;
  opacity: 0.85;
}
.hud-bulbs i { width: 4px; height: 4px; display: block; box-shadow: 0 0 0 1px #03080e; }
.hud-bulbs .cy { background: #4fe6df; }
.hud-bulbs .am { background: #ffa23a; }
.hud-bulbs .rd { background: #ff4b5b; }
.hud-mod img { display: block; width: 100%; height: 100%; object-fit: contain; }

.health-mod { display: flex; align-items: center; }
.health-row { display: flex; align-items: center; }
.pip {
  position: relative;
  width: var(--pip);
  height: calc(var(--pip) * 1.02);
  margin-left: calc(var(--pip) * -0.06);
  flex: 0 0 auto;
}
.pip:first-child { margin-left: 0; }
.pip img { position: absolute; inset: 0; width: 100%; height: 100%; }
.pip .lit { z-index: 2; }
.pip.lost .lit { display: none; }
.pip.last .lit { animation: pipPulse 0.85s steps(2, end) infinite; }
@keyframes pipPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.ammo-mod { height: calc(var(--hud) * var(--ammo-h)); aspect-ratio: 546 / 184; }
.ammo-clip {
  position: absolute;
  left: 12.5%;
  right: 8.5%;
  top: 19%;
  bottom: 20%;
  overflow: hidden;
}
.ammo-spent {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 16.666%;
  width: 0%;
  background:
    linear-gradient(180deg, #071019 0 2px, #0a1624 2px 100%);
  box-shadow: inset 0 0 0 1px #050c14;
}

.dock-mod { height: calc(var(--hud) * var(--dock-h)); aspect-ratio: 323 / 316; }
.dock-window {
  position: absolute;
  left: 16%;
  right: 16%;
  top: 20%;
  bottom: 20%;
  display: grid;
  place-items: center;
}
.dock-empty {
  font-family: 'Silkscreen', monospace;
  font-size: calc(var(--hud) * 0.105);
  letter-spacing: 2px;
  color: #3a5168;
  opacity: 0.85;
  animation: dockDead 3.4s steps(1, end) infinite;
}
@keyframes dockDead {
  0%, 88% { opacity: 0.8; }
  90%, 96% { opacity: 0.12; }
  100% { opacity: 0.8; }
}
.dock-mod.live .dock-empty { display: none; }
.dock-live { display: none; width: 100%; height: 100%; place-items: center; }
.dock-mod.live .dock-live { display: grid; }
.dock-glyph {
  width: calc(var(--hud) * 0.2);
  height: calc(var(--hud) * 0.2);
  display: block;
  background: var(--cyan);
  box-shadow: inset 0 0 0 calc(var(--hud) * 0.035) #062028;
  position: relative;
}
.dock-glyph::before, .dock-glyph::after {
  content: "";
  position: absolute;
  background: #062028;
}
.dock-glyph::before { left: 28%; right: 28%; top: 0; bottom: 0; }
.dock-glyph::after { top: 28%; bottom: 28%; left: 0; right: 0; }
.dock-bar {
  display: block;
  width: 78%;
  height: calc(var(--hud) * 0.055);
  margin-top: calc(var(--hud) * 0.04);
  background: #06141a;
  box-shadow: inset 0 0 0 1px #0b2a33;
  position: relative;
}
.dock-bar s {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--cyan);
  text-decoration: none;
}

.level-mod { height: calc(var(--hud) * var(--level-h)); aspect-ratio: 394 / 261; }
.level-window {
  position: absolute;
  left: 9.5%;
  right: 9.5%;
  top: 18%;
  bottom: 17%;
  background: #06140f;
  box-shadow: inset 0 0 0 2px #0b2a1d, inset 0 0 0 4px #06100b;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4% 6%;
  overflow: hidden;
}
.level-digits {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-family: 'Silkscreen', monospace;
  color: #86ffa8;
  text-shadow: 1px 1px 0 #032e16;
  line-height: 1;
}
.level-digits span {
  font-weight: 700;
  font-size: calc(var(--hud) * 0.23);
  letter-spacing: 1px;
}
.level-digits em {
  font-style: normal;
  font-size: calc(var(--hud) * 0.095);
  color: #4fbf78;
  letter-spacing: 0;
}
.level-ticks {
  position: relative;
  display: flex;
  gap: 1px;
  height: calc(var(--hud) * 0.045);
  margin-top: 8%;
  overflow: hidden;
}
.level-ticks i {
  flex: 1 1 0;
  height: 100%;
  background: #123a26;
}

.hud-btn {
  flex: 0 0 auto;
  width: calc(var(--hud) * 0.3);
  height: calc(var(--hud) * 0.3);
  min-width: 26px;
  min-height: 26px;
  border: 2px solid #2c4a60;
  background: #0a1724;
  color: #7ea3b8;
  font-family: 'Silkscreen', monospace;
  font-size: calc(var(--hud) * 0.12);
  line-height: 1;
  cursor: pointer;
  box-shadow: 2px 2px 0 #02060b;
  padding: 0;
}
.hud-btn:active { transform: translate(2px, 2px); box-shadow: none; }

".chamber-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 3px;
  background: #061019;
  z-index: 2;
}
.chamber-track i {
  display: block;
  height: 100%;
  width: 0;
  background: #4fe6df;
  box-shadow: 1px 0 0 #d8fffb;
}
#hud.hurt { animation: hudHurt 0.36s steps(2, end) 1; }
@keyframes hudHurt {
  0%, 100% { filter: none; }
  50% { filter: brightness(1.9) saturate(0.4); }
}

@media (max-width: 620px) {
  :root { --hud: clamp(56px, 10.5vh, 88px); --pip: 30px; --ammo-h: 0.5; --dock-h: 0.66; --level-h: 0.76; }
  .hud-inner { gap: 5px; }
  .level-digits span { font-size: calc(var(--hud) * 0.24); }
}
@media (max-width: 430px) {
  :root { --hud: clamp(52px, 9.4vh, 74px); --pip: 26px; --ammo-h: 0.52; --dock-h: 0.66; --level-h: 0.78; }
  .terminal-text { font-size: 13px; line-height: 1.16; }
  .terminal-foot { font-size: 7px; }
  .intro-main { font-size: clamp(14px, 3.0vh, 23px); }
  .intro-sub { font-size: 11px; }
  .intro-head { font-size: 7px; }
  .title-art { width: 82vw; }
  .hud-inner { gap: 4px; padding: 0 4px; }
  .hud-btn { width: calc(var(--hud) * 0.34); height: calc(var(--hud) * 0.34); }
}
@media (max-width: 370px) {
  :root { --hud: 50px; }
  .dock-mod { display: none; }
  .level-digits em { display: none; }
  .hud-cap { display: none; }
  .hud-serial { display: none; }
  .hud-bulbs { display: none; }
}

/* ---------------- Controls ---------------- */

#controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: clamp(72px, 13vh, 120px);
  z-index: 18;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 clamp(8px, 2.2vw, 26px) calc(env(safe-area-inset-bottom) + 8px);
}
.ctrl-btn {
  pointer-events: auto;
  width: clamp(54px, 8.2vh, 84px);
  height: clamp(54px, 8.2vh, 84px);
  border: 3px solid #28536a;
  background: rgba(6, 15, 24, 0.76);
  color: var(--cyan);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.75), inset 0 0 0 2px #0a1e2a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: 'Silkscreen', monospace;
  cursor: pointer;
  padding: 0;
}
.ctrl-btn:active, .ctrl-btn.held {
  background: rgba(20, 70, 76, 0.85);
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8), inset 0 0 0 2px #0a2a2e;
}
.ctrl-glyph { font-size: clamp(13px, 2.2vh, 22px); line-height: 1; }
.ctrl-word { font-size: clamp(6px, 0.95vh, 9px); letter-spacing: 1px; color: #a9d7e2; }
.ctrl-hint {
  align-self: flex-end;
  margin-bottom: 6px;
  font-family: 'Silkscreen', monospace;
  font-size: clamp(6px, 1.25vh, 10px);
  color: #527791;
  letter-spacing: 1px;
  text-align: center;
  pointer-events: none;
  text-shadow: 1px 1px 0 #02060b;
  max-width: 52vw;
  line-height: 1.5;
  padding: 0 6px;
}

/* ---------------- Screens ---------------- */

.screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.32) 0 1px, transparent 1px 3px);
  pointer-events: none;
  opacity: 0.45;
}

.title-screen {
  background: rgba(2, 5, 10, 0.52);
}
.title-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(2, 5, 10, 0.66) 0 18%, rgba(2, 5, 10, 0.30) 18% 52%, rgba(2, 5, 10, 0.78) 52% 100%);
  pointer-events: none;
}
.title-column {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-height: 100%;
  padding: 2vh 4vw;
  gap: clamp(6px, 1.4vh, 18px);
  overflow: hidden;
}
.title-art {
  width: min(72vw, 620px);
  max-height: 32vh;
  object-fit: contain;
  filter: drop-shadow(7px 7px 0 rgba(0, 0, 0, 0.55));
  margin-top: 1vh;
}
.terminal-wrap {
  position: relative;
  width: min(86vw, 540px);
  aspect-ratio: 920 / 705;
  max-height: 38vh;
  margin: 0 auto;
  filter: drop-shadow(6px 6px 0 rgba(0, 0, 0, 0.6));
}
.terminal-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.terminal-glass {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 11%;
  bottom: 11%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5% 6%;
  background-color: #04130b;
  background-image: url("assets/dither_green.png");
  background-size: 16px 16px;
  overflow: hidden;
}
.terminal-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.42) 0 1px, transparent 1px 3px);
  pointer-events: none;
}
.terminal-glass::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 26%;
  top: -30%;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(120, 255, 170, 0) 0%, rgba(120, 255, 170, 0.20) 50%, rgba(120, 255, 170, 0) 100%);
  animation: sweepOnce 2.1s linear 0.45s 1 both;
}
@keyframes sweepOnce {
  0% { top: -30%; }
  100% { top: 116%; }
}
.terminal-text {
  font-family: 'VT323', monospace;
  color: #8dffb0;
  font-size: clamp(10px, 2.35vh, 18px);
  line-height: 1.14;
  text-shadow: 2px 2px 0 rgba(0, 30, 12, 0.85);
  white-space: pre-wrap;
  position: relative;
  z-index: 1;
  min-height: 4.4em;
}
.terminal-text .dim { color: #4faf72; }
.terminal-text .warn { color: #cfee8a; }
.terminal-foot {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Silkscreen', monospace;
  color: #4fbf78;
  font-size: clamp(6px, 1.25vh, 10px);
  letter-spacing: 0.5px;
  gap: 8px;
}
.blink { animation: blink 1s steps(1, end) infinite; color: #9dffc0; }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.title-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
#recordLine a {
  color: #8dffb0;
  text-decoration: none;
  border-bottom: 1px solid #2f8a55;
}
#recordLine a:hover { color: #e2ffe9; }
body.no-scan .screen::before,
body.no-scan .terminal-glass::after,
body.no-scan .cut-scan { display: none; }

.title-note {
  font-family: 'Silkscreen', monospace;
  font-size: clamp(6px, 1.15vh, 9px);
  letter-spacing: 0.5px;
  color: #4d718a;
  text-align: center;
  text-shadow: 1px 1px 0 #02060b;
}

.pixel-btn {
  font-family: 'Silkscreen', monospace;
  font-size: clamp(10px, 1.9vh, 15px);
  letter-spacing: 0.5px;
  color: #b8ffd0;
  background: #0a1a15;
  border: 3px solid #2f6f52;
  box-shadow: 4px 4px 0 #02060b, inset 0 0 0 2px #07100c;
  padding: clamp(8px, 1.5vh, 14px) clamp(14px, 2.6vw, 26px);
  cursor: pointer;
  text-transform: uppercase;
  line-height: 1;
}
.pixel-btn:hover { background: #12291f; color: #e2ffe9; }
.pixel-btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #02060b; }
.pixel-btn.big { font-size: clamp(12px, 2.3vh, 19px); color: #effff4; border-color: #48a67a; background: #0c211a; }
.pixel-btn.ghost { background: transparent; color: #7ea3b8; border-color: #234055; box-shadow: none; }
.pixel-btn.small { font-size: 9px; padding: 7px 10px; border-width: 2px; }

/* Intro */
.intro-screen {
  background: linear-gradient(180deg, rgba(2, 5, 10, 0.80) 0 34%, rgba(2, 5, 10, 0.42) 34% 56%, rgba(2, 5, 10, 0.16) 56% 100%);
}
.intro-wrap {
  position: relative;
  width: min(78vw, calc(62vh * 1.304), 470px);
  aspect-ratio: 920 / 705;
  filter: drop-shadow(7px 7px 0 rgba(0, 0, 0, 0.65));
}
.intro-terminal { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.intro-glass::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 24%;
  top: -30%;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(120, 255, 170, 0) 0%, rgba(120, 255, 170, 0.18) 50%, rgba(120, 255, 170, 0) 100%);
  animation: sweepOnce 1.8s linear 0.2s 1 both;
}
.intro-glass {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 11%;
  bottom: 11%;
  padding: 6%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2.6%;
  background-color: #04130b;
  background-image: url("assets/dither_green.png");
  background-size: 16px 16px;
  font-family: 'VT323', monospace;
  color: #8dffb0;
  text-shadow: 2px 2px 0 rgba(0, 30, 12, 0.85);
  overflow: hidden;
}
.intro-head {
  display: flex;
  justify-content: space-between;
  font-family: 'Silkscreen', monospace;
  font-size: clamp(7px, 1.35vh, 11px);
  color: #4fbf78;
  letter-spacing: 0.5px;
  white-space: nowrap;
  gap: 8px;
}
.intro-head span { flex: 0 0 auto; }
.intro-main {
  font-size: clamp(15px, 3.4vh, 27px);
  line-height: 1.02;
  color: #b8ffcb;
}
.intro-sub {
  font-size: clamp(11px, 2.3vh, 18px);
  line-height: 1.1;
  color: #6fd28d;
  min-height: 2.2em;
  white-space: pre-line;
}
.intro-go {
  font-family: 'Silkscreen', monospace;
  font-size: clamp(7px, 1.4vh, 11px);
  color: #a9ffc4;
  letter-spacing: 1px;
}

/* Pause */
.pause-screen, .over-screen { background: rgba(2, 5, 10, 0.8); }
.pause-card, .over-card {
  position: relative;
  z-index: 2;
  width: min(86vw, 430px);
  padding: clamp(18px, 3.4vh, 34px) clamp(16px, 4vw, 34px);
  background: #08121c;
  border: 3px solid #274a60;
  box-shadow: 7px 7px 0 #02060b, inset 0 0 0 2px #0c1b28;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(8px, 1.6vh, 14px);
  text-align: center;
}
.pause-title, .over-kicker {
  font-family: 'Silkscreen', monospace;
  font-size: clamp(8px, 1.5vh, 11px);
  letter-spacing: 2px;
  color: #5d8aa4;
}
.over-title {
  font-family: 'Pixelify Sans', monospace;
  font-size: clamp(26px, 6.5vh, 48px);
  line-height: 0.95;
  color: #ff6c81;
  text-shadow: 3px 3px 0 #000, 5px 5px 0 #300812;
  letter-spacing: 1px;
}
.pause-line, .over-stats {
  font-family: 'VT323', monospace;
  font-size: clamp(14px, 2.7vh, 22px);
  line-height: 1.25;
  color: #8fd6a8;
  white-space: pre-line;
}
.over-kicker { color: #ff5568; }

/* Cutscene */
.cutscene {
  position: absolute;
  inset: 0;
  z-index: 60;
  background: #000;
  overflow: hidden;
}
.cut-zoom {
  position: absolute;
  inset: 0;
  animation: cutZoom 30s steps(90, end) forwards;
}
@keyframes cutZoom {
  from { transform: scale(1); }
  to { transform: scale(1.09); }
}
.cut-wall {
  position: absolute;
  inset: 0;
  background-image: url("assets/elements/lab_far_wall.webp");
  background-repeat: no-repeat;
  image-rendering: pixelated;
  filter: brightness(0.58) contrast(1.22) saturate(0.82);
}
.cut-scan {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0 1px, transparent 1px 3px);
  pointer-events: none;
  mix-blend-mode: multiply;
}
.cut-scan::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 16%;
  top: -20%;
  background: linear-gradient(180deg, rgba(120, 255, 190, 0) 0 22%, rgba(120, 255, 190, 0.07) 22% 78%, rgba(120, 255, 190, 0) 78% 100%);
  animation: cutSweep 7s linear infinite;
}
@keyframes cutSweep { 0% { top: -20%; } 100% { top: 110%; } }
.cut-vignette {
  position: absolute;
  inset: 0;
  background: transparent;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.5), inset 0 0 0 14px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.cut-bars i {
  position: absolute;
  left: 0; right: 0;
  height: 9vh;
  background: #000;
  z-index: 3;
}
.cut-bars i:first-child { top: 0; }
.cut-bars i:last-child { bottom: 0; }
.cut-terminal {
  position: absolute;
  left: 5vw;
  right: 5vw;
  bottom: calc(9vh + 16px);
  z-index: 4;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}
.cut-lines {
  font-family: 'VT323', monospace;
  font-size: clamp(13px, 2.9vh, 25px);
  line-height: 1.22;
  color: #9dffc0;
  text-shadow: 2px 2px 0 rgba(0, 12, 5, 0.9);
  white-space: pre-wrap;
  max-width: 72vw;
  min-height: 3em;
}
.cut-lines .big { color: #ecfff1; font-size: 1.24em; }
.cut-lines .dim { color: #57ab78; }
.cut-actions { display: flex; align-items: center; gap: 12px; }
.cut-cursor { font-size: clamp(13px, 2.4vh, 21px); color: #9dffc0; }
.cut-end {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.4vh;
  background: rgba(0, 0, 0, 0.86);
  padding: 6vw;
  text-align: center;
}
.cut-title {
  width: min(62vw, 520px);
  max-height: 26vh;
  object-fit: contain;
  filter: drop-shadow(6px 6px 0 #000);
}
.cut-end-line {
  font-family: 'Silkscreen', monospace;
  font-size: clamp(10px, 2.1vh, 16px);
  letter-spacing: 4px;
  color: #7dffa8;
}
.cut-end-sub {
  font-family: 'VT323', monospace;
  font-size: clamp(13px, 2.5vh, 21px);
  color: #5f9d78;
  max-width: 80vw;
}

/* Toast */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(clamp(72px, 13vh, 120px) + 10px);
  transform: translateX(-50%);
  z-index: 25;
  padding: 7px 14px;
  background: rgba(4, 12, 20, 0.92);
  border: 2px solid #2b6a6c;
  box-shadow: 3px 3px 0 #02060b;
  font-family: 'Silkscreen', monospace;
  font-size: clamp(7px, 1.4vh, 11px);
  letter-spacing: 1px;
  color: var(--cyan);
  text-align: center;
  pointer-events: none;
  max-width: 84vw;
}
.toast.warn { border-color: #8a2a3a; color: #ff9caa; }

/* Landscape title layout */
@media (min-aspect-ratio: 1/1) {
  .title-column {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 2.2vw;
    padding: 2vh 3vw;
  }
  .title-art {
    width: min(46vw, 640px);
    max-height: 56vh;
    margin-top: 0;
  }
  .terminal-wrap { width: min(36vw, 470px); max-height: 62vh; }
  .title-actions, .title-note { flex-basis: 100%; }
  .title-note { order: 4; }
}

@media (max-height: 560px) {
  .title-art { max-height: 26vh; }
  .terminal-wrap { max-height: 46vh; }
}

@media (max-width: 620px) {
  .intro-screen { align-items: start; justify-items: center; padding-top: 9vh; }
  .intro-wrap { width: min(64vw, calc(62vh * 1.304), 470px); }
}

/* Narrow-screen text sizing must come after the base rules */
@media (max-width: 430px) {
  .terminal-text { font-size: 13px; line-height: 1.16; }
  .terminal-foot { font-size: 7px; }
  .intro-main { font-size: clamp(14px, 3vh, 23px); }
  .intro-sub { font-size: 11px; }
  .intro-head { font-size: 7px; }
  .title-art { width: 82vw; }
}
