/* Klaipėda — HUD and menus.
   Layout: desktop — stats top-left, minimap bottom-left, buttons 6x2 + utility row top-right, banner top-centre.
           narrow window / tablet — the banner goes under the utility row.
           phone portrait — minimap top-left with the stats under it, buttons 4x3 + utility row top-right,
                            banner under both, joystick left, GAS right.
           phone landscape — minimap top-left with the stats beside it, buttons 6x2, banner left-aligned under the
                            minimap, toasts at the bottom centre between the thumbs.
   The toasts always hang right under the mission banner: js/hud.js measures the banner (--bn) and the stats block
   (--hh), js/tutorial.js its card (--tt); --bt is the top of the banner in the current layout. */
:root {
  --sl: max(12px, env(safe-area-inset-left));
  --sr: max(12px, env(safe-area-inset-right));
  --st: max(12px, env(safe-area-inset-top));
  --sb: max(12px, env(safe-area-inset-bottom));
  --glass: rgba(8, 12, 24, 0.66);
  --line: rgba(255, 255, 255, 0.22);
  --accent: #e8433a;
  --gold: #f2b632;
  --cols: 6;          /* button block columns */
  --bw: 48px;         /* button width */
  --rows: 2;          /* rows of action buttons */
  --mm: 176px;        /* minimap diameter */
  --block-h: calc(var(--rows) * 44px + (var(--rows) - 1) * 6px);
}
body { --bt: var(--st); } /* top of the mission banner */

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #070b16;
  color: #e8ecf5;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
html, body, canvas { touch-action: none; -webkit-user-select: none; user-select: none; }
button { font-family: inherit; }
.hidden { display: none !important; }

#scene { display: block; width: 100vw; height: 100vh; }

/* ---------- stats block ---------- */
#hud {
  position: fixed;
  left: var(--sl);
  top: var(--st);
  max-width: 250px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  z-index: 3;
}
#hud .hud-row { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: baseline; }
#hud .stat { display: inline-flex; gap: 4px; align-items: baseline; white-space: nowrap; }
#hud .stat b { font-size: 17px; font-weight: 700; }
#hud .unit { opacity: 0.65; font-size: 12px; }
#hud .dim { opacity: 0.6; font-size: 12px; }
#hud .dim:empty { display: none; }
#hud .hud-meta { display: flex; flex-wrap: wrap; gap: 0 10px; }
#hud .hud-meta span:empty { display: none; }
#hud-debug { display: none; }
body.debug #hud-debug { display: block; }

#hud-wallet { display: none; align-items: center; gap: 8px; margin-top: 2px; font-size: 13px; }
#hud-wallet.on { display: flex; }
#hud-level { color: #9fe0ff; white-space: nowrap; }
#hud-coins { color: #ffd76a; white-space: nowrap; }
#hud-xp { flex: 1; min-width: 36px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.16); overflow: hidden; }
#hud-xp i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #39c7ff, #9fe0ff); transition: width 0.5s; }
/* "+12 € · +50 XP": under the stats block on desktop, over its last line on touch screens (nothing else is free there) */
#hud-gain {
  position: absolute; left: 0; top: 100%; margin-top: 6px;
  padding: 3px 9px; border-radius: 999px; background: linear-gradient(#f6c445, #e39a1c); color: #241800;
  font-weight: 700; font-size: 12px; white-space: nowrap; opacity: 0; transition: opacity 0.3s; text-shadow: none;
}
#hud-gain.show { opacity: 1; }

/* ---------- mission banner ---------- */
#banner {
  position: fixed; left: 50%; top: var(--bt); transform: translateX(-50%);
  width: max-content; max-width: min(620px, calc(100vw - 2 * (var(--cols) * var(--bw) + 60px)));
  display: grid; gap: 5px; justify-items: center; pointer-events: none; z-index: 3;
}
#banner > div {
  padding: 7px 14px; border-radius: 16px; background: var(--glass); border: 1px solid rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-weight: 600; font-size: 13px; line-height: 1.3; text-align: center; font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
#banner > div:empty { display: none; }
#hud-mission { color: #8fdcff; }
#hud-mode { color: #c9f58a; }
#hud-way { color: #ff9ccb; }
#hud-tag { color: #ffd9b0; }
#hud-tag.it { background: rgba(196, 48, 38, 0.9); border-color: rgba(255, 255, 255, 0.35); color: #fff; }
#hud-tag small { display: block; margin-top: 1px; font-weight: 500; font-size: 11.5px; opacity: 0.85; }

/* ---------- toast queue (js/hud.js) ---------- */
#toast {
  position: fixed; left: 50%; top: 22%; transform: translate(-50%, -10px); max-width: min(560px, calc(100vw - 32px));
  padding: 12px 18px; border-radius: 12px; background: rgba(0, 157, 224, 0.92); color: #fff; font-weight: 600;
  text-align: center; opacity: 0; transition: opacity 0.4s, transform 0.4s; pointer-events: none; z-index: 5;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
