/* Klaipėda — the look of the whole interface (loaded after style.css and wins over it). A GAME, not an app:
   solid navy panels with a coloured head, buttons «with a bottom» (a hard shadow of the dark tone of their own
   colour; pressed — they go down), a gloss on top, big colourful icons from one atlas (js/icons.js), one colour per
   section of the menu, one rounded grotesque (Rubik 500 / 700 / 900, local files), a spring on hover and press.
   Nothing here blurs the picture (no backdrop-filter) and only transform / opacity are animated.
   js/menu.js builds the menu:
     phone / narrow window — everything is behind ☰ (bottom sheet); on screen: minimap, the status pill, the banner,
                             joystick + GAS, hero button + ☰ top right, boost / voice / roll over GAS (#quick);
     desktop               — a narrow dock of icons on the right edge, Esc / ☰ opens the same menu as a window.
   Layers: HUD 3–7 · scrim 31 · sheets 32 · ☰ and the dock 33 · wardrobe 34 · open menu 40 / 41.
   OTHER PANELS: anything with the class `sheet` (or `panel`) gets the look for free — <button> is a game button
   (`.primary` / `.ok` / `.danger` colour it, `.on` marks the chosen one), inputs, selects, <progress>, lists
   (`.q-row`), `.tabs`, `.seg`, `.card`, `.price`, `.badge`, `.sheet-head` + `.sheet-x` are styled below (5.). */
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 300 900; font-display: swap; src: url(../fonts/rubik-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 300 900; font-display: swap; src: url(../fonts/rubik-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 300 900; font-display: swap; src: url(../fonts/rubik-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --ink: #0f1840;                 /* outlines, hard shadows */
  --ink-soft: rgba(15, 24, 64, 0.55);
  --navy: #1b2a63;                /* a panel */
  --navy-2: #283a80;              /* a plate on a panel */
  --navy-3: #3550a8;
  --well: #121d4b;                /* a hollow: bars, capsules */
  --ui-text: #ffffff;
  --ui-dim: #c6d0f7;              /* second-line text on navy (8 : 1) */
  --yellow: #ffd23f;
  --yellow-ink: #3d1c00;          /* text on yellow (10 : 1) */
  --ui-bg: var(--navy);
  --ui-bg-solid: var(--navy);
  --ui-head: #2f6df0;
  --ui-line: var(--ink);
  --ui-line-strong: var(--ink);
  --ui-fill: var(--navy-2);
  --ui-fill-hover: var(--navy-3);
  --ui-shadow: 0 8px 0 rgba(10, 16, 46, 0.5);
  --r-panel: 22px;
  --r-btn: 14px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --t: 170ms;
  --t-slow: 220ms;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --font-ui: "Rubik", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-title: var(--font-ui);
  --qb: 48px;            /* a button that stays on screen */
  /* the old button block is gone: what style.css still derives from it is one row of two buttons */
  --cols: 2; --bw: 48px; --rows: 1;
  --glass: var(--navy);
  --line: var(--ink);
  --gi-img: url(../img/icons.webp);
  --gi-size: calc(var(--gi-cols) * 100%) calc(var(--gi-rows) * 100%);
}
/* retina and phone screens: the atlas with cells of 256 px (a big icon stays sharp) */
@media (min-resolution: 1.5dppx) { :root { --gi-img: url(../img/icons-2x.webp); } }
/* <atlas> written by tools/build_icons.py — do not edit by hand */
:root { --gi-cols: 8; --gi-rows: 11;
  --gi-menu: 0% 0%; --gi-close: 14.2857% 0%; --gi-modes: 28.5714% 0%; --gi-story: 42.8571% 0%; --gi-quests: 57.1429% 0%; --gi-daily: 71.4286% 0%;
  --gi-gull: 85.7143% 0%; --gi-courier: 100% 0%; --gi-cat: 0% 10%; --gi-hanger: 14.2857% 10%; --gi-cam: 28.5714% 10%; --gi-cry: 42.8571% 10%;
  --gi-roll: 57.1429% 10%; --gi-boost: 71.4286% 10%; --gi-map: 85.7143% 10%; --gi-sock: 100% 10%; --gi-egg: 0% 20%; --gi-photo: 14.2857% 20%;
  --gi-globe: 28.5714% 20%; --gi-chat: 42.8571% 20%; --gi-emote: 57.1429% 20%; --gi-trophy: 71.4286% 20%; --gi-music: 85.7143% 20%; --gi-radio: 100% 20%;
  --gi-next: 0% 30%; --gi-volume: 14.2857% 30%; --gi-settings: 28.5714% 30%; --gi-help: 42.8571% 30%; --gi-lang: 57.1429% 30%; --gi-vhs: 71.4286% 30%;
  --gi-home: 85.7143% 30%; --gi-free: 100% 30%; --gi-race: 0% 40%; --gi-roofs: 14.2857% 40%; --gi-raid: 28.5714% 40%; --gi-bomber: 42.8571% 40%;
  --gi-delivery: 57.1429% 40%; --gi-rush: 71.4286% 40%; --gi-fish: 85.7143% 40%; --gi-lives: 100% 40%; --gi-pigeons: 0% 50%; --gi-granny: 14.2857% 50%;
  --gi-tag: 28.5714% 50%; --gi-orace: 42.8571% 50%; --gi-balcony: 57.1429% 50%; --gi-geo: 71.4286% 50%; --gi-rampage: 85.7143% 50%; --gi-pranks: 100% 50%;
  --gi-album: 0% 60%; --gi-weekly: 14.2857% 60%; --gi-coin: 28.5714% 60%; --gi-medal: 42.8571% 60%; --gi-lock: 57.1429% 60%; --gi-gift: 71.4286% 60%;
  --gi-ambulance: 85.7143% 60%; --gi-bank: 100% 60%; --gi-bike: 0% 70%; --gi-brake: 14.2857% 70%; --gi-bus: 28.5714% 70%; --gi-cafe: 42.8571% 70%;
  --gi-car: 57.1429% 70%; --gi-check: 71.4286% 70%; --gi-door: 85.7143% 70%; --gi-ebike: 100% 70%; --gi-fine: 0% 80%; --gi-food: 14.2857% 80%;
  --gi-fuel: 28.5714% 80%; --gi-garage: 42.8571% 80%; --gi-hall: 57.1429% 80%; --gi-journal: 71.4286% 80%; --gi-license: 85.7143% 80%; --gi-newbie: 100% 80%;
  --gi-pharmacy: 0% 90%; --gi-pin: 14.2857% 90%; --gi-police: 28.5714% 90%; --gi-post: 42.8571% 90%; --gi-school: 57.1429% 90%; --gi-scooter: 71.4286% 90%;
  --gi-shop: 85.7143% 90%; --gi-talk: 100% 90%; --gi-wallet: 0% 100%; --gi-fullscreen: 14.2857% 100%;
}
/* </atlas> */
@media (prefers-reduced-motion: reduce) {
  :root { --t: 1ms; --t-slow: 1ms; --spring: linear; }
  .tut-hl { animation: none; outline: 3px solid var(--yellow); outline-offset: 2px; }
  [data-badge]::after, .badge, .q-level .q-medal, .q-level .q-bar i::after, #hud #rp-needs .rn.low, .rd-tease .rd-ic, .rd-now.on .rd-eq i, #loading > span::before, #big-banner.show::before, #big-banner.show::after, #hud-wallet #hud-coins { animation: none !important; }
}
@keyframes ui-pop { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes ui-pop-c { from { opacity: 0; transform: translate(-50%, -46%) scale(0.94); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes ui-rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ui-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ui-bump { 0% { transform: none; } 40% { transform: scale(1.28) rotate(-4deg); } 100% { transform: none; } }
@keyframes ui-wobble { 0%, 100% { transform: rotate(-9deg); } 50% { transform: rotate(9deg) scale(1.08); } }
@keyframes ui-burst { 0% { transform: scale(0.3) rotate(0deg); opacity: 0; } 25% { opacity: 1; } 100% { transform: scale(1.25) rotate(24deg); opacity: 0; } }
@keyframes ui-bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-10px) rotate(3deg); } }

html, body { font-family: var(--font-ui); font-weight: 500; color: var(--ui-text); }
button, input, select, textarea, kbd, summary { font-family: var(--font-ui) !important; }

/* ---- icons: one atlas; the element's own width / height is the size of the picture */
.ic { display: block; width: 24px; height: 24px; flex: none; }
.gi { display: block; flex: none; background: var(--gi-img) 0 0 / var(--gi-size) no-repeat; font-style: normal; }
.gi-none { background: none; }
i.gi.inl { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -0.3em; }

/* ============================================================ 1. the game button
   face --c → --c2, bottom and outline --cb, text --ct, depth --dz */
:is(.tabs, .seg, .set-actions, .area-grid, .hats, .swatches, .langs, .heroes, .sc-btns) button, .panel .row button, .mode-card, #tutorial .tut-skip, #menu .mi, .sheet-x,
:is(#radio-panel, #map-panel, #emote-bar, #top-buttons, #quick, #photo-bar) button, #touch-ui > button, #btn-act, #btn-start,
:where(.sheet, .panel) :where(button:not(.link)), :where(.btn) {
  --c: #4460c4; --c2: #3149a6; --cb: var(--ink); --ct: #fff; --dz: 4px;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 46%), linear-gradient(180deg, var(--c), var(--c2));
  border: 3px solid var(--cb); border-radius: var(--r-btn); color: var(--ct);
  box-shadow: 0 var(--dz) 0 var(--cb);
  font-family: var(--font-ui); font-weight: 700; text-shadow: none; letter-spacing: 0;
  transition: transform var(--t) var(--spring), opacity var(--t);
  -webkit-backdrop-filter: none; backdrop-filter: none; -webkit-tap-highlight-color: transparent; cursor: pointer;
}
:where(.sheet, .panel) :where(button:not(.link)), :where(.btn) { min-height: 44px; padding: 0 14px; font-size: 14px; line-height: 1.2; }
@media (hover: hover) {
  :is(.tabs, .seg, .set-actions, .area-grid, .hats, .swatches, .langs, .heroes, .sc-btns) button:hover, .panel .row button:hover, .mode-card:hover, #tutorial .tut-skip:hover, #menu .mi:hover, .sheet-x:hover,
  :is(#radio-panel, #map-panel, #emote-bar, #top-buttons, #quick, #photo-bar) button:hover, #btn-act:hover, #btn-start:hover,
  :where(.sheet, .panel) :where(button:not(.link)):hover, :where(.btn):hover { transform: translateY(-2px); }
}
:is(.tabs, .seg, .set-actions, .area-grid, .hats, .swatches, .langs, .heroes, .sc-btns) button:active, .panel .row button:active, .mode-card:active, #tutorial .tut-skip:active, #menu .mi:active, .sheet-x:active,
:is(#radio-panel, #map-panel, #emote-bar, #top-buttons, #quick, #photo-bar) button:active, #touch-ui > button:active, #btn-act:active, #btn-start:active, #btn-gas.on,
:where(.sheet, .panel) :where(button:not(.link)):active, :where(.btn):active { transform: translateY(var(--dz)); box-shadow: 0 0 0 var(--cb); }
/* chosen / switched on: yellow */
:is(.tabs, .seg, .hats, .swatches, .langs, .heroes, .area-grid) button.on, .mode-card.on, :is(#radio-panel, #top-buttons) button.on,
:where(.sheet, .panel) :where(button.on) { --c: #ffe36b; --c2: #ffb81f; --cb: #9a4d00; --ct: var(--yellow-ink); }
/* (style.css paints its own `.on` / `.locked` / `.pending` with a higher specificity: the face is said again) */
:is(.tabs, .seg, .hats, .swatches, .langs, .heroes, .area-grid) button:is(.on, .locked, .pending), .mode-card.on, :is(#radio-panel, #top-buttons, #quick) button.on, #menu #music .mi.on {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 46%), linear-gradient(180deg, var(--c), var(--c2)); border-color: var(--cb); color: var(--ct);
}
/* the main action · «yes» · «careful» */
.panel .row button, .sc-btns button:first-child, #btn-start, :where(.sheet, .panel) :where(button.primary, button.buy), :where(.btn.primary) { --c: #ffe36b; --c2: #ffa51f; --cb: #9a4d00; --ct: var(--yellow-ink); }
:where(.sheet, .panel) :where(button.ok), :where(.btn.ok) { --c: #8be85a; --c2: #3fc23a; --cb: #17641b; --ct: #062b08; }
:where(.sheet, .panel) :where(button.danger), :where(.btn.danger) { --c: #f0553c; --c2: #cf2413; --cb: #7c0f05; --ct: #fff; }
:is(button, input, summary, a, select, textarea):focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
button:disabled, [aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
/* the red round «close» of every panel: the drawn icon, whatever the markup put inside */
.sheet-x {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 50%; box-shadow: none;
  background: var(--gi-img) var(--gi-close) / var(--gi-size) no-repeat; font-size: 0; color: transparent; overflow: hidden;
}
.sheet-x > * { display: none; }
.sheet-x:active { transform: scale(0.88); box-shadow: none; }
@media (hover: hover) { .sheet-x:hover { transform: rotate(90deg) scale(1.08); } }
/* a red «!» / «new» / a number on the corner of anything: <… data-badge="!">, or <i class="badge">3</i> inside it */
[data-badge] { position: relative; }
[data-badge]::after, .badge {
  content: attr(data-badge); position: absolute; right: -6px; top: -7px; z-index: 2; box-sizing: border-box; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px;
  background: #ff3b3b; border: 2px solid #fff; box-shadow: 0 2px 0 var(--ink); color: #fff; font: 900 12px/18px var(--font-ui); font-style: normal; text-align: center;
  animation: ui-wobble 1.1s ease-in-out infinite; pointer-events: none;
}

/* ============================================================ 2. HUD: stats, banner, toasts, cards */
#hud, #banner > div, #tutorial, #story-card, #orace-card, #story-credits, #chat-log div, #chat-input, #map-panel .map-legend, #minimap .mm-badge, #minimap .mm-zoom, #help {
  -webkit-backdrop-filter: none; backdrop-filter: none; text-shadow: none;
}
#hud { padding: 8px 12px 9px; border-radius: 18px; background: var(--navy); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink-soft); line-height: 1.45; font-weight: 500; }
#hud .stat b { font-weight: 900; font-size: 20px; }
#hud .unit, #hud .dim { opacity: 1; color: var(--ui-dim); }
#hud { max-width: 292px; }
#hud-wallet { flex-wrap: wrap; gap: 4px 9px; margin-top: 4px; padding-left: 7px; }
/* the scales of the hero (js/rp.js: fullness and warmth of the courier, the cheek of the gull, the sleep of the cat):
   a drawn icon over a short bar; nearly empty — red and blinking. js/tips.js tells what each one is. */
#hud #rp-needs { display: inline-flex; flex: none; align-items: center; gap: 7px; line-height: 1; }
#hud #rp-needs .rn { display: inline-grid; justify-items: center; gap: 1px; width: 24px; font-size: 0; }
#hud #rp-needs .rn .gi { display: block; width: 22px; height: 22px; border-radius: 0; overflow: visible; background: var(--gi-img) 0 0 / var(--gi-size) no-repeat; }
#hud #rp-needs .rn > i:not(.gi) { display: block; box-sizing: border-box; width: 24px; height: 7px; border: 2px solid var(--ink); border-radius: 4px; background: var(--well); overflow: hidden; }
#hud #rp-needs .rn > i > b { display: block; height: 100%; border-radius: 0; background: linear-gradient(180deg, #b6f58a, #3fc23a); }
#hud #rp-needs .rn.low > i > b { background: #ff5a4a; }
#hud #rp-needs .rn.low { animation: ui-blink 1s ease-in-out infinite; }
#hud #rp-needs .fx { font-size: 14px; }
@keyframes ui-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
/* level and money: capsules with an icon bigger than the capsule */
#hud-level, #hud-coins {
  position: relative; display: inline-flex; align-items: center; height: 22px; padding: 0 9px 0 23px; border-radius: 11px; background: var(--well); border: 2px solid var(--ink);
  font-weight: 900; font-size: 13px; line-height: 1; font-variant-numeric: tabular-nums;
}
#hud-level { color: #9fe0ff; }
#hud-coins { color: #ffd84a; margin-left: 5px; }
#hud-level::before, #hud-coins::before { content: ''; position: absolute; left: -9px; top: 50%; width: 30px; height: 30px; margin-top: -16px; background: var(--gi-img) var(--gi-medal) / var(--gi-size) no-repeat; }
#hud-coins::before { background-position: var(--gi-coin); }
#hud-level:empty { display: none; }
#hud-xp { height: 10px; border-radius: 6px; background: var(--well); border: 2px solid var(--ink); box-sizing: border-box; }
#hud-xp i { background: linear-gradient(180deg, #8ff0ff, #2aa8ff); border-radius: 3px; }
#hud-gain {
  padding: 3px 10px; border-radius: 999px; background: linear-gradient(#ffe36b, #ffb81f); border: 2px solid #9a4d00; box-shadow: 0 3px 0 #9a4d00; color: var(--yellow-ink);
  font-weight: 900; transform: scale(0.5) rotate(-4deg); transform-origin: 20% 50%; transition: opacity 0.2s, transform var(--t-slow) var(--spring);
}
#hud-gain.show { transform: rotate(-2deg); }
#hud-wallet:has(#hud-gain.show) #hud-coins { animation: ui-bump 420ms var(--spring); }

#banner { max-width: min(620px, calc(100vw - 2 * 290px)); gap: 9px; padding-bottom: 4px; }
#banner > div {
  --bc: var(--navy); --bd: var(--ink);
  padding: 6px 14px 7px; border-radius: 14px; background: var(--bc); border: 3px solid var(--bd); box-shadow: 0 4px 0 var(--bd);
  color: #fff; font-weight: 700; font-size: 13.5px; line-height: 1.3;
}
#banner > #hud-mission { --bc: #1c66dd; --bd: #0c3486; }
#banner > #hud-mode { --bc: #147a43; --bd: #07421f; }
#banner > #hud-way { --bc: #c2185b; --bd: #6e0a31; }
#banner > #hud-tag { --bc: #b85500; --bd: #6b2e00; }
#banner > #hud-story { --bc: #5a25c4; --bd: #2f0f78; }
#banner > #hud-orace { --bc: #b85500; --bd: #6b2e00; }
#banner > #hud-tag.it { --bc: #c41a0a; --bd: #6e0a02; background: var(--bc); border-color: var(--bd); }
#hud-tag small { opacity: 0.92; }

#toasts { transition: none; gap: 9px; } /* (no sliding: the banner above moves at once, a lagging toast would lie on it) */
.toast {
  --bc: #1c66dd; --bd: #0c3486;
  padding: 8px 16px 9px; border-radius: 16px; background: var(--bc); border: 3px solid var(--bd); box-shadow: 0 4px 0 var(--bd); color: #fff; font-weight: 700;
  transform: translateY(10px) scale(0.92); transition: opacity var(--t-slow), transform var(--t-slow) var(--spring);
}
.toast.show { transform: none; }
.toast.reward { --bc: #ffcf3a; --bd: #9a4d00; background: linear-gradient(#ffe36b, #ffb81f); color: var(--yellow-ink); font-weight: 900; }
.toast.reward::before { content: ''; display: inline-block; width: 1.6em; height: 1.6em; margin: -0.3em 6px -0.45em -4px; background: var(--gi-img) var(--gi-gift) / var(--gi-size) no-repeat; }
.toast.warn { --bc: #c41a0a; --bd: #6e0a02; background: var(--bc); }

/* level up, a new district, a chapter: a yellow plate, a tilted title, stars flying out */
#big-banner {
  padding: 12px 30px 14px; border-radius: 24px; background: linear-gradient(180deg, #fff0a0, #ffc21f 55%, #ff9d1c); border: 4px solid #9a4d00;
  box-shadow: 0 7px 0 #9a4d00, 0 16px 0 rgba(10, 16, 46, 0.3); transform: translate(-50%, 0) scale(0.5); transform-origin: 50% 0;
  top: max(24%, calc(var(--bt, 0px) + var(--bn, 0px) + 26px)); transition: opacity var(--t-slow), transform 320ms var(--spring);
}
#big-banner.show { transform: translate(-50%, 0); }
#big-banner .bb-title { font: 900 clamp(26px, 6vw, 46px)/1.05 var(--font-ui); font-style: normal; letter-spacing: 0.01em; color: var(--yellow-ink); text-shadow: 0 3px 0 rgba(255, 255, 255, 0.55); transform: rotate(-2deg); }
#big-banner .bb-sub { margin-top: 6px; font-weight: 700; font-size: 14.5px; color: var(--yellow-ink); }
/* a rare / epic find (js/fun4.js): the plate takes the colour of the rarity, the legendary one stays gold */
#big-banner[data-rarity="rare"] { background: linear-gradient(180deg, #8fd0ff, #2f7df0 55%, #1f5fd6); border-color: #0c3486; box-shadow: 0 7px 0 #0c3486, 0 16px 0 rgba(10, 16, 46, 0.3); }
#big-banner[data-rarity="epic"] { background: linear-gradient(180deg, #dcc0ff, #9a5cf5 55%, #6f33d6); border-color: #33127a; box-shadow: 0 7px 0 #33127a, 0 16px 0 rgba(10, 16, 46, 0.3); }
#big-banner:is([data-rarity="rare"], [data-rarity="epic"]) :is(.bb-title, .bb-sub) { color: #fff; text-shadow: 0 3px 0 rgba(15, 24, 64, 0.75); }
#big-banner[data-rarity="legendary"] .bb-title { color: var(--yellow-ink); text-shadow: 0 3px 0 rgba(255, 255, 255, 0.6); }
#big-banner[data-rarity="legendary"] { box-shadow: 0 7px 0 #9a4d00, 0 0 0 5px #fff, 0 16px 0 rgba(10, 16, 46, 0.3); }
#big-banner::before, #big-banner::after {
  content: ''; position: absolute; left: -12%; right: -12%; top: -70%; bottom: -70%; z-index: -1; pointer-events: none; opacity: 0;
  background:
    radial-gradient(circle 7px at 8% 30%, #fff 98%, transparent), radial-gradient(circle 5px at 20% 78%, #ffd84a 98%, transparent), radial-gradient(circle 6px at 92% 26%, #ff7fb0 98%, transparent),
    radial-gradient(circle 5px at 82% 80%, #5cc0ff 98%, transparent), radial-gradient(circle 6px at 50% 4%, #8be85a 98%, transparent), radial-gradient(circle 5px at 40% 96%, #fff 98%, transparent),
    radial-gradient(circle 4px at 2% 62%, #ff9d1c 98%, transparent), radial-gradient(circle 4px at 98% 58%, #ffd84a 98%, transparent);
}
#big-banner.show::before { animation: ui-burst 900ms ease-out 120ms both; }
#big-banner.show::after { animation: ui-burst 1100ms ease-out 380ms both; rotate: 40deg; }

/* the cards between the thumbs: the tutorial (navy, a yellow rim), a dialogue (paper), the online race */
#tutorial, #orace-card, #story-credits { border-radius: 18px; background: var(--navy); border: 3px solid var(--yellow); box-shadow: 0 5px 0 var(--ink-soft); padding: 10px 12px 12px 14px; }
#tutorial .tut-n { padding: 2px 9px; background: var(--yellow); color: var(--yellow-ink); font-weight: 900; transform: rotate(-3deg); }
#tutorial .tut-title { font-weight: 900; }
#tutorial .tut-skip { min-height: 36px; padding: 0 12px; font-size: 12px; --dz: 3px; }
#tutorial kbd, #help kbd, .sheet kbd { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 6px; border: 0; background: #fff; box-shadow: 0 2px 0 #8894c9; color: var(--ink); font: 700 12px/1.6 var(--font-ui); text-align: center; }
#tutorial .tut-bar, .q-bar, :where(.sheet, .panel) :where(progress, meter) { height: 12px; border-radius: 7px; background: var(--well); border: 2px solid var(--ink); box-sizing: border-box; }
#tutorial .tut-bar i, .q-bar i { border-radius: 4px; background: linear-gradient(180deg, #ffe36b, #ffa51f); }
#tutorial.ok { border-color: #8be85a; }
#tutorial.ok .tut-bar i { background: linear-gradient(180deg, #b6f58a, #3fc23a); }
#tutorial.ok .tut-title::after { color: #8be85a; }
#story-credits { padding: 0 16px; }
#orace-card { border-color: #ff9d1c; }
#orace-card .or-count { font: 900 36px/1.1 var(--font-ui); color: var(--yellow); }
#orace-card .or-row.me { color: var(--yellow); }
#story-credits .cr-title { font: 900 20px/1.2 var(--font-ui); font-style: normal; color: var(--yellow); }
#story-card { border-radius: 18px; background: #fff8e6; border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink-soft); padding: 10px 12px 11px 14px; color: #1a2147; font-weight: 500; }
#story-card .sc-name { flex: none; max-width: 70%; padding: 2px 11px 3px; border-radius: 999px; background: linear-gradient(#ffe36b, #ffb81f); border: 2px solid #9a4d00; color: var(--yellow-ink); font-weight: 900; font-size: 13.5px; transform: rotate(-2deg); }
#story-card .sc-n { margin-left: auto; opacity: 1; color: #5a6187; font-weight: 700; }
#story-card .sc-text { margin-top: 6px; }
#story-card .sc-tap { opacity: 1; color: #5a6187; }
.sc-btns { padding-bottom: 4px; }
.sc-btns button { min-height: 44px; padding: 0 16px; font-size: 13.5px; }
#chat-log div { border-radius: 12px; padding: 5px 10px 6px; background: var(--navy); border: 2px solid var(--ink); }
#chat-input, .creator input, .panel input:not([type="checkbox"]):not([type="range"]):not([type="radio"]), :where(.sheet, .panel) :where(select, textarea) {
  padding: 11px 14px; border-radius: 14px; border: 3px solid var(--ink); background: #fff; box-shadow: inset 0 3px 0 rgba(15, 24, 64, 0.14); color: var(--ink);
  font-weight: 700; font-size: 16px;
}
#chat-input::placeholder, .creator input::placeholder, .panel input::placeholder { color: #68719c; }
#chat-input:focus, .creator input:focus, .panel input:focus { outline: none; border-color: #ff9d1c; }
#minimap { border: 4px solid #fff; box-shadow: 0 0 0 3px var(--ink), 0 6px 0 3px var(--ink-soft); }
#minimap.it { border-color: #ff3b30; box-shadow: 0 0 0 3px var(--ink), 0 6px 0 3px var(--ink-soft); }
#minimap .mm-badge, #minimap .mm-zoom { background: var(--navy); border: 2px solid var(--ink); font-weight: 900; }
#map-panel .map-top b { font: 900 24px/1 var(--font-ui); font-style: normal; text-transform: uppercase; color: #fff; text-shadow: 0 3px 0 var(--ink); transform: rotate(-2deg); }
#map-panel .map-hint { opacity: 1; font-weight: 700; text-shadow: 0 2px 0 var(--ink); }
#map-panel button { min-width: 46px; height: 46px; font-weight: 900; font-size: 18px; }
#map-panel .map-zoom { gap: 12px; }
/* the filters of the shops on the map (js/rp.js): small pills in a row, the legend sits above them */
#map-panel .map-filter button { min-width: 0; height: auto; min-height: 38px; padding: 0 12px; border-radius: 999px; font-weight: 700; font-size: 13px; --dz: 3px; }
#map-panel:has(.map-filter) .map-legend { bottom: calc(var(--sb) + 64px); }
@media (max-width: 699px) {
  #map-panel:has(.map-filter) .map-legend { bottom: calc(var(--sb) + 150px); max-height: calc(100vh - 240px); overflow: hidden; }
  /* (four buttons and the title in one row of a 360 px screen) */
  #map-panel .map-top { gap: 5px; }
  #map-panel .map-top b { font-size: 18px; min-width: 0; }
  #map-panel .map-top button { min-width: 42px; height: 44px; padding: 0 6px; font-size: 16px; }
}
@media (orientation: landscape) and (max-height: 520px) { #map-panel:has(.map-filter) .map-legend { max-height: calc(100vh - 150px); } }
#map-panel .map-legend { border-radius: 16px; background: var(--navy); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink-soft); font-weight: 500; }
#photo-bar button { border-radius: 50%; --c: #fff; --c2: #dfe6ff; --ct: var(--ink); }
#photo-bar .photo-hint { opacity: 1; font-weight: 700; text-shadow: 0 2px 0 var(--ink); }
#street-name { background: var(--navy); border: 2px solid var(--ink); padding: 2px 12px 3px; color: #fff; font-family: var(--font-ui); font-weight: 700; text-shadow: none; }
/* «press E — enter: Lidl» (js/meta.js draws it in the middle of the screen): the yellow plate of the hints, a key cap */
#act-hint { padding: 7px 16px 8px; border-radius: 16px; background: linear-gradient(#ffe36b, #ffc21f); border: 3px solid #9a4d00; box-shadow: 0 4px 0 #9a4d00; color: var(--yellow-ink); font-family: var(--font-ui); font-weight: 900; }
#act-hint kbd { background: #fff; color: var(--ink); box-shadow: 0 3px 0 #8894c9; font-family: var(--font-ui); }
/* the translation of the billboard nearby (js/billboards.js sets its look inline, hence !important): a paper note */
#board-hint {
  padding: 3px 12px 4px !important; border-radius: 12px !important; background: #fff8e6 !important; border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink-soft);
  color: #1a2147 !important; font-family: var(--font-ui) !important; font-weight: 700 !important;
}
/* ---- bubbles: a line of a passer-by (js/voices.js makes #voice-bubble and moves it; its own css comes later, hence
   `body`). The element itself is only the place; the comic bubble is .vb-in inside it: a fat outline, a tail that
   points at the speaker (--tail), a spring when it pops up. data-look tells who speaks and how:
   say · shout (a jagged burst) · think (dashes and bubbles) · driver · kid · old · talk (the live talk, with a name). */
body #voice-bubble { box-sizing: border-box; max-width: min(64vw, 340px); padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--ink); font: 700 14px/1.25 var(--font-ui); }
body #voice-bubble::before, body #voice-bubble::after { display: none; }
.vb-in {
  --bb: #fff; --bo: var(--ink);
  position: relative; isolation: isolate; display: flex; align-items: center; gap: 8px; padding: 8px 14px 9px; border-radius: 22px; background: var(--bb); border: 3px solid var(--bo);
  box-shadow: 0 4px 0 var(--ink-soft); text-align: center; transform-origin: var(--tail, 50%) 100%; transform: scale(0.7); transition: transform 160ms ease-in;
}
#voice-bubble.on .vb-in { transform: none; animation: vb-pop 190ms var(--spring); }
@keyframes vb-pop { from { transform: scale(0.4) rotate(-7deg); } to { transform: none; } }
.vb-in::after { content: ''; position: absolute; left: var(--tail, 50%); bottom: -10px; z-index: -1; width: 16px; height: 16px; margin-left: -8px; background: var(--bb); border-right: 3px solid var(--bo); border-bottom: 3px solid var(--bo); border-radius: 0 0 5px 0; transform: rotate(45deg) skew(10deg, 10deg); }
#voice-bubble.edge:not([data-look="shout"]) .vb-in::after, #voice-bubble.edge[data-look="think"] .vb-in::before { display: none; }
.vb-tx { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; min-width: 0; }
.vb-av { flex: none; width: 36px; height: 36px; margin: -14px 0 -14px -24px; }
.vb-name { position: absolute; left: 12px; top: -13px; padding: 1px 9px 2px; border-radius: 999px; background: var(--bo); color: #fff; font: 900 11px/1.4 var(--font-ui); white-space: nowrap; }
[data-look="shout"] .vb-in { --bb: #ffe14a; padding: 15px 24px 16px; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--yellow-ink); font-weight: 900; font-size: 16px; }
[data-look="shout"] .vb-in::before, [data-look="shout"] .vb-in::after {
  content: ''; position: absolute; inset: -5px; left: -5px; bottom: -5px; z-index: -2; width: auto; height: auto; margin: 0; border: 0; border-radius: 0; background: var(--ink); transform: none;
  clip-path: polygon(0% 20%, 8% 14%, 5% 0%, 19% 10%, 29% 0%, 38% 11%, 50% 0%, 60% 11%, 72% 0%, 79% 12%, 95% 2%, 92% 17%, 100% 24%, 94% 38%, 100% 52%, 94% 66%, 100% 82%, 91% 86%, 94% 100%, 79% 90%, 68% 100%, 58% 89%, 46% 100%, 38% 89%, 24% 100%, 20% 87%, 5% 97%, 9% 81%, 0% 70%, 6% 54%, 0% 38%, 6% 28%);
}
[data-look="shout"] .vb-in::after { inset: 0; left: 0; bottom: 0; z-index: -1; background: var(--bb); }
[data-look="think"] .vb-in { --bb: #f1f5ff; border-style: dashed; border-radius: 26px; color: #3b4470; font-weight: 500; }
[data-look="think"] .vb-in::after { bottom: -17px; width: 11px; height: 11px; margin-left: -6px; border: 3px solid var(--bo); border-radius: 50%; transform: none; }
[data-look="think"] .vb-in::before { content: ''; position: absolute; left: var(--tail, 50%); bottom: -28px; width: 6px; height: 6px; margin-left: 4px; border: 2px solid var(--bo); border-radius: 50%; background: var(--bb); }
[data-look="driver"] .vb-in { --bb: #ffe9a8; --bo: #7a3b00; color: #3d1c00; border-radius: 12px 22px 22px 22px; }
[data-look="kid"] .vb-in { --bb: #e3faff; --bo: #0f5fc4; color: #0b2f6e; font-size: 13px; border-radius: 24px 24px 24px 10px; }
[data-look="old"] .vb-in { --bb: #fff3e0; --bo: #6b3410; color: #3b1d08; font-weight: 500; border-radius: 16px; }
[data-look="talk"] .vb-in { --bb: #f3eaff; --bo: #5a25c4; color: #25104f; box-shadow: 0 4px 0 rgba(58, 21, 133, 0.5); }
body #voice-bubble.driver { background: none; }
@media (max-width: 700px), (max-height: 500px) { body #voice-bubble { max-width: 70vw; font-size: 13px; padding: 0; } [data-look="shout"] .vb-in { font-size: 14.5px; } }
@media (prefers-reduced-motion: reduce) { #voice-bubble.on .vb-in { animation: none; } .vb-in { transition: none; } }

/* ============================================================ 3. what stays on screen: ☰ (+ the hero button on touch), the thumb buttons, GAS */
#loading:not(.done) { z-index: 50; }
#top-buttons { position: fixed; right: var(--sr); top: var(--st); display: flex; gap: 10px; z-index: 33; }
#top-buttons button, #quick button { position: relative; display: grid; place-items: center; width: var(--qb); height: var(--qb); padding: 0; }
#top-buttons button { --c: #dff1ff; --c2: #9fcfff; --cb: #1f4f96; }
#top-buttons #btn-menu { --c: #ffe36b; --c2: #ffa51f; --cb: #9a4d00; }
#top-buttons :is(.mi-tx, kbd), #quick :is(.mi-tx, kbd) { display: none; }
#top-buttons .mi-ic, #quick .mi-ic { width: 38px; height: 38px; }
#top-buttons #btn-menu .ic { width: 36px; height: 36px; }
#quick {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(max(28px, env(safe-area-inset-bottom)) + 112px + 12px);
  display: flex; gap: 10px; z-index: 4;
}
#quick button { width: 52px; height: 52px; border-radius: 50%; --c: #8fd6ff; --c2: #2f8bff; --cb: #0f3f96; }
#quick button[data-mi="boost"] { --c: #fff0a0; --c2: #ffb81f; --cb: #9a4d00; }
#quick button[data-mi="cry"] { --c: #ffb3d1; --c2: #f0347f; --cb: #7a0a38; }
#quick button.on { --c: #fffbe0; --c2: #ffe14a; --cb: #c26a00; }
#quick button.on::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid #fff; opacity: 0.9; pointer-events: none; }
/* a fan over GAS: the far one hangs lower, next to the big button */
#quick button:first-child { margin-bottom: -28px; align-self: flex-end; }
#quick button:nth-child(2) { margin-bottom: -6px; align-self: flex-end; }
#touch-ui > #btn-gas {
  --c: #f2543a; --c2: #c41a0a; --cb: #6e0a02; --dz: 7px; border-width: 4px; border-radius: 50%;
  background: radial-gradient(ellipse 62% 34% at 50% 20%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 70%), linear-gradient(180deg, var(--c), var(--c2));
  font: 900 23px/1 var(--font-ui) !important; letter-spacing: 0.04em; color: #fff; text-shadow: 0 3px 0 var(--cb); -webkit-text-stroke: 0;
}
#touch-ui > #btn-gas.on { --c: #ff7a52; --c2: #e0321c; }
/* the vehicle button next to GAS (js/touch.js): the brake — grey, the door / the garage — blue; held — red */
#touch-ui > #btn-veh { --c: #8493b8; --c2: #4a5a84; --cb: #1c2540; --dz: 5px; border-radius: 50%; font-weight: 900; }
#touch-ui > #btn-veh[data-mode="exit"], #touch-ui > #btn-veh[data-mode="garage"] { --c: #8fd6ff; --c2: #2f8bff; --cb: #0f3f96; }
#touch-ui > #btn-veh.on { --c: #ff7a52; --c2: #e0321c; --cb: #6e0a02; transform: translateY(var(--dz)); box-shadow: 0 0 0 var(--cb); }
#touch-ui > #btn-veh[data-mode], #touch-ui > #btn-veh.on { background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 46%), linear-gradient(180deg, var(--c), var(--c2)); }
/* (it sits where the far button of the fan hangs: that one moves up over it) */
#touch-ui:has(#btn-veh:not(.hidden)) #quick button:first-child { bottom: 48px; }
#btn-act, #touch-ui > #btn-act { --c: #8fd6ff; --c2: #2f8bff; --cb: #0f3f96; --dz: 5px; border-width: 3px; border-radius: 50%; }
#stick-base { border: 4px solid rgba(255, 255, 255, 0.75); background: rgba(27, 42, 99, 0.3); box-shadow: 0 0 0 3px rgba(15, 24, 64, 0.5); }
#stick-knob { background: linear-gradient(180deg, #fff, #c9d6ff); border: 3px solid var(--ink); box-sizing: border-box; box-shadow: 0 4px 0 var(--ink-soft); }
body.photo #quick, body.photo #btn-menu { display: none; }
.mi-ic { display: grid; place-items: center; width: 24px; height: 24px; flex: none; }
.mi-ic .gi { width: 100%; height: 100%; }
.mi-raw { font-size: 26px; line-height: 1; }

/* ============================================================ 4. the menu */
/* the game stays in sight under a light blue tint */
#ui-scrim { display: none; position: fixed; inset: 0; z-index: 31; background: rgba(20, 34, 96, 0.5); animation: ui-fade var(--t) ease-out; touch-action: none; }
body:has(.sheet:not(.hidden)) #ui-scrim, body:has(#help:not(.hidden)) #ui-scrim, body:has(#radio-panel:not(.hidden)) #ui-scrim,
body:has(#scores-panel:not(.hidden)) #ui-scrim { display: block; }
body.menu-open #ui-scrim { display: block; z-index: 40; }
body.photo #ui-scrim { display: none; }

#menu { display: none; box-sizing: border-box; color: var(--ui-text); }
#menu #music { position: static; max-width: none; font-size: inherit; z-index: auto; }
#menu #music .title { display: none; }
/* one section — one colour: face --c → --c2, the label band --cd, bottom and outline --cb */
#menu [data-g="play"] { --c: #ffe15a; --c2: #ffa51f; --cd: #b85500; --cb: #7d3700; }
#menu [data-g="hero"] { --c: #ff9cc3; --c2: #f0347f; --cd: #a8114f; --cb: #6e0a34; }
#menu [data-g="city"] { --c: #7df0b8; --c2: #12b886; --cd: #0b7a5c; --cb: #064d3a; }
#menu [data-g="people"] { --c: #8fd6ff; --c2: #1f8bff; --cd: #1259c9; --cb: #0b3a8a; }
#menu [data-g="sound"] { --c: #cdb0ff; --c2: #8a4dff; --cd: #5a25c4; --cb: #3a1585; }
#menu [data-g="more"] { --c: #c9d9ec; --c2: #7f9cc2; --cd: #3f5c84; --cb: #273d5c; }
/* a tile: the picture on the coloured face (it sticks out over the top edge), the name on the dark band below */
#menu .mi {
  --is: 50px; --dz: 5px;
  position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; align-items: center; min-width: 0; min-height: 88px;
  margin: 0; padding: 0; width: auto; height: auto; border-radius: 16px; overflow: visible; font: 700 11.5px/1.15 var(--font-ui); text-align: center; color: #fff;
}
#menu .mi .mi-ic { width: var(--is); height: var(--is); margin: -9px 0 2px; transition: transform var(--t) var(--spring); }
#menu .mi .mi-tx { justify-self: stretch; display: grid; align-content: center; min-height: 2.6em; padding: 3px 2px 4px; border-radius: 0 0 12px 12px; background: var(--cd); overflow-wrap: anywhere; -webkit-hyphens: auto; hyphens: auto; }
.mi b { font-weight: 700; }
.mi small { display: none; margin-top: 1px; font-weight: 500; font-size: 11px; line-height: 1.2; color: #fff; opacity: 0.92; }
@media (hover: hover) {
  #menu .mi:hover .mi-ic { transform: scale(1.16) rotate(-6deg); }
}
/* a hot key: a small key cap in the corner (js/menu.js writes it on desktop only) */
.mi kbd, .menu-head kbd {
  position: absolute; right: 4px; top: 4px; padding: 0 5px; border-radius: 6px; background: rgba(15, 24, 64, 0.72); color: #fff; font: 700 10px/1.6 var(--font-ui); white-space: nowrap;
}
/* switched on (online, music…): a white ring and a green tick in the corner */
#menu .mi.on { box-shadow: 0 var(--dz) 0 var(--cb), 0 0 0 3px #fff; }
#menu .mi.on::before {
  content: '✓'; position: absolute; left: -6px; top: -8px; z-index: 1; width: 22px; height: 22px; border-radius: 50%; background: #3fc23a; border: 2px solid #fff; box-shadow: 0 2px 0 var(--ink);
  color: #fff; font: 900 13px/22px var(--font-ui); text-align: center;
}
#menu .mi.on:active { box-shadow: 0 0 0 var(--cb), 0 0 0 3px #fff; }
#menu #music button.off { opacity: 1; }
#menu #music button.off .mi-ic { opacity: 0.5; filter: grayscale(1); }
/* the language tile shows which one is on: a chip on the picture */
#menu .mi[data-mi="lang"] small {
  display: block; position: absolute; left: 50%; top: 46px; transform: translateX(-50%) rotate(-3deg); margin: 0; padding: 1px 7px; border-radius: 999px;
  background: #fff; color: var(--ink); opacity: 1; font-weight: 900; font-size: 10.5px; line-height: 1.4; white-space: nowrap; box-shadow: 0 2px 0 var(--ink-soft);
}
/* THE main button: «Play» — four cells, the biggest picture, capital letters */
#menu .mi[data-mi="modes"] { grid-column: span 2; grid-row: span 2; --is: 104px; --dz: 6px; border-radius: 22px; font-size: 21px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.02em; }
#menu .mi[data-mi="modes"] .mi-ic { margin-top: -12px; }
#menu .mi[data-mi="modes"] .mi-tx { padding: 7px 8px 9px; border-radius: 0 0 17px 17px; }
#menu .mi[data-mi="modes"] b { font-weight: 900; text-shadow: 0 2px 0 var(--cb); }
#menu .mi[data-mi="modes"] small { display: block; margin-top: 3px; text-transform: none; letter-spacing: 0; font-size: 12px; }
/* (five or more small ones beside it: it stands three rows tall and the block has no hole; the last one is wide) */
#menu .mg-items:where(:has(> .mi:nth-child(6))) > .mi[data-mi="modes"] { grid-row: span 3; }
#menu .mg[data-g="play"] .mi[data-mi="daily"]:last-child { grid-column: span 2; }
.mg-range {
  display: flex; align-items: center; gap: var(--s2); min-height: 48px; padding: 0 12px 0 8px; border-radius: 16px; border: 3px solid var(--cb, var(--ink)); background: var(--cd, var(--navy-2)); box-sizing: border-box;
  grid-column: 1 / -1;
}
.mg-range .mi-ic { width: 34px; height: 34px; }
.mg-range input { flex: 1; min-width: 60px; height: 32px; margin: 0; accent-color: #ffd23f; cursor: pointer; touch-action: none; }
.mg-range b { flex: none; width: 44px; text-align: right; font-weight: 900; font-size: 13px; font-variant-numeric: tabular-nums; color: #fff; }

/* ---- open: a window in the middle (desktop, tablets) */
body.menu-open #menu {
  display: flex; flex-direction: column; position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 41;
  width: min(980px, calc(100vw - 32px)); max-height: min(94vh, 860px); border-radius: 28px; overflow: hidden;
  background: var(--navy); border: 4px solid var(--ink); box-shadow: var(--ui-shadow); animation: ui-pop-c var(--t-slow) var(--spring);
}
.menu-head, .sheet-head {
  --hc: #3f86f5; --hc2: #2259d6; --ht: #fff; --hs: var(--ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 50%), linear-gradient(180deg, var(--hc), var(--hc2)); border-bottom: 4px solid var(--ink); color: var(--ht);
}
.menu-head { display: flex; align-items: center; gap: var(--s3); padding: 9px 10px 9px 22px; }
.menu-title, .sheet-head b, #help > b {
  display: inline-block; font: 900 24px/1.1 var(--font-ui); font-style: normal; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ht, #fff); text-shadow: 0 3px 0 var(--hs, var(--ink)); transform: rotate(-2deg);
}
.menu-sub { flex: 1; min-width: 0; font-size: 13px; line-height: 1.3; font-weight: 500; color: #fff; }
.menu-grab { display: none; }
.menu-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 16px 22px; padding: 16px 22px 24px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
/* the name of a section: a tilted plate of its colour */
.mg h3 {
  display: inline-block; margin: 0 0 14px 2px; padding: 3px 12px 4px; border-radius: 999px; background: var(--cd); border: 2px solid var(--cb); box-shadow: 0 3px 0 var(--cb);
  font: 900 12px/1.2 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: #fff; transform: rotate(-2deg);
}
.mg-items, #menu #music.mg-items { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px 10px; align-items: stretch; justify-content: stretch; padding-bottom: 6px; }
body.menu-open #menu .mi.hidden { display: none; }
body.menu-open #menu .mi { --is: 50px; min-height: 86px; font-size: 12px; }
body.menu-open #menu .mi[data-mi="modes"] { --is: 112px; font-size: 23px; }
/* a wide screen: three columns of sections, the whole menu without scrolling */
@media (min-width: 1100px) {
  body.menu-open #menu { width: min(1200px, calc(100vw - 32px)); }
  .menu-body { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 22px; padding-top: 14px; padding-bottom: 18px; }
  body.menu-open #menu .mi { --is: 46px; min-height: 80px; font-size: 10.5px; }
  body.menu-open #menu .mi[data-mi="modes"] { --is: 118px; font-size: 21px; }
}

/* ---- open: a sheet from the bottom (phones, narrow windows, little height) */
@media (max-width: 699px), (max-height: 520px) {
  body.menu-on #menu {
    --menu-sheet: 1; display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 41;
    width: auto; max-height: 90vh; border-radius: 26px 26px 0 0; overflow: hidden; animation: none;
    background: var(--navy); border: 4px solid var(--ink); border-bottom: 0; box-shadow: none;
    transform: translateY(105%); visibility: hidden; transition: transform var(--t-slow) cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear var(--t-slow);
  }
  body.menu-open #menu { transform: none; visibility: visible; transition: transform var(--t-slow) cubic-bezier(0.2, 0.9, 0.3, 1.12), visibility 0s; }
  #menu.dragging { transition: none !important; }
  .menu-grab { display: block; position: absolute; left: 50%; top: 5px; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: rgba(255, 255, 255, 0.7); }
  .menu-head { position: relative; padding: 14px 6px 7px 16px; touch-action: none; }
  .menu-title { font-size: 22px; }
  .menu-sub { font-size: 12px; }
  .menu-body { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 14px 14px calc(18px + env(safe-area-inset-bottom)); }
  .mg h3 { margin-bottom: 15px; }
  .mg-items, #menu #music.mg-items { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px 8px; }
  body.menu-on #menu .mi { --is: 46px; min-height: 84px; font-size: 11px; }
  body.menu-on #menu .mi[data-mi="modes"] { --is: 118px; font-size: 20px; }
  body.menu-on #menu .mi.hidden { display: none; }
  body.menu-on #menu #music #btn-next { display: grid; } /* style.css hid «next» on phones when the block had four columns */
  #menu .mi[data-mi="lang"] small { top: 38px; }
}
@media (max-width: 380px) {
  body.menu-on #menu .mi { font-size: 10px; }
  .mg-items, #menu #music.mg-items { gap: 17px 6px; }
}
@media (max-height: 520px) {
  /* a phone on its side: the sheet leaves a strip of the scrim on both sides to tap */
  body.menu-on #menu { max-height: calc(100vh - 8px); max-width: 720px; margin: 0 auto; }
  .menu-head { padding-top: 11px; padding-bottom: 5px; }
  .menu-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 16px; align-items: start; }
  body.menu-on #menu .mi { --is: 42px; min-height: 78px; font-size: 10.5px; }
  body.menu-on #menu .mi[data-mi="modes"] { --is: 104px; font-size: 18px; }
}

/* ---- closed, desktop: the dock (a column of icons on the right edge, hint on hover) */
@media (min-width: 1100px) and (min-height: 700px) {
  body:not(.touch):not(.menu-open):not(.photo) #menu {
    --dk: clamp(30px, calc((100vh - 150px) / 17), 40px);
    display: block; position: fixed; right: var(--sr); top: calc(var(--st) + var(--qb) + 14px); z-index: 33; box-sizing: border-box; width: var(--qb); padding: 5px 0;
    border-radius: 24px; background: var(--navy); border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink-soft);
  }
  body:not(.menu-open) #menu .menu-head, body:not(.menu-open) #menu h3, body:not(.menu-open) #menu .mg-range,
  body:not(.menu-open) #menu .mi:not([data-dock]), body:not(.menu-open) #menu :is(.mi-tx, kbd), body:not(.menu-open) #menu .mi.on::before { display: none; }
  body:not(.menu-open) #menu .menu-body { display: block; padding: 0; overflow: visible; }
  body:not(.menu-open) #menu .mg + .mg { margin-top: 3px; padding-top: 3px; border-top: 2px solid rgba(255, 255, 255, 0.16); }
  body:not(.menu-open) #menu .mg-items, body:not(.menu-open) #menu #music.mg-items { display: grid; grid-template-columns: 1fr; justify-items: center; gap: 1px; padding: 0; }
  body:not(.menu-open) #menu .mi {
    --is: calc(var(--dk) - 4px); display: grid; grid-template-rows: none; grid-column: auto; grid-row: auto; place-items: center; width: var(--dk); height: var(--dk); min-height: 0; padding: 0;
    background: none; border: 0; border-radius: 50%; box-shadow: none;
  }
  body:not(.menu-open) #menu .mi .mi-ic { margin: 0; }
  body:not(.menu-open) #menu .mi:hover { transform: none; }
  body:not(.menu-open) #menu .mi:hover .mi-ic { transform: scale(1.28) rotate(-8deg); }
  body:not(.menu-open) #menu .mi:active { transform: scale(0.86); box-shadow: none; }
  body:not(.menu-open) #menu .mg-items > .mi[data-mi="modes"] { grid-row: auto; }
  body:not(.menu-open) #menu .mi.on { background: radial-gradient(circle, #ffe14a 0 62%, rgba(255, 225, 74, 0) 66%); box-shadow: none; }
  body:not(.menu-open) #menu .mi.hidden { display: none; }
  body:not(.touch) #btn-act { right: calc(var(--sr) + var(--qb) + var(--s3)); }
  /* a wide level-up / event banner keeps clear of the dock */
  body:not(.touch) #big-banner { max-width: calc(100vw - 2 * (var(--sr) + var(--qb) + 20px)); }
}
/* ---- hints (js/tips.js): the yellow tilted label on hover / long press, and the one-time «coach» bubble */
#tip-bubble {
  position: fixed; left: 0; top: 0; z-index: 70; box-sizing: border-box; max-width: min(290px, calc(100vw - 12px)); padding: 6px 12px 7px; border-radius: 12px;
  background: linear-gradient(#ffe36b, #ffc21f); border: 2px solid #9a4d00; box-shadow: 0 3px 0 #9a4d00; color: var(--yellow-ink); font: 700 13px/1.3 var(--font-ui); text-align: center;
  pointer-events: none; opacity: 0; visibility: hidden; transform: rotate(-2deg) scale(0.8);
}
#tip-bubble.on { opacity: 1; visibility: visible; transform: rotate(-2deg); transition: opacity var(--t), transform var(--t) var(--spring); }
.coach {
  position: fixed; left: 0; top: 0; z-index: 30; box-sizing: border-box; display: grid; gap: 8px; justify-items: end; max-width: min(300px, calc(100vw - 16px)); padding: 10px 12px 12px;
  border-radius: 18px; background: #fff8e6; border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink-soft); color: #1a2147; font: 700 13.5px/1.35 var(--font-ui); text-align: left;
  pointer-events: none; animation: ui-fade var(--t-slow) ease-out;
}
.coach::after { content: ''; position: absolute; left: var(--ax, 50%); margin-left: -9px; border: 9px solid transparent; }
.coach[data-side="bottom"]::after { top: -17px; border-bottom-color: #fff8e6; filter: drop-shadow(0 -3px 0 var(--ink)); }
.coach[data-side="top"]::after { bottom: -17px; border-top-color: #fff8e6; filter: drop-shadow(0 3px 0 var(--ink)); }
.coach-tx { justify-self: stretch; }
.coach .coach-ok { pointer-events: auto; min-height: 36px; padding: 0 16px; font-size: 13px; --dz: 3px; }
body.touch .coach .coach-ok { min-height: 44px; }
body.photo .coach, body.photo #tip-bubble { display: none; }

/* ============================================================ 5. sheets: modes, quests, records, settings, help, radio, emotes
   (and anything else with the class `sheet`: shops, the town hall, the driving school…) */
.sheet, #scores-panel, #help, body.touch #help, #radio-panel {
  z-index: 32; padding: var(--s4); gap: var(--s3); border-radius: var(--r-panel); color: var(--ui-text); font-weight: 500;
  background: var(--navy); border: 4px solid var(--ink); box-shadow: var(--ui-shadow);
}
.sheet:not(.hidden), #help:not(.hidden), #radio-panel:not(.hidden) { animation: ui-pop-c var(--t-slow) var(--spring); }
.sheet { width: min(660px, calc(100vw - 24px)); max-height: min(86vh, 720px); scroll-padding: 80px 0 12px; }
#loading { scroll-padding-bottom: 96px; }
.sheet-head { position: sticky; top: calc(-1 * var(--s4)); z-index: 3; margin: calc(-1 * var(--s4)) calc(-1 * var(--s4)) 0; padding: 7px 8px 7px 18px; }
.sheet-head b { font-size: 22px; }
#modes-panel .sheet-head { --hc: #ffe15a; --hc2: #ffa51f; --ht: var(--yellow-ink); --hs: rgba(255, 255, 255, 0.5); }
#quests-panel .sheet-head { --hc: #7df0b8; --hc2: #12b886; --ht: #05382a; --hs: rgba(255, 255, 255, 0.45); }
#album-panel .sheet-head, #journal-panel .sheet-head { --hc: #7df0b8; --hc2: #12b886; --ht: #05382a; --hs: rgba(255, 255, 255, 0.45); }
#settings-panel .sheet-head { --hc: #a9bfd8; --hc2: #6f8db3; --ht: #14233d; --hs: rgba(255, 255, 255, 0.45); }
.sheet :where(h3, h4) { margin: 4px 0 0; font-weight: 900; font-size: 15px; letter-spacing: 0.02em; }
.sheet :where(hr) { height: 2px; margin: 4px 0; border: 0; background: rgba(255, 255, 255, 0.14); }
.sheet .dim, .panel .dim { opacity: 1; color: var(--ui-dim); }
/* modes: cards with a big picture that leans out */
.mode-grid { gap: 16px 10px; padding: 8px 0 6px; }
.mode-card { --c: #334aa6; --c2: #263a8c; gap: 10px; min-height: 78px; padding: 8px 12px 8px 8px; border-radius: 18px; text-align: left; }
.mode-icon { display: grid; place-items: center; flex: none; width: 62px; height: 62px; margin: -18px 0 -4px -2px; font-size: 38px; line-height: 1; transition: transform var(--t) var(--spring); }
.mode-icon .gi { width: 100%; height: 100%; }
@media (hover: hover) { .mode-card:hover .mode-icon { transform: scale(1.14) rotate(-7deg); } }
.mode-text b { font-weight: 900; font-size: 15px; line-height: 1.2; }
.mode-text small { opacity: 1; color: #dfe6ff; font-weight: 500; }
.mode-text i { display: block; color: #ffd84a; font-weight: 700; }
.mode-text i .gi { display: inline-block; width: 18px; height: 18px; margin-right: 3px; vertical-align: -4px; }
.mode-card.on .mode-text small { color: #5a3000; }
.mode-card.on .mode-text i { color: #7a2a00; }
.mode-card.off { opacity: 0.55; }
/* tabs, segments */
.tabs { gap: 8px 6px; padding: 0 0 4px; background: none; }
.tabs button { min-height: 44px; padding: 4px 12px; font-size: 13px; line-height: 1.2; }
.seg { gap: 6px 5px; padding-bottom: 4px; }
.seg button, .set-actions button { min-height: 40px; padding: 0 12px; font-size: 13px; --dz: 3px; }
body.touch .seg button, body.touch .set-actions button { min-height: 44px; }
/* «buy» (shops, the driving school — js/rp.js): the yellow main button while it can be afforded */
.sheet button[data-buy]:not(:disabled) { --c: #ffe36b; --c2: #ffa51f; --cb: #9a4d00; --ct: var(--yellow-ink); }
/* rows, plates, bars */
.q-wallet, .wallet { position: relative; border-radius: 16px; background: linear-gradient(180deg, #3462d6, #2447a8); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink-soft); }
.q-wallet { padding: 10px 14px 12px; }
.q-wallet b { font-weight: 900; }
#quests-panel .q-wallet > span:first-of-type { position: relative; padding: 2px 10px 2px 26px; border-radius: 999px; background: var(--well); border: 2px solid var(--ink); color: #ffd84a; font-weight: 900; font-variant-numeric: tabular-nums; }
#quests-panel .q-wallet > span:first-of-type::before { content: ''; position: absolute; left: -10px; top: 50%; width: 34px; height: 34px; margin-top: -18px; background: var(--gi-img) var(--gi-coin) / var(--gi-size) no-repeat; }
.q-wallet small, .q-main small, .score-row small { opacity: 1; color: var(--ui-dim); }
.q-wallet small { color: #e3e9ff; }
.q-row, .q-egg, .score-row, .sheet .beast, :where(.sheet, .panel) :where(.card, li) { border-radius: 14px; background: var(--navy-2); border: 2px solid var(--ink); }
.q-row { align-items: center; padding: 8px 10px; }
/* ---- the quests sheet (js/meta.js): the level on top, tabs with icons, the pranks on a sticker, quests as cards */
.q-level { grid-template-columns: 66px minmax(0, 1fr) auto; grid-template-areas: "medal title coins" "medal bar bar" "medal xp xp"; align-items: center; gap: 5px 12px; padding: 10px 16px 12px 8px; }
.q-level .q-medal { grid-area: medal; width: 68px; height: 68px; margin: -16px 0 -10px; animation: ui-bob 3.2s ease-in-out infinite; }
.q-level > b { grid-area: title; font-size: 17px; line-height: 1.2; }
.q-level > span:first-of-type { grid-area: coins; }
.q-level .q-bar { grid-area: bar; height: 16px; border-radius: 9px; }
.q-level .q-bar i { position: relative; overflow: hidden; min-width: 6px; border-radius: 6px; background: linear-gradient(180deg, #8ff0ff, #2aa8ff); }
.q-level .q-bar i::after { content: ''; position: absolute; inset: 0; width: 60px; background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0)); animation: q-shine 2.4s ease-in-out infinite; }
@keyframes q-shine { 0% { transform: translateX(-80px); } 60%, 100% { transform: translateX(520px); } }
.q-level small { grid-area: xp; }
.tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tab-ic { width: 24px; height: 24px; margin: -4px 0; }
.tab-n { min-width: 20px; padding: 0 5px; border-radius: 10px; background: #ff3b3b; border: 2px solid #fff; color: #fff; font: 900 11px/16px var(--font-ui); font-style: normal; text-align: center; }
.q-cols { display: grid; gap: 16px; align-items: start; }
.q-cards, .q-grid { display: grid; gap: 10px; align-content: start; }
.q-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.q-card { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 12px 10px 8px; border-left-width: 8px; }
.q-card[data-tier="1"] { border-left-color: #3fc23a; }
.q-card[data-tier="2"] { border-left-color: #2aa8ff; }
.q-card[data-tier="3"] { border-left-color: #ffb81f; }
.q-card .q-icon { width: 48px; }
.q-card .q-icon .gi { width: 46px; height: 46px; }
.q-card .q-main b { font-weight: 900; }
.q-prize { display: grid; gap: 5px; justify-items: end; }
.chip-c, .chip-x { display: block; padding: 2px 9px 3px; border-radius: 999px; border: 2px solid var(--ink); box-shadow: 0 2px 0 var(--ink); font: 900 12px/1.3 var(--font-ui); font-style: normal; white-space: nowrap; }
.chip-c { background: linear-gradient(#ffe36b, #ffb81f); color: var(--yellow-ink); }
.chip-x { background: linear-gradient(#b9e4ff, #5cb2ff); color: #06224f; }
.q-card.done .q-prize, .q-card.done .q-bar { opacity: 0.45; }
/* done: a stamp, a little askew (only the stamp — the text stays straight) */
.q-stamp { position: absolute; right: 8px; top: 50%; padding: 3px 9px 4px; border-radius: 8px; border: 3px solid #b6f58a; background: rgba(15, 40, 34, 0.88); color: #b6f58a; font: 900 13px/1.2 var(--font-ui); font-style: normal; letter-spacing: 0.06em; white-space: nowrap; transform: translateY(-50%) rotate(-7deg); }
/* the pranks of the day: a note on a yellow sticker, with a strip of tape */
.q-note { position: relative; display: grid; gap: 0; padding: 20px 14px 12px; border-radius: 4px 4px 16px 4px; background: repeating-linear-gradient(180deg, #fff3a8 0 31px, #ecdf8e 31px 32px); box-shadow: 0 5px 0 rgba(10, 16, 46, 0.35); color: #33280a; }
.q-note::before { content: ''; position: absolute; left: 50%; top: -9px; width: 92px; height: 20px; margin-left: -46px; background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(60, 40, 0, 0.12); transform: rotate(-2deg); }
.sheet .q-note .prank-head { margin: 0 0 4px; font-size: 15.5px; color: #33280a; }
.sheet .q-note .prank-head span { opacity: 1; font-weight: 900; }
.sheet .q-note .q-row.prank { min-height: 44px; padding: 6px 2px; border: 0; border-bottom: 2px dashed rgba(60, 40, 0, 0.22); border-radius: 0; background: none; color: #33280a; }
.sheet .q-note .q-row.prank .q-main b { font-weight: 700; }
.sheet .q-note .q-row.prank.done .q-main b { text-decoration: line-through; opacity: 0.55; }
.sheet .q-note .q-main small, .sheet .q-note .dim { color: #6b5512; }
.sheet .q-note .dim { padding-top: 8px; }
.sheet .q-note .prank-sep { display: none; }
.q-row.done { opacity: 1; background: #1f5a4a; }
.q-row.done .q-main b { text-decoration: none; }
.q-icon { display: grid; place-items: center; flex: none; width: 34px; font-size: 22px; }
.q-icon .gi { width: 34px; height: 34px; }
.q-main b { font-weight: 700; }
.score-row { padding: 7px 12px; font-weight: 700; }
.score-row:nth-child(1) > span:first-child { font-size: 19px; }
.score-row b { color: #ffd84a; font-weight: 900; }
.area-grid { gap: 9px 6px; padding-bottom: 4px; }
.area-grid button { min-height: 44px; padding: 6px 10px; font-size: 13px; text-align: left; --dz: 3px; --c: #34489c; --c2: #2a3b86; --ct: var(--ui-dim); }
.area-grid button.on { --c: #1a7d52; --c2: #116540; --cb: #053a26; --ct: #fff; }
.area-grid button.here { box-shadow: 0 var(--dz) 0 var(--cb), 0 0 0 3px #ffd84a; }
/* the journal of the easter eggs (js/journal.js): cards with a rim of the colour of their rarity */
#journal-panel .jr-sum > span:first-of-type { font-weight: 900; color: #ffe36b; }
#journal-panel .jr-chip { padding: 3px 10px; border-radius: 999px; background: var(--well); border: 2px solid var(--ink); font-weight: 900; }
#journal-panel .jr-more small, #journal-panel .jr-sort small, #journal-panel .jr-recent { color: var(--ui-dim); font-weight: 700; }
#journal-panel .jr-grid { gap: 12px 8px; padding-bottom: 6px; }
#journal-panel .jr-card { border-radius: 16px; background: var(--navy-2); border: 3px solid var(--rc); box-shadow: 0 4px 0 var(--ink-soft); }
#journal-panel .jr-card.on { background: color-mix(in srgb, var(--rc) 20%, var(--navy-2)); }
#journal-panel .jr-card.miss { opacity: 0.8; background: var(--well); border-style: dashed; }
#journal-panel .jr-icon { font-size: 34px; }
#journal-panel .jr-card b { font-weight: 900; }
#journal-panel .jr-card small { opacity: 1; color: #dfe6ff; }
#journal-panel .jr-card i { opacity: 1; color: var(--ui-dim); }
#journal-panel .jr-map, #journal-panel .jr-more button { --dz: 3px; }
.sheet .beast { opacity: 0.7; }
.sheet .beast.on { opacity: 1; background: #2f6b4f; border-color: var(--ink); }
.sheet .prank-head b { font-weight: 900; }
.sheet .prank-sep { height: 2px; background: rgba(255, 255, 255, 0.14); }
:where(.sheet, .panel) :where(ul, ol) { margin: 0; padding: 0; display: grid; gap: 6px; list-style: none; }
:where(.sheet, .panel) :where(li, .card) { padding: 8px 12px; }
:where(.sheet, .panel) :where(.price) { color: #ffd84a; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
:where(.sheet, .panel) :where(progress, meter) { -webkit-appearance: none; appearance: none; display: block; width: 100%; overflow: hidden; }
:where(.sheet, .panel) :where(progress)::-webkit-progress-bar { background: var(--well); }
:where(.sheet, .panel) :where(progress)::-webkit-progress-value { background: linear-gradient(180deg, #ffe36b, #ffa51f); border-radius: 4px; }
/* settings */
.set-row { gap: 6px 12px; min-height: 50px; padding: 3px 0; font-weight: 700; }
.set-row + .set-row, .set-row + .dim + .set-row { border-top: 2px solid rgba(255, 255, 255, 0.1); }
.set-row b { font-weight: 900; color: #ffd84a; }
.set-row input[type="range"], :where(.sheet, .panel) input[type="range"] { accent-color: #ffd23f; }

#help, body.touch #help {
  left: 50%; top: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); width: min(640px, calc(100vw - 24px)); max-width: none;
  max-height: calc(100vh - 24px); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; padding: var(--s4) 20px; font-size: 14px; line-height: 1.8;
}
#help > b { margin-right: 8px; font-size: 22px; }
#help .dim { opacity: 1; color: var(--ui-dim); font-size: 12px; }
#help .for-keys, #help .for-touch { margin-top: var(--s2); }
#help div b { font-weight: 700; }

/* ---- the radio receiver (js/radio.js): groups -> stations, what plays now on top */
#radio-panel { width: min(760px, calc(100vw - 24px)); gap: 0; }
.rd-top { position: sticky; top: calc(-1 * var(--s4)); z-index: 3; margin: calc(-1 * var(--s4)) calc(-1 * var(--s4)) 0; background: var(--navy); border-bottom: 3px solid var(--ink); }
.rd-top .sheet-head { position: static; margin: 0; --hc: #b48cff; --hc2: #7445ee; }
.rd-now { display: flex; align-items: stretch; gap: 8px; padding: 10px var(--s4) 12px; }
#radio-panel .rd-key { flex: none; display: grid; place-items: center; width: 48px; min-height: 48px; padding: 0; border-radius: 14px; --c: #9a78f0; --c2: #6a3fd0; --cb: #2c0f6e; }
.rd-key .ic { width: 30px; height: 30px; }
.rd-flip { transform: scaleX(-1); }
.rd-dice span { font-size: 24px; line-height: 1; }
/* the screen of a car radio */
#radio-panel .rd-screen {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 12px; border-radius: 14px; text-align: left;
  background: #0b1230; border: 3px solid var(--ink); box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.45), 0 2px 0 rgba(255, 255, 255, 0.12); color: #b9ff8a;
}
#radio-panel .rd-screen:active, #radio-panel .rd-screen:hover { transform: none; box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.45), 0 2px 0 rgba(255, 255, 255, 0.12); }
.rd-np { display: grid; min-width: 0; }
.rd-np small { font-weight: 700; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: #8fb2ff; }
.rd-np b { font-weight: 900; font-size: 16px; line-height: 1.2; overflow-wrap: anywhere; }
.rd-now:not(.on) .rd-screen { color: #9aa6d6; }
.rd-eq { flex: none; display: flex; align-items: flex-end; gap: 3px; width: 22px; height: 22px; }
.rd-eq i { flex: 1; height: 100%; border-radius: 2px; background: currentColor; transform-origin: 50% 100%; transform: scaleY(0.25); }
.rd-now.on .rd-eq i { animation: rd-eq 0.9s ease-in-out infinite; }
.rd-now.on .rd-eq i:nth-child(2) { animation-delay: -0.5s; }
.rd-now.on .rd-eq i:nth-child(3) { animation-delay: -0.2s; }
.rd-now.on .rd-eq i:nth-child(4) { animation-delay: -0.7s; }
@keyframes rd-eq { 0%, 100% { transform: scaleY(0.25); } 50% { transform: scaleY(1); } }
.rd-body { padding-top: 12px; }
.rd-ask { font-weight: 900; font-size: 15px; }
/* step 1: the groups — big cards, one colour each (a ribbon of the flag where there is one) */
.rd-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 22px 12px; padding: 22px 0 8px; }
#radio-panel .rd-group {
  position: relative; display: grid; grid-template-columns: 62px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 92px; padding: 14px 12px 12px 12px; border-radius: 20px; text-align: left;
  --c: #4460c4; --c2: #3149a6; --cb: var(--ink); --ct: #fff; --dz: 5px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 40%), linear-gradient(180deg, var(--c), var(--c2)); border-color: var(--cb); color: var(--ct);
}
.rd-group .rd-ic { width: 68px; height: 68px; margin: -20px 0 -4px -6px; transition: transform var(--t) var(--spring); }
@media (hover: hover) { .rd-group:hover .rd-ic { transform: scale(1.12) rotate(-6deg); } }
.rd-tx { display: grid; gap: 3px; min-width: 0; }
.rd-tx b { font-weight: 900; font-size: 16px; line-height: 1.15; overflow-wrap: anywhere; }
.rd-tx small { font-weight: 500; font-size: 12px; line-height: 1.3; }
.rd-n { position: absolute; right: 8px; top: -13px; padding: 2px 9px 3px; border-radius: 999px; background: #fff; border: 2px solid var(--ink); color: var(--ink); font: 900 11px/1.3 var(--font-ui); font-style: normal; white-space: nowrap; transform: rotate(3deg); }
#radio-panel .rd-group.on { box-shadow: 0 var(--dz) 0 var(--cb), 0 0 0 3px #fff; }
#radio-panel .rd-group.on:active { box-shadow: 0 0 0 var(--cb), 0 0 0 3px #fff; }
#radio-panel .rg-sea { --c: #1a72d6; --c2: #0f4fa8; --cb: #082f6e; }
#radio-panel .rg-lt { --c: #157a44; --c2: #0d5c31; --cb: #06381d; }
#radio-panel .rg-ru { --c: #c2306b; --c2: #8f1648; --cb: #5a0a2b; }
#radio-panel .rg-ua { --c: #1763c9; --c2: #0f4696; --cb: #082a5e; }
#radio-panel .rg-in { --c: #b3500a; --c2: #8a3a06; --cb: #542202; }
#radio-panel .rg-game { --c: #7a52dd; --c2: #5f36c4; --cb: #2c0f6e; }
#radio-panel .rg-mine { --c: #ffe36b; --c2: #ffa51f; --cb: #9a4d00; --ct: var(--yellow-ink); }
.rd-group:is(.rg-lt, .rg-ua, .rg-in)::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 7px; border-radius: 0 4px 4px 0; }
.rd-group.rg-lt::before { background: linear-gradient(180deg, #fdb913 0 33%, #00a35c 33% 66%, #e0343a 66%); }
.rd-group.rg-ua::before { background: linear-gradient(180deg, #4aa3ff 0 50%, #ffd700 50%); }
.rd-group.rg-in::before { background: linear-gradient(180deg, #ff9933 0 33%, #fff 33% 66%, #2fae4f 66%); }
/* step 2: the stations of the group */
.rd-bar { display: flex; align-items: center; gap: 10px; padding: 6px 12px 7px 6px; border-radius: 16px; background: linear-gradient(180deg, var(--c, #4460c4), var(--c2, #3149a6)); border: 3px solid var(--cb, var(--ink)); color: var(--ct, #fff); }
.rd-bar b { flex: 1; min-width: 0; font-weight: 900; font-size: 17px; overflow-wrap: anywhere; }
.rd-bar small { flex: none; font-weight: 700; font-size: 12px; white-space: nowrap; }
.rd-bar .rd-ic { width: 40px; height: 40px; margin: -8px 0; }
#radio-panel .rd-back { flex: none; min-height: 40px; padding: 0 12px 0 10px; font-size: 13px; --c: #fff; --c2: #dfe6ff; --cb: var(--ink); --ct: var(--ink); --dz: 3px; }
body.touch #radio-panel .rd-back { min-height: 44px; }
.rd-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px 10px; padding: 14px 0 8px; }
.rd-st { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 6px; }
#radio-panel .rd-play { display: grid; align-content: center; gap: 2px; min-height: 58px; padding: 7px 12px 8px; text-align: left; --c: #334aa6; --c2: #263a8c; }
.rd-play b { font-weight: 900; font-size: 15px; line-height: 1.2; overflow-wrap: anywhere; }
.rd-play small { font-weight: 500; font-size: 12px; line-height: 1.3; color: #dfe6ff; }
#radio-panel .rd-st.on .rd-play { --c: #ffe36b; --c2: #ffb81f; --cb: #9a4d00; --ct: var(--yellow-ink); }
.rd-st.on .rd-play small { color: #5a3000; }
.rd-air { display: inline-block; margin-left: 8px; padding: 1px 7px 2px; border-radius: 999px; background: #c41a0a; color: #fff; font: 900 10px/1.4 var(--font-ui); font-style: normal; letter-spacing: 0.06em; text-transform: uppercase; vertical-align: 2px; }
#radio-panel .rd-star { display: grid; place-items: center; padding: 0; font-size: 24px; line-height: 1; --c: #334aa6; --c2: #263a8c; --cb: var(--ink); --ct: #c6d0f7; }
#radio-panel .rd-star.on { --c: #334aa6; --c2: #263a8c; --cb: var(--ink); --ct: #ffd84a; background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 46%), linear-gradient(180deg, var(--c), var(--c2)); border-color: var(--cb); color: var(--ct); }
#radio-panel .foot { padding-top: 6px; opacity: 1; color: var(--ui-dim); font-size: 11.5px; }
/* the first visit: the receiver over the start screen, three buttons to go on */
#radio-scrim { display: none; position: fixed; inset: 0; z-index: 52; background: rgba(20, 34, 96, 0.55); }
body.radio-first-open #radio-scrim { display: block; }
#radio-panel.first { z-index: 53; }
.rd-first { position: sticky; bottom: calc(-1 * var(--s4)); z-index: 2; display: flex; flex-wrap: wrap; gap: 10px 8px; margin: 6px calc(-1 * var(--s4)) 0; padding: 12px var(--s4) 12px; background: var(--navy); border-top: 3px solid var(--ink); }
.rd-first button { flex: 1 1 150px; min-height: 48px; }
.rd-first button.primary { flex: 2 1 220px; font-weight: 900; font-size: 15px; }
/* …and the card on the start screen that opens it (in the slot #radio-first of js/profile.js) */
#radio-first:empty { display: none; }
.rd-tease {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; box-sizing: border-box; width: 100%; padding: 8px 10px 10px 8px; border-radius: 18px; text-align: left; cursor: pointer;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 46%), linear-gradient(180deg, #7a52dd, #5f36c4); border: 3px solid #2c0f6e; box-shadow: 0 4px 0 #2c0f6e; color: #fff;
}
.rd-tease .rd-ic { width: 54px; height: 54px; margin: -6px 0; animation: ui-bob 2.4s ease-in-out infinite; }
.rd-tease .rd-tx { flex: 1 1 150px; }
.rd-tease .rd-tx b { font-size: 15.5px; }
.rd-tease .rd-tease-go { flex: none; min-height: 40px; padding: 0 14px; font-size: 13.5px; --dz: 3px; }
body.touch .rd-tease .rd-tease-go { min-height: 44px; }
#loading.wardrobe #radio-first { display: none; }

/* emotes (#emote-bar, the markup is in index.html): ten round buttons — emoji, two drawings of the atlas, the pink
   soup and «Labas!»; a key cap with the number on a desktop, two rows of five on a phone */
#emote-bar {
  left: 50%; right: auto; top: calc(var(--bt) + var(--bn, 0px) + 12px); transform: translateX(-50%); grid-template-columns: repeat(10, 52px); gap: 8px; counter-reset: emote;
  padding: 10px 10px 14px; border-radius: 26px; background: var(--navy); border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink-soft); z-index: 30; animation: ui-fade var(--t) ease-out;
}
#emote-bar button { position: relative; display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border-radius: 50%; --c: #fff; --c2: #d5e0ff; --cb: #5468b0; font-size: 26px; line-height: 1; counter-increment: emote; }
#emote-bar button:nth-child(odd) { --c: #fffbe6; --c2: #ffe9a8; --cb: #b8862b; }
#emote-bar button > * { pointer-events: none; }
#emote-bar .gi { width: 40px; height: 40px; }
.em-soup { display: block; width: 36px; height: 36px; border-radius: 50%; background: radial-gradient(circle at 63% 56%, #ffc928 0 11%, #fffdf3 12% 25%, transparent 26%), radial-gradient(circle, #f58fc6 0 58%, #fff 59% 76%, #14224a 77%); }
.em-word { display: block; padding: 2px 4px 3px; border-radius: 7px; background: #ffd23f; border: 2px solid var(--ink); color: var(--yellow-ink); font: 900 10px/1.1 var(--font-ui); font-style: normal; transform: rotate(-8deg); }
@media (hover: hover) {
  #emote-bar button:hover { transform: translateY(-4px) rotate(-6deg) scale(1.1); }
  body:not(.touch) #emote-bar button::after { content: counter(emote); position: absolute; right: -4px; bottom: -6px; min-width: 16px; padding: 0 3px; border-radius: 6px; background: var(--ink); color: #fff; font: 700 10px/1.6 var(--font-ui); }
  body:not(.touch) #emote-bar button:nth-child(10)::after { content: '0'; }
}
#emote-bar button:active { transform: translateY(var(--dz)) scale(0.92); }

/* ============================================================ 6. start screen and the wardrobe (js/profile.js) */
#loading {
  background:
    radial-gradient(90% 50% at 50% 112%, rgba(255, 214, 107, 0.55), rgba(255, 214, 107, 0) 70%),
    repeating-conic-gradient(from -4deg at 50% 112%, rgba(255, 255, 255, 0.07) 0 5deg, rgba(255, 255, 255, 0) 5deg 10deg),
    linear-gradient(180deg, #0d3a94 0%, #1459c8 55%, #1c74e0 100%);
  font-size: 15px; letter-spacing: 0;
}
#loading > span { display: grid; justify-items: center; gap: 14px; font: 900 22px/1.3 var(--font-ui); color: #fff; text-shadow: 0 3px 0 var(--ink); }
#loading > span::before { content: ''; width: 112px; height: 112px; background: var(--gi-img) var(--gi-gull) / var(--gi-size) no-repeat; animation: ui-bob 1.6s ease-in-out infinite; }
#loading .start {
  display: flex; flex-direction: column; gap: 14px; box-sizing: border-box; width: min(540px, 100%); padding: 20px 20px 18px;
  border-radius: 26px; background: var(--card); border: 4px solid var(--ink); box-shadow: var(--ui-shadow); --card: #1b2a63;
}
/* the start button is always in sight: a bar that sticks to the bottom edge, the list scrolls away under its fade */
.start-bar {
  /* (sticky counts from the content edge of the scrolling box: the negative offset takes the bar down over its padding) */
  --pad: max(24px, env(safe-area-inset-bottom));
  position: sticky; bottom: calc(-1 * var(--pad)); z-index: 2; display: flex; justify-content: center; margin: -6px -20px 0; padding: 24px 20px calc(var(--pad) - 2px);
  background: linear-gradient(180deg, rgba(27, 42, 99, 0), var(--card) 40%); pointer-events: none;
}
#loading.wardrobe .start-bar { --pad: 18px; }
.start-top { display: flex; justify-content: center; }
.langs { margin: 0; gap: 6px; padding: 0 0 4px; background: none; }
.langs button { min-width: 54px; min-height: 40px; padding: 0 12px; border-radius: 999px; font-weight: 900; font-size: 13px; --dz: 3px; }
/* the name of the game: fat yellow letters, a dark outline, a hard shadow, a tilt — and a gull on the last letter */
#loading .logo {
  position: relative; align-self: center; font: 900 clamp(36px, 11.5vw, 64px)/1 var(--font-ui); font-style: normal; text-transform: uppercase; letter-spacing: 0.01em;
  color: #ffd84a; -webkit-text-stroke: 0.16em var(--ink); paint-order: stroke fill; text-shadow: 0 0.1em 0 var(--ink), 0 0.17em 0 rgba(10, 16, 46, 0.35); transform: rotate(-3deg); margin: 10px 0 4px;
}
#loading .logo::after { content: ''; position: absolute; right: -0.28em; top: -0.72em; width: 0.95em; height: 0.95em; background: var(--gi-img) var(--gi-gull) / var(--gi-size) no-repeat; transform: rotate(8deg); }
#loading .sub { margin: 0 auto; max-width: 44ch; opacity: 1; color: #fff; letter-spacing: 0; font-size: 14px; line-height: 1.45; font-weight: 500; }
.creator { margin: 0; gap: var(--s3); }
.creator input { text-align: center; }
/* heroes: three cards, the picture leans out over the top edge */
.heroes { gap: 10px; margin-top: 30px; padding-bottom: 5px; }
.heroes button { display: grid; justify-items: center; gap: 2px; padding: 0 4px 9px; border-radius: 18px; font-weight: 900; font-size: 14px; line-height: 1.2; --dz: 5px; }
.heroes button .ic { width: 84px; height: 84px; margin-top: -32px; transition: transform var(--t) var(--spring); }
.heroes button span { font-size: 14px; }
.heroes button.on .ic { transform: scale(1.14) rotate(-5deg); }
.heroes button:not(.on) .ic { filter: saturate(0.75); }
.swatches, .hats { gap: 9px 7px; padding-bottom: 4px; }
.hats button, .swatches button { min-height: 40px; padding: 6px 12px; border-radius: 999px; font-size: 13px; line-height: 1.2; --dz: 3px; }
body.touch .hats button, body.touch .swatches button { min-height: 44px; }
/* (a colour button carries its colour inline as --c — the very name of the face variable: its face is said in full) */
.swatches button { background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 46%), linear-gradient(180deg, #4460c4, #3149a6); }
.swatches button.locked { background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 46%), linear-gradient(180deg, #2a3566, #232c57); }
.swatches button.on { background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 46%), linear-gradient(180deg, #ffe36b, #ffb81f); }
.swatches button.pending { background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 46%), linear-gradient(180deg, #8be85a, #3fc23a); }
.swatches i:not(.gi) { width: 18px; height: 18px; box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px #fff; margin-right: 3px; }
.swatches i.gi, .hats i.gi { width: 1.35em; height: 1.35em; margin: 0 3px 0 0; border-radius: 0; box-shadow: none; background: var(--gi-img) 0 0 / var(--gi-size) no-repeat; }
.lock { display: inline-flex; align-items: center; margin-left: 4px; }
.hats button.locked, .swatches button.locked { border-style: solid; --c: #2a3566; --c2: #232c57; --ct: var(--ui-dim); }
.hats button.pending, .swatches button.pending { border-style: solid; --c: #8be85a; --c2: #3fc23a; --cb: #17641b; --ct: #062b08; }
.lock { opacity: 1; font-weight: 700; font-size: 11.5px; }
.wallet { font-size: 14px; padding: 9px 14px 10px 44px; font-weight: 500; text-align: left; }
.wallet::before { content: ''; position: absolute; left: 2px; top: 50%; width: 40px; height: 40px; margin-top: -21px; background: var(--gi-img) var(--gi-coin) / var(--gi-size) no-repeat; }
.wallet b { color: #ffe36b; font-weight: 900; }
.wallet .dim { opacity: 1; color: #e3e9ff; }
.shop-msg { color: #ffe36b; font-weight: 700; }
.look-extra { margin-top: 0; }
.look-label { opacity: 1; color: var(--ui-dim); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
button.link, .more-look summary { color: #fff0a8; font-weight: 700; }
/* (the bar lets taps through to the list under its fade; the button takes them only while the screen is shown:
   after the start #loading is merely transparent, and a «live» invisible button would sit over GAS) */
#loading:not(.done) .start-bar #btn-start, #loading.wardrobe .start-bar #btn-start { pointer-events: auto; }
.start-bar #btn-start {
  position: static; min-height: 64px; padding: 0 44px 2px; border-radius: 22px; border-width: 4px; --dz: 7px;
  font: 900 23px/1 var(--font-ui) !important; letter-spacing: 0.03em; text-transform: uppercase; text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5);
}
.acct { margin-top: 0; opacity: 1; color: #fff; font-weight: 500; }
.panel { margin-top: 0; border-radius: 18px; background: var(--navy-2); border: 3px solid var(--ink); }
.sheet.panel, #scores-panel.panel { background: var(--navy); border-width: 4px; border-radius: var(--r-panel); }
.panel .row { padding-bottom: 4px; }
.panel .row button { min-height: 46px; font-size: 14px; }
.panel > b { font-weight: 900; }
#loading .look-x { display: none; }
/* «full screen» on the start screen (js/fullscreen.js puts it next to the languages) */
.start-top { gap: 10px; align-items: flex-start; }
#btn-fs { flex: none; display: grid; place-items: center; width: 46px; min-height: 40px; padding: 0; border-radius: 14px; --dz: 3px; }
#btn-fs .ic { width: 30px; height: 30px; }
#btn-fs.on { --c: #ffe36b; --c2: #ffb81f; --cb: #9a4d00; }
body.touch #btn-fs { min-height: 44px; }
.fs-hint { align-self: center; max-width: 34ch; padding: 6px 12px; border-radius: 12px; background: #fff8e6; border: 2px solid var(--ink); color: #1a2147; font-weight: 700; font-size: 12.5px; line-height: 1.35; text-align: center; }
#loading.wardrobe #btn-fs, #loading.wardrobe .fs-hint { display: none; }

/* a wide screen: the title, the start button and the account on the left, the creator as a card on the right */
@media (min-width: 1000px) and (min-height: 600px) {
  #loading:not(.wardrobe) .start {
    display: grid; grid-template-columns: minmax(300px, 500px) minmax(0, 560px); grid-template-rows: repeat(7, auto) 1fr; gap: 18px 56px;
    justify-items: start; align-items: start; width: auto; max-width: 100%; padding: 0; background: none; border: 0; box-shadow: none; text-align: left;
  }
  #loading:not(.wardrobe) .start > * { grid-column: 1; }
  #loading:not(.wardrobe) .logo { grid-row: 1; align-self: start; margin: 9vh 0 6px 10px; font-size: clamp(48px, 4.5vw, 74px); white-space: nowrap; }
  #loading:not(.wardrobe) .sub { grid-row: 2; margin: 0; max-width: 34ch; font-size: 17px; font-weight: 700; text-shadow: 0 2px 0 rgba(15, 24, 64, 0.6); }
  #loading:not(.wardrobe) .start-bar { grid-row: 3; position: static; margin: 12px 0 10px; padding: 0; background: none; }
  #loading:not(.wardrobe) .start-bar #btn-start { min-height: 76px; padding: 0 56px 2px; font-size: 28px !important; border-radius: 26px; }
  #loading:not(.wardrobe) #radio-first { grid-row: 4; width: 100%; max-width: 470px; }
  #loading:not(.wardrobe) .start-top { grid-row: 5; }
  #loading:not(.wardrobe) .acct { grid-row: 6; justify-content: flex-start; text-shadow: 0 2px 0 rgba(15, 24, 64, 0.6); font-weight: 700; }
  #loading:not(.wardrobe) #acct-panel { grid-row: 7; width: 100%; box-sizing: border-box; }
  #loading:not(.wardrobe) .creator {
    grid-column: 2; grid-row: 1 / -1; box-sizing: border-box; width: 100%; max-height: calc(100vh - 56px); overflow-y: auto; overscroll-behavior: contain;
    padding: 22px 22px 24px; border-radius: 26px; background: var(--card); border: 4px solid var(--ink); box-shadow: var(--ui-shadow); text-align: center;
  }
}

/* the wardrobe: the same creator over the running game */
#loading.done.wardrobe { opacity: 1; pointer-events: auto; z-index: 34; overflow: hidden; background: rgba(20, 34, 96, 0.35); transition: opacity var(--t); place-items: center end; padding-right: max(76px, env(safe-area-inset-right)); }
#loading.wardrobe .start {
  position: relative; width: min(460px, 100%); max-height: 100%; overflow-y: auto; overscroll-behavior: contain; margin: 0; background: var(--card);
  animation: ui-pop var(--t-slow) var(--spring); text-align: center;
}
#loading.wardrobe :is(.langs, .acct, #acct-panel) { display: none; }
#loading.wardrobe .start-top { display: contents; }
#loading.wardrobe .look-x { display: grid; position: absolute; right: 8px; top: 8px; z-index: 3; }
#loading.wardrobe .logo {
  align-self: flex-start; font-size: 24px; line-height: 44px; margin: -10px 52px 0 0; text-align: left; color: #fff; -webkit-text-stroke: 0; text-shadow: 0 3px 0 var(--ink); transform: rotate(-2deg);
}
#loading.wardrobe .logo::after { display: none; }
#loading.wardrobe .sub { margin: -8px 0 0; text-align: left; font-size: 13px; color: var(--ui-dim); }
#loading.wardrobe #btn-start { min-height: 52px; padding: 0 36px 2px; font-size: 18px !important; --dz: 5px; }

/* ============================================================ 7. layouts */
body { --bt: var(--st); }
/* narrow desktop window: the banner goes under the stats card */
@media (max-width: 1099px) {
  body:not(.touch) { --bt: calc(var(--st) + var(--hh, 96px) + 12px); }
  #banner { max-width: calc(100vw - 24px); }
}
/* touch screens: minimap top left, the status pill beside it, the banner under the pill */
body.touch { --mm: 116px; --bt: calc(var(--st) + var(--hh, 36px) + 12px); }
body.touch #hud {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; box-sizing: border-box;
  left: calc(var(--sl) + var(--mm) + 12px); right: auto; top: var(--st); max-width: calc(100vw - var(--sl) - var(--sr) - var(--mm) - 2 * var(--qb) - 44px);
  padding: 4px 12px 8px; border-radius: 18px; font-size: 12px; line-height: 1.5; white-space: nowrap;
}
body.touch #hud .hud-row { flex-wrap: nowrap; gap: 0 8px; }
body.touch #hud .stat { gap: 3px; }
body.touch #hud .stat b { font-size: 15px; }
body.touch #hud-level, body.touch #hud-coins { height: 20px; padding: 0 7px 0 19px; font-size: 12px; }
body.touch #hud-level::before, body.touch #hud-coins::before { left: -8px; width: 26px; height: 26px; margin-top: -14px; }
body.touch #hud .unit { font-size: 11px; }
body.touch #hud-wallet { margin: 0; gap: 3px 9px; padding-left: 7px; font-size: 12px; min-width: 0; }
body.touch #hud-xp { position: absolute; left: 14px; right: 14px; bottom: 3px; height: 3px; min-width: 0; border: 0; border-radius: 2px; background: rgba(255, 255, 255, 0.2); }
body.touch #hud .hud-meta, body.touch #hud-place { display: none; }
body.touch #hud-gain { left: auto; right: 0; top: 100%; bottom: auto; margin: 7px 0 0; }
body.touch.no-minimap #banner { left: var(--sl); }
body.touch #banner {
  left: calc(var(--sl) + var(--mm) + 12px); right: auto; transform: none; width: max-content; justify-items: start;
  max-width: calc(100vw - var(--sl) - var(--sr) - var(--mm) - 12px);
}
body.touch #banner > div { text-align: left; }
body.touch #chat-log { bottom: 190px; }

/* phone held upright (and any window narrower than 600 px): ☰ row, the pill under it, the banner across */
@media (max-width: 699px) and (orientation: portrait), (max-width: 599px) {
  :root { --cols: 2; --rows: 1; }
  body.touch { --mm: 100px; --bt: calc(var(--st) + max(var(--mm), var(--qb) + 12px + var(--hh, 36px)) + 12px); }
  body.touch #hud, body.touch.no-minimap #hud {
    left: auto; right: var(--sr); top: calc(var(--st) + var(--qb) + 12px); max-width: calc(100vw - var(--sl) - var(--sr) - var(--mm) - 10px); font-size: 12px;
  }
  body.touch.no-minimap #hud { max-width: calc(100vw - var(--sl) - var(--sr)); }
  #banner, body.touch #banner, body.touch.no-minimap #banner { left: var(--sl); right: var(--sr); transform: none; width: auto; max-width: none; justify-items: center; }
  body.touch #banner > div { text-align: center; }
  #banner > div { border-radius: 14px; font-size: 13px; padding: 5px 12px 6px; }
  .toast { font-size: 13px; padding: 7px 12px 8px; }
  #emote-bar { grid-template-columns: repeat(5, 52px); gap: 8px; }
  body.touch #btn-act { bottom: calc(max(28px, env(safe-area-inset-bottom)) + 112px + 12px + 52px + 12px); right: max(20px, env(safe-area-inset-right)); width: 64px; height: 64px; }
  /* (the level-up plate with a long second line keeps clear of the action button under it) */
  #big-banner { padding: 9px 14px 11px; }
  #big-banner .bb-sub { margin-top: 4px; font-size: 13.5px; line-height: 1.3; }
  body.touch #big-banner { top: max(calc(50% - 84px), calc(var(--bt, 0px) + var(--bn, 0px) + 26px)); }
  body.touch.story-card #big-banner, body.touch.orace-card #big-banner { top: max(calc(50% - 84px), calc(var(--bt) + var(--bn, 0px) + var(--tt, 108px) + 34px)); }
  /* sheets rise from the bottom edge, like the menu */
  .sheet, #radio-panel, #help, body.touch #help {
    left: 0; right: 0; top: auto; bottom: 0; transform: none; width: auto; max-height: 86vh; border-radius: 26px 26px 0 0; border-bottom: 0; box-shadow: none;
    padding-bottom: calc(var(--s4) + env(safe-area-inset-bottom));
  }
  .sheet:not(.hidden), #help:not(.hidden), #radio-panel:not(.hidden) { animation: ui-rise var(--t-slow) cubic-bezier(0.2, 0.9, 0.3, 1.12); }
  .sheet-head b, #help > b { font-size: 20px; }
  .mode-grid { grid-template-columns: 1fr; }
  #loading { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  #loading .start { padding: 16px 14px 16px; gap: var(--s3); }
  .start-bar { margin: -6px -14px 0; padding-left: 14px; padding-right: 14px; }
  .start-bar #btn-start { padding-left: 30px; padding-right: 30px; font-size: 21px !important; }
  #loading .sub { font-size: 13.5px; }
  .heroes button .ic { width: 76px; height: 76px; }
  #loading.done.wardrobe { place-items: end stretch; padding: 0; }
  #loading.wardrobe .start { width: 100%; max-height: 74vh; border-radius: 26px 26px 0 0; border-bottom: 0; box-shadow: none; padding-bottom: calc(16px + env(safe-area-inset-bottom)); animation-name: ui-rise; }
  #loading.wardrobe .start-bar { --pad: calc(16px + env(safe-area-inset-bottom)); }
}

/* phone on its side: little height */
@media (orientation: landscape) and (max-height: 520px) {
  body.touch { --mm: 100px; --bt: calc(var(--st) + var(--hh, 36px) + 12px); }
  /* (the banner ends left of the fan of buttons over GAS and of the action button, whatever its height) */
  body.touch #banner { max-width: calc(100vw - var(--sl) - var(--mm) - 12px - max(16px, env(safe-area-inset-right)) - 218px); gap: 7px; }
  body.touch #banner > div { padding: 4px 11px 5px; font-size: 12.5px; border-radius: 12px; box-shadow: 0 3px 0 var(--bd); }
  body.touch #chat-log { bottom: 112px; }
  /* the level-up plate: compact, and narrow enough to stand beside the action button left of GAS */
  #big-banner { top: max(calc(55% - 46px), calc(var(--bt, 0px) + var(--bn, 0px) + 14px)); max-width: min(400px, calc(100vw - 452px)); padding: 6px 14px 8px; border-width: 3px; border-radius: 18px; box-shadow: 0 5px 0 #9a4d00, 0 11px 0 rgba(10, 16, 46, 0.3); }
  #big-banner .bb-title { font-size: 23px; }
  #big-banner .bb-sub { margin-top: 3px; font-size: 12.5px; line-height: 1.3; }
  .sheet, #scores-panel, #help, body.touch #help, #radio-panel { max-height: calc(100vh - 20px); box-shadow: 0 4px 0 rgba(10, 16, 46, 0.5); }
  /* (☰ and the hero button stay above a sheet: it keeps clear of them, so its × is never under a button) */
  body.touch .sheet, body.touch #help { width: min(600px, calc(100vw - 2 * (var(--sr) + 2 * var(--qb) + 20px))); }
  /* start screen: the creator on the left, the title and the start button in the right column */
  #loading { place-items: start; }
  #loading .start { width: calc(100% - 236px); max-width: 560px; margin: 0; padding: 14px; gap: 10px; }
  #loading .logo { position: fixed; right: max(14px, env(safe-area-inset-right)); top: max(40px, env(safe-area-inset-top)); width: 212px; margin: 0; font-size: 31px; text-align: center; }
  #loading .logo::after { right: 0; }
  #loading .sub { position: fixed; right: max(14px, env(safe-area-inset-right)); top: calc(max(40px, env(safe-area-inset-top)) + 50px); width: 212px; margin: 0; font-size: 12.5px; line-height: 1.4; text-align: center; text-shadow: 0 2px 0 rgba(15, 24, 64, 0.6); font-weight: 700; }
  .start-bar { display: contents; }
  .start-bar #btn-start { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); width: 212px; min-height: 56px; padding: 0 8px 2px; font-size: 18px !important; box-sizing: border-box; }
  /* the wardrobe: a card on the left with everything inside it, the hero stays in sight on the right */
  #loading.done.wardrobe { place-items: start; padding: 8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left)); }
  #loading.wardrobe .start { width: calc(100% - 236px); max-height: 100%; padding: 14px; box-shadow: none; }
  #loading.wardrobe .logo { position: static; width: auto; font-size: 22px; line-height: 44px; margin: -8px 52px 0 0; text-align: left; }
  #loading.wardrobe .sub { position: static; width: auto; margin: -8px 0 0; text-align: left; text-shadow: none; font-weight: 500; }
  #loading.wardrobe .start-bar { display: flex; --pad: 14px; }
  #loading.wardrobe .start-bar #btn-start { position: static; width: auto; min-height: 48px; padding: 0 36px 2px; }
  #loading.wardrobe .look-x { position: absolute; right: 8px; top: 8px; bottom: auto; width: 44px; }
}

/* ============================================================ 8. switches (settings, «online» on the start screen) */
.set-row input[type="checkbox"], .acct .toggle input, :where(.sheet, .panel) input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 54px; height: 30px; margin: 0; padding: 0; border-radius: 15px;
  background: var(--well); border: 3px solid var(--ink); box-shadow: none; cursor: pointer;
}
.set-row input[type="checkbox"]::before, .acct .toggle input::before, :where(.sheet, .panel) input[type="checkbox"]::before {
  content: ''; position: absolute; left: 1px; top: 1px; width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(180deg, #fff, #c9d6ff); box-shadow: 0 2px 0 rgba(15, 24, 64, 0.5);
  transition: transform var(--t) var(--spring);
}
.set-row input[type="checkbox"]:checked, .acct .toggle input:checked, :where(.sheet, .panel) input[type="checkbox"]:checked { background: #3fc23a; }
.set-row input[type="checkbox"]:checked::before, .acct .toggle input:checked::before, :where(.sheet, .panel) input[type="checkbox"]:checked::before { transform: translateX(24px); }
.acct .toggle { gap: var(--s2); min-height: 44px; }

/* the city map takes the whole screen: ☰ and the dock step aside (the map has its own close button in that corner) */
body:has(#map-panel:not(.hidden)) #top-buttons, body:has(#map-panel:not(.hidden)):not(.menu-open) #menu { display: none; }

/* (style.css still puts the old #radio-panel list into the corner as a grid and paints its buttons: the receiver is
   a sheet like the others — these lines come last on purpose) */
#radio-panel { left: 50%; top: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); display: block; max-height: min(86vh, 720px); overflow-y: auto; }
#radio-panel .sheet-x { width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%; box-shadow: none; background: var(--gi-img) var(--gi-close) / var(--gi-size) no-repeat; font-size: 0; }
#radio-panel .rd-first button, #radio-panel .rd-back { justify-content: center; }
#radio-panel .rd-first .primary { --c: #ffe36b; --c2: #ffa51f; --cb: #9a4d00; --ct: var(--yellow-ink); }
#radio-panel button small { white-space: normal; opacity: 1; font-size: 12px; }
#radio-panel .rd-np small { font-size: 10.5px; }
.rd-now { align-items: center; }
#radio-panel .rd-screen { justify-content: flex-start; }
.rd-np b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
@media (max-width: 699px) and (orientation: portrait), (max-width: 599px) {
  #radio-panel { left: 0; right: 0; top: auto; bottom: 0; transform: none; max-height: 86vh; }
  .rd-np b { font-size: 14px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  #radio-panel { max-height: calc(100vh - 20px); }
  body.touch #radio-panel { width: min(600px, calc(100vw - 2 * (var(--sr) + 2 * var(--qb) + 20px))); }
}

/* ---- scroll bars of every panel: thin, in the colours of the game (never the white system one) */
* { scrollbar-width: thin; scrollbar-color: #7d9bff #121d4b; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #121d4b; border-radius: 6px; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #9db4ff, #4460c4); border-radius: 6px; border: 2px solid #121d4b; }
::-webkit-scrollbar-corner { background: transparent; }

/* ---- a desktop (a wide window, no touch): the sheets are BIG and lay their content out in more columns, so that
   on 1366 × 768 and larger nothing scrolls (the journal of 100+ eggs is the one long list; phones keep scrolling) */
@media (min-width: 1100px) and (min-height: 600px) {
  /* (☰ and the dock stay on top at the right edge: a window that would reach them moves left instead of going under) */
  body:not(.touch) :is(.sheet, #radio-panel, #help) { --sw: min(1320px, calc(100vw - var(--sr) - var(--qb) - 30px)); width: var(--sw); max-height: 92vh; left: min(50vw, calc(100vw - var(--sr) - var(--qb) - 14px - var(--sw) / 2)); }
  body:not(.touch) :is(#settings-panel, #board-panel) { --sw: min(1000px, calc(100vw - var(--sr) - var(--qb) - 30px)); }
  body:not(.touch) .mode-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px 9px; padding-top: 10px; }
  body:not(.touch) .mode-card { min-height: 0; padding: 5px 9px 6px 6px; gap: 8px; }
  body:not(.touch) .mode-icon { width: 50px; height: 50px; margin: -12px 0 -2px -2px; }
  body:not(.touch) .mode-text { gap: 1px; }
  body:not(.touch) .mode-text b { font-size: 14px; }
  body:not(.touch) .mode-text small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 11.5px; line-height: 1.25; }
  body:not(.touch) .mode-text i { font-size: 11.5px; }
  body:not(.touch) .q-cols { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 22px; }
  body:not(.touch) .q-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  body:not(.touch) .sheet .beast-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 7px; }
  body:not(.touch) .sheet .beast { padding: 6px 8px; }
  body:not(.touch) .sheet .beast-icon { font-size: 22px; }
  body:not(.touch) .sheet .beast b { font-size: 12.5px; }
  body:not(.touch) .sheet .beast small { font-size: 11px; line-height: 1.2; }
  body:not(.touch) .q-grid .q-card { grid-template-columns: 40px minmax(0, 1fr); }
  body:not(.touch) .q-grid .q-card .q-icon .gi { width: 38px; height: 38px; }
  body:not(.touch) .q-grid .q-prize { grid-column: 1 / -1; grid-auto-flow: column; justify-content: start; }
  body:not(.touch) .area-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  /* settings, the wallet / the newcomer's steps / a shop (js/rp.js): two columns */
  body:not(.touch) :is(#settings-panel, #rp-panel) { display: block; column-count: 2; column-gap: 34px; }
  body:not(.touch) :is(#settings-panel, #rp-panel) > * { break-inside: avoid; }
  body:not(.touch) :is(#settings-panel, #rp-panel) > .sheet-head { column-span: all; margin-bottom: 12px; }
  body:not(.touch) #settings-panel > .dim { margin: 0 0 6px; }
  body:not(.touch) #rp-panel > :not(.q-row):not(.sheet-head) { column-span: all; margin: 0 0 10px; }
  body:not(.touch) #rp-panel > .q-row { margin: 0 0 8px; }
  body:not(.touch) #journal-panel .jr-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  body:not(.touch) #help { --sw: min(1100px, calc(100vw - var(--sr) - var(--qb) - 30px)); }
  body:not(.touch) #help :is(.for-keys, .for-touch) { column-count: 2; column-gap: 34px; }
  body:not(.touch) .rd-groups { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body:not(.touch) .rd-list { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px 8px; }
  body:not(.touch) .rd-st { grid-template-columns: minmax(0, 1fr) 36px; gap: 4px; }
  body:not(.touch) #radio-panel .rd-play { min-height: 64px; padding: 6px 9px 7px; }
  body:not(.touch) .rd-play b { font-size: 13.5px; }
  body:not(.touch) #radio-panel .rd-play small { font-size: 11px; line-height: 1.25; }
  body:not(.touch) #radio-panel .rd-star { font-size: 19px; }
}
.rd-pages, .pager { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.rd-pages i, .pager i { font: 900 13px/1 var(--font-ui); font-style: normal; white-space: nowrap; color: #fff; }
.q-count { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; }
.pager button { min-width: 44px; min-height: 36px; padding: 0 8px; font-size: 18px; --dz: 3px; }
#radio-panel .rd-pages button { justify-content: center; min-width: 40px; min-height: 36px; padding: 0 8px; font-size: 18px; --c: #fff; --c2: #dfe6ff; --cb: var(--ink); --ct: var(--ink); --dz: 3px; }

/* ============================================================ stacks (js/hudlayout.js)
   The plates that come and go — the mission banner, toasts, the level-up plate, the cards of the tutorial and of a
   dialogue, the emote bar, «press E», the chat field, the street name, the translation of a billboard, the chat log —
   are children of five fixed flex columns. Their own position / transform is switched off here; whether a plate
   takes room is the attribute data-hud (on / off) the manager keeps. Nothing in one stack can lie on its neighbour. */
.hud-stack { position: fixed; z-index: 9; display: flex; flex-direction: column; gap: 8px; box-sizing: border-box; pointer-events: none; }
.hud-stack:empty { display: none; }
.hud-stack > * { position: relative !important; left: auto !important; right: auto !important; top: auto !important; bottom: auto !important; margin: 0 !important; flex: none; max-width: 100% !important; pointer-events: auto; }
.hud-stack > [data-hud="off"], .hud-stack > [data-hud-squeezed] { display: none !important; }
.hud-stack > :is(#banner, #toasts, #emote-bar, #chat-input, #tutorial, #story-card, #orace-card, #story-credits, #street-name, #act-hint, #big-banner, #chat-log) { transform: none; }
.hud-stack > #board-hint { transform: none !important; visibility: visible; }
.hud-stack > #toasts { width: 100%; }
.hud-stack > :is(#tutorial, #story-card, #orace-card, #story-credits) { width: min(460px, 100%) !important; }
.hud-stack > #chat-input { width: min(480px, 100%); }
.hud-stack > #chat-log { width: 100%; }
.hud-stack > #banner { width: max-content; }
.hud-stack > #act-hint { animation: none; }
.hud-stack > #big-banner { width: max-content; opacity: 1; transition: none; animation: ui-pop 320ms var(--spring); }
.hud-stack > #street-name { visibility: visible; opacity: 1; }
.hud-stack > #street-name.swap { opacity: 0; }
/* top centre */
#hud-top { top: var(--bt); left: 50%; transform: translateX(-50%); width: min(620px, calc(100vw - 2 * 290px)); align-items: center; }
/* bottom centre: the first in order lies lowest */
#hud-bottom { bottom: calc(var(--sb) + 8px); left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 2 * var(--mm, 176px) - 80px)); flex-direction: column-reverse; align-items: center; }
#hud-bl { left: var(--sl); bottom: calc(var(--sb) + var(--mm) + 14px); width: min(420px, calc(100vw - 32px)); align-items: flex-start; }
body.no-minimap #hud-bl { bottom: var(--sb); }
#hud-tr { right: calc(var(--sr) + var(--qb) + 14px); top: var(--st); width: min(280px, 28vw); align-items: flex-end; }
#hud-br { right: calc(var(--sr) + var(--qb) + 14px); bottom: calc(var(--sb) + 8px); width: min(280px, 28vw); flex-direction: column-reverse; align-items: flex-end; }
@media (max-width: 1099px) {
  body:not(.touch) #hud-top { width: calc(100vw - 24px); }
}
@media (max-width: 899px) {
  body:not(.touch) #hud-bottom { bottom: calc(var(--sb) + var(--mm) + 18px); width: calc(100vw - 24px); }
}
/* a phone held upright: the top stack across the screen under the stats pill, the bottom one in the strip left of GAS */
body[data-hud-layout="portrait"] #hud-top { left: var(--sl); right: var(--sr); transform: none; width: auto; }
body[data-hud-layout="portrait"] #hud-bottom { left: var(--sl); right: 144px; bottom: max(12px, env(safe-area-inset-bottom)); transform: none; width: auto; }
body[data-hud-layout="portrait"] #hud-bl { bottom: 190px; }
body[data-hud-layout="portrait"] #hud-br { right: var(--sr); bottom: calc(max(28px, env(safe-area-inset-bottom)) + 280px); }
body[data-hud-layout="portrait"] #hud-tr { display: none; }
/* a phone on its side: the top stack left, under the pill and clear of the buttons on the right; the bottom one between the thumbs */
body[data-hud-layout="land"] #hud-top {
  left: calc(var(--sl) + var(--mm) + 12px); transform: none; align-items: flex-start;
  width: calc(100vw - var(--sl) - var(--mm) - 12px - max(16px, env(safe-area-inset-right)) - 218px);
}
body[data-hud-layout="land"] #hud-bottom { left: calc(var(--sl) + 252px); right: calc(var(--sr) + 218px); bottom: var(--sb); transform: none; width: auto; }
body[data-hud-layout="land"] #hud-bl { left: calc(var(--sl) + 8px); bottom: 112px; width: 38vw; }
body[data-hud-layout="land"] :is(#hud-tr, #hud-br) { display: none; }
body[data-hud-layout="land"] #emote-bar { grid-template-columns: repeat(5, 52px); }
body.photo .hud-stack > :not(#photo-bar) { display: none !important; }
