/* ONARU CITY · ui-kit
   One reusable design system for every screen: graphite instrument glass, brass-gold accents, hairline rules,
   micro-labels, technical numerals. Loaded after game.css and glass.css, so it only re-skins existing markup.
   Brand rules: premium blue + gold. No purple anywhere. */

:root {
  --ui-void: #04080f;
  --ui-bg: #070d18;
  --ui-bg-2: #0b1524;
  --ui-panel: rgba(9, 17, 30, 0.9);
  --ui-panel-2: rgba(14, 26, 44, 0.72);
  --ui-inset: rgba(4, 10, 20, 0.55);
  --ui-line: rgba(232, 200, 116, 0.16);
  --ui-line-2: rgba(255, 255, 255, 0.08);
  --ui-line-3: rgba(232, 200, 116, 0.34);
  --ui-text: #f3efe4;
  --ui-dim: #a8b8ce;
  --ui-mute: #6f819c;
  --ui-gold: #e8c874;
  --ui-gold-2: #f7e4ae;
  --ui-gold-deep: #c9a24a;
  --ui-cyan: #57c7ff;
  --ui-ok: #4cc38a;
  --ui-warn: #f0a04b;
  --ui-danger: #ff8f7a;
  --ui-r-2xl: 28px;
  --ui-r-xl: 22px;
  --ui-r-lg: 16px;
  --ui-r-md: 12px;
  --ui-r-pill: 999px;
  --ui-shadow: 0 34px 90px -30px #000, 0 2px 0 rgba(255, 255, 255, 0.05) inset, 0 -1px 0 rgba(0, 0, 0, 0.5) inset;
  --ui-shadow-sm: 0 14px 34px -18px #000, 0 1px 0 rgba(255, 255, 255, 0.05) inset;
  --ui-glow: 0 0 0 1px rgba(232, 200, 116, 0.1), 0 18px 50px -28px rgba(232, 200, 116, 0.4);
  --ui-track: 0.22em;
  --ui-label: 9.5px;
  --ui-mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", ui-monospace, "Consolas", monospace;

  /* keep every legacy rule on brand: glass.css reads these */
  --accent: #e8c874;
  --accent-2: #c9a24a;
  --gold: #d9a94a;
  --gold-2: #f0cf86;
  --glass-line: rgba(232, 200, 116, 0.16);
  --glass-hi: rgba(255, 255, 255, 0.22);
  --line: rgba(232, 200, 116, 0.16);
}