body.hud-on #toast { display: none !important; } /* everything goes through the queue below */
#toasts {
  position: fixed; left: 50%; top: calc(var(--bt) + var(--bn, 0px) + 10px); transform: translateX(-50%);
  width: min(560px, calc(100vw - 24px)); display: flex; flex-direction: column; align-items: center; gap: 6px;
  pointer-events: none; z-index: 7; transition: top 0.2s;
}
.toast {
  max-width: 100%; box-sizing: border-box; padding: 9px 16px; border-radius: 12px; background: rgba(0, 137, 204, 0.95);
  color: #fff; font-weight: 600; font-size: 14px; line-height: 1.35; text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); opacity: 0; transform: translateY(-8px); transition: opacity 0.3s, transform 0.3s;
}
.toast.show { opacity: 1; transform: none; }
.toast.reward { background: linear-gradient(#f6c445, #e39a1c); color: #241800; }
.toast.warn { background: rgba(214, 58, 47, 0.95); }

#big-banner {
  /* (the third term: a wide two-line banner on a 720 px screen keeps clear of the music buttons on the right) */
  position: fixed; left: 50%; top: max(30%, calc(var(--bt, 0px) + var(--bn, 0px) + 64px), calc(var(--st) + var(--block-h) + 128px)); transform: translate(-50%, -50%) scale(0.8); width: max-content; max-width: calc(100vw - 32px);
  padding: 14px 28px; border-radius: 18px; text-align: center; pointer-events: none; z-index: 9; opacity: 0;
  background: linear-gradient(180deg, rgba(20, 16, 4, 0.92), rgba(8, 12, 24, 0.92)); border: 2px solid var(--gold);
  box-shadow: 0 0 40px rgba(242, 182, 50, 0.45); transition: opacity 0.4s, transform 0.4s; box-sizing: border-box;
}
#big-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#big-banner .bb-title { font: 800 clamp(26px, 6vw, 44px)/1.1 Georgia, "Times New Roman", serif; font-style: italic; color: var(--gold); letter-spacing: 0.04em; text-transform: uppercase; }
#big-banner .bb-sub { margin-top: 6px; font-weight: 600; font-size: 14px; }

/* ---------- first-run tutorial (js/tutorial.js) ---------- */
#tutorial {
  position: fixed; left: 50%; bottom: calc(var(--sb) + 18px); transform: translateX(-50%); box-sizing: border-box;
  width: min(460px, calc(100vw - 24px)); padding: 9px 12px 11px 14px; border-radius: 14px;
  background: rgba(8, 12, 24, 0.9); border: 1px solid rgba(242, 182, 50, 0.6); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); pointer-events: none; z-index: 6;
}
#tutorial .tut-head { display: flex; align-items: center; gap: 8px; }
#tutorial .tut-n { padding: 2px 8px; border-radius: 999px; background: var(--gold); color: #241800; font-size: 12px; font-weight: 700; }
#tutorial .tut-title { flex: 1; min-width: 0; font-size: 15px; }
#tutorial .tut-skip {
  pointer-events: auto; min-height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08); color: #fff; font: 600 12px/1 system-ui, sans-serif; cursor: pointer; touch-action: manipulation;
}
#tutorial .tut-text { margin-top: 5px; font-size: 13.5px; line-height: 1.45; }
#tutorial kbd {
  display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 5px; border: 1px solid rgba(255, 255, 255, 0.45);
  border-bottom-width: 2px; background: rgba(255, 255, 255, 0.1); font: 700 12px/1.5 system-ui, sans-serif; text-align: center;
}
#tutorial .tut-bar { margin-top: 8px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
#tutorial .tut-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #f6c445, #e39a1c); transition: width 0.2s; }
#tutorial.ok { border-color: #5fe08a; }
#tutorial.ok .tut-bar i { background: #5fe08a; }
#tutorial.ok .tut-title::after { content: ' ✓'; color: #5fe08a; }
.tut-hl { animation: tut-pulse 1s ease-in-out infinite; }
#stick-base.tut-hl { opacity: 1; border-color: var(--gold); }
@keyframes tut-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 182, 50, 0.9); }
  50% { box-shadow: 0 0 0 12px rgba(242, 182, 50, 0); }
}

/* ---------- minimap and the city map (js/minimap.js) ---------- */
#minimap {
  position: fixed; left: var(--sl); bottom: var(--sb); width: var(--mm); height: var(--mm); border-radius: 50%;
  background: #16263c; border: 2px solid rgba(255, 255, 255, 0.85); box-sizing: border-box;
  box-shadow: 0 0 0 3px rgba(8, 12, 24, 0.6), 0 8px 22px rgba(0, 0, 0, 0.55); cursor: pointer; z-index: 5;
  -webkit-tap-highlight-color: transparent;
}
#minimap.it { border-color: #ff3b30; box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.45), 0 8px 22px rgba(0, 0, 0, 0.55); }
#minimap canvas { display: block; width: 100%; height: 100%; border-radius: 50%; will-change: transform; }
/* the hero arrow: always points up, the map turns under it */
#minimap .mm-me {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 17px; margin: -9px 0 0 -7px; color: #fff; pointer-events: none;
  filter: drop-shadow(0 0 1px #0b1220) drop-shadow(0 0 1px #0b1220) drop-shadow(0 0 1px #0b1220);
}
#minimap .mm-me::before { content: ''; position: absolute; inset: 0; background: currentColor; clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%); }
#minimap .mm-zoom {
  position: absolute; left: 50%; bottom: 16%; transform: translateX(-50%); padding: 2px 8px; border-radius: 999px;
  background: rgba(8, 12, 24, 0.85); font-size: 11px; font-weight: 700; white-space: nowrap; opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
#minimap .mm-zoom.show { opacity: 1; }
#minimap .mm-badge {
  position: absolute; right: -6px; bottom: -6px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(8, 12, 24, 0.9); border: 1px solid var(--line); font-size: 15px; pointer-events: none;
}
body.no-minimap #minimap { display: none; }
#map-panel { position: fixed; inset: 0; z-index: 9; background: #101c2e; }
#map-panel canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#map-panel .map-top {
  position: absolute; left: var(--sl); right: var(--sr); top: var(--st); display: flex; align-items: center; gap: 8px; pointer-events: none;
}
#map-panel .map-top b { font: 800 22px/1 Georgia, "Times New Roman", serif; font-style: italic; color: var(--accent); text-shadow: 0 2px 6px #000; }
#map-panel .map-hint { flex: 1; font-size: 12px; opacity: 0.8; text-shadow: 0 1px 3px #000; }
#map-panel button {
  pointer-events: auto; min-width: 46px; height: 46px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(8, 12, 24, 0.82); color: #fff; font: 700 17px/1 system-ui, sans-serif; cursor: pointer;
}
#map-panel .map-zoom { position: absolute; right: var(--sr); bottom: calc(var(--sb) + 12px); display: grid; gap: 8px; }
#map-panel .map-legend {
  position: absolute; left: var(--sl); bottom: calc(var(--sb) + 12px); max-width: min(270px, calc(100vw - 96px)); box-sizing: border-box;
  display: grid; gap: 3px; padding: 10px 12px; border-radius: 12px; background: rgba(8, 12, 24, 0.88); border: 1px solid var(--line);
  font-size: 12.5px; line-height: 1.3; pointer-events: none;
}
.map-legend b { margin-bottom: 2px; }
.map-legend div { display: flex; align-items: center; gap: 8px; }
.map-legend span { flex: none; width: 20px; text-align: center; }
.lg-me { display: inline-block; width: 11px; height: 14px; background: #fff; clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%); }
.lg-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px #0b1220; }
.lg-dot.it { box-shadow: 0 0 0 1.5px #0b1220, 0 0 0 4px #ff3b30; }

/* ---------- help: collapsible "?" panel ---------- */
#help {
  position: fixed; right: var(--sr); bottom: var(--sb); max-width: min(560px, calc(100vw - 24px)); box-sizing: border-box;
  padding: 10px 14px; border-radius: 12px; background: rgba(8, 12, 24, 0.88); border: 1px solid rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); font-size: 12px; line-height: 1.6; z-index: 6; cursor: pointer;
}
#help .dim { opacity: 0.55; }
#help .for-touch { display: none; }
body.touch #help .for-touch { display: block; }
body.touch #help .for-keys { display: none; }
body.touch #help { right: auto; bottom: auto; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow-y: auto; font-size: 13px; }

