:root {
  --bg: #0c0d10;
  --bone: #e7e1d6;
  --dim: #8e877c;
  --line: rgba(231, 225, 214, 0.16);
  --copper: #8f6a52;
  --copper-bright: #c4a48a;
  --glow: var(--copper);
  --amber: #c4893a;
  --alert: #c45c42;
  --guard: #a3b56a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { touch-action: none; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--bone);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  position: fixed;
  inset: 0;
  width: 100%;
}
button, input { font: inherit; color: inherit; }
input { user-select: text; -webkit-user-select: text; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#screen { height: 100dvh; position: relative; overflow: hidden; background: var(--bg); }
#world { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; min-width: 0; }
#map-frame { position: absolute; inset: 0; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; max-width: 100%; display: block; touch-action: none; }
#panel { display: none; }

#screen.is-game #world {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(min(280px, 100%), 440px);
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
}
#screen.is-game[data-role="runner"] #world { grid-template-columns: 1fr; }
#screen.is-game #map { position: relative; min-width: 0; min-height: 0; height: 100%; }
#screen.is-game[data-role="guide"] #world {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  grid-template-rows: auto minmax(0, 1fr);
}
#screen.is-game[data-role="guide"] #panel { display: contents; }
#screen.is-game[data-role="guide"] #map {
  grid-column: 1;
  grid-row: 1 / span 2;
  container-type: size;
  display: grid;
  place-items: center;
}
#screen.is-game[data-role="guide"] #map-frame {
  position: relative;
  inset: auto;
  width: min(100cqw, 100cqh);
  height: min(100cqw, 100cqh);
}
#screen.is-game[data-role="guide"] .guide-top { grid-column: 2; grid-row: 1; }
#screen.is-game[data-role="guide"] .board {
  grid-column: 2;
  grid-row: 2;
  min-height: 0;
  overflow: auto;
}
#screen.is-game[data-role="guide"] .frame,
#screen.is-game[data-role="guide"] #full,
#screen.is-game[data-role="guide"] #quit,
#screen.is-game[data-role="guide"] #help-open { display: none; }

.frame { position: absolute; inset: 12px; pointer-events: none; z-index: 3; display: none; }
#screen.is-game .frame { display: block; }
.frame span { position: absolute; width: 18px; height: 18px; border: 1px solid rgba(143, 106, 82, 0.7); }
.frame span:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.frame span:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.frame span:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.frame span:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }

#lobby, #result, #waitbanner { transition: opacity 0.45s ease; }
#lobby.is-off, #result.is-off, #waitbanner.is-off {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.dictate { margin: 2px 0 0; color: var(--dim); font-size: 14px; }
.wait { margin: 10px 0 4px; font-size: 18px; }
.wait.is-waiting { color: var(--copper-bright); }
.wait.is-ready { color: var(--bone); }
.screen-name {
  font-size: clamp(34px, 8vw, 52px);
  letter-spacing: 0.01em;
  text-transform: none;
  line-height: 1.05;
}
.screen-job {
  margin: 8px 0 0;
  font-size: 17px;
  line-height: 1.35;
  color: var(--bone);
}
.seat-warn {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(211, 147, 64, 0.75);
  border-radius: 4px;
  color: #f1c98d;
  font-size: 16px;
  line-height: 1.35;
  background: rgba(211, 147, 64, 0.12);
}
.lobby-plate.is-full .dictate,
.lobby-plate.is-full .urls,
.lobby-plate.is-full .fine { font-size: 12px; }
.lobby-actions { margin: 14px 0 8px; }
.lobby-actions button {
  flex: 1 1 120px;
  min-height: 52px;
  text-align: center;
  padding: 12px 14px;
}
.lobby-actions .swap-loud {
  border-color: #d39340;
  color: #f1c98d;
  background:
    linear-gradient(180deg, rgba(211, 147, 64, 0.38), transparent 46%),
    #2a2118;
  box-shadow: inset 0 0 0 1px rgba(211, 147, 64, 0.55), 0 0 18px rgba(211, 147, 64, 0.22);
}
.lobby-actions .swap-quiet {
  opacity: 0.62;
  background: transparent;
  box-shadow: none;
  border-color: rgba(143, 106, 82, 0.4);
}
#screen[data-phase="lobby"] #lobby { overflow: hidden; }
#screen[data-phase="lobby"] #plate { width: min(520px, 100%); }
#screen[data-phase="lobby"] .qr {
  width: min(160px, 22vh);
  height: auto;
  aspect-ratio: 1;
  margin: 10px 0 6px;
}
#lobby {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding:
    calc(24px + env(safe-area-inset-top))
    calc(16px + env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom))
    calc(16px + env(safe-area-inset-left));
  background: radial-gradient(ellipse at center, rgba(8, 9, 14, 0.2), rgba(8, 9, 14, 0.78) 72%);
}
.plate { width: min(440px, 100%); margin: auto; transition: opacity 0.4s ease; }
.plate.is-swap { opacity: 0; transition: none; }
.kicker {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--glow);
}
h1, h2, .result-card h2 {
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", Georgia, serif;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0;
}
h1 { font-size: clamp(34px, 8vw, 58px); line-height: 0.95; }
h2, .result-card h2 { font-size: 28px; letter-spacing: 0.08em; }
.lead, .fine { color: var(--dim); line-height: 1.45; }
.lead { font-size: 16px; max-width: 36em; }
.fine { font-size: 13px; margin: 0; }
.err { min-height: 1.2em; color: var(--amber); font-size: 14px; }

