:root {
  --bg: #020507;
  --ink: #f2fbff;
  --muted: #a9c1ca;
  --cyan: #9fe7ff;
  --cyan-soft: rgba(159, 231, 255, .42);
  --panel: rgba(2, 9, 13, .78);
  --panel-strong: rgba(3, 14, 20, .92);
  --red: #ff4848;
  --green: #9bea59;
  --yellow: #ffd95a;
  --font-display: "Bahnschrift Condensed", "Arial Narrow", "Roboto Condensed", "Segoe UI Condensed", Arial, sans-serif;
  --font-ui: "Bahnschrift", "Roboto Condensed", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: #000 url("assets/desktop-ambience.webp") center center / cover fixed no-repeat;
  color: var(--ink);
  font-family: var(--font-display);
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body {
  display: grid;
  align-items: start;
  justify-items: center;
}

button {
  appearance: none;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.phone-frame {
  width: min(100vw, 430px);
  max-width: 100%;
  min-height: 100svh;
  margin: 0;
  position: relative;
  overflow: hidden;
  background: var(--bg);
  container-type: inline-size;
}

.phone-frame,
.panel-screen {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.phone-frame::-webkit-scrollbar,
.panel-screen::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.screen {
  display: none;
  width: 100%;
  min-height: 100svh;
  position: relative;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.screen.active { display: flex; }

.home-screen {
  flex-direction: column;
  justify-content: space-between;
  background: #020609 url("assets/hero-lab.webp") center center / cover no-repeat;
}

.home-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-repeat: repeat;
  background-position: center center;
}

.mist-layer {
  z-index: 1;
  opacity: .48;
  background-image: url("assets/home-mist.webp");
  background-size: 118% auto;
  animation: homeMistDrift 13s ease-in-out infinite alternate;
}

.mist-b {
  opacity: .28;
  background-size: 150% auto;
  animation-duration: 18s;
  animation-direction: alternate-reverse;
}

.spark-layer {
  z-index: 3;
  opacity: .42;
  background-image: url("assets/home-sparks.webp");
  background-size: 100% auto;
  animation: sparkFloat 5.5s steps(4, end) infinite;
}

.premium-atmosphere-layer {
  z-index: 4;
  opacity: .74;
  background-image: url("assets/home-premium-atmosphere.webp");
  background-size: 100% 100%;
  background-position: center;
  animation: premiumAtmosphere 7.4s ease-in-out infinite;
}

.side-rail {
  position: absolute;
  z-index: 7;
  left: 10px;
  top: 30%;
  display: grid;
  gap: 9px;
}

.icon-btn,
.control-btn {
  width: 44px;
  height: 44px;
  position: relative;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: center;
}

.icon-gear { background-image: url("assets/ui/icon-gear.webp"); }
.icon-map { background-image: url("assets/ui/icon-map.webp"); }
.icon-book { background-image: url("assets/ui/icon-book.webp"); }
.icon-cup { background-image: url("assets/ui/icon-cup.webp"); }
.icon-pause { background-image: url("assets/ui/control-pulse.webp"); }
.icon-left { background-image: url("assets/ui/control-left.webp"); }
.icon-right { background-image: url("assets/ui/control-right.webp"); }
.icon-up { background-image: url("assets/ui/control-up.webp"); }
.icon-down { background-image: url("assets/ui/control-down.webp"); }
.icon-dash { background-image: url("assets/ui/control-dash.webp"); }
.icon-pulse { background-image: url("assets/ui/control-pulse.webp"); }

.mini-icon {
  width: 19px;
  height: 19px;
  position: relative;
  display: inline-block;
  margin-right: 10px;
  color: currentColor;
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

.brand {
  position: relative;
  z-index: 8;
  padding-top: clamp(12px, 2.8svh, 24px);
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(151, 226, 255, .5), 0 4px 18px #000;
}

.logo-stack {
  width: min(88cqw, 352px);
  position: relative;
  margin-inline: auto;
  animation: logoArrival .72s ease-out both, logoWake 4.8s ease-in-out .9s infinite;
}

.logo-mark {
  width: 100%;
  aspect-ratio: 971 / 469;
  margin: 0;
  display: block;
  margin-inline: auto;
  background: transparent url("assets/logo-shadow-trap.webp") center center / contain no-repeat;
  font-size: 0;
  line-height: 0;
}

.logo-sheen {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: transparent url("assets/logo-sheen.webp") center center / contain no-repeat;
  animation: logoSheen 4.4s ease-in-out 1.35s infinite;
}

.hero-focus {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-height: 270px;
  pointer-events: none;
}

.home-actions {
  position: relative;
  z-index: 8;
  display: grid;
  gap: 11px;
  width: min(76cqw, 304px);
  margin: 0 auto clamp(16px, 3svh, 26px);
}

.glass-btn {
  min-height: 50px;
  padding: 0 18px;
  color: var(--ink);
  background: transparent url("assets/ui/button-wide.webp") center / 100% 100% no-repeat;
  font: 900 clamp(15px, 4.35cqw, 19px)/1 var(--font-display);
  letter-spacing: .11em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: transform .16s ease, filter .18s ease;
}

.home-actions .glass-btn {
  animation: buttonRise .58s ease-out both;
}

.home-actions .glass-btn:nth-child(2) { animation-delay: .08s; }
.home-actions .glass-btn:nth-child(3) { animation-delay: .16s; }

.home-actions .glass-btn.primary {
  animation: buttonRise .58s ease-out both, ctaBreathe 2.65s ease-in-out .85s infinite, actionReady 5.8s ease-in-out 1.2s infinite;
}

.glass-btn:hover,
.glass-btn:focus-visible {
  transform: translateY(-2px);
  filter: brightness(1.24) saturate(1.12);
}

.glass-btn:active {
  transform: translateY(1px) scale(.985);
  filter: brightness(1.42) saturate(1.18);
}

.icon-btn {
  transition: transform .16s ease, filter .16s ease;
}

.side-rail .icon-btn {
  animation: iconWake .7s ease-out both, iconSignal 4.6s ease-in-out 1s infinite;
}

.side-rail .icon-btn:nth-child(2) { animation-delay: .07s; }
.side-rail .icon-btn:nth-child(3) { animation-delay: .14s; }
.side-rail .icon-btn:nth-child(4) { animation-delay: .21s; }

.icon-btn:hover,
.icon-btn:focus-visible {
  transform: translateX(2px) scale(1.04);
  filter: brightness(1.28) saturate(1.12);
}

.glass-btn.primary {
  min-height: 66px;
  font-size: clamp(27px, 7.7cqw, 33px);
  letter-spacing: .2em;
  background-image: url("assets/ui/button-wide.webp");
}

.game-screen,
.panel-screen {
  flex-direction: column;
  gap: 9px;
  background: #020507 url("assets/hero-lab.webp") center / cover no-repeat;
}

.panel-screen {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.game-hud,
.objectives-panel,
.panel-head,
.profile-card,
.lore-panel {
  position: relative;
  z-index: 3;
  background: var(--panel);
}

.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  min-height: 48px;
  padding: 6px 9px;
  text-transform: uppercase;
}

.hud-title {
  min-width: 0;
}

.hud-title strong,
.panel-head h2,
.subhead {
  display: block;
  color: var(--cyan);
  font-size: clamp(16px, 4.45cqw, 20px);
  line-height: .96;
  letter-spacing: .095em;
  text-shadow: 0 0 15px rgba(159, 231, 255, .55);
  text-wrap: balance;
}

.hud-title span {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: clamp(9px, 2.55cqw, 11px);
  line-height: 1.15;
  letter-spacing: .065em;
  font-weight: 800;
  white-space: nowrap;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  font-family: var(--font-ui);
  font-size: clamp(11px, 3cqw, 13px);
  font-weight: 900;
  letter-spacing: .07em;
  white-space: nowrap;
}

.objectives-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
  padding: 7px 9px;
  text-transform: uppercase;
  font-family: var(--font-ui);
  font-size: clamp(9px, 2.5cqw, 11px);
  line-height: 1.18;
  font-weight: 900;
  letter-spacing: .025em;
}

.route-guide {
  grid-column: 1 / -1;
  margin: 1px 0 0;
  color: var(--cyan);
  font-family: var(--font-ui);
  font-size: clamp(9px, 2.5cqw, 11px);
  line-height: 1.18;
  letter-spacing: .045em;
}

.objectives-panel b {
  color: var(--cyan);
  letter-spacing: .065em;
}

.objectives-panel ol {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 16px;
}

.objectives-panel li.done {
  color: var(--green);
  text-decoration: line-through;
}

.playfield {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #05080b;
}

.playfield:focus,
.playfield:focus-visible {
  outline: 0;
}

.room-backdrop {
  position: absolute;
  inset: 0;
  background-image: url("assets/lab-atlas-v2.webp");
  background-size: 400% 200%;
  background-repeat: no-repeat;
  opacity: .56;
  filter: contrast(1.12) brightness(.74);
}

.wall-grid {
  position: absolute;
  inset: 0;
  background-image: url("assets/lab-atlas-v2.webp");
  background-size: 400% 200%;
  background-repeat: no-repeat;
  opacity: .22;
  filter: contrast(1.22) brightness(.58);
}

.playfield[data-theme="research"] .wall-grid,
.playfield[data-theme="transit"] .wall-grid { opacity: .44; }

.playfield[data-theme="security"] .wall-grid,
.playfield[data-theme="tunnel"] .wall-grid { opacity: .28; }

.platform,
.ladder,
.security-door,
.switch,
.special-node,
.camera-unit,
.guard,
.robot-unit,
.checkpoint,
.exit-pad,
.player-echo,
.player,
.shadow-zone,
.light-beam,
.laser-grid {
  position: absolute;
}

.platform {
  height: 22px;
  background-image: url("assets/gameplay-sprites.webp");
  background-size: 400% 400%;
  background-position: 100% 66.666%;
  background-repeat: repeat-x;
  opacity: .92;
  filter: brightness(1.12) contrast(1.08) drop-shadow(0 0 5px rgba(159, 231, 255, .22));
}

.playfield[data-theme="chemical"] .platform,
.playfield[data-theme="power"] .platform { filter: brightness(.86) sepia(.18) saturate(1.4); }

.playfield[data-theme="assembly"] .platform,
.playfield[data-theme="security"] .platform { filter: brightness(.74) saturate(1.2); }

.playfield[data-theme="transit"] .platform,
.playfield[data-theme="tunnel"] .platform { filter: brightness(.66) saturate(.8); }

.floor-bottom { left: 0; right: 0; bottom: 16%; }
.floor-mid { left: 0; right: 0; bottom: 47%; }
.floor-top { left: 0; right: 0; bottom: 78%; }
.ledge { width: 30%; bottom: 31%; }
.ledge-left { left: 6%; }
.ledge-right { right: 8%; bottom: 62%; }

.ladder {
  width: 28px;
  height: 29%;
  background-image: url("assets/gameplay-sprites.webp");
  background-size: 400% 400%;
  background-position: 0 100%;
  background-repeat: repeat-y;
  opacity: .82;
}

.ladder i {
  display: none;
}

.ladder-left { left: 18%; bottom: 17%; }
.ladder-right { right: 21%; bottom: 48%; }

.shadow-zone {
  z-index: 1;
  height: 13%;
  background-image: url("assets/gameplay-sprites.webp");
  background-size: 400% 400%;
  background-position: 33.333% 0;
  background-repeat: no-repeat;
  opacity: .6;
  filter: drop-shadow(0 0 8px rgba(110, 221, 255, .35));
  animation: shadowBreathe 2.4s ease-in-out infinite;
}

.shadow-zone.moving {
  opacity: .76;
  filter: brightness(1.12) drop-shadow(0 0 12px rgba(110, 221, 255, .52));
}

.shadow-a { left: 3%; width: 31%; bottom: 17%; }
.shadow-b { left: 4%; width: 28%; bottom: 48%; }
.shadow-c { left: 55%; width: 22%; bottom: 48%; }
.shadow-d { left: 66%; width: 26%; bottom: 79%; }

.light-beam {
  z-index: 2;
  width: 26%;
  height: 30%;
  background-image: url("assets/gameplay-sprites.webp");
  background-size: 400% 400%;
  background-position: 66.666% 100%;
  background-repeat: no-repeat;
  animation: lightSweep 3.4s ease-in-out infinite;
}

.beam-top { left: 42%; top: 1%; transform-origin: 50% 0; }
.beam-mid { right: 8%; top: 36%; transform: rotate(15deg); transform-origin: 80% 15%; background-position: 100% 100%; animation-duration: 2.8s; }

.laser-grid {
  z-index: 4;
  left: 37%;
  right: 10%;
  bottom: 21%;
  height: 19%;
  background-image: url("assets/gameplay-sprites.webp");
  background-size: 400% 400%;
  background-position: 33.333% 100%;
  background-repeat: no-repeat;
  animation: laserHum 1.25s ease-in-out infinite;
}

.laser-grid i {
  display: none;
}

.camera-unit {
  z-index: 5;
  right: 9%;
  bottom: 59%;
  width: 62px;
  height: 50px;
  background-image: url("assets/gameplay-sprites.webp");
  background-size: 400% 400%;
  background-position: 0 33.333%;
  background-repeat: no-repeat;
}

.camera-unit.off {
  opacity: .45;
}

.playfield.camera-idle .beam-mid,
.playfield.top-idle .beam-top {
  opacity: .18;
  filter: brightness(.55) saturate(.7);
}

.playfield.camera-idle .camera-unit {
  opacity: .58;
  filter: brightness(.72) saturate(.85);
}

.playfield.laser-idle .laser-grid {
  opacity: .28;
  filter: brightness(.46) saturate(.7);
}

.playfield.blackout .room-backdrop {
  filter: contrast(1.18) brightness(.54) saturate(.92);
}

.playfield.blackout .shadow-zone {
  opacity: .82;
}

.switch {
  z-index: 6;
  width: 42px;
  height: 52px;
  background-image: url("assets/gameplay-sprites.webp");
  background-size: 400% 400%;
  background-position: 100% 33.333%;
  background-repeat: no-repeat;
}

.special-node {
  z-index: 6;
  width: 46px;
  height: 52px;
  background-image: url("assets/gameplay-sprites.webp");
  background-size: 400% 400%;
  background-position: 100% 33.333%;
  background-repeat: no-repeat;
}

.special-node[hidden] {
  display: none;
}

.switch.on {
  background-position: 0 66.666%;
  filter: brightness(1.2) saturate(1.15);
}

.special-node.on {
  background-position: 0 66.666%;
  opacity: .68;
  filter: brightness(1.22) saturate(1.18);
}

.switch.near,
.special-node.near,
.security-door.near,
.exit-pad.near {
  filter: brightness(1.35) saturate(1.25) drop-shadow(0 0 9px rgba(159, 231, 255, .55));
}

.switch.next-target,
.special-node.next-target,
.exit-pad.next-target {
  filter: brightness(1.5) saturate(1.3) drop-shadow(0 0 12px rgba(159, 231, 255, .75));
  animation: targetPulse 1.05s ease-in-out infinite;
}

.switch-camera { left: 28%; bottom: 49%; }
.switch-door { right: 19%; bottom: 80%; }

.guard {
  z-index: 5;
  width: 54px;
  height: 76px;
  bottom: 79%;
  left: 48%;
  background-image: url("assets/gameplay-sprites.webp");
  background-size: 400% 400%;
  background-position: 66.666% 0;
  background-repeat: no-repeat;
  animation: patrolBob 1.1s ease-in-out infinite;
}

.robot-unit {
  z-index: 5;
  width: 58px;
  height: 54px;
  right: 7%;
  bottom: 48%;
  background-image: url("assets/gameplay-sprites.webp");
  background-size: 400% 400%;
  background-position: 100% 0;
  background-repeat: no-repeat;
  animation: robotScan 1.4s steps(2, end) infinite;
}

.robot-unit.possessed {
  opacity: .55;
  filter: brightness(1.35) saturate(1.15) drop-shadow(0 0 10px rgba(159, 231, 255, .55));
}

.checkpoint,
.exit-pad {
  z-index: 4;
  bottom: 17%;
  width: 48px;
  height: 58px;
  background-image: url("assets/gameplay-sprites.webp");
  background-size: 400% 400%;
  background-repeat: no-repeat;
}

.checkpoint { left: 5%; background-position: 33.333% 66.666%; }
.exit-pad { background-position: 66.666% 66.666%; }

.security-door {
  z-index: 5;
  right: 4%;
  bottom: 79%;
  width: 62px;
  height: 92px;
  background-image: url("assets/gameplay-sprites.webp");
  background-size: 400% 400%;
  background-position: 33.333% 33.333%;
  background-repeat: no-repeat;
}

.security-door.open {
  background-position: 66.666% 33.333%;
  opacity: .66;
}

.exit-pad { right: 6%; bottom: 79%; opacity: 0; }

.exit-pad.open {
  opacity: .94;
  filter: brightness(1.2) saturate(1.12) drop-shadow(0 0 10px rgba(159, 231, 255, .5));
}

.player,
.player-echo {
  z-index: 7;
  width: 60px;
  height: 78px;
  left: 15%;
  bottom: 17%;
  transition: bottom .18s ease, filter .12s ease, opacity .12s ease;
  background-repeat: no-repeat;
  transform-origin: 50% 82%;
}

.player {
  background-image: url("assets/shadow-action-fx.webp"), url("assets/shadow-forms-atlas.webp");
  background-size: 400% 100%, 400% 200%;
  background-position: 0 0, var(--shadow-position, 0 0);
  animation: shadowIdle 1.8s ease-in-out infinite;
  filter: brightness(1.22) contrast(1.08) drop-shadow(0 0 12px rgba(135, 225, 255, .65));
}

.player-echo {
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  background-image: url("assets/shadow-forms-atlas.webp");
  background-size: 400% 200%;
  background-position: var(--shadow-position, 0 0);
  filter: blur(.4px) drop-shadow(0 0 10px rgba(125, 223, 255, .42));
}

.player-echo.show {
  opacity: .24;
}

.player-echo.echo-b.show {
  opacity: .13;
}

.player-echo.facing-left {
  transform: scaleX(-1);
}

.player.hidden {
  opacity: .7;
  background-position: 100% 0, var(--shadow-position, 0 0);
  filter: brightness(1.08) drop-shadow(0 0 14px rgba(84, 198, 255, .88));
}

.player.merged {
  opacity: .48;
  background-position: 100% 0, var(--shadow-position, 0 0);
  filter: brightness(1.25) contrast(1.1) drop-shadow(0 0 20px rgba(84, 198, 255, .9));
}

.playfield.clone-active .player-echo.show {
  opacity: .4;
  filter: brightness(1.2) drop-shadow(0 0 14px rgba(125, 223, 255, .7));
}

.player.dead {
  filter: drop-shadow(0 0 14px var(--red));
}

.player.facing-left {
  transform: scaleX(-1);
  animation: shadowIdleLeft 1.8s ease-in-out infinite;
}

.player.walking {
  background-position: 33.333% 0, var(--shadow-position, 0 0);
  animation: shadowRun .34s ease-in-out infinite;
}

.player.walking.facing-left {
  animation: shadowRunLeft .34s ease-in-out infinite;
}

.player.climbing {
  animation: shadowClimb .5s ease-in-out infinite;
}

.player.dashing {
  opacity: .8;
  background-position: 66.666% 0, var(--shadow-position, 0 0);
  filter: brightness(1.35) drop-shadow(0 0 18px rgba(159, 231, 255, .95));
  animation: shadowDash .22s ease-out;
}

.action-prompt {
  position: absolute;
  z-index: 12;
  max-width: 156px;
  padding: 6px 8px;
  background: rgba(2, 12, 18, .9);
  color: var(--cyan);
  text-transform: uppercase;
  font-family: var(--font-ui);
  font-size: 10px;
  line-height: 1.12;
  letter-spacing: .06em;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
}

.alert-meter {
  position: absolute;
  z-index: 13;
  left: 16px;
  right: 16px;
  top: 8px;
  height: 7px;
  overflow: hidden;
  opacity: .82;
  background: rgba(4, 14, 19, .78);
  pointer-events: none;
}

.alert-meter i {
  display: block;
  width: 0;
  height: 100%;
  background: url("assets/ui/button-wide.webp") center / 100% 100% no-repeat;
  filter: brightness(1.4) saturate(1.35);
  transition: width .12s ease;
}

.tutorial-callout {
  position: absolute;
  z-index: 14;
  max-width: 168px;
  padding: 7px 9px;
  background: rgba(2, 12, 18, .92);
  color: var(--ink);
  text-transform: uppercase;
  font-family: var(--font-ui);
  font-size: 10px;
  line-height: 1.18;
  letter-spacing: .055em;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translateY(5px);
}

.tutorial-callout.show {
  opacity: 1;
  transform: translateY(0);
}

.action-prompt.show {
  opacity: 1;
  transform: translateY(0);
}

.action-prompt[data-mode="shadow"] {
  color: var(--green);
}

.action-prompt[data-mode="door"],
.action-prompt[data-mode="switch"] {
  color: var(--yellow);
}

.player.dashing.facing-left {
  animation: shadowDashLeft .22s ease-out;
}

.death-flash {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 8px 10px;
  border: 0;
  background: #210507;
  color: #fff;
  text-transform: uppercase;
  font-family: var(--font-ui);
  font-size: 11px;
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: .06em;
  opacity: 0;
  pointer-events: none;
}

.death-flash.show {
  opacity: 1;
}

.playfield.alert {
  animation: roomAlert .32s linear 2;
}

.playfield.warning .room-backdrop {
  filter: contrast(1.16) brightness(.82) saturate(1.12);
}

.playfield.danger .room-backdrop {
  filter: contrast(1.22) brightness(.9) saturate(1.25);
}

.playfield.enemy-alert .room-backdrop {
  filter: contrast(1.2) brightness(.74) saturate(1.25);
}

.guard.alerted,
.robot-unit.alerted {
  filter: brightness(1.38) saturate(1.35) drop-shadow(0 0 12px rgba(255, 70, 77, .72));
  animation-duration: .62s;
}

.playfield.complete {
  animation: roomClear .7s ease-out;
}

.result-panel {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, .68);
}

.guide-panel {
  position: absolute;
  z-index: 34;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(0, 0, 0, .72);
}

.guide-panel.show {
  display: flex;
}

.guide-card {
  width: min(100%, 364px);
  padding: 17px 14px;
  background: rgba(2, 12, 18, .95);
  text-transform: uppercase;
  text-align: center;
}

.guide-card span,
.guide-card h2 {
  display: block;
  margin: 0;
}

.guide-card span {
  color: var(--cyan);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
}

.guide-card h2 {
  margin-top: 5px;
  font-size: clamp(25px, 7cqw, 34px);
  line-height: .95;
  letter-spacing: .08em;
}

.guide-controls {
  margin: 8px auto 0;
  color: var(--cyan);
  font-family: var(--font-ui);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: .04em;
}

.guide-steps {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.guide-steps li {
  padding: 8px 9px;
  background: rgba(5, 19, 27, .82);
}

.guide-steps strong,
.guide-steps em {
  display: block;
}

.guide-steps strong {
  color: var(--cyan);
  font-size: 13px;
  line-height: 1.05;
  letter-spacing: .07em;
}

.guide-steps em {
  margin-top: 4px;
  color: var(--ink);
  font-family: var(--font-ui);
  font-style: normal;
  font-size: 11px;
  line-height: 1.18;
  letter-spacing: .025em;
}

.guide-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.result-panel.show {
  display: flex;
}

.result-card {
  position: relative;
  overflow: hidden;
  width: min(100%, 354px);
  padding: 18px 15px;
  text-align: center;
  text-transform: uppercase;
  background: rgba(2, 12, 17, .94);
}

.result-burst {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: url("assets/result-burst.webp") center / cover no-repeat;
  opacity: 0;
  pointer-events: none;
}

.result-panel.cinematic .result-burst {
  animation: resultBurst 1.35s ease-out both;
}

.result-panel.cinematic .result-card {
  animation: resultRise .48s ease-out both;
}

.result-card span,
.result-card p {
  display: block;
  margin: 0;
  font-family: var(--font-ui);
  font-size: 11px;
  line-height: 1.3;
  font-weight: 900;
  letter-spacing: .09em;
}

.result-card span,
.result-card h2,
.result-card p,
.result-stars,
.result-stats,
.result-actions {
  position: relative;
  z-index: 1;
}

.result-card span,
.result-card p,
.result-stars {
  color: var(--cyan);
}

.result-card h2 {
  margin: 8px 0 6px;
  color: var(--ink);
  font-size: clamp(25px, 7cqw, 31px);
  line-height: .95;
  letter-spacing: .09em;
}

.result-stars {
  margin-bottom: 13px;
  font-size: 28px;
  letter-spacing: .22em;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin: 0 0 13px;
}

.result-stats div {
  min-width: 0;
  padding: 8px 5px;
  background: rgba(8, 29, 38, .66);
}

.result-panel.cinematic .result-stats div {
  animation: rewardStep .42s ease-out both;
}

.result-panel.cinematic .result-stats div:nth-child(2) { animation-delay: .05s; }
.result-panel.cinematic .result-stats div:nth-child(3) { animation-delay: .1s; }
.result-panel.cinematic .result-stats div:nth-child(4) { animation-delay: .15s; }

.result-stats dt,
.result-stats dd {
  margin: 0;
}

.result-stats dt {
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 9px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .07em;
}

.result-stats dd {
  margin-top: 5px;
  color: var(--ink);
  font-size: 18px;
  line-height: .95;
  font-weight: 900;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 9px;
  margin-top: 15px;
}

.result-actions .glass-btn {
  min-height: 46px;
  padding-inline: 8px;
  font-size: 15px;
}

.result-actions .glass-btn.primary {
  min-height: 52px;
  font-size: 19px;
  letter-spacing: .13em;
}

.pause-panel {
  position: absolute;
  z-index: 32;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, .72);
}

.pause-panel.show {
  display: flex;
}

.pause-card {
  width: min(100%, 356px);
  padding: 17px 14px;
  text-align: center;
  text-transform: uppercase;
  background: rgba(2, 12, 17, .94);
}

.pause-card span {
  color: var(--cyan);
  font-family: var(--font-ui);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: .1em;
}

.pause-card h2 {
  margin: 7px 0 15px;
  color: var(--ink);
  font-size: 31px;
  line-height: .92;
  letter-spacing: .12em;
}

.settings-list {
  display: grid;
  gap: 8px;
}

.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 8px 10px;
  background: rgba(8, 29, 38, .66);
  text-align: left;
  text-transform: uppercase;
}

.setting-row strong {
  min-width: 0;
  font-size: 15px;
  line-height: 1;
  letter-spacing: .07em;
}

.setting-row em {
  color: var(--cyan);
  font-family: var(--font-ui);
  font-size: 10px;
  line-height: 1.15;
  font-style: normal;
  font-weight: 900;
  letter-spacing: .055em;
  text-align: right;
}

.danger-row em {
  color: var(--red);
}

.resource-hud {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  background: var(--panel);
  text-transform: uppercase;
}

.resource-hud span {
  color: var(--cyan);
  font-family: var(--font-ui);
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .08em;
}

.energy-meter {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(22px, 1fr);
  gap: 5px;
}

.energy-meter i {
  height: 7px;
  background: url("assets/ui/button-wide.webp") center / 100% 100% no-repeat;
  filter: brightness(.58);
}

.energy-meter i.on {
  background-image: url("assets/ui/control-pulse.webp");
  filter: brightness(1.25) saturate(1.2);
}

.control-deck {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  max-width: 388px;
  width: 100%;
  margin-inline: auto;
}

.control-btn {
  width: 100%;
  height: 50px;
  min-width: 0;
  color: var(--ink);
}

.key-hint {
  position: absolute;
  right: 5px;
  bottom: 4px;
  padding: 1px 4px;
  background: rgba(2, 12, 18, .82);
  color: var(--cyan);
  font-family: var(--font-ui);
  font-size: 9px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.control-deck .icon-dash { grid-column: 2; }
.control-deck .icon-pulse { grid-column: 3; }

.control-btn.pressed {
  filter: brightness(1.35) saturate(1.18);
  transform: translateY(1px);
}

@keyframes homeMistDrift {
  0% { transform: translate3d(-14px, 18px, 0) scale(1.02); opacity: .32; }
  45% { opacity: .54; }
  100% { transform: translate3d(18px, -24px, 0) scale(1.05); opacity: .42; }
}

@keyframes sparkFloat {
  0%, 100% { transform: translate3d(0, 0, 0); opacity: .24; }
  35% { opacity: .58; }
  70% { transform: translate3d(0, -16px, 0); opacity: .36; }
}

@keyframes premiumAtmosphere {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: .58; filter: brightness(.96); }
  38% { transform: translate3d(0, -3px, 0) scale(1.006); opacity: .86; filter: brightness(1.14); }
  72% { transform: translate3d(1px, 2px, 0) scale(1.002); opacity: .66; filter: brightness(1); }
}

@keyframes logoArrival {
  0% { transform: translateY(-10px) scale(.96); opacity: 0; filter: brightness(.72); }
  100% { transform: translateY(0) scale(1); opacity: 1; filter: brightness(1); }
}

@keyframes logoWake {
  0%, 100% { filter: brightness(1) saturate(1); }
  50% { filter: brightness(1.16) saturate(1.08); }
}

@keyframes logoSheen {
  0%, 58%, 100% { transform: translateX(-52%) scale(1.04); opacity: 0; }
  70% { opacity: .58; }
  84% { transform: translateX(52%) scale(1.04); opacity: 0; }
}

@keyframes buttonRise {
  0% { transform: translateY(12px); opacity: 0; filter: brightness(.72); }
  100% { transform: translateY(0); opacity: 1; filter: brightness(1); }
}

@keyframes ctaBreathe {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.2) saturate(1.1); }
}