/* ---------- loading / start screen ---------- */
#loading {
  position: fixed; inset: 0; display: grid; place-items: center; background: #070b16; font-size: 18px; letter-spacing: 0.04em;
  transition: opacity 0.8s; z-index: 10; overflow-y: auto; box-sizing: border-box;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
#loading.done { opacity: 0; pointer-events: none; }
#loading .start { text-align: center; width: min(460px, 100%); margin: auto; }
#loading .logo { font: 800 clamp(40px, 9vw, 84px)/1 Georgia, 'Times New Roman', serif; font-style: italic; color: var(--accent); text-shadow: 0 0 24px rgba(232, 67, 58, 0.55); }
#loading .sub { margin: 14px 0 28px; opacity: 0.75; letter-spacing: 0.06em; }
#btn-start {
  padding: 16px 44px; border: 0; border-radius: 999px; background: var(--accent); color: #fff;
  font: 700 20px/1 system-ui, sans-serif; letter-spacing: 0.06em; cursor: pointer;
  /* always in sight: the creator above it is taller than one screen, so the button sticks to the bottom edge */
  position: sticky; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 2;
  box-shadow: 0 0 0 10px rgba(7, 11, 22, 0.92), 0 0 34px 12px rgba(232, 67, 58, 0.45);
}
.langs { display: flex; justify-content: center; gap: 6px; margin-bottom: 16px; letter-spacing: 0; }
.langs button {
  min-width: 52px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05); color: #e8ecf5; font: 700 13px/1 system-ui, sans-serif; cursor: pointer;
}
.langs button.on { border-color: var(--accent); background: rgba(232, 67, 58, 0.18); }

/* ---------- character creator and shop ---------- */
.creator { display: grid; gap: 12px; margin: 4px 0 22px; letter-spacing: 0; }
.creator input, .panel input {
  width: 100%; box-sizing: border-box; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06); color: #fff; font: 600 16px/1.2 system-ui, sans-serif; text-align: center;
}
.heroes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.heroes button, .hats button, .swatches button, .panel .row button {
  border: 1px solid rgba(255,255,255,0.16); background: rgba(255,255,255,0.05); color: #e8ecf5;
  border-radius: 12px; padding: 10px 6px; font: 600 13px/1.2 system-ui, sans-serif; cursor: pointer;
}
.heroes button { font-size: 26px; display: grid; gap: 4px; }
.heroes button span { font-size: 13px; }
.heroes button.on, .hats button.on, .swatches button.on { border-color: var(--accent); background: rgba(232,67,58,0.18); }
.swatches, .hats { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.swatches button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; min-height: 40px; }
.swatches i { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px rgba(255,255,255,0.35); }
.hats button { padding: 9px 10px; min-height: 40px; }
.hats button.locked, .swatches button.locked { border-style: dashed; color: rgba(232, 236, 245, 0.72); }
.hats button.pending, .swatches button.pending { border-style: solid; border-color: var(--gold); background: rgba(242, 182, 50, 0.2); color: #fff; }
.lock { font-size: 11px; font-weight: 500; opacity: 0.9; white-space: nowrap; }
.wallet { font-size: 14px; padding: 8px 12px; border-radius: 12px; background: rgba(242, 182, 50, 0.1); border: 1px solid rgba(242, 182, 50, 0.28); }
.wallet b { color: #ffd76a; }
.wallet .dim { opacity: 0.6; font-size: 12px; }
.shop-msg { min-height: 18px; font-size: 13px; color: #ffd76a; }
.shop-msg:empty { display: none; }
.acct { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; align-items: center; font-size: 13px; opacity: 0.9; letter-spacing: 0; }
.acct .toggle { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.acct .toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
button.link { background: none; border: 0; color: #7fd8ff; font: inherit; cursor: pointer; text-decoration: underline; padding: 6px 0; }
.panel { margin-top: 14px; padding: 14px; border-radius: 14px; background: rgba(255,255,255,0.06); display: grid; gap: 8px; text-align: left; font-size: 14px; letter-spacing: 0; }
.panel .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.panel .row button { background: var(--accent); border: 0; color: #fff; padding: 12px; }
.panel ol { margin: 6px 0 0; padding-left: 22px; }
.panel .dim { opacity: 0.65; font-size: 12px; }

/* ---------- sheets: modes, quests, records, settings (js/meta.js) ---------- */
.sheet, #scores-panel {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; box-sizing: border-box;
  width: min(540px, calc(100vw - 24px)); max-height: min(82vh, 660px); overflow-y: auto; touch-action: pan-y;
  background: rgba(8, 12, 24, 0.95); border: 1px solid rgba(255, 255, 255, 0.12); box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain; z-index: 8;
}
#scores-panel { width: min(420px, calc(100vw - 24px)); z-index: 8; cursor: pointer; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; font-size: 17px; }
.sheet-x {
  flex: none; width: 44px; height: 44px; margin: -8px -8px -8px 0; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06);
  color: #fff; font-size: 16px; cursor: pointer;
}
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.mode-card {
  display: flex; gap: 10px; align-items: center; text-align: left; min-height: 64px; padding: 10px 12px; border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.05); color: #e8ecf5; cursor: pointer;
}
.mode-card.on { border-color: var(--accent); background: rgba(232, 67, 58, 0.16); }
.mode-icon { font-size: 28px; line-height: 1; }
.mode-text { display: grid; gap: 2px; min-width: 0; }
.mode-text b { font-size: 14px; }
.mode-text small { font-size: 12px; opacity: 0.75; line-height: 1.3; }
.mode-text i { font-style: normal; font-size: 12px; color: #ffd76a; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs button {
  flex: 1 1 auto; min-height: 44px; padding: 6px 10px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05); color: #e8ecf5; font: 600 13px/1.2 system-ui, sans-serif; cursor: pointer;
}
.tabs button.on { border-color: var(--accent); background: rgba(232, 67, 58, 0.18); }
.q-wallet { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(242, 182, 50, 0.1); border: 1px solid rgba(242, 182, 50, 0.28); }
.q-wallet > span:first-of-type { color: #ffd76a; font-weight: 700; }
.q-wallet .q-bar, .q-wallet small { grid-column: 1 / -1; }
.q-wallet small { opacity: 0.65; font-size: 12px; }
.q-body { display: grid; gap: 8px; }
.q-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); }
.q-row.done { opacity: 0.6; }
.q-icon { font-size: 20px; line-height: 1.2; }
.q-main { display: grid; gap: 4px; flex: 1; min-width: 0; }
.q-main b { font-size: 14px; }
.q-main small { font-size: 12px; opacity: 0.75; }
.q-bar { display: block; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.q-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f6c445, #e39a1c); }
.q-egg { font-size: 13px; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }

/* records */
.score-list { display: grid; gap: 4px; }
.score-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.05); font-size: 13.5px;
}
.score-row > span:first-child { text-align: center; }
.score-row small { opacity: 0.65; }
.score-row b { font-variant-numeric: tabular-nums; text-align: right; }