.roles, .join { display: flex; flex-wrap: wrap; gap: 10px; }
.roles { margin: 22px 0 18px; }
.roles button, .solid, .ghost, .call-row button, #veil-btn, #next, #sprint, #listen, #knock, #wait-menu, #quit-result, #score-form button, .menu-list button {
  min-height: 58px;
  border-radius: 2px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 14px;
  font-family: Palatino, "Palatino Linotype", Georgia, serif;
  touch-action: manipulation;
  background:
    linear-gradient(180deg, rgba(196, 164, 138, 0.16), transparent 28%),
    #1a1612;
  color: #e7d7c0;
  border: 1px solid #8f6a52;
  box-shadow: inset 0 0 0 1px rgba(20, 14, 10, 0.8), inset 0 0 0 3px rgba(143, 106, 82, 0.28);
}
.roles button:active, .solid:active, .ghost:active, .call-row button:active, #veil-btn:active, #next:active, #sprint:active, #listen:active, #knock:active, .menu-list button:active,
.roles button.is-down, .solid.is-down, .ghost.is-down, .call-row button.is-down, #veil-btn.is-down, #next.is-down, #sprint.is-down, #listen.is-down, #knock.is-down, .menu-list button.is-down {
  background: #2a2118;
  color: #f3e6d4;
  box-shadow: inset 0 0 0 1px #c4a48a;
}
.solid, #next {
  border-color: #7a624c;
}
.roles button small {
  display: block;
  letter-spacing: 0;
  text-transform: none;
  font-size: 13px;
  color: var(--dim);
  margin-top: 4px;
}
.roles button { text-align: left; padding: 14px 16px 12px; flex: 1 1 180px; min-height: 78px; }
.lobby-actions { margin: 12px 0 6px; }
.lobby-actions button {
  flex: 1 1 auto;
  min-height: 48px;
  text-align: center;
  padding: 10px 12px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
@media (max-width: 520px) {
  .lobby-actions { flex-direction: column; }
  .lobby-actions button { width: 100%; }
}
.join { margin-top: 8px; align-items: end; }
.join input {
  flex: 1 1 160px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 28px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(239, 231, 218, 0.35);
  border-radius: 0;
  padding: 8px 0 10px;
  min-width: 0;
}
.join button, #next { padding: 0 18px; }
button:disabled { opacity: 0.4; cursor: default; }
#veil-btn:disabled { opacity: 1; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--glow); outline-offset: 3px; }

.qr {
  width: 180px;
  height: 180px;
  margin: 18px 0 8px;
  background: #efe7da;
  padding: 8px;
}
.code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.42em;
  font-size: 40px;
  margin: 8px 0 12px;
}
.lobby-code { font-size: clamp(28px, 7vw, 40px); }
.lobby-plate.is-full .lobby-code {
  font-size: clamp(20px, 5vw, 28px);
  letter-spacing: 0.22em;
  color: var(--dim);
  margin-top: 12px;
}
.urls { word-break: break-all; }