/* Themes: Ember (gold), Glass (steel), Midnight (blue — replaces the old violet "neon" look). */
:root[data-theme="glass"] { --accent: #dfe6f0; --gold: #c9d2de; --gold-2: #f2f5f9; --ui-gold: #dfe6f0; --ui-gold-2: #ffffff; --ui-gold-deep: #aab4c3; --ui-line: rgba(223, 230, 240, 0.18); }
:root[data-theme="neon"], :root[data-theme="midnight"] { --accent: #8fd8ff; --gold: #7fcdf5; --gold-2: #d7f2ff; --ui-gold: #8fd8ff; --ui-gold-2: #e0f6ff; --ui-gold-deep: #4f9fc9; --ui-line: rgba(143, 216, 255, 0.22); }

body {
  font-family: "Segoe UI Variable Display", "SF Pro Display", "Avenir Next", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(232, 200, 116, 0.28); color: #fff; }
* { scrollbar-width: thin; scrollbar-color: rgba(232, 200, 116, 0.28) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(232, 200, 116, 0.24); border-radius: 99px; }

/* ── typography ─────────────────────────────────────────────────────────────────────────── */
h1, h2, h2.big, h3 {
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--ui-text);
}
h2 { font-size: clamp(20px, 3.4vw, 26px); line-height: 1.12; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
h2::before { content: ""; width: 22px; height: 1px; background: linear-gradient(90deg, var(--ui-gold), transparent); flex: none; }
h2.big { font-size: clamp(28px, 6vw, 46px); letter-spacing: 0.01em; background: linear-gradient(180deg, #fff 25%, var(--ui-gold-2)); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; }
h3 { font-size: 12px; letter-spacing: var(--ui-track); text-transform: uppercase; color: var(--ui-dim); font-weight: 650; }
p { color: var(--ui-text); }
.lede { color: var(--ui-dim); font-size: clamp(14.5px, 3.2vw, 17px); line-height: 1.6; }
.fine { color: var(--ui-mute); font-size: 12px; letter-spacing: 0.015em; line-height: 1.5; }
.meta { color: var(--ui-gold); font-size: 12px; letter-spacing: 0.04em; }
a { color: var(--ui-gold-2); text-underline-offset: 3px; }
a:hover { color: #fff; }

/* reusable micro-label, index and spec primitives */
.ui-k, .kicker, .st-kicker {
  font-size: var(--ui-label);
  font-weight: 700;
  letter-spacing: var(--ui-track);
  text-transform: uppercase;
  color: var(--ui-mute);
}
.ui-num { font-family: var(--ui-mono); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.ui-rule { height: 1px; background: linear-gradient(90deg, var(--ui-line-3), transparent); border: 0; margin: 14px 0; }
.ui-badge {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 24px; padding: 4px 10px; border-radius: var(--ui-r-pill);
  border: 1px solid var(--ui-line); background: rgba(232, 200, 116, 0.08);
  color: var(--ui-gold-2); font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  white-space: nowrap;
}
.ui-badge.live { border-color: rgba(76, 195, 138, 0.45); background: rgba(76, 195, 138, 0.1); color: #8fe6ba; }
.ui-badge.warn { border-color: rgba(240, 160, 75, 0.45); background: rgba(240, 160, 75, 0.1); color: #ffc68f; }
.ui-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ui-ok); box-shadow: 0 0 0 3px rgba(76, 195, 138, 0.14); }

/* ── overlays + panels ─────────────────────────────────────────────────────────────────── */
.overlay {
  background:
    radial-gradient(ellipse at 50% 18%, rgba(24, 46, 80, 0.42), transparent 58%),
    radial-gradient(ellipse at 50% 120%, rgba(201, 162, 74, 0.08), transparent 55%),
    rgba(3, 7, 13, 0.82);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
}
.overlay::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 72px 72px; mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 78%);
}
.panel {
  background:
    linear-gradient(155deg, rgba(20, 34, 54, 0.92), rgba(7, 13, 24, 0.96) 55%, rgba(9, 16, 28, 0.98));
  border: 1px solid var(--ui-line-2);
  border-radius: var(--ui-r-2xl);
  box-shadow: var(--ui-shadow);
  backdrop-filter: blur(28px) saturate(1.25);
  -webkit-backdrop-filter: blur(28px) saturate(1.25);
  animation: panel-in 0.42s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.panel::before {
  background:
    linear-gradient(180deg, rgba(232, 200, 116, 0.5), transparent 1px) top / 100% 1px no-repeat,
    linear-gradient(120deg, rgba(255, 255, 255, 0.06), transparent 30%, transparent 72%, rgba(232, 200, 116, 0.05));
}
@keyframes panel-in { from { opacity: 0; transform: translateY(18px) scale(0.985); } to { opacity: 1; transform: none; } }
.panel > h2:first-child { margin-top: 0; }

/* ── buttons, fields, cards ────────────────────────────────────────────────────────────── */
.btn {
  --btn-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025));
  position: relative;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: var(--ui-r-md);
  border: 1px solid var(--ui-line);
  background: var(--btn-bg);
  color: var(--ui-text);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 10px 24px -18px #000;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.16s ease, box-shadow 0.16s ease, color 0.14s ease;
}
.btn:hover { border-color: var(--ui-line-3); background: linear-gradient(180deg, rgba(232, 200, 116, 0.14), rgba(255, 255, 255, 0.035)); transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 16px 30px -20px #000; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--ui-gold); outline-offset: 3px; }
.btn.primary, .btn.gold {
  color: #07101e;
  border-color: rgba(255, 236, 190, 0.55);
  background: linear-gradient(180deg, #f7e4ae, #e2be6b 48%, #c9a24a);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset, 0 -2px 0 rgba(110, 74, 16, 0.35) inset, 0 18px 36px -20px rgba(232, 200, 116, 0.65);
}
.btn.primary:hover, .btn.gold:hover { background: linear-gradient(180deg, #fff1c6, #edcb7a 48%, #d3ac51); color: #050b14; }
.btn.ghost { background: transparent; border-color: var(--ui-line-2); color: var(--ui-dim); }
.btn.ghost:hover { color: var(--ui-text); border-color: var(--ui-line-3); }
.btn.danger { color: #ffb0a2; border-color: rgba(255, 143, 122, 0.28); background: rgba(255, 143, 122, 0.06); }
.btn.danger:hover { background: rgba(255, 143, 122, 0.12); border-color: rgba(255, 143, 122, 0.5); }
.btn.small { min-height: 36px; padding: 7px 12px; font-size: 12px; border-radius: 10px; }
.btn[disabled] { opacity: 0.38; cursor: not-allowed; transform: none; }
.btn[aria-pressed="true"]:not(.primary) { border-color: var(--ui-gold); color: var(--ui-gold-2); background: rgba(232, 200, 116, 0.12); }

:is(.btn, .card, a, .tab, .swatch):focus-visible {
  outline: 2px solid var(--ui-gold);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(232, 200, 116, 0.14);
}

.field { display: grid; gap: 7px; font-weight: 650; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ui-mute); }
.text {
  min-height: 48px; padding: 11px 14px; border-radius: var(--ui-r-md);
  border: 1px solid var(--ui-line); background: var(--ui-inset); color: var(--ui-text);
  font: 500 15px/1.3 inherit; letter-spacing: 0.02em;
}
.text:focus { outline: none; border-color: var(--ui-gold); box-shadow: 0 0 0 4px rgba(232, 200, 116, 0.12); }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; background: var(--c); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); }
.swatch[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 2px var(--ui-gold); }

.card.choice, .job, .st-row, .shopcard, .card.profile {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--ui-line-2);
  border-radius: var(--ui-r-lg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 18px 40px -30px #000;
}
.card.choice:hover { background: linear-gradient(165deg, rgba(232, 200, 116, 0.13), rgba(255, 255, 255, 0.03)); border-color: var(--ui-line-3); transform: translateY(-2px); }
.card.choice strong { color: var(--ui-gold-2); letter-spacing: 0.01em; }
.job.active { border-color: var(--ui-line-3); background: linear-gradient(165deg, rgba(232, 200, 116, 0.14), rgba(255, 255, 255, 0.03)); }
.job-top strong { font-weight: 650; letter-spacing: 0.01em; }
.badge { border-radius: 4px; background: rgba(87, 199, 255, 0.1); color: #9adcff; border: 1px solid rgba(87, 199, 255, 0.22); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; }
.badge.bulk { background: rgba(240, 160, 75, 0.1); border-color: rgba(240, 160, 75, 0.28); color: #ffc68f; }
.timer-inline { font-family: var(--ui-mono); letter-spacing: 0.06em; color: var(--ui-gold-2); }
.stats li { background: var(--ui-inset); border-color: var(--ui-line-2); border-radius: var(--ui-r-md); }
.stats strong { color: var(--ui-gold-2); font-variant-numeric: tabular-nums; }
.stats span { color: var(--ui-mute); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.keys { font-size: 13px; }
.keys th, .keys td { border-bottom: 1px solid var(--ui-line-2); padding: 10px 12px; }
.keys thead th { color: var(--ui-mute); font-size: 9.5px; letter-spacing: var(--ui-track); }
.keys tbody th { color: var(--ui-text); font-weight: 650; }

/* tabs / garage */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px; border: 1px solid var(--ui-line-2); border-radius: var(--ui-r-pill); background: var(--ui-inset); width: max-content; max-width: 100%; }
.tab { border: 0; background: transparent; color: var(--ui-dim); padding: 8px 16px; min-height: 38px; border-radius: var(--ui-r-pill); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; }
.tab[aria-selected="true"] { background: linear-gradient(180deg, var(--ui-gold-2), var(--ui-gold-deep)); color: #07101e; }
.shop h3 { color: var(--ui-gold-2); letter-spacing: 0.18em; }
.shopcard.equipped { border-color: rgba(76, 195, 138, 0.55); background: rgba(76, 195, 138, 0.07); }
.garage-head h2, .profile-head h2 { margin: 0; }

/* ── HUD ───────────────────────────────────────────────────────────────────────────────── */
#hud { padding: calc(var(--sat) + 14px) calc(var(--sar) + 16px) 0 calc(var(--sal) + 16px); gap: 16px; }
.hud-left { gap: 9px; max-width: min(560px, 64vw); }
.chips { gap: 6px; }
.chip {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--ui-line-2);
  background: linear-gradient(180deg, rgba(16, 30, 50, 0.72), rgba(6, 13, 24, 0.78));
  color: var(--ui-dim);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  box-shadow: 0 8px 22px -14px #000, 0 1px 0 rgba(255, 255, 255, 0.05) inset;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
}
.chip.chip-live { color: var(--ui-gold-2); border-color: var(--ui-line); display: inline-flex; align-items: center; gap: 7px; }
.chip.chip-live i { width: 5px; height: 5px; border-radius: 50%; background: var(--ui-ok); box-shadow: 0 0 0 3px rgba(76, 195, 138, 0.14); animation: livePulse 2.4s ease-in-out infinite; }
@keyframes livePulse { 50% { box-shadow: 0 0 0 5px rgba(76, 195, 138, 0.05); } }
.chip.gold { color: #08121f; border-color: transparent; background: linear-gradient(180deg, var(--ui-gold-2), var(--ui-gold-deep)); font-family: var(--ui-mono); letter-spacing: 0.04em; font-size: 11px; }

#objective {
  position: relative;
  padding: 10px 14px 10px 16px;
  max-width: 340px;
  gap: 3px;
  border-radius: var(--ui-r-md);
  border: 1px solid var(--ui-line-2);
  border-left: 0;
  background: linear-gradient(150deg, rgba(14, 28, 48, 0.86), rgba(5, 11, 21, 0.88));
  box-shadow: var(--ui-shadow-sm);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}
#objective::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px;
  background: linear-gradient(180deg, var(--ui-gold-2), rgba(232, 200, 116, 0.12));
}
#objective .obj-k { font-size: var(--ui-label); font-weight: 750; letter-spacing: var(--ui-track); text-transform: uppercase; color: var(--ui-mute); }
#objective strong { font-size: 13.5px; font-weight: 650; line-height: 1.3; letter-spacing: 0.005em; color: #fff; }
#objective span#objective-sub { font-size: 11px; line-height: 1.4; color: var(--ui-dim); }

#timer {
  border-radius: var(--ui-r-md);
  border: 1px solid var(--ui-line);
  background: linear-gradient(160deg, rgba(20, 38, 62, 0.9), rgba(6, 12, 22, 0.92));
  color: var(--ui-gold-2);
  font-family: var(--ui-mono);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.1em;
  padding: 7px 16px 7px 14px;
  box-shadow: var(--ui-shadow-sm);
}
#timer::before { content: "ETA"; display: block; font: 700 8px/1 var(--ui-mono); letter-spacing: 0.3em; color: var(--ui-mute); margin-bottom: 3px; }
#timer.late { color: #ffb2a6; border-color: rgba(255, 143, 122, 0.5); }

#street { align-self: start; font-size: 10.5px; font-weight: 650; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ui-dim); padding: 5px 10px; border: 1px solid var(--ui-line-2); border-radius: 5px; background: rgba(6, 13, 24, 0.6); width: max-content; backdrop-filter: blur(10px); }
#street:empty { display: none; }
#hp { width: min(220px, 46vw); height: 5px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.06); overflow: hidden; }
#hp > i { display: block; height: 100%; width: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--ui-ok), #8fe0b4); transition: width 0.3s ease; }
#hp.low > i { background: linear-gradient(90deg, var(--ui-danger), #ffb2a6); }

.hud-right { gap: 10px; }
.map-shell { position: relative; width: 128px; height: 128px; display: grid; place-items: center; }
.map-shell::before {
  content: ""; position: absolute; inset: -7px; border-radius: 50%;
  border: 1px solid var(--ui-line-2);
  background: conic-gradient(from 0deg, rgba(232, 200, 116, 0.4) 0 1deg, transparent 1deg 29deg, rgba(255, 255, 255, 0.12) 29deg 30deg, transparent 30deg 59deg, rgba(255, 255, 255, 0.12) 59deg 60deg, transparent 60deg 89deg, rgba(255, 255, 255, 0.12) 89deg 90deg, transparent 90deg 100%);
  -webkit-mask: radial-gradient(circle, transparent 63%, #000 64%);
  mask: radial-gradient(circle, transparent 63%, #000 64%);
  opacity: 0.8;
}
.map-shell::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.55), 0 18px 40px -18px #000; pointer-events: none; }
#minimap {
  width: 128px; height: 128px;
  border-radius: 50%;
  border: 1px solid var(--ui-line-3);
  box-shadow: 0 0 0 4px rgba(5, 11, 21, 0.7), 0 0 0 5px rgba(232, 200, 116, 0.12);
}
.map-n { position: absolute; top: -2px; left: 50%; transform: translate(-50%, -50%); z-index: 2; font: 800 9px/1 var(--ui-mono); letter-spacing: 0.2em; color: var(--ui-gold-2); background: #08111f; border: 1px solid var(--ui-line-3); border-radius: 999px; padding: 3px 6px 3px 8px; }

#nav {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 11px;
  padding: 9px 13px 9px 10px; min-width: 190px;
  border-radius: var(--ui-r-md); border: 1px solid var(--ui-line-2);
  background: linear-gradient(160deg, rgba(15, 30, 51, 0.88), rgba(5, 11, 21, 0.9));
  box-shadow: var(--ui-shadow-sm); backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
#nav-ico { grid-row: span 2; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--ui-line); background: rgba(232, 200, 116, 0.09); color: var(--ui-gold-2); font-size: 17px; }
#nav-text { font-size: 11.5px; font-weight: 650; color: var(--ui-text); line-height: 1.3; }
#nav-dist { font: 700 10px/1 var(--ui-mono); letter-spacing: 0.1em; color: var(--ui-gold); font-style: normal; }
#map-btn { justify-self: end; }
#arrow {
  padding: 4px 13px 4px 5px; border-radius: var(--ui-r-pill);
  border: 1px solid var(--ui-line-2); background: linear-gradient(160deg, rgba(15, 30, 51, 0.88), rgba(5, 11, 21, 0.9));
  box-shadow: var(--ui-shadow-sm);
}
#arrow-dial { width: 36px; height: 36px; border-radius: 50%; background: radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.08), rgba(5, 11, 21, 0.4)); border: 1px solid var(--ui-line-2); }
#arrow-dist { font: 700 11px/1 var(--ui-mono); letter-spacing: 0.08em; color: var(--ui-gold-2); }

#prompt {
  bottom: calc(var(--sab) + 26px);
  border-radius: var(--ui-r-pill);
  border: 1px solid var(--ui-line-3);
  background: linear-gradient(180deg, rgba(20, 36, 58, 0.94), rgba(5, 11, 21, 0.96));
  color: var(--ui-gold-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 12px 22px 12px 26px;
  box-shadow: 0 20px 44px -22px #000, 0 0 0 1px rgba(232, 200, 116, 0.06), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
#prompt::before {
  content: ""; position: absolute; left: 12px; top: 50%; width: 4px; height: 4px; margin-top: -2px;
  border-radius: 50%; background: var(--ui-gold); box-shadow: 0 0 8px rgba(232, 200, 116, 0.8);
}

#toasts { top: calc(var(--sat) + 152px); gap: 7px; }
.toast {
  position: relative;
  padding: 10px 16px 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--ui-line-2);
  border-left: 0;
  background: linear-gradient(160deg, rgba(16, 31, 52, 0.94), rgba(5, 11, 21, 0.94));
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.04em;
  box-shadow: var(--ui-shadow-sm); backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.toast::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--ui-gold); border-radius: 2px; }
.toast.ok::before { background: var(--ui-ok); } .toast.warn::before { background: var(--ui-warn); } .toast.bad::before { background: var(--ui-danger); }
.toast.out { opacity: 0; transform: translateY(-6px); }

#offline { border: 1px solid rgba(240, 160, 75, 0.35); background: rgba(240, 160, 75, 0.1); color: #ffd2a3; border-radius: 6px; font-size: 10.5px; letter-spacing: 0.05em; padding: 6px 10px; max-width: 210px; text-align: right; }

/* tutorial */
#tutorial { border-radius: var(--ui-r-md); border: 1px solid var(--ui-line-2); background: linear-gradient(160deg, rgba(16, 31, 52, 0.9), rgba(5, 11, 21, 0.92)); padding: 10px 14px; max-width: 340px; box-shadow: var(--ui-shadow-sm); }
#tutorial .tut-top strong { font-size: 9.5px; letter-spacing: var(--ui-track); text-transform: uppercase; color: var(--ui-gold-2); }
#tutorial p { font-size: 12.5px; color: var(--ui-dim); line-height: 1.45; }
#tutorial #tut-skip { border: 0; background: transparent; color: var(--ui-mute); letter-spacing: 0.12em; text-transform: uppercase; font-size: 9px; padding: 2px 4px; }
#tutorial .tut-bar { height: 2px; background: rgba(255, 255, 255, 0.08); margin-top: 8px; }
#tutorial .tut-bar i { background: linear-gradient(90deg, var(--ui-gold), var(--ui-gold-2)); }

/* ── touch controls ────────────────────────────────────────────────────────────────────── */
#touch .stick { background: radial-gradient(circle at 50% 40%, rgba(18, 34, 56, 0.6), rgba(4, 9, 17, 0.66)); border: 1px solid var(--ui-line); box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.4); }
#touch .knob { width: 54px; height: 54px; margin: -27px 0 0 -27px; background: radial-gradient(circle at 35% 30%, #fff2cf, #e2be6b 45%, #a8802f); box-shadow: 0 4px 14px #0009, 0 1px 0 rgba(255, 255, 255, 0.6) inset; }
.tbtn {
  border-radius: 50%; border: 1px solid var(--ui-line-3);
  background: radial-gradient(circle at 50% 30%, rgba(22, 42, 68, 0.9), rgba(5, 11, 21, 0.92));
  color: var(--ui-gold-2);
  font-size: 10px; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase;
  box-shadow: 0 12px 26px -14px #000, 0 1px 0 rgba(255, 255, 255, 0.07) inset;
}
.tbtn.big { background: radial-gradient(circle at 50% 30%, #f9e6b2, #d9b25f 55%, #b78b37); color: #07101e; border-color: rgba(255, 240, 200, 0.7); }
.tbtn.down { transform: scale(0.94); filter: brightness(1.15); }
#touch .tbtn.menu { border-radius: 12px; }

/* ── pause dashboard ───────────────────────────────────────────────────────────────────── */
/* Floating in-world buttons must never sit over a modal conversation or the pause dashboard. */
body.has-overlay #city-life-btn { opacity: 0; pointer-events: none; visibility: hidden; }
.overlay[aria-label="pause"] { padding: calc(var(--sat) + 12px) calc(var(--sar) + 12px) calc(var(--sab) + 12px) calc(var(--sal) + 12px); }
.overlay[aria-label="pause"] .panel {
  width: min(1160px, 100%); max-height: 100%; padding: 0; overflow: hidden;
  text-align: left; display: block;
  border-radius: var(--ui-r-2xl);
}
.overlay[aria-label="pause"] .panel::before { display: none; }
.overlay[aria-label="pause"] h2 { font-size: 15px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ui-dim); margin: 0; gap: 10px; }
.overlay[aria-label="pause"] h2::before { width: 14px; background: var(--ui-gold); }

.ui-dash {
  display: grid; grid-template-rows: auto 1fr; min-height: 0;
  height: min(760px, calc(100svh - 24px - var(--sat) - var(--sab)));
  background:
    radial-gradient(ellipse at 78% 0%, rgba(232, 200, 116, 0.07), transparent 46%),
    linear-gradient(180deg, rgba(10, 19, 33, 0.6), rgba(4, 9, 17, 0.6));
}
.ui-dash-top {
  display: flex; align-items: center; gap: 18px;
  padding: 16px clamp(16px, 2.6vw, 28px);
  border-bottom: 1px solid var(--ui-line-2);
  background: rgba(6, 12, 22, 0.55);
}
.ui-brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.ui-brand b { font-size: 17px; font-weight: 800; letter-spacing: 0.34em; color: #fff; text-transform: uppercase; }
.ui-brand span { font-size: 9px; font-weight: 700; letter-spacing: 0.32em; text-transform: uppercase; color: var(--ui-gold); padding-left: 10px; border-left: 1px solid var(--ui-line-3); }
.ui-brand i { display: block; font: 500 9px/1.4 system-ui; letter-spacing: 0.08em; color: var(--ui-mute); font-style: normal; }
.ui-dash-top .ui-head-meta { margin-left: auto; display: none; text-align: right; font: 600 9.5px/1.6 var(--ui-mono); letter-spacing: 0.12em; color: var(--ui-mute); text-transform: uppercase; }
.ui-dash-top .ui-head-meta b { display: block; color: var(--ui-gold-2); font-weight: 700; }
.ui-dash-top .view-switch { margin-left: auto; }
.ui-dash-top .ui-badge { margin-left: 4px; }
@media (min-width: 860px) { .ui-dash-top .ui-head-meta { display: block; margin-left: 0; } .ui-dash-top .view-switch { margin-left: auto; } }

.ui-dash-grid {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr) 300px;
  min-height: 0;
}
.ui-rail {
  display: flex; flex-direction: column; gap: 3px;
  padding: 22px 12px; border-right: 1px solid var(--ui-line-2);
  background: linear-gradient(180deg, rgba(7, 14, 26, 0.55), rgba(4, 9, 17, 0.35));
  overflow-y: auto; scrollbar-width: none;
}
.ui-rail::-webkit-scrollbar { display: none; }
.ui-rail-k { font: 700 8.5px/1 var(--ui-mono); letter-spacing: 0.28em; color: var(--ui-mute); text-transform: uppercase; padding: 0 10px 12px; }
.ui-rail-btn {
  appearance: none; border: 1px solid transparent; background: transparent; color: var(--ui-mute);
  display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 4px;
  padding: 10px; border-radius: 9px; cursor: pointer; text-align: left;
  font: 650 11px/1.2 inherit; letter-spacing: 0.1em; text-transform: uppercase;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.ui-rail-btn b { font: 600 9px/1 var(--ui-mono); letter-spacing: 0.08em; color: var(--ui-mute); }
.ui-rail-btn span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-rail-btn:hover { color: var(--ui-text); background: rgba(255, 255, 255, 0.04); }
.ui-rail-btn.on { color: var(--ui-gold-2); background: rgba(232, 200, 116, 0.07); border-color: var(--ui-line); }
.ui-rail-btn.on b { color: var(--ui-gold); }
.ui-rail-meta { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--ui-line-2); font: 600 8.5px/1.7 var(--ui-mono); letter-spacing: 0.16em; color: var(--ui-mute); text-transform: uppercase; }
.ui-rail-meta b { color: var(--ui-gold); display: block; }

.ui-dash-main { padding: 20px clamp(16px, 2.4vw, 26px) 26px; overflow: auto; display: grid; align-content: start; gap: 26px; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: rgba(232, 200, 116, 0.35) transparent; }
.ui-dash-main::-webkit-scrollbar, .ui-status::-webkit-scrollbar { width: 8px; }
.ui-dash-main::-webkit-scrollbar-thumb, .ui-status::-webkit-scrollbar-thumb { background: rgba(232, 200, 116, 0.3); border-radius: 99px; }
.ui-dash-main::-webkit-scrollbar-track, .ui-status::-webkit-scrollbar-track { background: transparent; }
.ui-sec { display: grid; gap: 10px; scroll-margin-top: 8px; }
.ui-sec-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; gap: 10px; }
.ui-sec-head b { font: 600 9px/1 var(--ui-mono); color: var(--ui-gold); letter-spacing: 0.1em; }
.ui-sec-head h2 { min-width: 0; margin: 0; }
.ui-sec-head .ui-sec-note { font: 600 9px/1 var(--ui-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ui-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 8px; }
.ui-tile {
  position: relative; display: grid; gap: 4px; align-content: start;
  min-height: 86px; padding: 13px 34px 12px 14px;
  border: 1px solid var(--ui-line-2); border-radius: var(--ui-r-md);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  color: var(--ui-text); text-align: left; cursor: pointer;
  font: 650 13px/1.25 inherit; letter-spacing: 0.01em;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.ui-tile:hover { border-color: var(--ui-line-3); background: linear-gradient(165deg, rgba(232, 200, 116, 0.1), rgba(255, 255, 255, 0.02)); transform: translateY(-1px); }
.ui-tile .ui-tile-text { display: grid; gap: 3px; align-content: start; min-width: 0; }
.ui-tile .ui-tile-k { font: 700 8px/1 var(--ui-mono); letter-spacing: 0.24em; text-transform: uppercase; color: var(--ui-mute); min-height: 10px; }
.ui-tile strong { font-size: 13px; font-weight: 650; line-height: 1.28; }
.ui-tile small { font-size: 10.5px; font-weight: 500; color: var(--ui-mute); letter-spacing: 0.01em; line-height: 1.35; }
.ui-tile .ui-tile-go { position: absolute; right: 12px; top: 12px; width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid var(--ui-line-2); border-radius: 50%; color: var(--ui-mute); font: 600 10px/1 var(--ui-mono); font-style: normal; transition: all 0.15s; }
.ui-tile:hover .ui-tile-go { color: #07101e; background: var(--ui-gold); border-color: var(--ui-gold); }
.ui-tile.primary {
  grid-column: 1 / -1; min-height: 78px; align-content: center;
  grid-template-columns: 1fr auto; align-items: center;
  color: #07101e; border-color: rgba(255, 238, 194, 0.5);
  background: linear-gradient(100deg, #f7e4ae, #e2be6b 55%, #c9a24a);
  box-shadow: 0 20px 44px -24px rgba(232, 200, 116, 0.7), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}
.ui-tile.primary .ui-tile-k { color: rgba(7, 16, 30, 0.55); }
.ui-tile.primary strong { font-size: 17px; letter-spacing: 0.12em; text-transform: uppercase; }
.ui-tile.primary small { color: rgba(7, 16, 30, 0.62); }
.ui-tile.primary .ui-tile-go { color: #07101e; border-color: rgba(7, 16, 30, 0.3); }
.ui-tile.primary:hover { filter: brightness(1.03); transform: translateY(-1px); }
.ui-tile.primary .ui-tile-text { display: grid; gap: 3px; }

.ui-status {
  border-left: 1px solid var(--ui-line-2);
  background: linear-gradient(180deg, rgba(7, 14, 26, 0.6), rgba(4, 9, 17, 0.45));
  padding: 18px 18px 22px; display: grid; align-content: start; gap: 14px; overflow: auto;
}
.ui-status-k { font: 700 8.5px/1 var(--ui-mono); letter-spacing: 0.28em; color: var(--ui-mute); text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.ui-status-k::after { content: ""; flex: 1; height: 1px; background: var(--ui-line-2); }
.ui-status-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 11.5px; color: var(--ui-dim); }
.ui-status-row b { font: 650 11.5px/1.2 inherit; color: var(--ui-text); text-align: right; }
.ui-status-row b.mono { font-family: var(--ui-mono); letter-spacing: 0.06em; color: var(--ui-gold-2); }
.ui-status .show-stage { min-height: 190px; border-radius: var(--ui-r-md); }
.ui-status .show-meta { display: grid; grid-template-columns: auto 1fr 1fr; align-items: end; gap: 4px 14px; left: 12px; right: 12px; bottom: 10px; }
.ui-status .show-meta .big { grid-column: 1 / -1; font-size: 20px; font-weight: 700; letter-spacing: 0.02em; }
.ui-status .show-meta .stat { font-size: 9px; letter-spacing: 0.14em; }
.ui-status .show-meta .stat b { font-size: 14px; }
.ui-status .ui-badge { justify-self: start; }

.ui-dash.showcase .ui-dash-grid { grid-template-columns: 148px minmax(0, 1fr); }
.ui-dash.showcase .ui-status { grid-column: 1 / -1; grid-row: 2; border-left: 0; border-top: 1px solid var(--ui-line-2); }
.ui-dash.showcase .ui-dash-main { grid-row: 3; }
.ui-dash.showcase .ui-status .show-stage { min-height: 330px; }

@media (max-width: 1020px) {
  .ui-dash-grid { grid-template-columns: 132px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .ui-status {
    grid-column: 1 / -1; grid-row: 2; border-left: 0; border-top: 1px solid var(--ui-line-2);
    display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); align-items: start;
    gap: 8px 16px; max-height: 38svh; padding: 14px 16px 16px;
  }
  .ui-status .ui-status-k { grid-column: 1 / -1; }
  .ui-status .show-stage { min-height: 150px; grid-column: span 2; }
  .ui-status .ui-status-row { min-width: 0; }
  .ui-rail-meta { display: none; }
  .ui-rail-btn { font-size: 10px; letter-spacing: 0.05em; }
}
@media (max-width: 700px) {
  .ui-dash { height: calc(100svh - 20px - var(--sat) - var(--sab)); }
  .ui-dash-top { padding: 12px 14px; gap: 10px; }
  .ui-brand b { font-size: 14px; letter-spacing: 0.26em; }
  .ui-brand span, .ui-brand i { display: none; }
  .ui-dash-grid { grid-template-columns: 1fr; }
  .ui-rail { flex-direction: row; overflow-x: auto; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--ui-line-2); gap: 4px; }
  .ui-rail-k, .ui-rail-meta { display: none; }
  .ui-rail-btn { grid-template-columns: auto 1fr; white-space: nowrap; padding: 8px 10px; }
  .ui-dash-main { padding: 16px 14px 22px; gap: 22px; }
  .ui-tiles { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); }
  .ui-tile { min-height: 78px; padding: 11px 30px 10px 12px; }
  .ui-status { grid-column: auto; }
}
@media (max-height: 560px) and (min-width: 701px) {
  .ui-dash { height: calc(100svh - 16px); }
  .ui-dash-top { padding: 9px 16px; }
  .ui-dash-main { padding: 12px 16px 16px; gap: 18px; }
  .ui-tile { min-height: 64px; }
  .ui-tile.primary { min-height: 56px; }
  .ui-status .show-stage { min-height: 140px; }
}

/* legacy pause-head (kept for safety) */
.pause-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.view-switch { display: inline-flex; padding: 3px; border-radius: var(--ui-r-pill); background: rgba(4, 10, 20, 0.6); border: 1px solid var(--ui-line-2); }
.view-switch button { border: 0; background: transparent; color: var(--ui-mute); padding: 7px 14px; border-radius: var(--ui-r-pill); font: 700 9.5px/1 inherit; letter-spacing: 0.14em; text-transform: uppercase; cursor: pointer; }
.view-switch button[aria-pressed="true"] { background: linear-gradient(180deg, var(--ui-gold-2), var(--ui-gold-deep)); color: #07101e; }

/* ── big map ───────────────────────────────────────────────────────────────────────────── */
.overlay[aria-label="bigmap"] .panel { width: min(1040px, 100%); }
.bigmap { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
@media (min-width: 760px) { .bigmap { grid-template-columns: 300px 1fr; } }
.bigmap canvas { width: 100%; height: auto; border-radius: var(--ui-r-lg); border: 1px solid var(--ui-line-2); box-shadow: var(--ui-shadow-sm); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ui-dim); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5); }
.steps { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 11.5px; color: var(--ui-dim); }
.steps li::marker { color: var(--ui-gold); font-family: var(--ui-mono); }

/* ── cinematic dialogue: a lower-third instrument card over the live scene ─────────────── */
.overlay.ov-dialogue {
  background: linear-gradient(180deg, rgba(2, 6, 12, 0) 0%, rgba(2, 6, 12, 0) 46%, rgba(2, 6, 12, 0.62) 100%);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  padding-bottom: calc(var(--sab) + clamp(96px, 16vh, 150px));
}
.overlay.ov-dialogue::before { display: none; }
.overlay.ov-dialogue .panel {
  width: min(720px, 100%);
  border-radius: var(--ui-r-xl);
  padding: 16px 22px 14px;
  background: linear-gradient(160deg, rgba(16, 31, 52, 0.95), rgba(4, 10, 20, 0.97));
  border: 1px solid var(--ui-line-2);
  border-top: 1px solid var(--ui-line-3);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}
.overlay.ov-dialogue .panel::after {
  content: ""; position: absolute; left: 22px; right: 22px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--ui-gold), transparent); opacity: 0.5;
}
.overlay.ov-dialogue .panel::before {
  content: "ONARU · COMMS"; position: absolute; top: -19px; left: 2px;
  font: 700 8px/1 var(--ui-mono); letter-spacing: 0.3em; color: var(--ui-gold);
  text-transform: uppercase; background: transparent;
}
.overlay.ov-dialogue .st-speaker { gap: 13px; }
.overlay.ov-dialogue .st-av { width: 48px; height: 48px; border-radius: 12px; background: radial-gradient(circle at 32% 26%, #2c476e, #0a1526); border: 1px solid var(--ui-line-3); color: var(--ui-gold-2); font: 700 18px/1 var(--ui-mono); }
.overlay.ov-dialogue .st-who { font-size: 11.5px; letter-spacing: 0.2em; color: var(--ui-gold-2); }
.overlay.ov-dialogue .st-role { font-size: 10.5px; letter-spacing: 0.06em; color: var(--ui-mute); }
.overlay.ov-dialogue .st-live i { background: var(--ui-gold); }
.overlay.ov-dialogue .st-say { font: 500 clamp(15px, 2.4vw, 18px)/1.55 inherit; letter-spacing: 0.005em; color: #f7f4ec; margin: 10px 0 12px; }
.overlay.ov-dialogue .row { gap: 7px; }
.overlay.ov-dialogue .row .btn { min-height: 38px; border-radius: 9px; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; padding: 8px 14px; background: rgba(255, 255, 255, 0.04); border-color: var(--ui-line-2); color: var(--ui-dim); }
.overlay.ov-dialogue .row .btn.primary { color: #07101e; border-color: transparent; background: linear-gradient(180deg, var(--ui-gold-2), var(--ui-gold-deep)); }
.overlay.ov-dialogue .stack .btn { min-height: 44px; border-radius: 10px; border-color: var(--ui-line-2); background: rgba(255, 255, 255, 0.035); text-align: left; justify-content: flex-start; font-size: 13px; }
.overlay.ov-dialogue .stack { counter-reset: opt; }
.overlay.ov-dialogue .stack .btn::before { counter-increment: opt; content: "0" counter(opt); font: 600 9px/1 var(--ui-mono); color: var(--ui-gold); margin-right: 10px; letter-spacing: 0.1em; }
.overlay.ov-dialogue .stack .btn:hover { border-color: var(--ui-line-3); background: rgba(232, 200, 116, 0.1); }
@media (max-width: 560px) { .overlay.ov-dialogue .panel { border-radius: 16px; padding: 13px 14px 12px; } .overlay.ov-dialogue .st-av { width: 40px; height: 40px; } }

/* ── loading / title / opener ──────────────────────────────────────────────────────────── */
#loading { background: radial-gradient(ellipse at 50% 34%, #132a47 0%, #070d18 58%, #03070d 100%); }
#loading .brandmark { font: 800 12px/1 var(--ui-mono); letter-spacing: 0.62em; color: var(--ui-gold-2); }
#loading p { color: var(--ui-mute); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; }
#loading::after {
  content: ""; display: block; width: 160px; height: 1px; margin: 6px auto 0;
  background: linear-gradient(90deg, transparent, var(--ui-gold), transparent);
  animation: loadSweep 1.8s ease-in-out infinite;
}
@keyframes loadSweep { 0%, 100% { opacity: 0.25; transform: scaleX(0.4); } 50% { opacity: 1; transform: scaleX(1); } }

/* phone */
.phone-shell, .p-screen { background: linear-gradient(180deg, #0a1728, rgba(4, 9, 17, 0.98)); }
.phone-shell { border: 1px solid var(--ui-line); border-radius: 28px; box-shadow: var(--ui-shadow); }

/* generic close/cancel row */
.row { gap: 8px; }

@media (max-width: 560px) {
  .hud-left { max-width: 60vw; }
  .map-shell, #minimap { width: 96px; height: 96px; }
  #toasts { top: calc(var(--sat) + 124px); }
  .chip { font-size: 9.5px; padding: 5px 9px; }
  #objective { max-width: 60vw; padding: 9px 11px 9px 13px; }
  #objective strong { font-size: 12.5px; }
  #nav { min-width: 0; width: min(230px, 60vw); }
  #prompt { font-size: 10.5px; padding: 10px 16px 10px 22px; }
  .panel { padding: 16px; border-radius: 20px; }
}
@media (max-height: 520px) {
  .map-shell, #minimap { width: 88px; height: 88px; }
  #toasts { top: calc(var(--sat) + 6px); }
}

/* Portrait phones: one text column on the left, map and menu on the right, prompts above the thumbs.
   These sit last on purpose: they override the generic small-screen rules above. */
@media (orientation: portrait) and (max-width: 560px) {
  #hud { gap: 8px; padding-right: calc(var(--sar) + 8px); }
  .hud-left { max-width: calc(100vw - 206px); gap: 6px; }
  #objective { max-width: 100%; }
  #objective strong { line-height: 1.2; }
  #nav { width: min(180px, 46vw); }
  #toasts { top: calc(var(--sat) + 236px); left: calc(var(--sal) + 10px); transform: none; width: min(64vw, 320px); justify-items: start; }
  body[data-hud="hidden"] #toasts { top: calc(var(--sat) + 14px); left: 50%; transform: translateX(-50%); width: min(92vw, 460px); justify-items: center; }
  body[data-device="touch"] #prompt { bottom: calc(var(--sab) + 190px); max-width: 86vw; }
}

/* Landscape phones (844×390 and similar): short HUD, controls at the corners, prompt in the bottom gap. */
@media (orientation: landscape) and (max-height: 560px) {
  #hud { gap: 8px; padding-top: calc(var(--sat) + 6px); }
  .hud-left { max-width: min(330px, 42vw); gap: 5px; }
  .chip { font-size: 10.5px; padding: 4px 9px; }
  .chip-live, #street, #objective .obj-k, #objective #objective-sub { display: none; }
  #objective { max-width: min(330px, 42vw); padding: 6px 10px; }
  #objective strong { font-size: 12px; line-height: 1.2; }
  #timer { font-size: 16px; padding: 4px 10px; }
  #tutorial { padding: 7px 10px; max-width: min(330px, 42vw); }
  #tutorial p { margin: 4px 0; font-size: 11px; }
  #minimap, .map-shell { width: 78px; height: 78px; }
  body[data-device="touch"] #touch .tbtn.menu { right: calc(var(--sar) + 98px); }
  #nav { width: min(210px, 32vw); }
  #arrow-dist { font-size: 11px; }
  body[data-device="touch"] #prompt { bottom: calc(var(--sab) + 12px); max-width: 52vw; padding: 7px 14px; font-size: 11px; }
  #toasts { top: auto; bottom: calc(var(--sab) + 58px); width: min(58vw, 400px); }
  #touch .look { top: 112px; }
  #touch .btns { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .panel, .chip.chip-live i, #loading::after { animation: none !important; }
  .ui-dash-main { scroll-behavior: auto; }
}

/* one focus language everywhere: brass, never the legacy cyan ring */
:is(.btn, .card, a, input, select, textarea, [tabindex]):focus,
:is(.btn, .card, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--ui-gold);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(232, 200, 116, 0.14);
}

/* ── intro gate + recap: the first thing a new player sees ─────────────────────────────── */
.in-gate, .in-recap { background: radial-gradient(ellipse at 50% 30%, rgba(20, 42, 74, 0.6), transparent 62%), rgba(2, 6, 12, 0.86); backdrop-filter: blur(14px); }
.in-gate-card {
  max-width: 560px; width: 100%; text-align: left; display: grid; gap: 14px;
  padding: clamp(22px, 4vw, 34px);
  border-radius: var(--ui-r-2xl);
  border: 1px solid var(--ui-line-2); border-top: 1px solid var(--ui-line-3);
  background:
    radial-gradient(ellipse at 82% 0%, rgba(232, 200, 116, 0.08), transparent 46%),
    linear-gradient(155deg, rgba(20, 34, 54, 0.96), rgba(5, 11, 21, 0.98));
  box-shadow: var(--ui-shadow);
  animation: panel-in 0.42s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.in-gate-card h1 { margin: 0; font-size: clamp(30px, 6vw, 44px); font-weight: 800; letter-spacing: 0.01em; color: #fff; line-height: 1; }
.in-gate-card h2 { margin: 0; font-size: clamp(20px, 4vw, 26px); }
.in-gate-card p { margin: 0; line-height: 1.55; color: var(--ui-dim); }
.in-kicker { font: 700 9.5px/1 var(--ui-mono); letter-spacing: 0.3em; text-transform: uppercase; color: var(--ui-gold); }
.in-tag { color: var(--ui-dim); font-size: clamp(14px, 2.6vw, 16px); letter-spacing: 0.01em; }
.in-gate-brand { display: flex; align-items: baseline; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--ui-line-2); }
.in-gate-brand b { font-size: 15px; font-weight: 800; letter-spacing: 0.34em; color: #fff; }
.in-gate-brand span { font-size: 9px; font-weight: 700; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ui-gold); padding-left: 10px; border-left: 1px solid var(--ui-line-3); }
.in-gate-brand i { margin-left: auto; font: 500 9px/1.4 var(--ui-mono); letter-spacing: 0.1em; color: var(--ui-mute); font-style: normal; text-align: right; }
.in-choices { display: grid; gap: 8px; margin-top: 2px; }
.in-choices .btn { justify-content: space-between; text-align: left; }
.in-choices .btn.primary { letter-spacing: 0.04em; }
.in-choices .btn[aria-pressed] { color: var(--ui-dim); }
.in-skip { justify-self: start; }
.in-gate-card .fine { margin-top: 2px; }
@media (max-width: 560px) { .in-gate-brand i { display: none; } }

/* ── graphics settings + optional frame meter ─────────────────────────────────────────────── */
.gfx { display: grid; gap: 16px; text-align: left; min-height: 0; }
.gfx-overlay .panel { display: flex; flex-direction: column; gap: 0; padding: 0; overflow: hidden; }
.gfx-overlay .gfx { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 24px clamp(16px, 4vw, 34px) 0; }
.gfx-scroll {
  display: grid; gap: 16px; min-height: 0; overflow-y: auto; padding-right: 4px;
  scrollbar-width: thin; scrollbar-color: rgba(232, 200, 116, 0.35) transparent;
}
.gfx-scroll h2 { margin: 0; }
.gfx-actions { padding: 14px 0 20px; border-top: 1px solid var(--ui-line); }
.gfx .lede { margin: 0; }
.gfx-groups { display: grid; gap: 12px; }
.gfx-group {
  display: grid; gap: 8px; padding: 12px 14px; align-content: start;
  border: 1px solid var(--ui-line-2); border-radius: var(--ui-r-md);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
}
.gfx-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gfx-head h3 { margin: 0; }
.gfx-head .fine { margin-left: auto; text-align: right; }
.gfx .seg .btn { flex: 1 1 auto; min-width: 76px; }
.gfx .seg .btn[aria-pressed="true"] {
  background: linear-gradient(180deg, var(--ui-gold-2), var(--ui-gold-deep));
  border-color: transparent; color: #07101e;
}
.gfx .seg .btn[aria-pressed="true"]:focus-visible { outline-color: #fff; }
.gfx-readouts { display: grid; gap: 12px; }
.gfx-effective-box, .gfx-live-box {
  display: grid; gap: 8px; padding: 12px 14px;
  border: 1px solid var(--ui-line); border-radius: var(--ui-r-md); background: var(--ui-inset);
}
.gfx-effective { display: grid; gap: 6px; }
.gfx-live { display: grid; gap: 4px; font-size: 11px; letter-spacing: 0.02em; color: var(--ui-dim); }
.gfx .row { justify-content: flex-end; }
#perf {
  position: fixed; top: calc(var(--sat, 0px) + 10px); left: 50%; transform: translateX(-50%);
  z-index: 7; display: grid; gap: 3px; padding: 8px 12px; max-width: min(94vw, 620px);
  border: 1px solid var(--ui-line); border-radius: 10px;
  background: rgba(4, 10, 20, 0.74); backdrop-filter: blur(8px);
  color: var(--ui-gold-2); font: 600 10px/1.45 var(--ui-mono); letter-spacing: 0.04em;
  text-align: left; pointer-events: none;
}
#perf[hidden] { display: none; }
#perf div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 760px) {
  .overlay[aria-label="graphics"] .panel { width: min(920px, 100%); }
  .gfx-groups { grid-template-columns: 1fr 1fr; }
  .gfx-group:nth-child(1), .gfx-group:nth-child(4) { grid-column: 1 / -1; }
  .gfx .seg .btn { min-width: 0; }
  .gfx-readouts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) { .gfx .seg .btn { min-width: 64px; } #perf { font-size: 9px; padding: 6px 9px; } }