/* settings */
.set-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; min-height: 44px; }
.set-row > span:first-child { flex: 1 1 130px; min-width: 0; }
.set-row.off { opacity: 0.45; }
.set-row input[type="range"] {
  flex: 1 1 100px; max-width: 220px; width: auto; height: 32px; margin: 0; padding: 0; border: 0; border-radius: 0; background: none;
  accent-color: var(--accent); touch-action: none; cursor: pointer;
}
.set-row input[type="checkbox"] { flex: none; width: 26px; height: 26px; margin: 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
.set-row b { flex: none; width: 44px; text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.seg button, .set-actions button {
  min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05); color: #e8ecf5; font: 600 13px/1.2 system-ui, sans-serif; cursor: pointer;
}
.seg button.on { border-color: var(--accent); background: rgba(232, 67, 58, 0.18); }
.set-actions { justify-content: flex-end; margin-top: 4px; }

/* ---------- buttons block, utility row (music / help / settings), emotes ---------- */
#touch-ui button {
  border: 1px solid var(--line);
  color: #fff;
  font: 700 18px/1 system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
#top-buttons {
  position: fixed; right: var(--sr); top: var(--st);
  display: grid; grid-template-columns: repeat(var(--cols), var(--bw)); gap: 6px; z-index: 4;
}
#top-buttons button { width: var(--bw); height: 44px; padding: 0; border-radius: 12px; background: var(--glass); cursor: pointer; }
#top-buttons button.on { background: rgba(200, 150, 40, 0.8); }
#music {
  position: fixed; right: var(--sr); top: calc(var(--st) + var(--block-h) + 6px);
  display: flex; align-items: center; justify-content: flex-end; gap: 6px; max-width: calc(100vw - 24px); font-size: 12px; z-index: 4;
}
#music .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; text-shadow: 0 1px 4px #000; pointer-events: none; }
body.hud-on #music .title { display: none; } /* track changes are announced with a toast */
#music button {
  width: var(--bw); height: 44px; padding: 0; border-radius: 12px; border: 1px solid var(--line);
  background: var(--glass); color: #fff; font: 700 17px/1 system-ui, sans-serif; cursor: pointer;
}
#music button.off { opacity: 0.45; }
#ac-msg.ok { color: #7dffa0; font-weight: 700; font-size: 14px; }
#music #btn-radio.on { background: rgba(200, 150, 40, 0.8); }
#radio-panel {
  position: fixed; right: var(--sr); top: calc(var(--st) + var(--block-h) + 58px); z-index: 30;
  width: min(250px, calc(100vw - 24px)); max-height: min(62vh, 460px); overflow-y: auto; overscroll-behavior: contain;
  display: grid; gap: 4px; padding: 8px; border-radius: 14px; border: 1px solid var(--line); background: rgba(8, 12, 24, 0.94);
}
#radio-panel.hidden { display: none; }
#radio-panel .head { font: 800 13px/1.2 system-ui, sans-serif; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; padding: 4px 6px; }
#radio-panel .foot { font-size: 11px; opacity: 0.55; padding: 4px 6px; }
#radio-panel button {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border-radius: 10px;
  border: 1px solid transparent; background: rgba(255, 255, 255, 0.06); color: #fff; font: 600 14px/1.2 system-ui, sans-serif; cursor: pointer; text-align: left;
}
#radio-panel button.on { border-color: var(--gold); background: rgba(200, 150, 40, 0.28); }
#radio-panel button small { opacity: 0.55; font-size: 11px; white-space: nowrap; }
body.photo #radio-panel { display: none; }
#emote-bar {
  position: fixed; right: var(--sr); top: calc(var(--st) + var(--block-h) + 62px);
  display: grid; grid-template-columns: repeat(var(--cols), var(--bw)); gap: 6px; z-index: 8;
}
#emote-bar button { height: 44px; padding: 0; border-radius: 12px; border: 1px solid var(--line); background: rgba(8,12,24,0.85); font-size: 22px; cursor: pointer; }

/* ---------- joystick and GAS (touch screens) ---------- */
#stick-zone { position: fixed; left: 0; top: 0; bottom: 0; width: 55%; }
#stick-base {
  position: fixed; left: 25%; top: 70%; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28); background: rgba(10, 16, 30, 0.25); opacity: 0.55; pointer-events: none;
}
#stick-base.active { opacity: 1; }
#stick-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(220, 228, 245, 0.75); }
#btn-gas {
  position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(28px, env(safe-area-inset-bottom));
  width: 112px; height: 112px; border-radius: 50%; background: rgba(140, 32, 32, 0.85); letter-spacing: 0.06em; z-index: 4;
}
#btn-gas.on { background: rgba(200, 60, 40, 0.95); transform: scale(0.95); }

/* ---------- photo mode: shutter bar and flash (js/photo.js) ---------- */
#photo-bar {
  display: none; position: fixed; left: 50%; bottom: calc(var(--sb) + 16px); transform: translateX(-50%);
  align-items: center; gap: 14px; z-index: 6;
}
body.photo #photo-bar { display: flex; }
#photo-bar button {
  width: 52px; height: 52px; padding: 0; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.9); background: rgba(8, 12, 24, 0.5);
  color: #fff; font: 700 20px/1 system-ui, sans-serif; cursor: pointer; touch-action: manipulation;
}
#photo-bar .shutter { width: 68px; height: 68px; font-size: 34px; color: #fff; }
#photo-bar .shutter:active { transform: scale(0.94); }
#photo-bar .photo-look { position: relative; }
#photo-bar .photo-look small { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 4px; font-size: 11px; font-weight: 700; white-space: nowrap; text-shadow: 0 1px 3px #000; pointer-events: none; }
#photo-bar .photo-hint { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 8px; font-size: 12px; white-space: nowrap; opacity: 0.8; text-shadow: 0 1px 3px #000; pointer-events: none; }
#photo-flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 20; }
#photo-flash.go { animation: photo-flash 0.35s ease-out; }
@keyframes photo-flash { from { opacity: 0.85; } to { opacity: 0; } }