.join input::placeholder { letter-spacing: 0.18em; font-size: 13px; color: #6d675f; }

.guide-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(14px + env(safe-area-inset-top)) 14px 6px calc(14px + env(safe-area-inset-left));
}
#panel .ico {
  width: 38px;
  height: 38px;
  min-height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(196, 164, 138, 0.28);
  background: rgba(23, 20, 15, 0.7);
  color: var(--copper-bright);
  letter-spacing: 0;
  text-transform: none;
  box-shadow: none;
}
#panel .ico svg { width: 18px; height: 18px; }
.room {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.32em;
  color: var(--dim);
}
.room b { color: var(--copper-bright); font-weight: 600; }
#map-chrome { position: absolute; inset: 0; pointer-events: none; }
.bracket { position: absolute; width: 18px; height: 18px; border: 1.5px solid var(--copper); }
.bracket.tl { top: -5px; left: -5px; border-right: 0; border-bottom: 0; }
.bracket.tr { top: -5px; right: -5px; border-left: 0; border-bottom: 0; }
.bracket.bl { bottom: -5px; left: -5px; border-right: 0; border-top: 0; }
.bracket.br { bottom: -5px; right: -5px; border-left: 0; border-top: 0; }
.chip {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 5px 9px 5px 10px;
  border-radius: 3px;
  background: rgba(14, 12, 10, 0.82);
  border: 1px solid rgba(196, 164, 138, 0.25);
  font-weight: 600;
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.22em;
  color: var(--copper-bright);
}
.chip time {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--bone);
  font-variant-numeric: tabular-nums;
}
section.board {
  position: relative;
  margin: 0;
  padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(255, 240, 220, 0.05), transparent 30%),
    var(--stone-tex, none),
    linear-gradient(180deg, #221d17, #17140f);
  background-size: auto, 256px 256px, auto;
  border-top: 1px solid rgba(196, 164, 138, 0.22);
  box-shadow: 0 -18px 30px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.board::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -1px;
  width: 120px;
  height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--copper-bright), transparent);
  opacity: 0.6;
}
.threat { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.eye {
  --c: var(--guard);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--c) 30%, transparent), transparent 62%), #2e271f;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(196, 164, 138, 0.25);
}
.eye svg { width: 34px; height: 34px; color: var(--c); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--c) 60%, transparent)); }
.eye::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--c);
  opacity: 0;
}
.board[data-sn="hunt"] .eye { --c: var(--alert); }
.board[data-sn="alert"] .eye { --c: #d39340; }
.board[data-sn="search"] .eye { --c: #8a9a5a; }
.board[data-sn="hunt"] .eye::after { animation: eye-ping 1s ease-out infinite; }
.board[data-sn="alert"] .eye::after { animation: eye-ping 1.8s ease-out infinite; }
@keyframes eye-ping { from { opacity: 0.9; transform: scale(0.9); } to { opacity: 0; transform: scale(1.35); } }
#panel h2.sn-name {
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-transform: none;
  font-weight: 400;
  color: var(--c, var(--guard));
  margin: 0 0 9px;
}
.board[data-sn="patrol"] .sn-name { --c: var(--guard); }
.board[data-sn="alert"] .sn-name { --c: #d39340; }
.board[data-sn="hunt"] .sn-name { --c: var(--alert); }
.board[data-sn="search"] .sn-name { --c: #a8b47a; }
.sn-sub { margin: 4px 0 7px; font-weight: 600; font-size: 10px; line-height: 1; letter-spacing: 0.24em; text-transform: uppercase; color: var(--dim); }
.wake { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; }
.wake i { height: 6px; border-radius: 1px; background: rgba(231, 225, 214, 0.08); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.5); }
.wake i.on { background: var(--copper-bright); box-shadow: 0 0 6px rgba(196, 164, 138, 0.4); }
.wake i.on.hot { background: #d39340; box-shadow: 0 0 8px rgba(211, 147, 64, 0.55); }
.wake i.on.wild { background: var(--alert); box-shadow: 0 0 8px rgba(196, 92, 66, 0.6); }
.wake-l { display: flex; justify-content: space-between; margin-top: 4px; font-size: 9px; line-height: 1; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(142, 135, 124, 0.7); }
.loot { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.seals { display: flex; gap: 5px; }
.seal { width: 22px; height: 25px; color: #d39340; }
.seal.spent { color: rgba(231, 225, 214, 0.16); }
.seal.spent .core { opacity: 0; }
.seal:not(.spent) { filter: drop-shadow(0 0 5px rgba(211, 147, 64, 0.55)); }
.pts { font-weight: 600; font-size: 20px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--bone); display: flex; align-items: center; gap: 5px; }
.pts small { font-weight: 600; font-size: 9px; letter-spacing: 0.22em; color: var(--dim); }
.pts .keyic { width: 16px; height: 16px; color: rgba(231, 225, 214, 0.2); }
.pts .keyic.has { color: #d39340; filter: drop-shadow(0 0 4px rgba(211, 147, 64, 0.6)); }
.door {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(211, 147, 64, 0.22), rgba(211, 147, 64, 0.06));
  border: 1px solid rgba(211, 147, 64, 0.55);
  color: #f1c98d;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.25;
  animation: door-breathe 1.6s ease-in-out infinite;
}
.door svg { width: 20px; height: 20px; flex: none; }
@keyframes door-breathe { 50% { box-shadow: 0 0 18px rgba(211, 147, 64, 0.35); } }
.keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; position: relative; }
#panel .key, #panel .veil {
  position: relative;
  min-height: 70px;
  border-radius: 6px;
  border: 0;
  color: var(--bone);
  padding: 8px 6px 7px;
  letter-spacing: 0;
  text-transform: none;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 235, 210, 0.09), transparent 60%),
    var(--stone-tex, none),
    linear-gradient(180deg, #3a3128, #251f19);
  background-size: auto, 200px 200px, auto;
  box-shadow: inset 0 1px 0 rgba(255, 240, 220, 0.16), inset 0 -3px 0 rgba(0, 0, 0, 0.45), 0 3px 0 #0e0c0a, 0 6px 12px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  touch-action: manipulation;
}
#panel .key svg { width: 24px; height: 24px; color: var(--copper-bright); }
#panel .key span { font-weight: 700; font-size: 12px; line-height: 1; letter-spacing: 0.2em; text-transform: uppercase; }
#panel .key.long span { letter-spacing: 0.06em; font-size: 11px; }
#panel .key small { position: absolute; top: 6px; right: 8px; font-weight: 600; font-size: 9px; line-height: 1; color: rgba(196, 164, 138, 0.55); }
#panel .key.dir {
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 235, 210, 0.09), transparent 60%),
    var(--stone-tex, none),
    linear-gradient(180deg, #403427, #2a2119);
  background-size: auto, 200px 200px, auto;
}
#panel .key.stop svg { color: var(--alert); }
#panel .key:active, #panel .key.is-down, #panel .veil:active, #panel .veil.is-down {
  transform: translateY(3px);
  background: linear-gradient(180deg, #3a3128, #251f19);
  color: var(--bone);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(211, 147, 64, 0.6), 0 0 16px rgba(211, 147, 64, 0.35);
}
#panel .key.sent::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  border: 1.5px solid #d39340;
  animation: call-sent 0.7s ease-out forwards;
}
@keyframes call-sent { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(1.12); } }
#panel .veil { --p: 1; padding: 0; }
#panel .veil .ring {
  position: absolute;
  inset: 7px;
  margin: auto;
  aspect-ratio: 1;
  height: calc(100% - 14px);
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--copper-bright) calc(var(--p) * 360deg), rgba(231, 225, 214, 0.09) 0);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%);
  mask: radial-gradient(circle, transparent 62%, #000 63%);
}
#panel .veil b { position: relative; font-weight: 700; font-size: 10px; line-height: 1; letter-spacing: 0.16em; text-transform: uppercase; }
#panel .veil em:empty { display: none; }
#panel .veil em { position: relative; font-weight: 600; font-size: 18px; line-height: 1; font-style: normal; font-variant-numeric: tabular-nums; color: var(--copper-bright); }
#panel .veil.on .ring { background: conic-gradient(#d39340 360deg, transparent 0); animation: veil-spin 2.2s linear infinite; }
#panel .veil.on b { color: #f1c98d; }
#panel .veil.cool { color: var(--dim); }
#panel .veil.cool .ring { background: conic-gradient(rgba(196, 164, 138, 0.6) calc(var(--p) * 360deg), rgba(231, 225, 214, 0.08) 0); }
#panel .veil:disabled { opacity: 1; }
#panel .veil.hint { animation: veil-hint 0.8s ease-in-out infinite; }
#panel .veil.hint .ring { background: conic-gradient(#f1c98d 360deg, transparent 0); }
@keyframes veil-hint {
  0%, 100% { box-shadow: 0 0 0 0 rgba(241, 201, 141, 0); filter: brightness(1); }
  50% { box-shadow: 0 0 0 5px rgba(211, 147, 64, 0.55); filter: brightness(1.45); }
}
.veil-hint {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: -28px;
  transform: translateX(-50%);
  margin: 0;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #f1c98d;
  background: rgba(14, 12, 10, 0.92);
  border: 1px solid rgba(211, 147, 64, 0.55);
  border-radius: 3px;
  padding: 4px 8px;
  pointer-events: none;
}
@keyframes veil-spin { to { transform: rotate(360deg); } }
.echo {
  position: absolute;
  left: 50%;
  top: -30px;
  transform: translateX(-50%);
  white-space: nowrap;
  font-weight: 600;
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #f1c98d;
  padding: 6px 10px;
  border-radius: 3px;
  background: rgba(14, 12, 10, 0.85);
  border: 1px solid rgba(211, 147, 64, 0.4);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
.echo.show { opacity: 1; transform: translate(-50%, -4px); }

#touch { position: absolute; inset: 72px 0 0; z-index: 4; display: flex; }
#stick-zone, #look-zone { flex: 1; }
#stick {
  position: fixed;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  border: 1px solid rgba(143, 106, 82, 0.55);
  z-index: 5;
  pointer-events: none;
}
#stick i {
  position: absolute;
  width: 48px;
  height: 48px;
  left: 36px;
  top: 36px;
  border-radius: 50%;
  background: rgba(143, 106, 82, 0.55);
}
#deck {
  position: fixed;
  z-index: 5;
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
#deck #sprint {
  position: static;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  letter-spacing: 0.08em;
}
#listen, #knock {
  width: 76px;
  min-height: 64px;
  border-radius: 12px;
  font-size: 14px;
}
#sprint.on {
  background: linear-gradient(180deg, #6a5040, #3a2a22);
  color: var(--bone);
  border-color: var(--copper-bright);
}
#hint {
  position: fixed;
  z-index: 5;
  left: 50%;
  top: calc(18px + env(safe-area-inset-top));
  transform: translateX(-50%);
  width: min(440px, calc(100% - 156px));
  margin: 0;
  text-align: center;
  color: var(--bone);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 12px #000;
  pointer-events: none;
}
#toast {
  position: fixed;
  z-index: 6;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  font-family: Palatino, "Palatino Linotype", Georgia, serif;
  font-size: clamp(42px, 12vw, 84px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  text-shadow: 0 10px 40px #000;
}
#toast.show { opacity: 1; }
#full {
  position: fixed;
  z-index: 9;
  top: calc(10px + env(safe-area-inset-top));
  left: calc(10px + env(safe-area-inset-left));
  background: transparent;
  border: 0;
  color: var(--dim);
  letter-spacing: 0;
  text-transform: none;
  font-size: 13px;
  min-height: 36px;
}
#screen.is-game[data-role="guide"] #full {
  left: auto;
  right: calc(10px + env(safe-area-inset-right));
}
#pad-note, #pad-help {
  position: fixed;
  z-index: 5;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 2px 12px #000;
}
#pad-note {
  bottom: calc(14px + env(safe-area-inset-bottom));
  color: var(--copper-bright);
  font-size: 13px;
  letter-spacing: 0.04em;
}
#pad-help {
  bottom: calc(14px + env(safe-area-inset-bottom));
  width: min(560px, calc(100% - 128px));
  color: var(--bone);
  font-size: 13px;
  line-height: 1.45;
}
#screen.is-game #pad-note { bottom: calc(62px + env(safe-area-inset-bottom)); }
@media (max-width: 800px) {
  #screen.is-game #hint { visibility: hidden; }
  #screen.is-game #pad-help {
    bottom: calc(112px + env(safe-area-inset-bottom));
    width: min(560px, calc(100% - 28px));
  }
  #screen.is-game #pad-note { bottom: calc(168px + env(safe-area-inset-bottom)); }
}
.is-pad { outline: 2px solid var(--amber); outline-offset: 3px; }
.host { margin: 14px 0 0; color: var(--copper-bright); font-size: 18px; letter-spacing: 0.03em; }
#waitbanner {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 32px));
  text-align: center;
  padding: 16px;
  background: rgba(8, 9, 14, 0.8);
  border: 1px solid var(--line);
}
#result {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: rgba(8, 9, 14, 0.62);
  padding: 20px;
}
.result-card {
  width: min(460px, 100%);
  background:
    linear-gradient(180deg, rgba(231, 225, 214, 0.05), transparent 72px),
    #161411;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 22px 22px;
}
.flash-win #result-kicker { color: var(--amber); }
.flash-lose #result-kicker { color: var(--guard); }
#result-time { color: var(--dim); }
#result-note { margin: 10px 0 0; }
#next { margin-top: 8px; }

