:root {
  --ink: #edf3f4;
  --muted: #aab9bd;
  --dim: #788a90;
  --night: #080a0c;
  --surface: rgba(13, 19, 23, .92);
  --surface-strong: #12191d;
  --line: rgba(175, 214, 216, .2);
  --line-strong: rgba(175, 214, 216, .44);
  --signal: #66c7c8;
  --signal-on: #071516;
  --safe: #7bbca6;
  --danger: #d85b62;
  --paper: #ddd7c2;
  --paper-ink: #20272a;
  --shadow: 0 18px 54px rgba(0, 0, 0, .42);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --z-world: 0;
  --z-grade: 2;
  --z-hud: 10;
  --z-panel: 20;
  --z-modal: 100;
  --z-toast: 110;
}

* { box-sizing: border-box; }

html, body { width: 100%; min-height: 100%; }

html { background: var(--night); }

body {
  margin: 0;
  overflow: hidden;
  background: var(--night);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }

button { touch-action: manipulation; }

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 3px;
}

.hidden { display: none !important; }

.skip-link {
  position: fixed;
  z-index: 9999;
  left: 16px;
  top: -80px;
  padding: 12px 16px;
  background: var(--signal);
  color: var(--signal-on);
  font-weight: 900;
  text-decoration: none;
}

.skip-link:focus { top: 16px; }

.landing {
  position: relative;
  height: 100dvh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  isolation: isolate;
  overflow-x: hidden;
  overflow-y: auto;
  padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 68% 23%, rgba(91, 110, 75, .28), transparent 33%),
    linear-gradient(122deg, #1a2118 0%, #0b0d0a 52%, #11130f 100%);
}

.landing::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  opacity: .18;
  background:
    linear-gradient(90deg, transparent 0 18%, #aab49c 18% 18.2%, transparent 18.2% 43%, #aab49c 43% 43.2%, transparent 43.2%),
    linear-gradient(0deg, #10130f 0 22%, transparent 22%);
  transform: perspective(800px) rotateX(12deg) scale(1.12);
  transform-origin: bottom;
}

.landing-noise,
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, .018) 3px 4px);
}

.landing-noise { z-index: -1; opacity: .7; }