/* ---------- chat ---------- */
#chat-log {
  position: fixed; left: var(--sl); bottom: calc(var(--sb) + var(--mm) + 14px); max-width: min(420px, calc(100vw - 32px)); display: grid; gap: 4px;
  font-size: 13px; pointer-events: none; z-index: 4;
}
body.no-minimap #chat-log { bottom: var(--sb); }
#chat-log div { padding: 5px 10px; border-radius: 10px; background: rgba(8,12,24,0.66); transition: opacity 1s; }
#chat-log div.old { opacity: 0; }
#chat-input {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(480px, calc(100vw - 32px)); box-sizing: border-box;
  padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.25); background: rgba(8,12,24,0.9);
  color: #fff; font: 16px system-ui, sans-serif; z-index: 8;
}
body.touch #chat-input { bottom: auto; top: 30%; }

/* ---------- narrower desktop windows and tablets: the banner goes under the utility row ---------- */
@media (max-width: 1099px) {
  body { --bt: calc(var(--st) + var(--block-h) + 58px); }
  #banner { max-width: min(620px, calc(100vw - 24px)); }
}
/* narrow desktop window: the tutorial card would cover the minimap */
@media (max-width: 899px) {
  body:not(.touch) #tutorial { bottom: calc(var(--sb) + var(--mm) + 18px); }
}

/* ---------- touch screens: minimap top-left (the joystick owns the bottom-left) ---------- */
body.touch { --mm: 132px; }
body.touch #minimap { left: var(--sl); top: var(--st); bottom: auto; }
body.touch #hud { left: calc(var(--sl) + var(--mm) + 10px); max-width: 210px; padding: 7px 10px; font-size: 13px; }
body.touch.no-minimap #hud { left: var(--sl); }
body.touch #hud .stat b { font-size: 15px; }
body.touch #hud-place { display: none; }
body.touch #hud-gain { left: 8px; right: 8px; top: auto; bottom: 5px; margin: 0; text-align: center; }
body.touch #chat-log { bottom: 150px; }

/* ---------- phone portrait (and any window narrower than 600 px) ---------- */
@media (max-width: 699px) and (orientation: portrait), (max-width: 599px) {
  :root { --cols: 4; --bw: 44px; --rows: 3; --mm: 150px; }
  body.touch { --mm: 112px; }
  body.touch.no-minimap { --mm: -8px; } /* the stats block takes the place of the minimap */
  #hud { max-width: calc(100vw - 4 * 44px - 18px - var(--sl) - var(--sr) - 8px); box-sizing: border-box; }
  #hud .stat b, body.touch #hud .stat b { font-size: 14px; }
  /* under the minimap: speed, altitude, wallet, online (the eggs counter lives in the 📋 panel) */
  body.touch #hud { left: var(--sl); top: calc(var(--st) + var(--mm) + 8px); max-width: calc(100vw - 4 * 44px - 18px - var(--sl) - var(--sr) - 8px); font-size: 12px; }
  body.touch #hud-eggs, body.touch #hud-amber { display: none; }
  /* the banner clears both columns: the buttons with the utility row on the right, the minimap and the stats on the left */
  body.touch { --bt: max(calc(var(--st) + var(--block-h) + 58px), calc(var(--st) + var(--mm) + 16px + var(--hh, 92px))); }
  #banner { left: var(--sl); right: var(--sr); transform: none; width: auto; max-width: none; }
  #banner > div { border-radius: 14px; font-size: 12.5px; padding: 6px 10px; }
  .toast { font-size: 13px; padding: 8px 12px; }
  /* the tutorial card sits between the banner and the toasts: the bottom belongs to the thumbs */
  body.touch #tutorial { top: calc(var(--bt) + var(--bn, 0px) + 8px); bottom: auto; }
  body.touch.tutorial #toasts { top: calc(var(--bt) + var(--bn, 0px) + var(--tt, 108px) + 16px); }
  #emote-bar { grid-template-columns: repeat(3, 48px); }
  body.touch #big-banner { top: max(50%, calc(var(--bt, 0px) + var(--bn, 0px) + 64px)); }
  #map-panel .map-hint { display: none; }
  #map-panel .map-top b { flex: 1; }
  #map-panel .map-top { gap: 6px; }
}

/* ---------- phone landscape: little height ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  body.touch { --mm: 104px; }
  body.touch.no-minimap { --mm: 0px; }
  /* stats beside the minimap, as wide as the buttons on the right allow (small phones get here with the 4-column block) */
  body.touch #hud {
    left: calc(var(--sl) + var(--mm) + 10px); top: var(--st);
    max-width: min(210px, calc(100vw - var(--sl) - var(--sr) - var(--mm) - var(--cols) * (var(--bw) + 6px) - 28px));
  }
  body.touch.no-minimap #hud { left: var(--sl); }
  /* banner: left-aligned under the minimap and the stats, never under the utility row on the right */
  body.touch { --bt: calc(var(--st) + max(var(--mm), var(--hh, 88px)) + 12px); }
  body.touch #banner { left: var(--sl); right: auto; transform: none; width: max-content; justify-items: start; max-width: calc(100vw - var(--sl) - var(--sr) - 4 * var(--bw) - 28px); }
  body.touch #banner > div { text-align: left; }
  /* toasts go to the bottom centre between the thumbs; the tutorial card sits there too, toasts stack above it */
  /* (440 px: a full-width toast keeps clear of the ❄ button of «Бомбардир» left of GAS) */
  #toasts { top: auto; bottom: var(--sb); flex-direction: column-reverse; width: min(400px, calc(100vw - 440px)); }
  body.touch #tutorial { bottom: var(--sb); width: min(400px, calc(100vw - 420px)); padding: 7px 10px 9px 12px; }
  body.touch #tutorial .tut-text { font-size: 12.5px; line-height: 1.35; }
  body.tutorial #toasts { bottom: calc(var(--sb) + var(--tt, 100px) + 8px); }
  /* level-up banner: a compact card between the top row and the toasts */
  #big-banner { top: 55%; padding: 8px 18px; max-width: min(400px, calc(100vw - 380px)); }
  #big-banner .bb-title { font-size: 26px; }
  #big-banner .bb-sub { margin-top: 3px; font-size: 12.5px; line-height: 1.3; }
  body.touch #hud-tag small { display: none; } /* the top three of «Салки»: no room for it here */
  body.touch #chat-log { bottom: 104px; left: calc(var(--sl) + 8px); max-width: 38vw; }
  body.touch #chat-log div:nth-last-child(n+4) { display: none; }
  body.touch #chat-input { top: 22%; }
  .sheet, #scores-panel { max-height: calc(100vh - 16px); }
  #photo-bar { bottom: calc(var(--sb) + 6px); }
  #map-panel .map-legend { font-size: 11.5px; gap: 1px; padding: 8px 10px; max-height: calc(100vh - 90px); overflow: hidden; }
}