#quit {
  position: fixed;
  z-index: 9;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  min-height: 36px;
  padding: 0 12px;
  background: transparent;
  border: 0;
  color: var(--copper-bright);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#intro {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  background: #070706;
}
#intro-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.intro-copy {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  padding:
    calc(16px + env(safe-area-inset-top))
    calc(22px + env(safe-area-inset-right))
    calc(18px + env(safe-area-inset-bottom))
    calc(22px + env(safe-area-inset-left));
  pointer-events: none;
}
.intro-copy .menu-list {
  width: min(300px, 86vw);
  margin: 0 0 4px;
}
.intro-copy .menu-list,
.intro-copy button,
.intro-copy .fine { pointer-events: auto; }
.intro-copy .fine { text-align: center; }
#intro-go { animation: rise 0.7s ease; }
#intro-skip {
  min-height: 36px;
  padding: 0 12px;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--dim);
  font-size: 14px;
}
#intro-skip:active { transform: none; background: transparent; box-shadow: none; }
#screen[data-phase="intro"] #full { visibility: hidden; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
#plate:has(.opt-plate) { width: min(560px, 100%); }
#opt-layer {
  position: absolute;
  inset: 0;
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(24px + env(safe-area-inset-top))
    calc(16px + env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom))
    calc(16px + env(safe-area-inset-left));
  background: rgba(5, 5, 6, 0.62);
  backdrop-filter: blur(3px);
}
.opt-plate {
  width: min(560px, 100%);
  padding: 28px 32px 22px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 240, 220, 0.05), transparent 30%),
    linear-gradient(180deg, rgba(34, 29, 23, 0.96), rgba(20, 17, 13, 0.98));
  border: 1px solid rgba(196, 164, 138, 0.25);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 240, 220, 0.08);
}
.opt-plate h2 {
  margin: 6px 0 18px;
  font-size: 32px;
  letter-spacing: 0.02em;
  text-transform: none;
}
.opt-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 14px 12px;
  border-radius: 4px;
  border-top: 1px solid var(--line);
}
.opt-row:last-of-type { border-bottom: 1px solid var(--line); }
.opt-row.on {
  background: linear-gradient(90deg, rgba(211, 147, 64, 0.12), transparent 70%);
  box-shadow: inset 3px 0 0 #d39340;
}
.opt-row b { display: block; font-weight: 600; font-size: 16px; letter-spacing: 0; text-transform: none; }
.opt-row p { margin: 4px 0 0; max-width: 34em; color: var(--dim); font-size: 13px; line-height: 1.4; }
.opt-toggle {
  all: unset;
  cursor: pointer;
  position: relative;
  width: 64px;
  height: 30px;
  border-radius: 20px;
  background: #1a1612;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(196, 164, 138, 0.25);
}
.opt-toggle::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(180deg, #6d5d4d, #3d342b);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s, background 0.2s;
}
.opt-toggle[aria-checked="true"] { background: linear-gradient(90deg, rgba(211, 147, 64, 0.45), rgba(211, 147, 64, 0.2)); }
.opt-toggle[aria-checked="true"]::after {
  transform: translateX(34px);
  background: radial-gradient(circle at 40% 35%, #f1c98d, #d39340);
  box-shadow: 0 0 10px rgba(211, 147, 64, 0.7);
}
.opt-toggle:focus-visible { outline: 2px solid #d39340; outline-offset: 3px; }
.opt-slider { display: flex; align-items: center; gap: 12px; }
.opt-slider output {
  width: 32px;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #f1c98d;
}
.opt-slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 160px;
  height: 28px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  border: 0;
  border-radius: 0;
  padding: 0;
  letter-spacing: 0;
  text-transform: none;
  font-size: 14px;
}
.opt-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #d39340 var(--v, 80%), #1a1612 var(--v, 80%));
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(196, 164, 138, 0.2);
}
.opt-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #f1c98d, #d39340);
  box-shadow: 0 0 10px rgba(211, 147, 64, 0.6);
}
.opt-slider input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: #1a1612;
}
.opt-slider input[type="range"]::-moz-range-progress {
  height: 8px;
  border-radius: 4px;
  background: #d39340;
}
.opt-slider input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: #d39340;
}
.opt-back {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
@media (max-width: 520px) {
  .opt-plate { padding: 18px 14px 14px; }
  .opt-plate h2 { font-size: 28px; }
  .opt-row { gap: 10px; padding: 12px 8px; }
  .opt-slider input[type="range"] { width: 112px; }
}
.opt-pad { display: flex; gap: 16px; align-items: center; color: var(--dim); font-size: 13px; }
.opt-pad span { display: inline-flex; align-items: center; gap: 6px; }
.pad-a, .pad-b {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-style: normal;
  font-weight: 700;
  font-size: 12px;
  color: #111;
  background: var(--guard);
}
.pad-b { background: var(--alert); }
.opt-actions { display: flex; gap: 10px; align-items: center; }
.stone-btn, .opt-leave {
  all: unset;
  cursor: pointer;
  box-sizing: border-box;
}
.stone-btn {
  padding: 12px 22px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #3a3128, #251f19);
  color: var(--bone);
  box-shadow: inset 0 1px 0 rgba(255, 240, 220, 0.16), inset 0 -3px 0 rgba(0, 0, 0, 0.45), 0 3px 0 #0e0c0a;
}
.stone-btn:active { transform: translateY(2px); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6); }
.stone-btn:focus-visible, .opt-leave:focus-visible { outline: 2px solid #d39340; outline-offset: 2px; }
.opt-leave {
  padding: 8px 4px;
  color: var(--dim);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.menu-list { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.menu-list button { width: 100%; text-align: center; min-height: 58px; }
.credits, .board { list-style: none; margin: 8px 0 16px; padding: 0; }
.credits li, .board li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
}
.studio {
  margin: 2px 0 20px;
  color: var(--dim);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-align: center;
}
#score-form { display: flex; gap: 8px; margin: 12px 0; }
#score-form[hidden] { display: none; }
#score-form input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(239, 231, 218, 0.35);
  border-radius: 0;
  font-size: 20px;
  padding: 8px 0;
}
#waitbanner button { margin-top: 12px; width: 100%; }
#smoke {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  overflow: hidden;
}
#smoke i {
  position: absolute;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0;
  background: radial-gradient(circle, rgba(210, 206, 196, 0.72), rgba(40, 38, 34, 0.2) 70%);
}
#smoke i:nth-child(1) { width: 80vw; height: 70vh; left: -10vw; top: 10vh; }
#smoke i:nth-child(2) { width: 90vw; height: 80vh; right: -20vw; top: 0; background: radial-gradient(circle, rgba(120, 116, 108, 0.78), transparent 68%); }
#smoke i:nth-child(3) { width: 100vw; height: 100vh; left: 0; top: 0; background: radial-gradient(circle, rgba(20, 18, 16, 0.88), rgba(8, 8, 8, 0.94) 70%); filter: none; }
#smoke.is-on i { animation: smoke-bloom 2.5s ease forwards; }
#smoke.is-on i:nth-child(2) { animation-delay: 0.08s; }
#smoke.is-on i:nth-child(3) { animation-delay: 0.05s; }
@keyframes smoke-bloom {
  0% { opacity: 0; transform: scale(0.86); }
  18% { opacity: 1; transform: scale(1); }
  68% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.06); }
}
.chart {
  display: block;
  width: min(100%, 420px);
  height: auto;
  margin: 8px 0 16px;
  background: #efe4cf;
  border: 1px solid #8f6a52;
}
#help {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  background: rgba(7, 7, 6, 0.72);
}
#help.is-off { display: none; }
.help-card {
  width: min(460px, 100%);
  max-height: 100%;
  overflow: auto;
  background: #14110e;
  border: 1px solid #8f6a52;
  box-shadow: inset 0 0 0 3px rgba(143, 106, 82, 0.28);
  padding: 22px 20px 18px;
}
.help-card p { margin: 0 0 10px; line-height: 1.45; }
#help-open {
  position: fixed;
  z-index: 9;
  top: calc(10px + env(safe-area-inset-top));
  right: calc(10px + env(safe-area-inset-right));
  min-height: 36px;
  padding: 0 8px;
  background: transparent;
  border: 0;
  color: var(--copper-bright);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