@keyframes actionReady {
  0%, 72%, 100% { transform: translateY(0) scale(1); }
  80% { transform: translateY(-2px) scale(1.012); }
  88% { transform: translateY(1px) scale(.998); }
}

@keyframes iconWake {
  0% { transform: translateX(-10px); opacity: 0; filter: brightness(.7); }
  100% { transform: translateX(0); opacity: 1; filter: brightness(1); }
}

@keyframes iconSignal {
  0%, 66%, 100% { filter: brightness(1); }
  74% { filter: brightness(1.38) saturate(1.16); }
  82% { filter: brightness(.92); }
}

@keyframes targetPulse {
  0%, 100% { opacity: .86; filter: brightness(1.28) saturate(1.12) drop-shadow(0 0 8px rgba(159, 231, 255, .5)); }
  50% { opacity: 1; filter: brightness(1.62) saturate(1.32) drop-shadow(0 0 14px rgba(159, 231, 255, .85)); }
}

@keyframes shadowRun {
  0% { transform: translateX(-1px) translateY(0) skewX(0deg); }
  50% { transform: translateX(2px) translateY(-3px) skewX(-3deg); }
  100% { transform: translateX(-1px) translateY(0) skewX(0deg); }
}

@keyframes shadowIdle {
  0%, 100% { transform: translateY(0) scaleX(1); }
  50% { transform: translateY(-2px) scaleX(1.03); }
}