/* ---------- photo mode: only the picture, the 📷 button and the shutter (P / 📷 to toggle back) ---------- */
body.photo #hud, body.photo #help, body.photo #music, body.photo #chat-log, body.photo #stick-zone, body.photo #btn-gas,
body.photo #minimap, body.photo #banner, body.photo #toasts, body.photo #emote-bar, body.photo #big-banner,
body.photo #tutorial { display: none !important; }
body.photo #top-buttons button:not(#btn-photo) { display: none; }

/* ---------- v54: exploration tab, action button of a mode, the «more» block of the creator ---------- */
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.area-grid button {
  padding: 9px 8px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05);
  color: rgba(232, 236, 245, 0.75); font: 600 13px/1.2 system-ui, sans-serif; text-align: left; cursor: pointer; touch-action: manipulation;
}
.area-grid button.on { color: #fff; border-color: rgba(242, 182, 50, 0.45); background: rgba(242, 182, 50, 0.12); }
.area-grid button.here { box-shadow: 0 0 0 2px var(--accent) inset; }
#btn-act {
  position: fixed; right: var(--sr); top: 50%; width: 64px; height: 64px; margin-top: -32px; padding: 0; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85); background: rgba(30, 110, 190, 0.85); color: #fff; font: 700 28px/1 system-ui, sans-serif;
  cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent; z-index: 5;
}
#btn-act:active { transform: scale(0.93); }
/* what to press, in words: «Нажми E — Войти: Lidl» (js/meta.js) */
#act-hint {
  position: fixed; left: 50%; bottom: 24vh; transform: translateX(-50%); max-width: min(86vw, 520px); padding: 9px 16px; border-radius: 999px;
  background: rgba(14, 22, 40, 0.88); border: 2px solid #ffd23f; color: #fff; font: 700 17px/1.25 Rubik, system-ui, sans-serif; text-align: center;
  pointer-events: none; z-index: 5; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); animation: act-hint 1.4s ease-in-out infinite;
}
#act-hint kbd {
  display: inline-block; min-width: 28px; padding: 2px 8px; margin: 0 2px; border-radius: 8px; background: #ffd23f; color: #1b2233;
  font: 900 17px/1.3 Rubik, system-ui, sans-serif; box-shadow: 0 3px 0 #b8860b; text-align: center;
}
#act-hint.hidden, body.photo #act-hint { display: none; }
@keyframes act-hint { 0%, 100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.05); } }
@media (prefers-reduced-motion: reduce) { #act-hint { animation: none; } }
body.touch #act-hint { bottom: auto; top: 22vh; font-size: 15px; }
#btn-act.hidden, body.photo #btn-act { display: none; }
/* touch screens: above the GAS button; in landscape (little height) — to the left of it */
body.touch #btn-act { top: auto; margin-top: 0; right: calc(max(20px, env(safe-area-inset-right)) + 21px); bottom: calc(max(28px, env(safe-area-inset-bottom)) + 126px); width: 70px; height: 70px; }
@media (orientation: landscape) and (max-height: 520px) {
  body.touch #btn-act { right: calc(max(20px, env(safe-area-inset-right)) + 126px); bottom: calc(max(28px, env(safe-area-inset-bottom)) + 21px); }
}
/* one line under the hats: «random look» and the folded block; the block takes the whole width when it is open */
.look-extra { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0 18px; margin-top: -6px; }
.more-look { text-align: center; }
.more-look[open] { flex-basis: 100%; }
.more-look summary { cursor: pointer; color: #7fd8ff; font-size: 14px; padding: 6px 0; list-style: none; text-decoration: underline; }
.more-look summary::-webkit-details-marker { display: none; }
.more-look[open] summary { margin-bottom: 6px; }
.look-label { font-size: 12px; opacity: 0.6; margin: 8px 0 4px; letter-spacing: 0.04em; }
#btn-random { font-size: 14px; }

/* ---------- v59: story dialogue card, online race card, credits (js/story.js, js/orace.js) ----------
   Both cards take the slot of the tutorial card (bottom centre on desktop, under the banner on a phone held
   upright, between the thumbs on a phone held sideways): never over the joystick or the action buttons.
   A tap anywhere on a card closes it / shows the next line. */
#story-card, #orace-card {
  position: fixed; left: 50%; bottom: calc(var(--sb) + 18px); transform: translateX(-50%); box-sizing: border-box;
  width: min(460px, calc(100vw - 24px)); padding: 9px 12px 10px 14px; border-radius: 14px; color: #fff;
  background: rgba(8, 12, 24, 0.92); border: 1px solid rgba(242, 182, 50, 0.6); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); z-index: 7; cursor: pointer; touch-action: manipulation;
  font-size: 13.5px; line-height: 1.4;
}
#orace-card { border-color: rgba(255, 138, 61, 0.8); z-index: 7; display: grid; gap: 4px; }
#story-card.hidden, #orace-card.hidden { display: none; }
#story-card .sc-head { display: flex; align-items: center; gap: 8px; }
#story-card .sc-who { font-size: 22px; line-height: 1; }
#story-card .sc-name { flex: 1; min-width: 0; font-size: 14px; color: var(--gold); }
#story-card .sc-n { font-size: 11.5px; opacity: 0.6; }
#story-card .sc-text { margin-top: 4px; }
.sc-btns { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 6px; flex-wrap: wrap; }
.sc-tap { font-size: 11.5px; opacity: 0.55; text-align: right; }
.sc-btns button {
  min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08);
  color: #fff; font: 600 13px/1 system-ui, sans-serif; cursor: pointer; touch-action: manipulation;
}
.sc-btns button:first-child { background: linear-gradient(#f6c445, #e39a1c); color: #241800; border-color: transparent; }
#orace-card .or-count { font: 800 34px/1.1 Georgia, "Times New Roman", serif; color: var(--gold); text-align: center; }
#orace-card .or-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 6px; padding: 2px 0; }
#orace-card .or-row.me { color: var(--gold); font-weight: 700; }
#hud-story { color: #ffe9a8; }
#hud-orace { color: #ffd0a8; }
.mode-card.off { opacity: 0.5; }
/* the credits of the finale roll in the slot of the cards (after the last dialogue), so they never cover the controls */
#story-credits {
  position: fixed; left: 50%; bottom: calc(var(--sb) + 18px); transform: translateX(-50%); box-sizing: border-box;
  width: min(460px, calc(100vw - 24px)); height: 170px; padding: 0 16px; border-radius: 14px; overflow: hidden; text-align: center;
  color: #fff; z-index: 7; background: rgba(8, 12, 24, 0.85); border: 1px solid rgba(242, 182, 50, 0.6); cursor: pointer; touch-action: manipulation;
  -webkit-mask-image: linear-gradient(transparent, #000 16%, #000 84%, transparent); mask-image: linear-gradient(transparent, #000 16%, #000 84%, transparent);
}
#story-credits .cr-roll { animation: credits-roll 40s linear forwards; }
#story-credits p { margin: 0 0 11px; font-size: 13.5px; line-height: 1.35; }
#story-credits .cr-title { font: 800 20px/1.2 Georgia, "Times New Roman", serif; font-style: italic; color: var(--gold); margin-bottom: 16px; }
#story-credits .cr-x { position: absolute; right: 10px; bottom: 4px; font-size: 11px; opacity: 0.6; }
@keyframes credits-roll { from { transform: translateY(170px); } to { transform: translateY(-100%); } }
@media (max-width: 899px) {
  body:not(.touch) #story-card, body:not(.touch) #orace-card, body:not(.touch) #story-credits { bottom: calc(var(--sb) + var(--mm) + 18px); }
}
@media (max-width: 699px) and (orientation: portrait), (max-width: 599px) {
  body.touch #story-card, body.touch #orace-card, body.touch #story-credits { top: calc(var(--bt) + var(--bn, 0px) + 8px); bottom: auto; }
  body.touch.story-card #toasts, body.touch.orace-card #toasts { top: calc(var(--bt) + var(--bn, 0px) + var(--tt, 108px) + 16px); }
  /* «Глава 3 из 12» comes together with the dialogue card: under the card, not over it */
  body.touch.story-card #big-banner, body.touch.orace-card #big-banner { top: max(50%, calc(var(--bt) + var(--bn, 0px) + var(--tt, 108px) + 72px)); }
  body.touch #story-credits { height: 132px; }
}
/* phone held sideways: between the thumbs — right of the joystick, left of the action buttons */
@media (orientation: landscape) and (max-height: 520px) {
  body.touch #story-card, body.touch #orace-card, body.touch #story-credits {
    left: calc(var(--sl) + 252px); right: calc(var(--sr) + 218px); transform: none; width: auto; bottom: var(--sb);
    padding: 7px 10px 8px 12px; font-size: 12.5px; line-height: 1.3;
  }
  body.touch #story-credits { height: 118px; padding: 0 12px; }
  body.story-card #toasts, body.orace-card #toasts { bottom: calc(var(--sb) + var(--tt, 100px) + 8px); }
}
body.photo #story-card, body.photo #orace-card, body.photo #story-credits { display: none !important; }
/* four-column button block (phones): the «next» button gives its place to the radio; «next» is the first row of the radio list */
@media (max-width: 699px) and (orientation: portrait), (max-width: 599px), (orientation: landscape) and (max-height: 520px) {
  #music #btn-next { display: none; }
}
/* phone on its side: the start button sits in the free right corner (in the middle it covered the hero cards);
   the big banner keeps clear of a tall mission banner */
@media (orientation: landscape) and (max-height: 520px) {
  #btn-start { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); padding: 14px 24px; font-size: 18px; }
  #big-banner { top: max(55%, calc(var(--bt, 0px) + var(--bn, 0px) + 58px)); }
  /* no room for the chapter banner next to the dialogue card: the chapter is in the mission line anyway */
  body.touch.story-card #big-banner, body.touch.orace-card #big-banner { display: none; }
}

/* ---------- the street under the hero (js/streetname.js) ---------- */
#street-name {
  position: fixed; left: 50%; bottom: calc(var(--sb) + 8px); transform: translateX(-50%); z-index: 4;
  max-width: min(360px, calc(100vw - 2 * var(--mm, 150px) - 80px)); box-sizing: border-box; padding: 3px 11px; border-radius: 999px;
  background: rgba(8, 12, 24, 0.42); color: rgba(255, 255, 255, 0.88); font: 500 12.5px/1.3 system-ui, sans-serif; letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none; opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0s 0.2s;
}
#street-name.on { opacity: 1; visibility: visible; transition: opacity 0.2s, visibility 0s; }
#street-name.on.swap { opacity: 0; }
#street-name[data-district]:not([data-district=""])::before { content: attr(data-district) " · "; opacity: 0.72; font-weight: 600; }
#street-name.blocked, body.photo #street-name, body.menu-open #street-name { opacity: 0; visibility: hidden; transition: none; }
/* touch: in the free strip between the joystick side and GAS (centred left of the GAS button) */
body.touch #street-name {
  left: calc((100vw - 144px + var(--sl)) / 2); bottom: max(12px, env(safe-area-inset-bottom));
  max-width: calc(100vw - 144px - var(--sl) - 12px);
}