.channel-landing {
  background:
    radial-gradient(circle at 68% 24%, rgba(62, 121, 128, .28), transparent 34%),
    radial-gradient(circle at 18% 78%, rgba(151, 47, 56, .14), transparent 30%),
    linear-gradient(122deg, #17242a 0%, #080a0c 52%, #10161a 100%);
}

.channel-landing::before {
  opacity: .23;
  background:
    linear-gradient(90deg, transparent 0 18%, #6c858a 18% 18.2%, transparent 18.2% 43%, #6c858a 43% 43.2%, transparent 43.2%),
    linear-gradient(0deg, #0b1013 0 22%, transparent 22%);
}

.station-mark {
  position: absolute;
  left: clamp(24px, 5vw, 80px);
  top: clamp(24px, 6vh, 72px);
  width: 116px;
  height: 116px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(102, 199, 200, .42);
  background: rgba(7, 12, 15, .52);
  color: var(--signal);
  transform: rotate(-2deg);
}
.station-mark span { position: absolute; inset: 7px 0 auto; font: 900 52px/1 Georgia, serif; }
.station-mark b { margin-top: 18px; color: var(--danger); font: 950 38px/1 ui-monospace, monospace; text-shadow: 2px 0 rgba(102,199,200,.7); }
.station-mark small { position: absolute; bottom: 10px; letter-spacing: .24em; font: 900 8px/1 ui-monospace, monospace; }

.store-mark {
  position: absolute;
  left: clamp(24px, 5vw, 80px);
  top: clamp(24px, 6vh, 72px);
  display: grid;
  width: 112px;
  height: 112px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .16);
  color: #dce5d4;
  letter-spacing: -.08em;
  transform: rotate(-3deg);
}

.store-mark__roof {
  position: absolute;
  top: 19px;
  width: 62px;
  height: 3px;
  background: var(--danger);
  box-shadow: 0 -7px 0 rgba(213, 99, 93, .5);
}

.store-mark__word { margin-top: 10px; font-size: 30px; font-weight: 950; }
.store-mark__mart { position: absolute; bottom: 15px; font: 800 9px/1 ui-monospace, monospace; letter-spacing: .28em; color: var(--signal); }

.briefing-card {
  position: relative;
  width: min(740px, 100%);
  margin: 44px auto 0;
  padding: clamp(28px, 5.5vw, 58px);
  border: 1px solid #1e211b;
  background: var(--paper);
  color: var(--paper-ink);
  box-shadow: 14px 14px 0 #050605, 0 34px 100px rgba(0, 0, 0, .38);
}

.briefing-card::before {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  top: 18px;
  border-top: 1px dashed rgba(32, 35, 29, .42);
}

.kicker,
.eyebrow {
  margin: 0;
  color: var(--safe);
  font: 850 10px/1.35 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.briefing-card .kicker { color: #28595c; }

.closing-stamp {
  position: absolute;
  right: clamp(12px, 3vw, 30px);
  top: 34px;
  margin: 0;
  padding: 8px 10px 6px;
  border: 3px solid var(--danger);
  color: #b84d48;
  font-weight: 950;
  transform: rotate(8deg);
}

.briefing-card h1 {
  margin: 34px 0 24px;
  font-family: Georgia, "Nanum Myeongjo", Batang, serif;
  font-size: clamp(50px, 9vw, 84px);
  font-weight: 900;
  line-height: .92;
  letter-spacing: -.075em;
}

.briefing-card h1 em { color: #c84f57; font-style: normal; text-shadow: 2px 0 #66c7c8; }
.briefing-card h1 span { font-size: .58em; letter-spacing: -.045em; }

.lead {
  max-width: 610px;
  margin: 0;
  font-size: clamp(15px, 1.8vw, 17px);
  line-height: 1.75;
  word-break: keep-all;
}

.game-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 28px 0;
  border-block: 1px dashed rgba(32, 35, 29, .46);
}

.game-facts div { padding: 16px 12px; text-align: center; }
.game-facts div + div { border-left: 1px dashed rgba(32, 35, 29, .35); }
.game-facts dt { margin-bottom: 4px; font: 800 10px/1 ui-monospace, monospace; letter-spacing: .13em; color: #656a5e; }
.game-facts dd { margin: 0; font-size: 18px; font-weight: 900; }

.landing-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.button {
  min-height: 48px;
  border: 1px solid transparent;
  padding: 13px 18px;
  font-weight: 900;
  cursor: pointer;
  transition: background-color 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease), transform 120ms ease-out;
}

.button:active { transform: scale(.98); }
.button--primary { background: #21666a; border-color: #142e31; color: #fff; box-shadow: 4px 4px 0 #142e31; }
.button--primary:hover { background: #285b60; }
.button--ghost { border-color: #454b3f; background: transparent; color: currentColor; }
.button--ghost:hover { background: rgba(0, 0, 0, .06); }
.landing-note { margin: 18px 0 0; color: #555b50; font-size: 12px; }

.game { 
  position: fixed;
  inset: 0;
  min-width: 320px;
  background: #07090b;
  overflow: hidden;
}

.world { position: absolute; inset: 0; z-index: var(--z-world); }
.world canvas { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }

.world-loading {
  position: absolute;
  z-index: calc(var(--z-hud) - 1);
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  background: #080a0c;
  color: var(--signal);
  text-align: center;
  pointer-events: none;
  transition: opacity 220ms ease-out, visibility 220ms ease-out;
}
.world-loading span { font: 900 15px/1.2 ui-monospace, monospace; letter-spacing: .12em; }
.world-loading small { color: var(--muted); font-size: 12px; }
.world-loading.is-hidden { opacity: 0; visibility: hidden; }

.world-grade {
  position: absolute;
  inset: 0;
  z-index: var(--z-grade);
  pointer-events: none;
  background:
    radial-gradient(circle at center, transparent 58%, rgba(3, 7, 9, .12) 84%, rgba(3, 7, 9, .38) 100%),
    linear-gradient(180deg, rgba(6, 16, 19, .025), rgba(6, 16, 19, .08));
}

.scanlines { z-index: calc(var(--z-grade) + 1); opacity: .16; }

.hud-top {
  position: absolute;
  z-index: var(--z-hud);
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  width: min(1160px, calc(100% - 32px));
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(12, 15, 11, .82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  transform: translateX(-50%);
}

.hud-brand { min-width: 0; display: flex; align-items: center; gap: 11px; }
.hud-brand__mark { flex: 0 0 40px; display: grid; width: 40px; height: 40px; place-items: center; background: var(--danger); color: white; font: 950 19px/1 Georgia, serif; }
.hud-brand span:last-child { display: grid; min-width: 0; }
.hud-brand b { overflow: hidden; font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }
.hud-brand small { margin-top: 2px; color: var(--muted); font-size: 10px; }

.shift-chip {
  margin-left: auto;
  padding: 7px 12px;
  border-left: 1px solid var(--line);
  display: grid;
  gap: 2px;
}

.shift-chip span { color: var(--signal); font: 800 9px/1 ui-monospace, monospace; letter-spacing: .15em; }
.shift-chip strong { font: 800 12px/1.2 ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.hud-actions { display: flex; align-items: center; gap: 8px; }

.icon-button,
.panel-close {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .035);
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 180ms, background-color 180ms, color 180ms;
}

.icon-button:hover,
.panel-close:hover { border-color: var(--signal); background: rgba(102, 199, 200, .1); }
.icon-button[aria-pressed="false"] { color: var(--danger); }
.icon-button svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.side-panel {
  position: absolute;
  z-index: var(--z-hud);
  top: 96px;
  width: 244px;
  max-height: calc(100dvh - 206px);
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.side-panel--left { left: max(16px, env(safe-area-inset-left)); }
.side-panel--right { right: max(16px, env(safe-area-inset-right)); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.panel-heading h2 { margin: 5px 0 0; font: 800 20px/1.2 Georgia, Batang, serif; }
.panel-close { display: none; flex: 0 0 44px; }

.map-preview {
  margin: 0 0 12px;
  border: 1px solid var(--line-strong);
  padding: 7px;
  background: rgba(4, 7, 4, .72);
}

.map-preview canvas { display: block; width: 100%; height: auto; aspect-ratio: 424 / 214; }
.channel-game .map-preview canvas { aspect-ratio: 1 / 1; }
.map-preview p { display: flex; flex-wrap: wrap; gap: 8px 12px; margin: 7px 2px 0; color: var(--muted); font-size: 11px; }
.map-preview p span { display: inline-flex; align-items: center; gap: 5px; }
.map-key { display: inline-block; width: 8px; height: 8px; border: 1px solid currentColor; }
.map-key--player { border-radius: 50%; background: var(--signal); color: var(--signal); }
.map-key--door { background: var(--safe); color: var(--safe); }
.map-key--locked { position: relative; border-color: var(--danger); color: var(--danger); }
.map-key--locked::before, .map-key--locked::after { content: ""; position: absolute; left: 3px; top: -1px; width: 1px; height: 8px; background: currentColor; transform: rotate(45deg); }
.map-key--locked::after { transform: rotate(-45deg); }
.map-note { margin: 10px 1px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.room-list { display: grid; gap: 6px; }

.room-button {
  position: relative;
  width: 100%;
  min-height: 51px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  padding: 7px 8px;
  background: rgba(0, 0, 0, .16);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background-color 180ms, border-color 180ms;
}

.room-button::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 46px;
  height: 12px;
  border-left: 1px dashed var(--line-strong);
}

.room-button:last-child::after { display: none; }
.room-button:hover:not(:disabled) { border-color: var(--signal); background: rgba(102, 199, 200, .08); }
.room-button.is-active { border-color: var(--signal); background: rgba(102, 199, 200, .13); }
.room-button.is-waypoint { border-color: var(--safe); box-shadow: inset 3px 0 0 var(--safe); }
.room-button:disabled { opacity: .42; cursor: not-allowed; }
.room-button__code { color: var(--signal); font: 900 11px/1 ui-monospace, monospace; }
.room-button__name { overflow: hidden; font-size: 12px; font-weight: 850; white-space: nowrap; text-overflow: ellipsis; }
.room-button__state { color: var(--muted); font: 750 9px/1 ui-monospace, monospace; }
.room-button.is-active .room-button__state { color: var(--signal); }

.panel-progress { margin-top: 18px; color: var(--muted); font-size: 11px; }
.panel-progress b { color: var(--signal); font: 900 16px/1 ui-monospace, monospace; }
.progress-track { height: 3px; margin-top: 8px; overflow: hidden; background: rgba(255, 255, 255, .1); }
.progress-track i { display: block; width: 0; height: 100%; background: var(--signal); transition: width 350ms var(--ease); }

.bag-items { display: grid; gap: 7px; }

.bag-item {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  padding: 7px 9px;
  background: rgba(0, 0, 0, .16);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms, background-color 180ms;
}

.bag-item:hover { border-color: var(--signal); }
.bag-item.is-selected { border-color: var(--signal); background: rgba(102, 199, 200, .12); }
.bag-item__icon { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid var(--line-strong); color: var(--signal); font: 900 11px/1 ui-monospace, monospace; }
.bag-item__name { min-width: 0; overflow: hidden; font-size: 11px; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }

.empty-state { padding: 18px 10px; border: 1px dashed var(--line); color: var(--muted); font-size: 12px; line-height: 1.55; text-align: center; }

.selected-item {
  min-height: 65px;
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.selected-item strong { display: block; margin-bottom: 3px; color: var(--signal); font-size: 11px; }

.text-button {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.text-button:hover { border-color: var(--signal); }

.objective-card {
  position: absolute;
  z-index: var(--z-hud);
  top: 96px;
  left: 50%;
  width: min(420px, calc(100% - 544px));
  padding: 14px 17px;
  border-top: 2px solid var(--signal);
  background: rgba(12, 15, 11, .78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  transform: translateX(-50%);
  pointer-events: none;
}

.objective-card h2 { margin: 5px 0 4px; font: 800 20px/1.2 Georgia, Batang, serif; }
.objective-card p:last-child { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.hud-minimap { display: none; }

.crosshair {
  position: absolute;
  z-index: var(--z-hud);
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: transform 160ms var(--ease);
}

.crosshair i { position: absolute; display: block; background: rgba(242, 245, 235, .76); box-shadow: 0 0 5px #000; transition: background-color 140ms, transform 140ms; }
.crosshair i:nth-child(1), .crosshair i:nth-child(2) { left: 16px; width: 2px; height: 8px; }
.crosshair i:nth-child(1) { top: 1px; }
.crosshair i:nth-child(2) { bottom: 1px; }
.crosshair i:nth-child(3), .crosshair i:nth-child(4) { top: 16px; width: 8px; height: 2px; }
.crosshair i:nth-child(3) { left: 1px; }
.crosshair i:nth-child(4) { right: 1px; }
.crosshair.is-targeting { transform: translate(-50%, -50%) scale(.82); }
.crosshair.is-targeting i { background: var(--signal); }

.interaction-prompt {
  position: absolute;
  z-index: var(--z-hud);
  left: 50%;
  bottom: 132px;
  min-height: 50px;
  max-width: min(480px, calc(100% - 550px));
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  padding: 7px 14px 7px 8px;
  background: rgba(9, 11, 8, .76);
  color: var(--muted);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}

.interaction-prompt:not(:disabled) { border-color: var(--signal); color: var(--ink); cursor: pointer; }
.interaction-prompt kbd { display: grid; min-width: 34px; height: 34px; place-items: center; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .06); color: var(--signal); font: 900 12px/1 ui-monospace, monospace; }
.interaction-prompt span { overflow: hidden; font-size: 12px; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }

.narrative-bar {
  position: absolute;
  z-index: var(--z-hud);
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  width: min(760px, calc(100% - 552px));
  min-height: 86px;
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: stretch;
  border: 1px solid var(--line);
  background: rgba(12, 15, 11, .88);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
}

.narrative-bar__index { display: grid; place-items: center; border-right: 1px solid var(--line); color: var(--safe); font: 900 9px/1 ui-monospace, monospace; letter-spacing: .1em; writing-mode: vertical-rl; }
.narrative-bar p { align-self: center; margin: 0; padding: 13px 16px; color: #d3d8cf; font-size: 12px; line-height: 1.65; word-break: keep-all; }

.mouse-status {
  position: absolute;
  z-index: var(--z-hud);
  right: 18px;
  bottom: 18px;
  min-height: 44px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: rgba(12, 15, 11, .78);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.mobile-controls,
.mobile-toolbar,
.panel-backdrop { display: none; }

.overlay {
  position: fixed;
  z-index: var(--z-modal);
  inset: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(1, 2, 1, .82);
  backdrop-filter: blur(8px);
}

.modal {
  position: relative;
  width: min(660px, 100%);
  max-height: min(860px, calc(100dvh - 32px));
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--signal);
  padding: clamp(22px, 4vw, 34px);
  background: #171b15;
  box-shadow: 0 32px 100px rgba(0, 0, 0, .72);
}

.modal-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: #0d100c;
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
}

.modal h2 { margin: 8px 48px 14px 0; font: 850 clamp(27px, 5vw, 36px)/1.12 Georgia, Batang, serif; letter-spacing: -.03em; }
.modal p, .modal li { color: #c2c8bd; font-size: 14px; line-height: 1.7; word-break: keep-all; }
.modal .button { margin-top: 8px; }

.paper {
  margin: 18px 0;
  border: 2px solid #252920;
  padding: clamp(16px, 3vw, 22px);
  background: var(--paper);
  color: var(--paper-ink);
  box-shadow: 7px 8px 0 #0b0d0a;
}

.paper h3 { margin: 0 0 12px; font: 850 21px/1.25 Georgia, Batang, serif; }
.paper p { color: var(--paper-ink); }
.paper .rule { padding: 10px 0; border-bottom: 1px solid rgba(32, 35, 29, .34); font-size: 13px; line-height: 1.6; }
.paper .rule:last-child { border-bottom: 0; }
.paper .rule--revealed { margin: 12px -6px -4px; border: 0; padding: 12px; background: #522923; color: #fff9ee; }

.choice-list { display: grid; gap: 9px; margin-top: 18px; }
.choice-button {
  min-height: 54px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: #0e120d;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms, background-color 180ms;
}
.choice-button:hover { border-color: var(--signal); background: rgba(102, 199, 200, .07); }
.choice-button b { display: block; margin-bottom: 4px; color: var(--signal); }
.choice-button small { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; }

.code-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin: 18px 0 6px; }
.code-form label { grid-column: 1 / -1; color: var(--muted); font-size: 12px; font-weight: 800; }
.code-form input { min-width: 0; height: 50px; border: 1px solid var(--line-strong); padding: 0 13px; background: #080a08; color: #fff; font: 900 20px/1 ui-monospace, monospace; letter-spacing: .16em; }

.item-acquired { display: grid; grid-template-columns: 64px 1fr; gap: 16px; align-items: center; margin: 18px 0; border: 1px solid var(--signal); padding: 16px; background: rgba(0, 0, 0, .15); }
.item-acquired__icon { display: grid; width: 62px; height: 62px; place-items: center; border: 1px solid var(--line-strong); color: var(--signal); font: 950 17px/1 ui-monospace, monospace; }
.item-acquired b { display: block; margin-bottom: 5px; color: var(--signal); }
.item-acquired p { margin: 0; font-size: 12px; }

.record-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 18px; }
.record-card { min-height: 112px; border: 1px solid var(--line); padding: 13px; background: #10130f; }
.record-card small { color: var(--safe); font: 800 9px/1.2 ui-monospace, monospace; letter-spacing: .08em; }
.record-card b { display: block; margin: 6px 0; font-size: 13px; }
.record-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }

.controls-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 18px 0; }
.control-row { display: grid; grid-template-columns: 88px 1fr; gap: 10px; align-items: center; min-height: 56px; border: 1px solid var(--line); padding: 9px; }
.control-row b { color: var(--signal); font: 900 11px/1.3 ui-monospace, monospace; }
.control-row span { color: var(--muted); font-size: 12px; }

.ending-stamp { color: var(--danger); font: 900 11px/1 ui-monospace, monospace; letter-spacing: .14em; }
.truth-box { margin: 16px 0; border-left: 3px solid var(--safe); padding: 2px 0 2px 14px; }
.truth-box b { color: var(--signal); }
.truth-box p { margin: 6px 0 0; }

.toast {
  position: fixed;
  z-index: var(--z-toast);
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100% - 32px);
  border-left: 4px solid var(--signal);
  padding: 12px 16px;
  background: #eef0e7;
  color: #181b16;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 900;
  transform: translateX(-50%);
}

.fatal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 12px;
  padding: clamp(24px, 8vw, 100px);
  background: #0b0d0a;
}
.fatal h2 { margin: 0; font: 850 clamp(30px, 6vw, 52px)/1.1 Georgia, Batang, serif; }
.fatal p { max-width: 580px; color: var(--muted); line-height: 1.7; }

.game.is-transitioning .world { opacity: .18; filter: blur(5px); }
.world { transition: opacity 220ms ease-out, filter 220ms ease-out; }

@media (max-width: 1080px) {
  .side-panel { width: 220px; }
  .objective-card { width: min(390px, calc(100% - 480px)); }
  .narrative-bar { width: min(680px, calc(100% - 500px)); }
  .interaction-prompt { max-width: calc(100% - 500px); }
}

@media (max-width: 900px), (pointer: coarse) {
  body { user-select: none; -webkit-user-select: none; }
  .store-mark, .station-mark { width: 76px; height: 76px; left: 16px; top: 16px; opacity: .6; }
  .station-mark span { top: 5px; font-size: 34px; }
  .station-mark b { margin-top: 12px; font-size: 25px; }
  .station-mark small { bottom: 7px; font-size: 6px; }
  .store-mark__roof { top: 12px; width: 40px; }
  .store-mark__word { font-size: 20px; }
  .store-mark__mart { bottom: 9px; font-size: 7px; }
  .briefing-card { margin-top: 56px; box-shadow: 8px 8px 0 #050605; }
  .closing-stamp { top: 25px; font-size: 11px; }
  .lead { font-size: 15px; }
  .game-facts div { padding: 13px 6px; }
  .game-facts dd { font-size: 15px; }
  .landing-actions { display: grid; }
  .button { width: 100%; }

  .hud-top {
    top: max(8px, env(safe-area-inset-top));
    width: calc(100% - 16px - env(safe-area-inset-left) - env(safe-area-inset-right));
    min-height: 56px;
    padding: 8px;
    gap: 8px;
  }
  .hud-brand__mark { flex-basis: 36px; width: 36px; height: 36px; }
  .hud-brand b { max-width: 136px; font-size: 12px; }
  .hud-brand small, .shift-chip { display: none; }
  .hud-actions { margin-left: auto; gap: 5px; }
  .icon-button { width: 44px; height: 44px; }
  .hide-small { display: none; }

  .side-panel {
    z-index: var(--z-panel);
    top: 0;
    bottom: 0;
    width: min(330px, 86vw);
    max-height: none;
    padding: max(20px, env(safe-area-inset-top)) 16px calc(90px + env(safe-area-inset-bottom));
    border-block: 0;
    transition: transform 240ms var(--ease);
  }
  .side-panel--left { left: 0; transform: translateX(-104%); }
  .side-panel--right { right: 0; transform: translateX(104%); }
  .side-panel.is-open { transform: translateX(0); }
  .panel-close { display: grid; }
  .panel-backdrop {
    position: absolute;
    z-index: calc(var(--z-panel) - 1);
    inset: 0;
    background: rgba(0, 0, 0, .56);
  }
  .panel-backdrop.is-visible { display: block; }

  .objective-card {
    top: 76px;
    left: 8px;
    width: calc(100% - 190px);
    max-width: 340px;
    padding: 9px 12px;
    transform: none;
  }
  .objective-card h2 { font-size: 16px; }
  .objective-card p:last-child { max-width: 330px; font-size: 11px; line-height: 1.5; }
  .hud-minimap {
    position: absolute;
    z-index: var(--z-hud);
    top: 76px;
    right: max(8px, env(safe-area-inset-right));
    width: 168px;
    min-height: 144px;
    display: block;
    border: 1px solid var(--line-strong);
    padding: 6px;
    background: rgba(8, 11, 8, .88);
    color: var(--ink);
    box-shadow: var(--shadow);
    text-align: left;
    backdrop-filter: blur(8px);
  }
  .hud-minimap__head { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin-bottom: 3px; }
  .hud-minimap__head b { color: var(--signal); font: 900 10px/1 ui-monospace, monospace; letter-spacing: .1em; }
  .hud-minimap__head small { max-width: 88px; overflow: hidden; color: var(--muted); font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
  .hud-minimap canvas { display: block; width: 100%; height: 112px; pointer-events: none; }
  .crosshair { top: 48%; }
  .interaction-prompt { display: none; }

  .narrative-bar {
    left: 8px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    width: calc(100% - 16px);
    min-height: 60px;
    grid-template-columns: 32px 1fr;
    transform: none;
  }
  .narrative-bar p { padding: 9px 11px; font-size: 12px; line-height: 1.5; }
  .narrative-bar__index { font-size: 8px; }

  .mobile-controls { display: block; }
  .joystick {
    position: absolute;
    z-index: var(--z-hud);
    left: max(18px, env(safe-area-inset-left));
    bottom: calc(158px + env(safe-area-inset-bottom));
    width: 104px;
    height: 104px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 50%;
    background: rgba(7, 9, 6, .26);
    touch-action: none;
  }
  .joystick::before, .joystick::after { content: ""; position: absolute; background: rgba(255, 255, 255, .12); }
  .joystick::before { left: 50%; top: 12px; bottom: 12px; width: 1px; }
  .joystick::after { top: 50%; left: 12px; right: 12px; height: 1px; }
  .joystick i { position: absolute; z-index: 1; left: 50%; top: 50%; width: 46px; height: 46px; border: 1px solid rgba(102, 199, 200, .68); border-radius: 50%; background: rgba(102, 199, 200, .18); transform: translate(-50%, -50%); }
  .mobile-interact {
    position: absolute;
    z-index: var(--z-hud);
    right: max(20px, env(safe-area-inset-right));
    bottom: calc(171px + env(safe-area-inset-bottom));
    width: 78px;
    height: 78px;
    border: 2px solid var(--signal);
    border-radius: 50%;
    background: rgba(19, 19, 12, .78);
    color: var(--signal);
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 0 0 8px rgba(102, 199, 200, .08);
  }
  .mobile-interact:disabled { opacity: .38; border-color: var(--muted); color: var(--muted); }
  .mobile-interact:not(:disabled):active { background: rgba(102, 199, 200, .25); }

  .mobile-toolbar {
    position: absolute;
    z-index: var(--z-hud);
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    min-height: 62px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid var(--line);
    background: rgba(12, 15, 11, .92);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
  }
  .mobile-toolbar button { min-width: 0; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 10px; font-weight: 800; }
  .mobile-toolbar button:last-child { border-right: 0; }
  .mobile-toolbar button span { display: block; margin: 0 auto 4px; color: var(--signal); font: 900 11px/1 ui-monospace, monospace; }
  .mouse-status { display: none; }
  .modal { max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .record-grid, .controls-grid { grid-template-columns: 1fr; }
  .choice-button { min-height: 58px; }
}

@media (max-width: 460px) {
  .briefing-card { padding: 28px 22px; }
  .briefing-card h1 { margin-top: 42px; }
  .closing-stamp { right: 15px; }
  .hud-actions .icon-button:nth-of-type(2) { display: none; }
  .objective-card { width: calc(100% - 170px); }
  .objective-card p:last-child { max-width: 220px; }
  .hud-minimap { width: 152px; min-height: 142px; }
  .hud-minimap canvas { height: 110px; }
  .joystick { width: 90px; height: 90px; bottom: calc(154px + env(safe-area-inset-bottom)); }
  .mobile-interact { width: 68px; height: 68px; bottom: calc(162px + env(safe-area-inset-bottom)); }
}

@media (max-height: 620px) and (orientation: landscape) {
  .objective-card { display: none; }
  .hud-minimap { top: 72px; width: 148px; min-height: 96px; }
  .hud-minimap canvas { height: 66px; }
  .narrative-bar { left: 140px; right: 140px; width: auto; bottom: calc(72px + env(safe-area-inset-bottom)); }
  .joystick { bottom: calc(78px + env(safe-area-inset-bottom)); width: 86px; height: 86px; }
  .mobile-interact { bottom: calc(84px + env(safe-area-inset-bottom)); width: 70px; height: 70px; }
  .mobile-toolbar { left: 25%; right: 25%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (forced-colors: active) {
  .room-button.is-active,
  .room-button.is-waypoint,
  .bag-item.is-selected,
  .interaction-prompt:not(:disabled),
  .mobile-interact:not(:disabled) { outline: 3px solid Highlight; outline-offset: -3px; }
  .progress-track i { background: Highlight; }
  .crosshair i { background: CanvasText; box-shadow: none; }
}

@media (prefers-contrast: more) {
  .scanlines { display: none; }
  .world-grade { opacity: .35; }
  .hud-top, .side-panel, .objective-card, .narrative-bar, .hud-minimap { background: #080a07; }
}