#screen[data-phase="intro"] #help-open { visibility: hidden; }
@media (max-width: 800px) {
  #screen.is-game[data-role="guide"] #help-open,
  #screen.is-game[data-role="guide"] #quit {
    top: calc(40px + env(safe-area-inset-top));
  }
  #screen.is-game[data-role="guide"] #help-open {
    right: calc(8px + env(safe-area-inset-right));
  }
}
.unit h2 { flex: 1 1 auto; }

@media (max-width: 800px) and (min-height: 521px) {
  #screen.is-game[data-role="guide"] #world {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
  #screen.is-game[data-role="guide"] #map {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
  }
  #screen.is-game[data-role="guide"] .guide-top {
    grid-column: 1;
    grid-row: 1;
    padding-right: calc(14px + env(safe-area-inset-right));
  }
  #screen.is-game[data-role="guide"] .board {
    grid-column: 1;
    grid-row: 3;
    overflow: visible;
  }
  #screen.is-game[data-role="runner"] #pad-help { bottom: calc(120px + env(safe-area-inset-bottom)); }
  #screen.is-game[data-role="runner"] #pad-note { bottom: calc(156px + env(safe-area-inset-bottom)); }
  h1 { letter-spacing: 0.08em; }
  #panel .key, #panel .veil { min-height: 64px; }
}