/* ---- vehicles (js/vehicles.js, js/touch.js): the one extra button next to GAS — brake / reverse of the car, the way
   out of the parked car, the garage; phones only (the keyboard has S, Space, E / X) */
#btn-veh {
  position: fixed; right: calc(max(20px, env(safe-area-inset-right)) + 112px); bottom: calc(max(28px, env(safe-area-inset-bottom)) + 80px);
  width: 64px; height: 64px; padding: 0; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(24, 30, 44, 0.86); color: #fff; font: 800 13px/1 system-ui, sans-serif; letter-spacing: 0.04em;
  touch-action: none; -webkit-tap-highlight-color: transparent; z-index: 5; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}
#btn-veh[data-mode="exit"], #btn-veh[data-mode="garage"] { font-size: 26px; background: rgba(30, 110, 190, 0.88); }
#btn-veh.on { background: rgba(214, 62, 44, 0.96); transform: scale(0.94); }
#btn-veh.hidden, body.photo #btn-veh, body:not(.touch) #btn-veh { display: none; }
#hud-veh[hidden] { display: none; }

/* ==== journal of the eggs (js/journal.js) and the celebration of a rare find (js/fun4.js) ==== */
#journal-panel .jr-chips, #journal-panel .jr-more { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
#journal-panel .jr-chip, #journal-panel .jr-rar { color: var(--rc); font-weight: 700; font-size: 12px; white-space: nowrap; }
#journal-panel .jr-chip { padding: 3px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); }
#journal-panel .jr-more button { min-height: 44px; padding: 4px 10px; font-size: 13px; }
#journal-panel .jr-recent { font-size: 13px; margin: 4px 0 8px; }
#journal-panel .jr-sort { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin: 8px 0; }
#journal-panel .jr-sort button, #journal-panel .jr-tabs button { min-height: 44px; }
#journal-panel .jr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
#journal-panel .jr-card { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 8px 9px; border-radius: 12px; overflow-wrap: anywhere;
  background: rgba(255, 255, 255, 0.05); border: 1px solid color-mix(in srgb, var(--rc) 45%, transparent); }