@keyframes shadowIdleLeft {
  0%, 100% { transform: scaleX(-1) translateY(0); }
  50% { transform: scaleX(-1.03) translateY(-2px); }
}

@keyframes shadowRunLeft {
  0% { transform: scaleX(-1) translateX(-1px) translateY(0) skewX(0deg); }
  50% { transform: scaleX(-1) translateX(2px) translateY(-3px) skewX(-3deg); }
  100% { transform: scaleX(-1) translateX(-1px) translateY(0) skewX(0deg); }
}

@keyframes shadowClimb {
  0%, 100% { transform: translateY(0) scaleX(.96); }
  50% { transform: translateY(-4px) scaleX(1.04); }
}

@keyframes shadowDash {
  0% { transform: scaleX(1.08) translateX(0); }
  100% { transform: scaleX(.92) translateX(12px); }
}

@keyframes shadowDashLeft {
  0% { transform: scaleX(-1.08) translateX(0); }
  100% { transform: scaleX(-.92) translateX(12px); }
}

@keyframes shadowBreathe {
  0%, 100% { opacity: .46; }
  50% { opacity: .68; }
}

@keyframes lightSweep {
  0%, 100% { opacity: .78; }
  50% { opacity: .98; }
}

@keyframes laserHum {
  0%, 100% { opacity: .82; }
  50% { opacity: 1; }
}