@media (max-height: 520px) {
  #screen.is-game[data-role="guide"] #world {
    grid-template-columns: minmax(0, 1fr) minmax(220px, min(420px, 50%));
    grid-template-rows: auto minmax(0, 1fr);
  }
  #screen.is-game[data-role="guide"] #panel h2.sn-name { font-size: 22px; margin-bottom: 4px; }
  #panel .key, #panel .veil { min-height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  #toast, #lobby, #result, #waitbanner, .plate, #intro-go, #smoke i,
  .eye::after, .door, #panel .key.sent::after, #panel .veil.on .ring, #panel .veil.hint,
  #menu-bg .sky, #menu-bg .planet, .menu-title, #loot-float, #screen.is-near::after,
  .code-cells span.caret::after { animation: none; }
  #panel .veil.hint { box-shadow: 0 0 0 3px rgba(211, 147, 64, 0.7); filter: none; }
  .menu-title { --fill: 110%; }
}

@property --fill { syntax: "<percentage>"; inherits: false; initial-value: -10%; }

#menu-bg { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
/* v=2 jak HD_VER w render.js, żeby podmiana pliku weszła razem z korytarzem. */
#menu-bg .sky {
  position: absolute; inset: 0;
  background: url("/tex/hd/sky.webp?v=2") 0 50% / auto 100% repeat-x;
  animation: menu-pan 160s linear infinite;
}
@keyframes menu-pan { to { background-position: -2400px 50%; } }
#menu-bg .planet {
  position: absolute; width: min(34vw, 420px); aspect-ratio: 1; right: 6vw; top: 3vh;
  background: url("/tex/hd/planet.webp?v=2") center / contain no-repeat;
  animation: menu-drift 40s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 24px rgba(196, 120, 60, 0.18));
}
@keyframes menu-drift { to { transform: translate(-18px, 10px) rotate(-1deg); } }
#menu-bg .ruin {
  position: absolute; left: 0; right: 0; bottom: 0; height: 30%;
  background: linear-gradient(180deg, #8a7364 0%, #3a2e26 16%, #100e0c 48%);
  clip-path: polygon(0 40%, 8% 40%, 8% 22%, 15% 22%, 15% 46%, 30% 46%, 30% 30%, 33% 30%, 33% 12%, 38% 12%, 38% 34%, 55% 34%, 55% 50%, 64% 50%, 64% 26%, 71% 26%, 71% 44%, 86% 44%, 86% 18%, 90% 18%, 90% 38%, 100% 38%, 100% 100%, 0 100%);
}
#menu-bg .haze {
  position: absolute; inset: 0;
  background: radial-gradient(90% 90% at 25% 55%, rgba(5, 5, 6, 0.55), transparent 70%), linear-gradient(90deg, rgba(5, 5, 6, 0.75), transparent 55%);
}
#menu-dust { position: absolute; inset: 0; width: 100%; height: 100%; }

#screen.is-hd.is-menu #lobby { background: transparent; }
#screen[data-phase="menu"] #lobby,
#screen[data-phase="home"] #lobby { padding: 0; align-items: stretch; overflow: hidden; }
#screen[data-phase="menu"] #plate,
#screen[data-phase="home"] #plate { width: 100%; height: 100%; max-width: none; margin: 0; }
#screen.is-hd[data-phase="story"] #plate,
#screen.is-hd[data-phase="credits"] #plate,
#screen.is-hd[data-phase="scores"] #plate,
#screen.is-hd[data-phase="lobby"] #plate {
  background: rgba(8, 9, 14, 0.78);
  padding: 22px 18px;
  border-radius: 8px;
}
#screen[data-phase="menu"] #help-open,
#screen[data-phase="home"] #help-open,
#screen[data-phase="options"] #help-open,
#screen[data-phase="story"] #help-open,
#screen[data-phase="credits"] #help-open,
#screen[data-phase="scores"] #help-open { display: none; }
#screen.is-menu #pad-note { display: none; }