#journal-panel .jr-card.on { background: color-mix(in srgb, var(--rc) 14%, rgba(255, 255, 255, 0.04)); }
#journal-panel .jr-card.miss { opacity: 0.7; border-style: dashed; }
#journal-panel .jr-card.miss .jr-icon { filter: grayscale(1) brightness(0.6); }
#journal-panel .jr-card[data-r="legendary"].on { box-shadow: 0 0 12px color-mix(in srgb, var(--rc) 55%, transparent); }
#journal-panel .jr-icon { font-size: 30px; line-height: 1.1; }
#journal-panel .jr-card b { font-size: 14px; line-height: 1.2; }
#journal-panel .jr-card small { font-size: 12px; line-height: 1.3; opacity: 0.85; }
#journal-panel .jr-card i { font-size: 11px; opacity: 0.7; }
#journal-panel .jr-map { margin-top: auto; min-height: 44px; font-size: 12px; }
@media (max-width: 520px) { #journal-panel .jr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#big-banner[data-rarity="rare"] .bb-title { color: #7cc0ff; }
#big-banner[data-rarity="epic"] .bb-title { color: #d7a2ff; }
#big-banner[data-rarity="legendary"] .bb-title { color: #ffc54a; text-shadow: 0 0 18px rgba(255, 190, 60, 0.8); }
.egg-confetti { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
.egg-confetti i { position: absolute; top: -40px; font-style: normal; animation: egg-fall 2.6s ease-in forwards; }
@keyframes egg-fall { to { transform: translateY(110vh) rotate(540deg); opacity: 0.2; } }
/* ==== journal end ==== */

/* ---- talk.js: live talk with a pedestrian (game buttons and the panel come from ui.css: .panel, .btn) ---- */
#talk-invite { position: fixed; left: 0; top: 0; z-index: 60; display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border-radius: 999px; border: 3px solid var(--ink, #0f1840); background: var(--yellow, #ffd23f); color: var(--yellow-ink, #3d1c00); font: 800 14px/1 var(--font-ui, system-ui); box-shadow: 0 4px 0 var(--ink-soft, rgba(0,0,0,.4)); cursor: pointer; will-change: transform; }
#talk-invite .ic { width: 26px; height: 26px; }
#talk-invite kbd { padding: 2px 6px; border-radius: 6px; background: var(--ink, #0f1840); color: #fff; font: 800 12px/1.2 var(--font-ui, system-ui); }
#talk-invite.hidden, #btn-talk.hidden, #talk-panel.hidden, body.photo :is(#talk-invite, #btn-talk, #talk-panel) { display: none; }
#btn-talk { position: fixed; z-index: 6; width: 60px; height: 60px; min-height: 0; padding: 0; border-radius: 50%; display: grid; place-items: center; right: calc(max(20px, env(safe-area-inset-right)) + 24px); bottom: calc(max(28px, env(safe-area-inset-bottom)) + 300px); }
#btn-talk .ic { width: 38px; height: 38px; }
#talk-panel { box-sizing: border-box; position: fixed; z-index: 30; left: 50%; bottom: calc(10px + var(--talk-kb, 0px)); transform: translateX(-50%); width: min(540px, calc(100vw - 24px)); margin: 0; padding: 10px 12px; display: grid; gap: 6px; background: var(--navy, #1b2a63); color: var(--ui-text, #fff); border: 3px solid var(--ink, #0f1840); border-radius: var(--r-panel, 18px); box-shadow: var(--ui-shadow, 0 6px 0 rgba(0,0,0,.4)); }
#talk-panel .tk-head { display: flex; align-items: center; gap: 8px; }
#talk-panel .tk-who { flex: 1; min-width: 0; font-size: 14px; line-height: 1.2; }
#talk-panel .tk-job { color: var(--ui-dim, #c6d0f7); }
#talk-panel .tk-ic .ic { width: 28px; height: 28px; }
#talk-panel .tk-log { max-height: min(24vh, 170px); overflow-y: auto; display: grid; gap: 4px; font-size: 14px; line-height: 1.3; }
#talk-panel .tk-me { justify-self: end; text-align: right; color: var(--ui-dim, #c6d0f7); }
#talk-panel .tk-consent { display: flex; gap: 8px; align-items: center; font-size: 12px; }
#talk-panel .tk-consent.hidden { display: none; }
#talk-panel .tk-row { display: flex; gap: 10px; align-items: center; }
#talk-panel .tk-mic { flex: none; width: 60px; height: 60px; min-height: 60px; padding: 0; border-radius: 50%; font-size: 26px; }
#talk-panel .tk-mic.hidden { display: none; }
#talk-panel .tk-mic.on { --c: #ff9a9a; --c2: #e0321c; --cb: #6e0a02; --ct: #fff; }
#talk-panel .tk-mic.busy { opacity: 0.75; }
#talk-panel .tk-col { flex: 1; min-width: 0; display: grid; gap: 4px; }
#talk-panel .tk-state, #talk-panel .tk-note { color: var(--ui-dim, #c6d0f7); font-size: 11px; min-height: 13px; }
#talk-panel .tk-form { display: flex; gap: 6px; }
#talk-panel .tk-input { flex: 1; min-width: 0; margin: 0; }
#talk-panel .tk-send { flex: none; min-width: 48px; }
#talk-help { margin-top: 6px; }
/* a phone: the panel hangs under the HUD, clear of the joystick, GAS and the thumb buttons (tests/talk.suite.mjs measures it) */
body.touch #talk-panel { top: 184px; bottom: auto; }
body.touch #talk-panel .tk-log { max-height: 18vh; }
@media (max-height: 500px) {
  body.touch #talk-panel { top: 80px; left: 268px; transform: none; width: min(440px, calc(100vw - 268px - 196px)); padding: 6px 10px; gap: 4px; }
  #talk-panel .tk-log { max-height: 24vh; }
  #talk-panel .tk-mic { width: 48px; height: 48px; min-height: 48px; font-size: 22px; }
  #btn-talk { bottom: 226px; width: 56px; height: 56px; }
}