@keyframes patrolBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes robotScan {
  0%, 100% { filter: brightness(.92); }
  50% { filter: brightness(1.15); }
}

@keyframes roomAlert {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.45) saturate(1.25); }
}

@keyframes roomClear {
  0% { filter: brightness(1); }
  45% { filter: brightness(1.45) saturate(1.25); }
  100% { filter: brightness(1); }
}

@keyframes resultBurst {
  0% { transform: scale(.78); opacity: 0; filter: brightness(.7); }
  30% { opacity: .98; filter: brightness(1.55); }
  100% { transform: scale(1.08); opacity: .5; filter: brightness(1); }
}

@keyframes resultRise {
  0% { transform: translateY(18px) scale(.94); opacity: 0; filter: brightness(.75); }
  100% { transform: translateY(0) scale(1); opacity: 1; filter: brightness(1); }
}

@keyframes rewardStep {
  0% { transform: translateY(8px); opacity: 0; filter: brightness(.7); }
  100% { transform: translateY(0); opacity: 1; filter: brightness(1); }
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 12px;
  text-transform: uppercase;
}

.panel-head h2,
.subhead {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.zone-list,
.card-grid,
.intel-grid,
.upgrade-list {
  position: relative;
  z-index: 3;
}

.zone-list {
  display: grid;
  gap: 10px;
}

.zone-card {
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  align-items: center;
  position: relative;
  overflow: hidden;
  border: 0;
  background-image: url("assets/zone-sheet.webp");
  background-size: 100% 800%;
}

.zone-card button {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.zone-copy {
  min-width: 0;
  padding: 12px 8px 12px 76px;
  text-transform: uppercase;
  text-shadow: 0 2px 8px #000;
  background: rgba(0, 0, 0, .22);
}

.zone-copy strong {
  display: block;
  font-family: var(--font-ui);
  font-size: clamp(10px, 2.8cqw, 12px);
  line-height: 1;
  letter-spacing: .075em;
  font-weight: 900;
}

.zone-copy span {
  display: block;
  margin-top: 5px;
  max-width: 100%;
  font-size: clamp(16px, 4.65cqw, 19px);
  line-height: .98;
  font-weight: 900;
  letter-spacing: .035em;
  overflow-wrap: anywhere;
}

.zone-state {
  width: 54px;
  padding-right: 5px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: clamp(11px, 3.15cqw, 14px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: .045em;
}
.zone-card.locked { filter: grayscale(.25) brightness(.56); }

.card-grid,
.intel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ability-card,
.intel-card {
  overflow: hidden;
  min-width: 0;
  border: 0;
  background: var(--panel-strong);
}

.thumb {
  height: clamp(84px, 26cqw, 112px);
  background-image: url("assets/card-sheet.webp");
  background-size: 500% 200%;
}

.ability-card h3,
.intel-card h3 {
  margin: 9px 7px 3px;
  color: var(--cyan);
  text-align: center;
  text-transform: uppercase;
  font-size: clamp(12px, 3.45cqw, 14px);
  line-height: 1.05;
  letter-spacing: .075em;
}

.ability-card p,
.intel-card p {
  min-height: 34px;
  margin: 0 8px 10px;
  color: var(--ink);
  text-align: center;
  font-family: var(--font-ui);
  font-size: clamp(10px, 2.8cqw, 12px);
  line-height: 1.32;
  font-weight: 700;
}

.subhead {
  position: relative;
  z-index: 3;
  padding-top: 6px;
  text-align: center;
  font-size: clamp(18px, 5.1cqw, 22px);
}

.profile-card {
  display: grid;
  grid-template-columns: 98px 1fr;
  gap: 15px;
  align-items: center;
  padding: 14px 15px;
  text-transform: uppercase;
}

.portrait {
  width: 92px;
  height: 92px;
  background-image: url("assets/card-sheet.webp");
  background-size: 500% 200%;
  background-position: 100% 100%;
}

.profile-card span {
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
}
.profile-card strong { display: block; font-size: 42px; line-height: .9; }
.profile-card small { color: var(--ink); }

.upgrade-list {
  display: grid;
  gap: 9px;
}

.upgrade-row {
  display: grid;
  grid-template-columns: minmax(128px, 1fr) minmax(76px, 100px) 36px;
  gap: 9px;
  align-items: center;
  min-height: 50px;
  padding: 8px 10px;
  background: var(--panel);
  text-transform: uppercase;
  font-family: var(--font-ui);
  font-size: clamp(11px, 3.15cqw, 13px);
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: .035em;
}

.meter {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.meter i {
  height: 6px;
  background: url("assets/ui/button-wide.webp") center / 100% 100% no-repeat;
}

.meter i.on {
  background: url("assets/ui/control-pulse.webp") center / 100% 100% no-repeat;
}

.plus-btn { width: 34px; height: 34px; font-size: 22px; }

.lore-panel {
  padding: 17px;
}

.lore-panel h3 {
  margin: 0 0 10px;
  color: var(--cyan);
  text-transform: uppercase;
}

.lore-panel p {
  margin: 0 0 12px;
  line-height: 1.5;
}

@media (max-width: 390px) {
  .screen { padding-left: 10px; padding-right: 10px; gap: 7px; }
  .icon-btn { width: 38px; height: 38px; }
  .side-rail { left: 8px; gap: 7px; }
  .brand { padding-top: 8px; }
  .logo-stack { width: min(86cqw, 316px); }
  .home-actions { width: 76cqw; gap: 8px; }
  .glass-btn { min-height: 44px; font-size: 16px; }
  .glass-btn.primary { min-height: 58px; font-size: 26px; }
  .game-hud { min-height: 54px; padding: 7px; }
  .hud-title strong { font-size: 17px; }
  .hud-title span { font-size: 10px; }
  .objectives-panel { font-size: 10px; }
  .playfield { min-height: 490px; }
  .resource-hud { min-height: 22px; padding-block: 2px; }
  .control-deck { gap: 5px; max-width: 324px; }
  .control-btn { height: 44px; }
  .player,
  .player-echo { width: 38px; height: 60px; }
  .upgrade-row { grid-template-columns: minmax(104px, 1fr) 70px 34px; font-size: 12px; }
}

@media (min-width: 760px) {
  body {
    min-height: 100vh;
    display: grid;
    align-items: start;
    justify-items: center;
    padding: 0;
  }

  .phone-frame {
    width: min(430px, calc(100svh * .45));
    min-height: 100svh;
  }

  .screen {
    min-height: 100svh;
  }
}

@media (min-width: 900px) {
  body {
    justify-items: center;
  }

  .phone-frame {
    margin-inline: auto;
  }
}

@media (orientation: portrait) {
  .playfield {
    min-height: 515px;
  }
}

@media (orientation: landscape), (min-width: 700px) and (max-height: 700px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  body {
    display: grid;
    align-items: start;
    justify-items: center;
    padding: 0;
  }

  .phone-frame {
    width: min(100vw, calc(100svh * 9 / 16), 430px);
    height: 100svh;
    max-width: none;
    min-height: 0;
  }

  .screen {
    min-height: 0;
    height: 100svh;
    padding: 10px;
  }

  .home-screen {
    background-size: cover;
    background-color: #000;
  }

  .brand {
    padding-top: 2px;
  }

  .logo-stack { width: min(64cqw, 270px); }

  .side-rail {
    left: 18px;
    top: 30%;
  }

  .hero-focus {
    min-height: 0;
  }

  .home-actions {
    width: min(31vw, 280px);
    gap: 7px;
    margin-bottom: 8px;
  }

  .glass-btn {
    min-height: 42px;
    font-size: 15px;
  }

  .glass-btn.primary {
    min-height: 54px;
    font-size: 25px;
  }

  .game-screen {
    display: none;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 6px;
  }

  .game-screen.active {
    display: grid;
  }

  .game-hud {
    min-height: 44px;
    padding: 5px 8px;
  }

  .hud-title strong {
    font-size: clamp(15px, 2.4vw, 22px);
  }

  .hud-title span,
  .objectives-panel {
    font-size: 10px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .objectives-panel {
    padding: 5px 8px;
    grid-template-columns: auto 1fr;
  }

  .objectives-panel ol {
    grid-template-columns: repeat(3, auto);
    gap: 14px;
    padding-left: 16px;
  }

  .playfield {
    min-height: 0;
    height: auto;
  }

  .control-deck {
    grid-template-columns: repeat(6, minmax(44px, 60px));
    justify-content: center;
    gap: 8px;
    max-width: none;
  }

  .control-deck .icon-dash,
  .control-deck .icon-pulse {
    grid-column: auto;
  }

  .resource-hud {
    min-height: 21px;
    padding: 2px 7px;
  }

  .control-btn {
    height: 44px;
  }

  .panel-screen {
    overflow-y: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-fx,
  .logo-stack,
  .logo-sheen,
  .home-actions .glass-btn,
  .home-actions .glass-btn.primary,
  .side-rail .icon-btn {
    animation: none;
  }

  .glass-btn,
  .icon-btn {
    transition: none;
  }
}

@media (orientation: landscape) and (min-width: 900px) {
  body {
    justify-items: center;
  }

  .phone-frame {
    margin-inline: auto;
  }
}

@media (max-width: 390px) and (max-height: 820px) {
  .screen {
    padding-top: 8px;
    padding-bottom: 8px;
    gap: 5px;
  }

  .game-hud {
    min-height: 46px;
    padding: 5px 6px;
  }

  .hud-title strong {
    font-size: 16px;
  }

  .hud-title span {
    margin-top: 3px;
    font-size: 9px;
  }

  .objectives-panel {
    gap: 5px;
    padding: 5px 7px;
    font-size: 9px;
  }

  .route-guide {
    font-size: 9px;
    line-height: 1.08;
  }

  .playfield {
    min-height: 452px;
  }

  .resource-hud {
    min-height: 19px;
    padding: 1px 6px;
  }

  .control-deck {
    max-width: 312px;
    gap: 4px;
  }

  .control-btn {
    height: 40px;
  }
}