.main-menu, .play-screen { position: relative; height: 100%; }
.menu-col {
  position: absolute; left: max(24px, 6.5vw); top: max(28px, 8vh); width: min(560px, 46vw);
  display: flex; flex-direction: column; gap: 8px;
}
.main-menu .kicker, .play-screen .kicker, .record .kicker { color: var(--copper-bright); letter-spacing: 0.42em; }
.menu-title {
  margin: 0 0 12px;
  font-size: clamp(36px, 6.4vw, 82px);
  line-height: 0.98;
  letter-spacing: 0.01em;
  text-transform: none;
  --fill: -10%;
  background: linear-gradient(90deg, #f1c98d 0%, #d39340 var(--fill), #cfc6b8 calc(var(--fill) + 6%), #cfc6b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.85));
  animation: menu-inlay 3.4s cubic-bezier(0.4, 0, 0.2, 1) 0.4s forwards;
}
@keyframes menu-inlay { to { --fill: 110%; } }
.menu-items { display: flex; flex-direction: column; gap: 2px; }
.menu-item {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 8px 0;
  font-family: Palatino, "Palatino Linotype", Georgia, serif;
  font-size: clamp(22px, 2.5vw, 34px);
  line-height: 1;
  color: rgba(231, 225, 214, 0.5);
  text-transform: none;
  letter-spacing: 0;
}
.menu-item i {
  width: 10px; height: 10px; flex: 0 0 auto; align-self: center;
  transform: rotate(45deg) scale(0.4);
  background: var(--copper);
  opacity: 0.4;
  transition: transform 0.25s, opacity 0.25s, background 0.25s, box-shadow 0.25s;
}
.menu-item small {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  opacity: 0;
}
.menu-item.on { color: var(--bone); transform: translateX(8px); }
.menu-item.on i { transform: rotate(45deg) scale(1); opacity: 1; background: #d39340; box-shadow: 0 0 12px rgba(211, 147, 64, 0.7); }
.menu-item.on small { opacity: 1; }
.menu-item:focus-visible { outline: none; }
.record {
  position: absolute; right: max(20px, 6vw); bottom: max(72px, 10vh); width: min(280px, 26vw);
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(34, 29, 23, 0.82), rgba(18, 15, 12, 0.88));
  border: 1px solid rgba(196, 164, 138, 0.22);
  border-radius: 6px;
}
.record h3 { margin: 8px 0 12px; font-family: Palatino, "Palatino Linotype", Georgia, serif; font-size: 22px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.record dl { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.record dt { font-size: 10px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); }
.record dd { margin: 6px 0 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.menu-foot {
  position: absolute; left: max(20px, 6vw); right: max(20px, 6vw); bottom: max(16px, 3vh);
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  color: var(--dim); font-size: 14px;
}
.menu-foot .host { margin: 0; font-size: 14px; letter-spacing: 0; }
.menu-foot .host b { color: var(--copper-bright); font-weight: 600; }
.pad-hints { display: flex; gap: 16px; align-items: center; }
.pad-hints span { display: inline-flex; align-items: center; gap: 6px; }
.text-back {
  all: unset;
  cursor: pointer;
  color: var(--copper-bright);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
}
.text-back:focus-visible { outline: 2px solid #d39340; outline-offset: 3px; }

.play-screen { display: flex; flex-direction: column; padding: max(18px, 4vh) max(18px, 5vw) max(12px, 3vh); gap: 12px; min-height: 0; box-sizing: border-box; }
.play-head h1 { font-size: clamp(28px, 4vw, 52px); letter-spacing: 0.02em; text-transform: none; }
.role-hint { display: block; margin: 6px 0 0; font-size: clamp(14px, 1.3vw, 18px); line-height: 1.35; color: var(--copper-bright); }
.play-roles {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr minmax(168px, 0.9fr);
  gap: clamp(8px, 1.6vw, 22px);
}
.role-card {
  all: unset;
  cursor: pointer;
  position: relative;
  min-height: 0;
  padding: 16px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(34, 29, 23, 0.6), rgba(16, 13, 10, 0.95));
  border: 1px solid rgba(196, 164, 138, 0.2);
}
.role-card .art { position: absolute; inset: 0 0 auto; width: 100%; height: 58%; }
.role-card h3 { margin: 0; position: relative; font-family: Palatino, "Palatino Linotype", Georgia, serif; font-size: clamp(20px, 2.4vw, 34px); font-weight: 400; letter-spacing: 0; text-transform: none; }
.role-card p { margin: 0; position: relative; font-size: clamp(12px, 1.1vw, 15px); line-height: 1.4; color: #cfc7ba; }
.role-card small { position: relative; font-size: 11px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--copper-bright); }
.role-card.on { border-color: #d39340; transform: translateY(-4px); box-shadow: 0 0 28px rgba(211, 147, 64, 0.15); }
.role-card:focus-visible { outline: none; }
.join-card {
  padding: 16px;
  border-radius: 8px;
  background: rgba(16, 13, 10, 0.8);
  border: 1px dashed rgba(196, 164, 138, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}
.join-card h3 { margin: 0; font-family: Palatino, "Palatino Linotype", Georgia, serif; font-size: clamp(18px, 1.8vw, 26px); font-weight: 400; letter-spacing: 0; text-transform: none; }
.join-card.on { border-color: #d39340; }
.join-card .err { margin: 0; }
.code-cells { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.code-cells input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; border: 0; padding: 0;
  background: transparent; color: transparent; caret-color: transparent; font-size: 16px;
}
.code-cells span {
  aspect-ratio: 0.8;
  display: grid; place-items: center;
  border-radius: 4px;
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 600;
  color: #f1c98d;
  background: #120f0c;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(196, 164, 138, 0.22);
}
.code-cells span.caret { box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.7), 0 0 0 1px #d39340; }
.code-cells span.caret::after {
  content: ""; width: 2px; height: 1.1em; background: #d39340; animation: code-blink 1s steps(2) infinite;
}
@keyframes code-blink { 50% { opacity: 0; } }
.play-screen .menu-foot { position: static; margin-top: auto; }

#runner-hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#runner-hud .tl {
  position: absolute; left: max(12px, 2vw); top: max(12px, 2vh);
  display: flex; gap: 14px; align-items: center;
  padding: 8px 14px; border-radius: 6px;
  background: linear-gradient(180deg, rgba(20, 17, 13, 0.75), rgba(12, 10, 8, 0.6));
  border: 1px solid rgba(196, 164, 138, 0.2);
}
#runner-hud .k { font-size: 10px; font-weight: 600; letter-spacing: 0.28em; text-transform: uppercase; color: var(--copper-bright); }
#runner-hud .v { display: block; margin-top: 4px; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
#runner-hud .sep { width: 1px; align-self: stretch; background: var(--line); }
#runner-hud .gems { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
#runner-hud .gems svg { width: 16px; height: 16px; }
#runner-hud .gems .v { margin: 0 0 0 4px; }
#runner-hud .has { color: #d39340; filter: drop-shadow(0 0 6px rgba(211, 147, 64, 0.7)); }
#runner-hud .not { color: rgba(231, 225, 214, 0.22); }
#call-banner {
  position: absolute; left: 50%; top: max(14px, 2.4vh); transform: translate(-50%, -8px);
  opacity: 0; display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: opacity 0.25s, transform 0.25s;
}
#call-banner.show { opacity: 1; transform: translate(-50%, 0); }
#call-banner small { font-size: 11px; font-weight: 600; letter-spacing: 0.4em; text-transform: uppercase; color: var(--copper-bright); }
#call-banner .word {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 28px 10px;
  background: linear-gradient(90deg, transparent, rgba(12, 10, 8, 0.78) 18%, rgba(12, 10, 8, 0.78) 82%, transparent);
  font-family: Palatino, "Palatino Linotype", Georgia, serif;
  font-size: clamp(28px, 3.4vw, 48px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bone);
  text-shadow: 0 0 24px rgba(211, 147, 64, 0.35);
}
#call-banner .word svg { width: 0.8em; height: 0.8em; color: #d39340; }
#loot-float {
  position: absolute; left: 50%; top: 58%; margin: 0;
  transform: translate(-50%, 0); opacity: 0;
  font-size: 15px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: #f1c98d;
  text-shadow: 0 0 12px rgba(211, 147, 64, 0.8);
}
#loot-float.show { animation: loot-up 1.4s ease-out forwards; }
@keyframes loot-up {
  0% { opacity: 0; transform: translate(-50%, 0); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -36px); }
}
#ear {
  position: absolute; left: max(12px, 2vw); bottom: max(12px, 2vh);
  width: clamp(108px, 18vw, 230px);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  opacity: 0.35; transition: opacity 0.4s;
}
#ear.live { opacity: 1; }
#ear svg { width: 100%; height: auto; overflow: visible; }
#ear p { margin: 0; font-size: clamp(11px, 1.15vw, 15px); font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--bone); text-align: center; }
#ear-wedge { transform-box: fill-box; transform-origin: center bottom; transition: transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 1); }
#legend {
  position: absolute; left: 50%; bottom: max(16px, 2.6vh); transform: translateX(-50%);
  margin: 0; color: rgba(231, 225, 214, 0.55); font-size: 13px; letter-spacing: 0.06em; white-space: nowrap;
}
#legend kbd {
  font: 700 12px/1 "Avenir Next", "Segoe UI", sans-serif;
  padding: 2px 5px; border-radius: 3px;
  border: 1px solid rgba(196, 164, 138, 0.3);
  background: rgba(14, 12, 10, 0.6);
  color: var(--bone);
}
#screen.is-warn::after {
  content: "";
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  box-shadow: inset 0 0 70px 6px rgba(163, 181, 106, 0.28);
}
#screen.is-near::after {
  content: "";
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  box-shadow: inset 0 0 80px 8px rgba(163, 181, 106, 0.35);
  animation: near-throb 0.9s ease-in-out infinite;
}
@keyframes near-throb { 50% { box-shadow: inset 0 0 110px 16px rgba(163, 181, 106, 0.45); } }
#screen.is-game[data-role="runner"] .frame { display: none; }
#screen.is-game[data-role="runner"] #hint { top: 86px; }

#deck {
  right: max(12px, 2vw);
  bottom: max(12px, 2vh);
  left: auto;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}
#deck button {
  position: relative;
  width: clamp(64px, 7.2vw, 104px);
  height: auto;
  min-height: 0;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  letter-spacing: 0;
  text-transform: none;
  color: var(--bone);
  background: radial-gradient(circle at 50% 35%, rgba(70, 58, 46, 0.92), rgba(24, 20, 16, 0.94));
  box-shadow: inset 0 1px 0 rgba(255, 240, 220, 0.16), inset 0 -4px 6px rgba(0, 0, 0, 0.5), 0 4px 0 rgba(8, 7, 6, 0.9), 0 10px 18px rgba(0, 0, 0, 0.5);
}
#deck #sprint { width: clamp(84px, 10vw, 140px); height: auto; aspect-ratio: 1; }
#deck button > span { display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; }
#deck svg.g { width: clamp(18px, 2.2vw, 28px); height: clamp(18px, 2.2vw, 28px); color: var(--copper-bright); }
#deck b { font-family: "Avenir Next", "Segoe UI", sans-serif; font-size: clamp(9px, 0.95vw, 12px); font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
#deck kbd {
  position: absolute; top: -4px; right: -2px; min-width: 18px; padding: 3px 5px; border-radius: 3px;
  font: 700 10px/1 "Avenir Next", "Segoe UI", sans-serif;
  color: var(--bone); background: #0e0c0a; border: 1px solid rgba(196, 164, 138, 0.35);
}
#deck .cd {
  position: absolute; inset: -4px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--copper-bright) calc(var(--p) * 360deg), rgba(231, 225, 214, 0.1) 0);
  -webkit-mask: radial-gradient(circle, transparent 66%, #000 67%);
  mask: radial-gradient(circle, transparent 66%, #000 67%);
}
#deck button.busy { color: var(--dim); }
#deck button.busy svg.g { color: var(--dim); }
#deck button.is-down, #deck button:active {
  transform: translateY(3px);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(211, 147, 64, 0.6), 0 0 18px rgba(211, 147, 64, 0.35);
}
#deck button.is-down svg.g, #deck #sprint.on svg.g { color: #f1c98d; }
#deck button:disabled { opacity: 1; }
#quit .ico, #help-open .ico { display: none; width: 20px; height: 20px; }
#screen.is-game[data-role="runner"] #quit,
#screen.is-game[data-role="runner"] #help-open {
  width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(14, 12, 10, 0.6);
  border: 1px solid rgba(196, 164, 138, 0.3);
  color: var(--copper-bright);
}
#screen.is-game[data-role="runner"] #quit { left: auto; right: max(12px, 2vw); transform: none; }
#screen.is-game[data-role="runner"] #help-open { right: calc(64px + env(safe-area-inset-right)); }
#screen.is-game[data-role="runner"] #quit .lbl,
#screen.is-game[data-role="runner"] #help-open .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#screen.is-game[data-role="runner"] #quit .ico,
#screen.is-game[data-role="runner"] #help-open .ico { display: block; }

@media (max-aspect-ratio: 1/1) {
  .menu-col, .record, .main-menu .menu-foot { position: static; width: auto; }
  .main-menu {
    display: flex; flex-direction: column; height: 100%; box-sizing: border-box;
    padding: max(20px, 4vh) 18px max(12px, 2vh); gap: 16px; overflow: auto;
  }
  .record { margin-top: auto; }
  .play-roles { grid-template-columns: 1fr; overflow: auto; }
  .role-card { min-height: 148px; }
  #call-banner { top: 78px; }
  #runner-hud .tl { gap: 8px; padding: 6px 8px; }
  #runner-hud .k { letter-spacing: 0.12em; font-size: 9px; }
  #runner-hud .v, #runner-hud .gems svg { font-size: 13px; }
  #runner-hud .gems svg { width: 14px; height: 14px; }
}
@media (max-width: 900px), (max-height: 520px) {
  #legend, #deck kbd { display: none; }
  #ear p { letter-spacing: 0.06em; font-size: 11px; }
}
@media (max-width: 700px) {
  #ear p { white-space: normal; max-width: 118px; text-align: center; line-height: 1.25; }
}
@media (max-height: 520px) {
  .menu-title { font-size: clamp(28px, 8vh, 48px); margin-bottom: 4px; }
  .menu-item { font-size: clamp(18px, 5vh, 26px); padding: 3px 0; }
  .record { width: min(220px, 30vw); padding: 8px 10px; }
  .record h3 { font-size: 16px; margin: 4px 0 6px; }
  .record dd { font-size: 14px; }
  .play-head h1 { font-size: clamp(22px, 6vh, 36px); }
  .role-card p { display: none; }
  .role-card { padding: 10px; }
}
