/*
 * app.css — responsive shell + screen layouts for the standalone web app.
 * The Android dp design maps directly: --u scales to a phone-width play column
 * (full width on mobile, a centred ~460px column on desktop).
 */
:root {
  --col: min(100vw, 460px, 56vh);
  --u: calc(var(--col) / 411);  /* 411dp reference width => 1u ≈ 1dp */
}
/* Fit-to-viewport: on short/square screens (foldables, tablets, landscape) the
 * play column is ALSO capped by viewport HEIGHT, so the whole game screen
 * (question card + full keypad) scales down to fit with no scrolling. On tall
 * phones 100vw wins, so they're unchanged. dvh excludes mobile browser chrome. */
@supports (height: 1dvh) {
  :root { --col: min(100vw, 460px, 56dvh); }
}

html, body { height: 100%; }
/* paint the safe-area / overscroll regions in the theme colour too, so an
 * installed (standalone) PWA blends edge-to-edge into the status/home bars. */
html, body { background: var(--bg); }
body { overflow: hidden; }
/* the page itself never scrolls or bounces: body's hidden used to reach the viewport on its own, but containment on body
 * (the phone layout's side safe areas below, contain: layout) stops that hand-over (CSS Overflow 3), so the root says it
 * itself, the same value the viewport had before (mw-v237 review of the iOS merge) */
html { overflow: hidden; }

/* Old engines without dvh (Chrome and WebViews before 108, Safari before 15.4) take
 * height: 100%: the page's height with the address bar showing (100vh is the height
 * with it hidden, 56 px taller on a phone). A dvh value that sits in a declaration with
 * var() must live inside @supports (height: 1dvh): such a declaration is never dropped
 * when the file is read, so an old engine would turn it into "unset" (height auto, 0 px
 * here, every screen in it is absolute) instead of keeping the fallback before it. */
.app {
  width: var(--col);
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: var(--bg-paint);   /* pattern themes: a static texture, painted once (themes.css) */
}

/* Side safe areas on the phone layout (iOS build 8, 25 Nov 2026, the iPhone Duo audit): the iPhone Duo's cover
 * screen keeps its camera and status bar in a strip down the right edge, an 84 pt safe-area inset in portrait, and
 * the app had put the home's gear, every menu's "?", the Pro sheet's close button and the games' sound buttons under
 * the camera. Every control now stays in the horizontal safe area: the body takes transparent side borders the size
 * of the side insets (its background, the theme's, shows through them edge to edge) and holds its fixed layers
 * (contain: layout), so the sheets, toasts and full-screen game layers (Math Hop, the Galaxy map) stay clear of the
 * strip too. Upright phones have no side inset, so nothing moves on them; the tablet and desktop layouts keep their
 * own safe-area rules. duo_safe_area.test.mjs. */
:root:not([data-tablet]):not([data-desktop]) body {
  border-left: env(safe-area-inset-left, 0px) solid transparent;
  border-right: env(safe-area-inset-right, 0px) solid transparent;
  contain: layout;
}
:root:not([data-tablet]):not([data-desktop]) .app { max-width: 100%; }
/* beside a dark game the strip is the game's own night (as the tablet surround), beside Math Hop its meadow */
:root:not([data-tablet]):not([data-desktop]):is([data-screen="galaxy"], [data-screen="raiders"], [data-screen="game"][data-mode="galaxy"], [data-screen="game"][data-mode="mathrun"]) body { background: #05070F; }
:root:not([data-tablet]):not([data-desktop])[data-screen="mathhop"] body { background: #9BDDB0; }
/* and while a sheet's scrim is up, the strip dims with it (about the sheet's own shade) */
:root:not([data-tablet]):not([data-desktop]) body:has(:is(.ach-detail-ov, .welcome-ov, .recover-ov, .yap-ov, .wl-stamp-ov:not(.wls), .wlb-dayov)) { background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)) var(--bg); }
:root:not([data-tablet]):not([data-desktop]) body:has(:is(.nsp-ov, .ci-overlay, .ex-overlay, .ta-sheet-ov, .lang-overlay, .share-sheet, .mi-overlay, .au-ov, .wn-ov, .lvm-ov, .lbr-ov, .lbn-ov)) { background: linear-gradient(rgba(6, 8, 14, 0.66), rgba(6, 8, 14, 0.66)) var(--bg); }
:root:not([data-tablet]):not([data-desktop]) body:has(:is(.pw-overlay, .quit-confirm, .sw-overlay)) { background: linear-gradient(rgba(6, 8, 14, 0.92), rgba(6, 8, 14, 0.92)) var(--bg); }

/* screen system: absolutely-stacked, toggled by .active */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: calc(16 * var(--u)) calc(18 * var(--u));
  padding-top: max(calc(16 * var(--u)), env(safe-area-inset-top));
  padding-bottom: max(calc(16 * var(--u)), env(safe-area-inset-bottom));
  overflow-y: auto;
  overflow-x: hidden;
}
.screen.active { display: flex; }
/* a screen takes focus for keyboard players (main.js focusScreen, tabindex -1): no ring round the whole screen */
.screen:focus { outline: none; }

/* ---------------------------------------------------------------- menu */
/* Header is a chunky card (mirrors MainActivity's title_card / bg_game_card) with
 * the settings gear tucked into its bottom-right corner. */
.menu-header {
  position: relative;
  text-align: center;
  margin: calc(8 * var(--u)) 0 calc(16 * var(--u));
  padding: calc(18 * var(--u)) calc(20 * var(--u)) calc(22 * var(--u));
  isolation: isolate;
}
/* Faint + - x / symbols around the header card's edges (owner's pick "border only", Oct 2026).
   Drawn as a mask over the theme's text colour, so it stays faint dark-on-light and
   light-on-dark in every theme and brand; the centre (logo and subtitle) stays clear. */
.menu-header::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
  background: var(--text-primary); opacity: .08;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 420 240'%3E%3Cg transform='translate(298 31.2) rotate(-9.7)'%3E%3Crect x='-6.7' y='-1.6' width='13.4' height='3.2' rx='1.6'/%3E%3Crect x='-1.6' y='-6.7' width='3.2' height='13.4' rx='1.6'/%3E%3C/g%3E%3Cg transform='translate(59.2 172.2) rotate(9.3)'%3E%3Crect x='-9.2' y='-2.2' width='18.4' height='4.4' rx='2.2'/%3E%3C/g%3E%3Cg transform='translate(130.7 36.1) rotate(47.6)'%3E%3Crect x='-6.3' y='-1.5' width='12.6' height='3' rx='1.5'/%3E%3Crect x='-1.5' y='-6.3' width='3' height='12.6' rx='1.5'/%3E%3C/g%3E%3Cg transform='translate(154 215) rotate(10.4)'%3E%3Crect x='-6.4' y='-1.5' width='12.8' height='3.1' rx='1.5'/%3E%3Ccircle cy='-4.6' r='1.9'/%3E%3Ccircle cy='4.6' r='1.9'/%3E%3C/g%3E%3Cg transform='translate(398.8 18.6) rotate(-4.7)'%3E%3Crect x='-11.8' y='-2.8' width='23.7' height='5.7' rx='2.8'/%3E%3Crect x='-2.8' y='-11.8' width='5.7' height='23.7' rx='2.8'/%3E%3C/g%3E%3Cg transform='translate(20.9 56) rotate(12.2)'%3E%3Crect x='-12.2' y='-2.9' width='24.4' height='5.9' rx='2.9'/%3E%3C/g%3E%3Cg transform='translate(122.2 203.2) rotate(53.5)'%3E%3Crect x='-7.4' y='-1.8' width='14.8' height='3.6' rx='1.8'/%3E%3Crect x='-1.8' y='-7.4' width='3.6' height='14.8' rx='1.8'/%3E%3C/g%3E%3Cg transform='translate(22.4 163) rotate(-3.4)'%3E%3Crect x='-7.1' y='-1.7' width='14.2' height='3.4' rx='1.7'/%3E%3Ccircle cy='-5.1' r='2.1'/%3E%3Ccircle cy='5.1' r='2.1'/%3E%3C/g%3E%3Cg transform='translate(74.4 17) rotate(0.5)'%3E%3Crect x='-7.1' y='-1.7' width='14.3' height='3.4' rx='1.7'/%3E%3Crect x='-1.7' y='-7.1' width='3.4' height='14.3' rx='1.7'/%3E%3C/g%3E%3Cg transform='translate(402.1 131.5) rotate(6.9)'%3E%3Crect x='-8.6' y='-2.1' width='17.1' height='4.1' rx='2.1'/%3E%3C/g%3E%3Cg transform='translate(204.2 222.8) rotate(48.9)'%3E%3Crect x='-13.2' y='-3.2' width='26.3' height='6.3' rx='3.2'/%3E%3Crect x='-3.2' y='-13.2' width='6.3' height='26.3' rx='3.2'/%3E%3C/g%3E%3Cg transform='translate(35.8 8.1) rotate(-15)'%3E%3Crect x='-8.9' y='-2.1' width='17.8' height='4.3' rx='2.1'/%3E%3Ccircle cy='-6.4' r='2.6'/%3E%3Ccircle cy='6.4' r='2.6'/%3E%3C/g%3E%3Cg transform='translate(242.5 214.1) rotate(-2.3)'%3E%3Crect x='-6.7' y='-1.6' width='13.5' height='3.2' rx='1.6'/%3E%3Crect x='-1.6' y='-6.7' width='3.2' height='13.5' rx='1.6'/%3E%3C/g%3E%3Cg transform='translate(382.2 101.6) rotate(13.8)'%3E%3Crect x='-9.1' y='-2.2' width='18.2' height='4.4' rx='2.2'/%3E%3C/g%3E%3Cg transform='translate(301.3 224) rotate(55.5)'%3E%3Crect x='-7.1' y='-1.7' width='14.2' height='3.4' rx='1.7'/%3E%3Crect x='-1.7' y='-7.1' width='3.4' height='14.2' rx='1.7'/%3E%3C/g%3E%3Cg transform='translate(404.3 198.2) rotate(-9.3)'%3E%3Crect x='-6.8' y='-1.6' width='13.5' height='3.2' rx='1.6'/%3E%3Ccircle cy='-4.9' r='2'/%3E%3Ccircle cy='4.9' r='2'/%3E%3C/g%3E%3Cg transform='translate(326.2 20.8) rotate(-16.7)'%3E%3Crect x='-6.7' y='-1.6' width='13.4' height='3.2' rx='1.6'/%3E%3Crect x='-1.6' y='-6.7' width='3.2' height='13.4' rx='1.6'/%3E%3C/g%3E%3Cg transform='translate(224.1 39.5) rotate(-2.8)'%3E%3Crect x='-14' y='-3.3' width='27.9' height='6.7' rx='3.3'/%3E%3C/g%3E%3Cg transform='translate(38.5 220.7) rotate(51.4)'%3E%3Crect x='-12.4' y='-3' width='24.9' height='6' rx='3'/%3E%3Crect x='-3' y='-12.4' width='6' height='24.9' rx='3'/%3E%3C/g%3E%3Cg transform='translate(407.5 65.7) rotate(-4.2)'%3E%3Crect x='-9.7' y='-2.3' width='19.3' height='4.6' rx='2.3'/%3E%3Ccircle cy='-7' r='2.9'/%3E%3Ccircle cy='7' r='2.9'/%3E%3C/g%3E%3Cg transform='translate(45.2 112.8) rotate(16.6)'%3E%3Crect x='-13' y='-3.1' width='26.1' height='6.3' rx='3.1'/%3E%3Crect x='-3.1' y='-13' width='6.3' height='26.1' rx='3.1'/%3E%3C/g%3E%3Cg transform='translate(367 228.6) rotate(14.5)'%3E%3Crect x='-6.3' y='-1.5' width='12.6' height='3' rx='1.5'/%3E%3C/g%3E%3C/svg%3E") center / cover no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 420 240'%3E%3Cg transform='translate(298 31.2) rotate(-9.7)'%3E%3Crect x='-6.7' y='-1.6' width='13.4' height='3.2' rx='1.6'/%3E%3Crect x='-1.6' y='-6.7' width='3.2' height='13.4' rx='1.6'/%3E%3C/g%3E%3Cg transform='translate(59.2 172.2) rotate(9.3)'%3E%3Crect x='-9.2' y='-2.2' width='18.4' height='4.4' rx='2.2'/%3E%3C/g%3E%3Cg transform='translate(130.7 36.1) rotate(47.6)'%3E%3Crect x='-6.3' y='-1.5' width='12.6' height='3' rx='1.5'/%3E%3Crect x='-1.5' y='-6.3' width='3' height='12.6' rx='1.5'/%3E%3C/g%3E%3Cg transform='translate(154 215) rotate(10.4)'%3E%3Crect x='-6.4' y='-1.5' width='12.8' height='3.1' rx='1.5'/%3E%3Ccircle cy='-4.6' r='1.9'/%3E%3Ccircle cy='4.6' r='1.9'/%3E%3C/g%3E%3Cg transform='translate(398.8 18.6) rotate(-4.7)'%3E%3Crect x='-11.8' y='-2.8' width='23.7' height='5.7' rx='2.8'/%3E%3Crect x='-2.8' y='-11.8' width='5.7' height='23.7' rx='2.8'/%3E%3C/g%3E%3Cg transform='translate(20.9 56) rotate(12.2)'%3E%3Crect x='-12.2' y='-2.9' width='24.4' height='5.9' rx='2.9'/%3E%3C/g%3E%3Cg transform='translate(122.2 203.2) rotate(53.5)'%3E%3Crect x='-7.4' y='-1.8' width='14.8' height='3.6' rx='1.8'/%3E%3Crect x='-1.8' y='-7.4' width='3.6' height='14.8' rx='1.8'/%3E%3C/g%3E%3Cg transform='translate(22.4 163) rotate(-3.4)'%3E%3Crect x='-7.1' y='-1.7' width='14.2' height='3.4' rx='1.7'/%3E%3Ccircle cy='-5.1' r='2.1'/%3E%3Ccircle cy='5.1' r='2.1'/%3E%3C/g%3E%3Cg transform='translate(74.4 17) rotate(0.5)'%3E%3Crect x='-7.1' y='-1.7' width='14.3' height='3.4' rx='1.7'/%3E%3Crect x='-1.7' y='-7.1' width='3.4' height='14.3' rx='1.7'/%3E%3C/g%3E%3Cg transform='translate(402.1 131.5) rotate(6.9)'%3E%3Crect x='-8.6' y='-2.1' width='17.1' height='4.1' rx='2.1'/%3E%3C/g%3E%3Cg transform='translate(204.2 222.8) rotate(48.9)'%3E%3Crect x='-13.2' y='-3.2' width='26.3' height='6.3' rx='3.2'/%3E%3Crect x='-3.2' y='-13.2' width='6.3' height='26.3' rx='3.2'/%3E%3C/g%3E%3Cg transform='translate(35.8 8.1) rotate(-15)'%3E%3Crect x='-8.9' y='-2.1' width='17.8' height='4.3' rx='2.1'/%3E%3Ccircle cy='-6.4' r='2.6'/%3E%3Ccircle cy='6.4' r='2.6'/%3E%3C/g%3E%3Cg transform='translate(242.5 214.1) rotate(-2.3)'%3E%3Crect x='-6.7' y='-1.6' width='13.5' height='3.2' rx='1.6'/%3E%3Crect x='-1.6' y='-6.7' width='3.2' height='13.5' rx='1.6'/%3E%3C/g%3E%3Cg transform='translate(382.2 101.6) rotate(13.8)'%3E%3Crect x='-9.1' y='-2.2' width='18.2' height='4.4' rx='2.2'/%3E%3C/g%3E%3Cg transform='translate(301.3 224) rotate(55.5)'%3E%3Crect x='-7.1' y='-1.7' width='14.2' height='3.4' rx='1.7'/%3E%3Crect x='-1.7' y='-7.1' width='3.4' height='14.2' rx='1.7'/%3E%3C/g%3E%3Cg transform='translate(404.3 198.2) rotate(-9.3)'%3E%3Crect x='-6.8' y='-1.6' width='13.5' height='3.2' rx='1.6'/%3E%3Ccircle cy='-4.9' r='2'/%3E%3Ccircle cy='4.9' r='2'/%3E%3C/g%3E%3Cg transform='translate(326.2 20.8) rotate(-16.7)'%3E%3Crect x='-6.7' y='-1.6' width='13.4' height='3.2' rx='1.6'/%3E%3Crect x='-1.6' y='-6.7' width='3.2' height='13.4' rx='1.6'/%3E%3C/g%3E%3Cg transform='translate(224.1 39.5) rotate(-2.8)'%3E%3Crect x='-14' y='-3.3' width='27.9' height='6.7' rx='3.3'/%3E%3C/g%3E%3Cg transform='translate(38.5 220.7) rotate(51.4)'%3E%3Crect x='-12.4' y='-3' width='24.9' height='6' rx='3'/%3E%3Crect x='-3' y='-12.4' width='6' height='24.9' rx='3'/%3E%3C/g%3E%3Cg transform='translate(407.5 65.7) rotate(-4.2)'%3E%3Crect x='-9.7' y='-2.3' width='19.3' height='4.6' rx='2.3'/%3E%3Ccircle cy='-7' r='2.9'/%3E%3Ccircle cy='7' r='2.9'/%3E%3C/g%3E%3Cg transform='translate(45.2 112.8) rotate(16.6)'%3E%3Crect x='-13' y='-3.1' width='26.1' height='6.3' rx='3.1'/%3E%3Crect x='-3.1' y='-13' width='6.3' height='26.1' rx='3.1'/%3E%3C/g%3E%3Cg transform='translate(367 228.6) rotate(14.5)'%3E%3Crect x='-6.3' y='-1.5' width='12.6' height='3' rx='1.5'/%3E%3C/g%3E%3C/svg%3E") center / cover no-repeat;
}
.menu-title { font-size: calc(50 * var(--u)); line-height: 0.92; letter-spacing: 0.02em; color: var(--text-primary); }
.menu-sub { margin-top: calc(8 * var(--u)); font-size: calc(14 * var(--u)); color: var(--text-secondary); }
.menu-streak { margin-top: calc(3 * var(--u)); font-size: calc(13 * var(--u)); font-weight: 900; color: var(--streak-green); }
/* The subtitle and the "Last played" line keep clear of the share and settings buttons in the card's bottom corners
   (mw-v228: es / fr / pt / de / ru ran under them on phones): an inset of the buttons' column (10u + the button, at
   least 44 px) less the card's own 20u padding, plus 2 px; a long line wraps (balanced), it is never hidden. */
.menu-sub, .menu-streak { padding-inline: max(calc(36 * var(--u)), calc(46px - 10 * var(--u))); text-wrap: balance; }
/* Doc beside the wordmark (his 3D head, owner 7 Nov 2026; ui/doc3d/): his box holds the still
   picture at first paint and, on Mid / High devices, the live canvas that fades in over it. The
   picture and the canvas overflow the box by the same margins (room for a hop or a lightbulb). */
.menu-brand { display: flex; align-items: center; justify-content: center; gap: calc(8 * var(--u)); margin-top: max(calc(32 * var(--u)), calc(37px - 6 * var(--u))); }
.menu-brand .menu-title { font-size: calc(41 * var(--u)); text-align: start; white-space: nowrap; font-family: 'Roboto', system-ui, sans-serif; }
.menu-doc { position: relative; flex: 0 0 auto; width: calc(116 * var(--u)); height: calc(104 * var(--u)); cursor: pointer; border-radius: calc(14 * var(--u)); -webkit-tap-highlight-color: transparent;
  touch-action: pan-y; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* he is carried on a full-window layer (ui/doc3d/banner.js): his box keeps its place, empty meanwhile */
.md-carry .md-still, .md-carry .md-pose { visibility: hidden; }
.md-free { position: fixed; inset: 0; pointer-events: none; z-index: 2147483000; }
.md-free > .md-gl { left: 0; top: 0; width: 100%; height: 100%; }
html.md-dragging, html.md-dragging body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; touch-action: none; }
/* the home music button, next to the flag (drawn speaker; the Music switch, as Settings) */
.menu-music { position: absolute; top: calc(6 * var(--u)); left: calc(12 * var(--u) + max(calc(40 * var(--u)), 40px) + 2px); width: 48px; height: 48px; padding: 10px; border: none; background: transparent;
  cursor: pointer; border-radius: 50%; display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; z-index: 2; }
.menu-music:active { transform: scale(0.92); }
.menu-music svg { width: 100%; height: 100%; }
[dir="rtl"] .menu-music { left: auto; right: calc(12 * var(--u) + max(calc(40 * var(--u)), 40px) + 2px); }
/* Doc's welcome takeover (ui/doc3d/welcome.js): the header's items keep their places, hidden; Doc fills the
   card over them (his big still picture at once, the live head over it), a speech bubble below his face;
   then the items fade in (md-shrink) as he shrinks into his banner box (hidden until he lands) */
.md-welcome > :not(.md-hero), .md-welcome .menu-title, .md-welcome .menu-doc { opacity: 0; visibility: hidden; }
.md-welcome > .menu-brand { opacity: 1; visibility: visible; }
.md-shrink .menu-doc { visibility: hidden; }
.md-shrink > :not(.md-hero), .md-shrink .menu-title, .md-xfade > :not(.md-hero), .md-xfade .menu-title { transition: opacity .35s ease-out .12s; }
.md-shrink > .menu-lang, .md-shrink > .menu-music, .md-shrink > .menu-tier, .md-shrink > .menu-share, .md-shrink > .menu-fab { transition-delay: .3s; }
.md-hero { position: absolute; inset: 0; z-index: 3; border-radius: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: pan-y; }
.md-hero-box { position: absolute; left: 50%; top: -2%; height: 90%; aspect-ratio: 116 / 104; transform: translateX(-50%); }
.md-hero-box[style] { transform: none; }
.md-hero-box.md-fit { transition: left .25s ease-out, top .25s ease-out, width .25s ease-out, height .25s ease-out; }
.md-hero-still { position: absolute; left: -24%; top: -44%; width: 148%; height: 156%; display: block; pointer-events: none; -webkit-user-select: none; user-select: none; }
.md-hero > .md-gl { left: 0; top: 0; width: 100%; height: 100%; z-index: 1; }
.md-hero.md-on .md-hero-still { opacity: 0; transition: opacity 0s .4s; }
.md-hero.md-hero-fade { opacity: 0; transition: opacity .3s ease-out; }
.md-bubble { position: absolute; z-index: 2; left: 3%; right: 3%; bottom: 4%; display: flex; align-items: center; gap: calc(10 * var(--u)); padding: calc(9 * var(--u)) calc(12 * var(--u));
  background: var(--face); color: var(--text-primary); border: calc(2.5 * var(--u)) solid var(--stroke); border-radius: calc(16 * var(--u));
  box-shadow: 0 calc(3 * var(--u)) 0 var(--stroke); opacity: 0; transform: translateY(calc(8 * var(--u))) scale(.94); transform-origin: 50% 0;
  transition: opacity .2s ease-out, transform .28s cubic-bezier(.3,1.5,.5,1); pointer-events: none; text-align: start; }
.md-bubble::before { content: ''; position: absolute; left: 50%; top: calc(-11 * var(--u)); width: calc(18 * var(--u)); height: calc(18 * var(--u)); margin-left: calc(-9 * var(--u));
  background: var(--face); border-left: calc(2.5 * var(--u)) solid var(--stroke); border-top: calc(2.5 * var(--u)) solid var(--stroke); transform: rotate(45deg); border-top-left-radius: calc(4 * var(--u)); }
.md-bubble.md-bub-in { opacity: 1; transform: none; pointer-events: auto; }
.md-bubble.md-bub-out { opacity: 0; transform: scale(.96); transition: opacity .15s ease-in, transform .15s ease-in; }
.md-bub-t { margin: 0; flex: 1 1 auto; font-weight: 800; font-size: calc(13.5 * var(--u)); line-height: 1.28; }
.md-bub-long .md-bub-t { font-size: calc(12 * var(--u)); line-height: 1.24; }
.md-bub-long .md-bub-go { max-width: 34%; }
.md-bub-go { flex: 0 0 auto; display: inline-flex; align-items: center; gap: calc(5 * var(--u)); min-height: 44px; max-width: 38%; padding: calc(6 * var(--u)) calc(10 * var(--u));
  font: inherit; font-weight: 900; font-size: calc(12.5 * var(--u)); line-height: 1.15; color: var(--on-accent, #fff); background: var(--accent1);
  border: calc(2.5 * var(--u)) solid var(--stroke); border-radius: calc(12 * var(--u)); box-shadow: 0 calc(3 * var(--u)) 0 var(--stroke); cursor: pointer; text-align: start; }
.md-bub-go:active { transform: translateY(calc(2 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 var(--stroke); }
[dir="rtl"] .md-bub-go svg { transform: scaleX(-1); }
.md-say { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .md-bubble, .md-bubble.md-bub-in { transition: opacity .2s; transform: none; } }
.md-still, .md-gl, .md-pose { position: absolute; display: block; pointer-events: none; -webkit-user-select: none; user-select: none; }
.menu-doc .md-still, .menu-doc .md-gl, .menu-doc .md-pose { left: -24%; top: -44%; width: 148%; height: 156%; }
.md-gl { opacity: 0; transition: opacity .35s ease-out; }
.md-on > .md-gl { opacity: 1; }
.md-on .md-still { opacity: 0; transition: opacity 0s .4s; }
.md-pose { opacity: 0; transition: opacity .25s ease-out; }
.md-posed .md-pose { opacity: 1; }
.md-posed .md-still { opacity: 0; transition: opacity .25s ease-out; }
/* Doc's coin avatar (lib/coach.js docAvatar): the 3D head's rest frame, with a talking frame that
   flaps while his words type out and a blink frame (the same hooks that move Max's SVG) */
.d3-f, .d3-pose { opacity: 0; }
.d3-ava .d3-rest { opacity: 1; }
.coach-talking .d3-ava .d3-talk { animation: d3Talk .26s linear infinite; }
.max-blink .d3-ava .d3-blink { animation: d3Blink .2s linear; }
@keyframes d3Talk { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes d3Blink { 0%, 100% { opacity: 0; } 25%, 75% { opacity: 1; } }
.d3-pose { transition: opacity .25s ease-out; }
.d3-posed .d3-pose { opacity: 1; }
.d3-posed .d3-f { visibility: hidden; }
/* an info card's Doc (ui/doc3d/cards.js): pressable; the live canvas overflows his coin so a prop or
   a hop has room, mostly upward, and the coin picture's head hides once it is in */
.d3-host { position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.d3-host > .md-gl { left: -26%; top: -36%; width: 152%; height: 144%; }
.d3-host.md-on .d3-f, .d3-host.md-on .d3-pose { visibility: hidden; transition: visibility 0s .4s; }
.d3-host.md-on .coach-avatar-svg { animation: none; }
/* "N free workouts left" line: subtle, tappable (opens the Pro sheet) */
.menu-free { display: block; margin: calc(4 * var(--u)) auto 0; max-width: 72%; padding: 0; background: transparent; border: none;
  font: inherit; font-size: calc(12.5 * var(--u)); font-weight: 800; color: var(--text-secondary);
  text-decoration: underline dotted; text-underline-offset: calc(3 * var(--u)); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.menu-free[hidden] { display: none; }
/* the one-time Pro offer's home reminder (ui/offerchip.js + styles/paywall.css, lazy): the
 * slot is reserved by renderMenu when an offer may be running, so the grid never jumps */
.offer-slot { min-height: max(52px, calc(52 * var(--u))); margin: calc(-4 * var(--u)) 0 calc(16 * var(--u)); }
/* Native app: the over-the-air update card under the home header (ui/updatecard.js):
 * downloading (progress bar), ready (Restart now), or a big download waiting on mobile data. */
.update-card { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: calc(10 * var(--u)) calc(12 * var(--u));
  margin: calc(-4 * var(--u)) 0 calc(16 * var(--u)); padding: calc(12 * var(--u)) calc(14 * var(--u));
  animation: updateCardIn 320ms ease-out both; }
.uc-ico { flex: 0 0 auto; box-sizing: border-box; width: calc(40 * var(--u)); height: calc(40 * var(--u)); padding: calc(7 * var(--u));
  border-radius: 50%; border: calc(2 * var(--u)) solid var(--stroke); background: var(--accent1); color: var(--on-accent); }
.uc-ico svg { display: block; }
.uc-body { flex: 1 1 calc(150 * var(--u)); min-width: 0; text-align: start; }
.uc-title { font-weight: 900; font-size: calc(15 * var(--u)); line-height: 1.25; color: var(--text-primary); overflow-wrap: anywhere; }
.uc-sub { margin-top: calc(2 * var(--u)); font-size: calc(12.5 * var(--u)); font-weight: 700; line-height: 1.3; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.uc-sub[hidden], .uc-bar[hidden], .update-card .uc-btn[hidden] { display: none; }
.uc-bar { height: calc(10 * var(--u)); margin-top: calc(7 * var(--u)); border-radius: calc(6 * var(--u)); overflow: hidden;
  border: calc(2 * var(--u)) solid var(--stroke); background: color-mix(in srgb, var(--text-primary) 10%, transparent); }
.uc-fill { height: 100%; width: 0; background: var(--accent1); transition: width 250ms ease-out; }
/* no progress yet (no event so far, or no total): a sliding indeterminate bar */
.uc-bar.indet .uc-fill { width: 40%; transition: none; animation: ucIndet 1.3s ease-in-out infinite; }
[dir="rtl"] .uc-bar.indet .uc-fill { animation-name: ucIndetRtl; }
@keyframes ucIndet { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@keyframes ucIndetRtl { from { transform: translateX(100%); } to { transform: translateX(-250%); } }
.update-card .uc-btn { flex: 0 0 auto; margin-inline-start: auto; min-height: max(44px, calc(44 * var(--u))); padding: calc(6 * var(--u)) calc(16 * var(--u)) calc(9 * var(--u));
  font-size: calc(14 * var(--u)); border-radius: calc(24 * var(--u)); box-shadow: 0 calc(4 * var(--u)) 0 0 color-mix(in srgb, var(--accent1) 45%, black 55%); }
.update-card .uc-btn::before { left: calc(10 * var(--u)); right: calc(10 * var(--u)); top: calc(5 * var(--u)); bottom: calc(24 * var(--u)); border-radius: calc(12 * var(--u)); }
.update-card .uc-btn:active { transform: translateY(calc(3 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 0 color-mix(in srgb, var(--accent1) 45%, black 55%); }
.update-card .uc-btn:disabled { opacity: 0.6; cursor: default; }
@keyframes updateCardIn { from { opacity: 0; transform: translateY(calc(-6 * var(--u))); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .update-card { animation: none; }
  .uc-fill { transition: none; }
  .uc-bar.indet .uc-fill, [dir="rtl"] .uc-bar.indet .uc-fill { animation: none; width: 100%; opacity: 0.45; }
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(14 * var(--u));
}
.menu-card {
  grid-column: span 1;
  padding: calc(20 * var(--u)) calc(14 * var(--u)) calc(26 * var(--u));
  text-align: center;
  cursor: pointer;
  transition: transform 90ms ease-out, box-shadow 90ms ease-out;
  /* own GPU layer — without this, some emulator/GPU compositors fail to invalidate
   * scrolled card tiles and ghost the upper cards over the lower ones (overlap) */
  will-change: transform;
}
.menu-card.wide { grid-column: span 2; }
.menu-card:active { transform: translateY(calc(4 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 0 var(--shadow); }
/* Online-only mode dimmed while offline; its desc reads "Needs connection". */
.menu-card.mc-offline { opacity: 0.5; }
.menu-card.mc-offline .mc-icon { filter: grayscale(1); }
.menu-card.mc-offline .mc-desc { color: #C2410C; font-weight: 800; }
/* Floating "NEW" tag on a freshly-unlocked card (Equation Raiders) — gold pill
 * bobbing at the top-right corner; removed on first open. */
.menu-card.has-new { position: relative; overflow: visible; }
.mc-new {
  position: absolute; top: calc(-10 * var(--u)); right: calc(-6 * var(--u)); z-index: 5;
  background: linear-gradient(180deg, #FFDD6B, #F5A623); color: #3a2400;
  font-weight: 900; font-size: calc(12 * var(--u)); letter-spacing: 0.06em;
  padding: calc(4 * var(--u)) calc(11 * var(--u)); border-radius: calc(20 * var(--u));
  border: calc(2 * var(--u)) solid #fff6d8;
  box-shadow: 0 calc(3 * var(--u)) calc(8 * var(--u)) rgba(0,0,0,0.3), 0 0 calc(13 * var(--u)) rgba(255,200,60,0.75);
  pointer-events: none; animation: mcNewFloat 1.5s ease-in-out infinite;
}
@keyframes mcNewFloat {
  0%, 100% { transform: translateY(0) rotate(-6deg) scale(1); }
  50% { transform: translateY(calc(-4 * var(--u))) rotate(-6deg) scale(1.09); }
}
.menu-card .mc-icon { width: calc(56 * var(--u)); height: calc(56 * var(--u)); margin: 0 auto calc(12 * var(--u)); }
.menu-card .mc-icon svg { display: block; width: 100%; height: 100%; }
.menu-card .mc-title { font-size: calc(18 * var(--u)); font-weight: 900; line-height: 1.08; color: var(--text-primary); }
.menu-card .mc-desc { margin-top: calc(5 * var(--u)); font-size: calc(13 * var(--u)); line-height: 1.2; color: var(--text-secondary); }
/* v211: every card is role="button" (keyboard / switch access), which the label rule
 * below would also apply to the card's description; keep it running text */
html:is(:lang(de), :lang(tr), :lang(id)) .menu-card[role="button"] .mc-desc { -webkit-hyphens: auto; hyphens: auto; hyphenate-limit-chars: 10 4 4; overflow-wrap: anywhere; }

/* Wide cards lay out horizontally (icon left, text, chevron) like item_brain_age_card.xml. */
.menu-card.wide {
  display: flex;
  align-items: center;
  text-align: left;
  padding: calc(16 * var(--u)) calc(18 * var(--u));
}
.menu-card.wide .mc-icon { width: calc(58 * var(--u)); height: calc(58 * var(--u)); margin: 0 calc(14 * var(--u)) 0 0; flex: 0 0 auto; }
.menu-card.wide .mc-body { flex: 1 1 auto; min-width: 0; }
.menu-card.wide .mc-title { line-height: 1.1; }
.menu-card.wide .mc-desc { margin-top: calc(2 * var(--u)); }
.menu-card.wide .mc-chev { flex: 0 0 auto; width: calc(20 * var(--u)); height: calc(28 * var(--u)); margin-left: calc(8 * var(--u)); opacity: 0.8; }

.menu-fab {
  position: absolute;
  bottom: calc(6 * var(--u));
  right: calc(10 * var(--u));
  width: calc(44 * var(--u)); height: calc(44 * var(--u));
  min-width: 44px; min-height: 44px;
  padding: calc(8 * var(--u));
  border: none; background: transparent; cursor: pointer;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
}
.menu-fab:active { transform: scale(0.92); }
.menu-fab svg { width: 100%; height: 100%; }

/* Share glyph — mirrors the gear, tucked into the header card's bottom-left. */
.menu-share {
  position: absolute;
  bottom: calc(6 * var(--u));
  left: calc(10 * var(--u));
  width: calc(40 * var(--u)); height: calc(40 * var(--u));
  min-width: 40px; min-height: 40px;
  padding: calc(8 * var(--u));
  border: none; background: transparent; cursor: pointer;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
}
.menu-share:active { transform: scale(0.92); }
.menu-share svg { width: 100%; height: 100%; }

/* ---------------------------------------------------------------- i18n
 * Script-font buckets: the chunky display font only carries Latin/Cyrillic, so
 * non-Latin locales swap in a system stack with the right glyphs (a bundled
 * display face per script can replace these later). loc-font-latin = default.
 * Set on <html> by i18n.applyLocale(). */
html.loc-font-cjk        { --i18n-font: "PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif; }
html.loc-font-ja         { --i18n-font: "Hiragino Sans","Hiragino Kaku Gothic ProN","Yu Gothic","Noto Sans JP","Meiryo",sans-serif; }
html.loc-font-ko         { --i18n-font: "Apple SD Gothic Neo","Noto Sans KR","Malgun Gothic","Nanum Gothic",sans-serif; }
html.loc-font-arabic     { --i18n-font: "Geeza Pro","Noto Naskh Arabic",Tahoma,sans-serif; }
html.loc-font-devanagari { --i18n-font: "Noto Sans Devanagari","Kohinoor Devanagari",sans-serif; }
html.loc-font-bengali    { --i18n-font: "Noto Sans Bengali","Kohinoor Bangla",sans-serif; }
html.loc-font-cjk body, html.loc-font-ja body, html.loc-font-ko body, html.loc-font-arabic body,
html.loc-font-devanagari body, html.loc-font-bengali body { font-family: var(--i18n-font); }
/* A thick -webkit-text-stroke (outlined titles + arcade banners) FLOODS dense
   non-Latin glyphs (CJK/Arabic/Indic) into solid blobs — e.g. Japanese "準備はいい？"
   rendered as a black smear. Drop the stroke for those scripts; the text-shadow
   already carries contrast. Latin countdown digits (.rd-cd-num) keep their outline. */
html:is(.loc-font-cjk,.loc-font-ja,.loc-font-ko,.loc-font-arabic,.loc-font-devanagari,.loc-font-bengali) :is(.mw-outline,.bl-announce),
html:is(.loc-font-cjk,.loc-font-ja,.loc-font-ko,.loc-font-arabic,.loc-font-devanagari,.loc-font-bengali) .rd-cd:not(.rd-cd-num) {
  -webkit-text-stroke-width: 0;
}

/* RTL (Arabic/Urdu): dir=rtl on <html> flips text/flow automatically; mirror the
 * absolutely-positioned corner buttons so they don't collide. */
[dir="rtl"] .menu-fab  { right: auto; left: calc(10 * var(--u)); }
[dir="rtl"] .menu-share { left: auto; right: calc(10 * var(--u)); }
[dir="rtl"] .back-fab  { left: auto; right: calc(14 * var(--u)); }
[dir="rtl"] .back-fab svg, [dir="rtl"] .mc-chev svg { transform: scaleX(-1); }

/* Flag language button — top-left of the home logo card (mirrors the gear). */
.menu-lang {
  position: absolute;
  top: calc(12 * var(--u)); left: calc(12 * var(--u));
  width: calc(40 * var(--u)); height: calc(34 * var(--u));
  min-width: 40px; min-height: 34px;
  padding: 0; border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; z-index: 2;
}
.menu-lang:active { transform: scale(0.92); }
.menu-flag, .intro-flag, .lang-flag {
  display: block; width: calc(30 * var(--u)); height: calc(22 * var(--u));
  object-fit: cover; border-radius: calc(5 * var(--u));
  border: calc(2 * var(--u)) solid var(--stroke);
  box-shadow: 0 calc(1 * var(--u)) calc(3 * var(--u)) rgba(0,0,0,0.25);
}
[dir="rtl"] .menu-lang { left: auto; right: calc(12 * var(--u)); }

/* PRO / BASIC tier chip — top-right of the logo card, mirroring the flag on the
 * left. Same chunky font + colour as the MATH WORKOUT wordmark, just smaller;
 * "BASIC" is tappable (opens the Pro sheet), "PRO" is a plain label. */
.menu-tier {
  position: absolute;
  top: calc(12 * var(--u)); right: calc(14 * var(--u));
  height: calc(34 * var(--u));
  display: flex; align-items: center;
  font-weight: 900; font-size: calc(20 * var(--u)); letter-spacing: 0.02em;
  color: var(--text-primary);
  z-index: 2; -webkit-tap-highlight-color: transparent;
}
.menu-tier[role="button"] { cursor: pointer; }
.menu-tier[role="button"]:active { transform: scale(0.94); }
[dir="rtl"] .menu-tier { right: auto; left: calc(14 * var(--u)); }

/* Intro flag button — top-left of the onboarding screen (mirrors intro-mute). */
.intro-lang {
  position: absolute; top: max(calc(14 * var(--u)), env(safe-area-inset-top)); left: calc(16 * var(--u));
  z-index: 5; width: calc(44 * var(--u)); height: calc(44 * var(--u));
  padding: 0; border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent;
}
.intro-lang:active { transform: scale(0.92); }
.intro-flag { width: calc(34 * var(--u)); height: calc(25 * var(--u)); }

/* Language picker dialog (tap a flag). */
.lang-overlay { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: calc(22 * var(--u)); background: rgba(6,8,14,0.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.lang-card { width: 100%; max-width: calc(360 * var(--u)); max-height: 84%; max-height: 84dvh; overflow-y: auto; padding: calc(18 * var(--u)); transform: scale(0.94); opacity: 0; transition: transform 140ms ease-out, opacity 140ms ease-out; }
.lang-card.in { transform: scale(1); opacity: 1; }
.lang-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(10 * var(--u)); }
.lang-opt { display: flex; align-items: center; gap: calc(10 * var(--u)); padding: calc(10 * var(--u)) calc(12 * var(--u)); border-radius: calc(14 * var(--u)); border: calc(3 * var(--u)) solid var(--stroke); background: var(--tile-face, var(--face)); cursor: pointer; font-weight: 900; color: var(--text-primary); }
.lang-opt.on { background: var(--accent1); color: var(--on-accent); }
.lang-opt:active { transform: translateY(calc(2 * var(--u))); }
.lang-name { font-size: calc(15 * var(--u)); line-height: 1.15; min-width: 0; text-align: start; }
/* an odd count (15 languages) would leave the last tile alone in a half row: span it
 * across the grid instead, centred, so the list always ends on a full row */
.lang-grid > .lang-opt:last-child:nth-child(odd) { grid-column: 1 / -1; justify-content: center; }

/* ---------------------------------------------------------------- game */
.game-top { display: flex; align-items: center; gap: calc(12 * var(--u)); margin-bottom: calc(10 * var(--u)); }
.game-top .mw-progress { flex: 1; }
.game-timer { font-variant-numeric: tabular-nums; font-weight: 900; font-size: calc(18 * var(--u)); min-width: calc(56 * var(--u)); text-align: right; }
/* real-time adaptive FOCUS chip: flashes "Focusing on ×" then dims to a small ADAPTIVE pill */
.adapt-chip { font-weight: 900; font-size: calc(10 * var(--u)); letter-spacing: 0.06em; text-transform: uppercase; color: var(--on-accent); background: var(--accent1); border-radius: calc(10 * var(--u)); padding: calc(3 * var(--u)) calc(8 * var(--u)); white-space: nowrap; line-height: 1; transition: background 400ms ease, color 400ms ease, opacity 400ms ease, padding 400ms ease; }
.adapt-chip[hidden] { display: none; }
.adapt-chip.pilled { background: transparent; color: var(--text-secondary); opacity: 0.7; padding: 0; font-size: calc(9 * var(--u)); letter-spacing: 0.12em; }
.adapt-chip.chip-in { animation: chipIn 380ms cubic-bezier(.2,1.3,.4,1) both; }
@keyframes chipIn { 0% { transform: scale(.55); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* iOS-safe exit: a pause button (≥44pt tap target) in the top-left safe area.
 * Tapping it opens the pause sheet — no bare back arrow to fat-finger mid-game. */
.game-pause-btn, .game-back-btn {
  flex: 0 0 auto;
  width: calc(40 * var(--u)); height: calc(40 * var(--u));
  min-width: 44px; min-height: 44px;          /* HIG minimum, even on tiny --u */
  margin: calc(-4 * var(--u)) 0 calc(-4 * var(--u)) calc(-4 * var(--u));
  display: flex; align-items: center; justify-content: center;
  border: none; padding: calc(9 * var(--u)); cursor: pointer;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text-primary) 9%, transparent);
  -webkit-tap-highlight-color: transparent;
}
.game-pause-btn:active, .game-back-btn:active { background: color-mix(in srgb, var(--text-primary) 18%, transparent); transform: scale(0.94); }
.game-pause-btn svg, .game-back-btn svg { width: 100%; height: 100%; }
.game-pause-btn svg rect { fill: var(--text-primary); }

.pause-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 62%, rgba(0,0,0,0.55));
  backdrop-filter: blur(calc(3 * var(--u)));
  padding: calc(24 * var(--u));
}
.pause-overlay[hidden] { display: none; }
.pause-sheet {
  width: 100%; max-width: calc(320 * var(--u));
  padding: calc(26 * var(--u)) calc(22 * var(--u));
  display: flex; flex-direction: column; gap: calc(12 * var(--u));
  text-align: center;
}
.pause-title { font-size: calc(34 * var(--u)); color: var(--text-primary); margin-bottom: calc(6 * var(--u)); }
.pause-sheet .mw-btn { align-self: stretch; }

/* the next-question preview — grey, centred, above the card (like Android) */
.q-next {
  text-align: center;
  font-weight: 900;
  font-size: calc(22 * var(--u));
  color: var(--text-secondary);
  min-height: calc(28 * var(--u));
  margin-bottom: calc(8 * var(--u));
}

/* the question + answer live in ONE chunky card (Android's bg_game_card) */
.q-area {
  flex: 1;
  min-height: 0;   /* let the card shrink so the keypad is always visible (no scroll) */
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: calc(14 * var(--u));
  margin: 0 0 calc(12 * var(--u));
  padding: calc(20 * var(--u)) calc(16 * var(--u)) calc(28 * var(--u));
}
.q-text { font-size: calc(60 * var(--u)); font-weight: 900; text-align: center; max-width: 100%; }
/* Math never mirrors (Arabic/Urdu): the question, its grey preview and the explainer's
 * header are isolated LTR runs, so "13 − 8" can never render as "8 − 13" under dir=rtl.
 * A .q-text that can hold localized prose (World Challenge's "Loading" line) carries
 * dir="auto" instead: prose takes its own direction, a bare expression still reads LTR. */
.q-text:not([dir]), .q-next, .ex-question { direction: ltr; unicode-bidi: isolate; }
/* each new question fades in fast */
@keyframes mw-qin { from { opacity: 0; transform: translateY(calc(6 * var(--u))); } to { opacity: 1; transform: translateY(0); } }
.q-text.q-in { animation: mw-qin 150ms ease-out; }
/* full-width answer field (matches the keypad width), purple ink, grey "?" hint */
.q-answer {
  width: 100%;
  min-height: calc(80 * var(--u));
  display: flex; align-items: center; justify-content: center;
  font-size: calc(52 * var(--u)); font-weight: 900;
  color: var(--answer-ink);
  font-variant-numeric: tabular-nums;
}
.q-answer.placeholder { color: var(--hint-ink); }
.q-hint { font-size: calc(20 * var(--u)); color: var(--text-secondary); min-height: calc(26 * var(--u)); }
/* brief green flash when the completed answer is correct (the answer stays
 * painted long enough to be seen before advancing) */
@keyframes mw-correct {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.q-answer.correct { color: var(--good-green); animation: mw-correct 240ms ease-out; }   /* #1A8F3C unless a dark pattern theme lightens it */
/* 3-wrongs reveal: the correct answer shown IN the answer slot, same size, red. */
.q-answer.reveal { color: var(--stat-red); }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: calc(10 * var(--u));
  margin-top: calc(8 * var(--u));
}
.keypad .mw-tile { height: calc(64 * var(--u)); font-size: calc(30 * var(--u)); display: flex; align-items: center; justify-content: center; }

/* ---------------------------------------------------------- countdown */
.count-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(8 * var(--u)); padding: calc(24 * var(--u)); background: var(--bg-paint); z-index: 5; }
.count-mode { text-align: center; font-size: calc(32 * var(--u)); line-height: 1.0; color: var(--text-primary); }
.count-diff { font-weight: 900; font-size: calc(20 * var(--u)); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); }
.count-count { font-weight: 900; font-size: calc(16 * var(--u)); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-secondary); }
.count-digit { font-size: calc(150 * var(--u)); color: var(--text-primary); margin-top: calc(8 * var(--u)); }

/* ----------------------------------------------------------- complete */
.complete-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg-paint); z-index: 5; }
.complete-text { font-size: calc(64 * var(--u)); color: var(--accent2); text-align: center; }

/* -------------------------------------------------------------- score */
.score-wrap { flex: 1; display: flex; flex-direction: column; }
.score-card { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(14 * var(--u)); padding: calc(18 * var(--u)) calc(20 * var(--u)) calc(22 * var(--u)); text-align: center; }
.score-stat { width: 100%; }
.score-stat-label { font-weight: 900; font-size: calc(16 * var(--u)); letter-spacing: 0.1em; color: var(--text-secondary); }
.score-stat-label.final { font-size: calc(20 * var(--u)); color: var(--text-primary); }
.score-stat-value { margin-top: calc(4 * var(--u)); font-weight: 900; font-size: calc(44 * var(--u)); }
/* the AI times tables win title ("20 IN A ROW!", modes/aitables.js showWin): sized like the Brain Cruncher's
 * result title (styles/cruncher.css .cruncher-screen .bc-result-title), whose rule only reaches the Cruncher's
 * own screen; without this the title fell back to 16 px under a 3u outline and its letters ran together */
.score-card .bc-result-title { font-size: calc(32 * var(--u)); line-height: 1.02; color: var(--accent1); overflow-wrap: anywhere; }
/* Nintendo-style: penalty values are an understated grey, not red — and no stroke */
.score-stat-value.danger { color: var(--text-secondary); }
/* the keypad score screen fits without scrolling on most phones (owner, 21 Nov 2026: "Ideally we want to avoid the screen
 * from scrolling on most phones"): tighter gaps everywhere; on short screens WRONG ATTEMPTS and TIME PENALTY sit side by
 * side, the type steps down a little (never under the app's minimum); the rows keep one height (score_rows) and the
 * buttons stay 48 px or more. Where it still would not fit, modes/keypad.js fitScore folds the pace chart to a one line
 * strip (tap to open) and then moves it under the buttons. */
.kp-score { gap: calc(10 * var(--u)); padding: calc(14 * var(--u)) calc(18 * var(--u)) calc(16 * var(--u)); }
/* the card keeps its own height (no stretched empty band inside it); the spare height goes above and below the whole
 * screen's column (auto margins: nothing is cut off when it does scroll) */
.kp-wrap > .kp-score { flex: 0 0 auto; margin-top: auto; }
.kp-wrap > :last-child { margin-bottom: auto; }
.score-wrap > .score-actions[data-r="btns"] { margin-top: calc(12 * var(--u)); }
.score-wrap > .coach-card { margin-top: calc(8 * var(--u)); }
@media (max-height: 800px) {
  .kp-score { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: center; justify-items: center; column-gap: calc(8 * var(--u)); row-gap: calc(6 * var(--u)); padding: calc(10 * var(--u)) calc(14 * var(--u)) calc(12 * var(--u)); }
  .kp-score > * { grid-column: 1 / -1; }
  .kp-score > .score-stat:nth-child(1), .kp-score > .score-stat:nth-child(2) { grid-column: auto; }
  .kp-score .score-stat-label { font-size: calc(13 * var(--u)); letter-spacing: .07em; }
  .kp-score .score-stat-label.final { font-size: calc(16 * var(--u)); }
  .kp-score .score-stat-value { margin-top: calc(2 * var(--u)); font-size: calc(34 * var(--u)); }
  .kp-score .score-final { margin-top: calc(2 * var(--u)); font-size: calc(48 * var(--u)); }
  .kp-score .score-divider { width: 60%; margin-block: calc(-2 * var(--u)); }
  .kp-score .score-newbest { margin-top: calc(3 * var(--u)); gap: calc(3 * var(--u)); }
  .kp-score .score-faster { font-size: calc(14 * var(--u)); }
  .score-wrap > .coach-card { padding: calc(8 * var(--u)) calc(12 * var(--u)); gap: calc(10 * var(--u)); }
  .score-wrap > .coach-card .coach-avatar { width: calc(44 * var(--u)); height: calc(44 * var(--u)); }
  .score-wrap > .coach-card .coach-line { font-size: calc(14 * var(--u)); }
  .score-wrap > .coach-card .coach-extra-line { font-size: calc(12 * var(--u)); }
  .score-wrap .traj-canvas { height: calc(38 * var(--u)); }
  .score-wrap .traj-panel { margin-top: calc(6 * var(--u)); padding: calc(5 * var(--u)) calc(9 * var(--u)); }
}
@media (max-height: 800px) and (min-height: 1px) { html:is(.loc-font-devanagari,.loc-font-bengali,.loc-font-arabic,.loc-font-cjk,.loc-font-ja,.loc-font-ko) .kp-score .score-stat-label { letter-spacing: 0; } }
/* the pace chart folded to one line (modes/keypad.js fitScore): the small trace beside its caption; a tap opens it */
.traj-slot.traj-strip .traj-panel { display: grid; grid-template-columns: calc(78 * var(--u)) 1fr; align-items: center; column-gap: calc(8 * var(--u)); padding: calc(4 * var(--u)) calc(9 * var(--u)); cursor: pointer; }
.traj-slot.traj-strip .traj-head { display: none; }
.traj-slot.traj-strip .traj-canvas { height: calc(24 * var(--u)); }
.traj-slot.traj-strip .traj-cap { margin: 0; text-align: start; }
.score-wrap.fit-last > .traj-slot { order: 9; }

/* "Complete" breather overlay (between finishing a workout and the score reveal) */
.complete-overlay { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: var(--bg-paint); cursor: pointer; opacity: 0; transition: opacity .18s ease; }
.complete-overlay.in { opacity: 1; }
.complete-box { padding: calc(28 * var(--u)) calc(44 * var(--u)) calc(34 * var(--u)); display: flex; align-items: center; justify-content: center; transform: scale(0.6); opacity: 0; animation: completePop .42s cubic-bezier(.2,1.3,.5,1) forwards; }
/* chunky but understated: a theme-aware dark grey (a softened primary text), no stroke */
.complete-text { font-size: calc(40 * var(--u)); font-weight: 900; color: color-mix(in srgb, var(--text-primary) 70%, var(--face)); text-transform: uppercase; letter-spacing: 0.04em; }
@keyframes completePop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.score-final { margin-top: calc(6 * var(--u)); font-weight: 900; font-size: calc(58 * var(--u)); color: var(--text-primary); font-variant-numeric: tabular-nums; }
.score-divider { width: 70%; height: calc(3 * var(--u)); background: var(--stroke); border-radius: calc(2 * var(--u)); }
/* (two buttons side by side: 12 u side padding leaves room for a long word, and a pair that still does not fit goes one
   above the other instead of pushing the second out of its card: SPEICHERN on the badge card; layout audit, 23 Nov 2026) */
.score-actions { display: flex; flex-wrap: wrap; gap: calc(10 * var(--u)); margin-top: calc(18 * var(--u)); }
.score-actions .mw-btn { flex: 1; padding-left: calc(12 * var(--u)); padding-right: calc(12 * var(--u)); }
/* keypad score screen (v211): PLAY AGAIN is the wider primary next to MENU. Scoped to that row
 * (data-r="btns"): the pause cards, game-over cards and other score screens keep their own sizing */
.score-actions[data-r="btns"] { position: relative; }
.score-actions[data-r="btns"] .mw-btn.again { flex: 1.4; }
.score-actions[data-r="btns"] .mw-btn { min-width: 0; padding-left: calc(12 * var(--u)); padding-right: calc(12 * var(--u)); }
/* a quiet "Tap to skip" (secondary text) where the buttons will land, while the card builds (it stays
 * visible inside the still-hidden actions row, and goes once everything is shown) */
.score-skip { position: absolute; inset: 0; visibility: visible; display: flex; align-items: center; justify-content: center;
  background: none; border: none; padding: 0; font: inherit; font-weight: 800; font-size: calc(14 * var(--u)); letter-spacing: 0.04em;
  color: var(--text-secondary); opacity: 0; animation: scoreSkipIn 400ms ease-out 500ms forwards; cursor: pointer; }
@keyframes scoreSkipIn { to { opacity: 1; } }   /* full --text-secondary: 4.5:1 on every light theme */
.score-actions:not(.hidden) .score-skip { display: none; }
/* BEST TIME: the BEST STREAK line's look (label + chip), the whole line is the button that
 * opens this level's best times. The chip is brushed steel with a stopwatch: time, not a combo. */
.score-best { min-height: 44px; margin: calc(-6 * var(--u)) 0; padding: 0 calc(8 * var(--u)); background: none; border: 0; border-radius: calc(12 * var(--u));
  font: inherit; color: inherit; cursor: pointer; }
.fx-combo.score-time { display: inline-flex; align-items: center; gap: calc(5 * var(--u)); direction: inherit;
  background: linear-gradient(to bottom, #FFFFFF, #D2DBE5); color: #1E2935; box-shadow: 0 calc(2 * var(--u)) 0 0 #4E5D6C; }
.score-time::before { content: ''; flex: 0 0 auto; width: 0.9em; height: 0.9em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.7' stroke-linecap='round'%3E%3Ccircle cx='12' cy='13.6' r='7.4'/%3E%3Cpath d='M12 13.6V9.8M12 6V3.4M9.3 3h5.4M18.4 6.9l1.5-1.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.7' stroke-linecap='round'%3E%3Ccircle cx='12' cy='13.6' r='7.4'/%3E%3Cpath d='M12 13.6V9.8M12 6V3.4M9.3 3h5.4M18.4 6.9l1.5-1.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.score-time b { font-weight: inherit; unicode-bidi: isolate; }
.fx-combo.score-time.bump { animation: scoreTimeBump 340ms cubic-bezier(.2, 1.6, .4, 1); }
@keyframes scoreTimeBump { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
/* NEW BEST end state: the time in gold (outline kept) with a soft gold glow; reduced motion and
 * Celebrations off land here directly. The scripts without the outline get a ring instead. */
.score-final.nbt-gold { color: var(--text-primary); }
/* the NEW BEST roll (ui/fx.js bestTime): one line box (--nbt-h), each changed digit a window
 * on a strip of digits; the digits stay left to right in RTL; then a shine twin + the delta */
.nbt-box { display: inline-block; position: relative; white-space: nowrap; transform-origin: 50% 65%; }
.nbt-num { display: inline-block; vertical-align: top; direction: ltr; unicode-bidi: isolate; }
.nbt-col, .nbt-ch { display: inline-block; vertical-align: top; height: var(--nbt-h); }
.nbt-col { clip-path: inset(0 -0.3em); }
.nbt-strip, .nbt-strip > span { display: block; }
.nbt-strip > span { height: var(--nbt-h); }
.nbt-shine { position: absolute; inset: 0; pointer-events: none; color: transparent; -webkit-text-fill-color: transparent; -webkit-text-stroke-width: 0; text-shadow: none;
  background: linear-gradient(100deg, transparent 38%, rgba(255, 255, 255, 0.95) 47%, rgba(255, 255, 255, 0.95) 53%, transparent 62%) 100% 0 / 260% 100% no-repeat;
  -webkit-background-clip: text; background-clip: text; }
.nbt-delta { position: absolute; top: 12%; inset-inline-start: calc(100% + 4 * var(--u)); padding: 0 calc(6 * var(--u)); border-radius: 999px; opacity: 0; pointer-events: none;
  font-size: calc(15 * var(--u)); line-height: 1.35; color: #fff; -webkit-text-stroke-width: 0; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
  background: linear-gradient(to bottom, #4ADE80, #1A8F3C); border: calc(2 * var(--u)) solid var(--stroke); box-shadow: 0 calc(2 * var(--u)) 0 0 var(--stroke); }
/* NEW BEST: a chunky gold ribbon + how much faster, under the final time */
.score-newbest { display: flex; flex-direction: column; align-items: center; gap: calc(6 * var(--u)); margin-top: calc(8 * var(--u)); }
.score-ribbon { display: inline-block; padding: calc(4 * var(--u)) calc(16 * var(--u)) calc(5 * var(--u)); border-radius: 999px;
  background: linear-gradient(to bottom, #FFE9A0, #F5C233 55%, #E8A41E); border: calc(2.5 * var(--u)) solid #B8860B;
  box-shadow: 0 calc(3 * var(--u)) 0 0 #8A5A10; color: #3A2606; font-weight: 900; font-size: calc(17 * var(--u)); letter-spacing: 0.08em; text-transform: uppercase; }
.score-faster { font-weight: 800; font-size: calc(15 * var(--u)); color: var(--streak-green, var(--good-green)); }
.score-newbest.nb-in .score-ribbon { animation: scoreRibbonIn 520ms cubic-bezier(.2, 1.5, .4, 1) both; }
.score-newbest.nb-in .score-faster { animation: mw-fadein 320ms ease-out 260ms both; }
@keyframes scoreRibbonIn { 0% { transform: scale(0.4) rotate(-6deg); opacity: 0; } 70% { transform: scale(1.08) rotate(1deg); opacity: 1; } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .score-skip { animation: none; opacity: 1; }
  .score-newbest.nb-in :is(.score-ribbon, .score-faster), .fx-combo.score-time.bump { animation: none; }
}
html:is(.loc-font-devanagari,.loc-font-bengali,.loc-font-arabic) .score-ribbon { letter-spacing: 0; }
.hidden { visibility: hidden; }
.fade-in { animation: mw-fadein 320ms ease-out; }
@keyframes mw-fadein { from { opacity: 0; } to { opacity: 1; } }

/* local best-times dialog (offline ModernScoresDialog equivalent) */
.scores-overlay { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--bg) 62%, rgba(0,0,0,0.55)); backdrop-filter: blur(calc(3 * var(--u))); padding: calc(24 * var(--u)); }
.scores-sheet { width: 100%; max-width: calc(340 * var(--u)); padding: calc(24 * var(--u)) calc(20 * var(--u)); display: flex; flex-direction: column; gap: calc(14 * var(--u)); }
.scores-title { text-align: center; font-size: calc(28 * var(--u)); color: var(--text-primary); }
.scores-list { display: flex; flex-direction: column; gap: calc(6 * var(--u)); max-height: 50vh; overflow-y: auto; }
.scores-row { display: flex; align-items: center; gap: calc(12 * var(--u)); padding: calc(8 * var(--u)) calc(12 * var(--u)); border-radius: calc(10 * var(--u)); background: var(--panel-face); font-weight: 900; }
.scores-row.current { background: var(--accent1); }
.scores-row.current .rank { color: var(--on-accent-soft); }
.scores-row.current .t { color: var(--on-accent); }
.scores-row .rank { width: calc(24 * var(--u)); color: var(--text-secondary); }
.scores-row .t { flex: 1; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.scores-empty { text-align: center; color: var(--text-secondary); font-weight: 900; padding: calc(16 * var(--u)); }
.scores-close { align-self: stretch; }
/* v211: the dialog names the level, each row its level + date, then other levels and
 * the times saved before levels were tracked */
.scores-sub { margin-top: calc(-8 * var(--u)); text-align: center; font-weight: 900; font-size: calc(13 * var(--u)); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); }
.scores-sec { margin-top: calc(8 * var(--u)); font-weight: 900; font-size: calc(12 * var(--u)); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-secondary); }
.scores-row .meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; text-align: start; }
.scores-row .meta .lv { font-size: calc(11.5 * var(--u)); letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scores-row .meta .dt { font-size: calc(12 * var(--u)); font-weight: 700; color: var(--text-secondary); }
.scores-row .meta + .t { flex: 0 0 auto; }
.scores-row.current .meta .lv { color: var(--on-accent, var(--text-primary)); }
.scores-row.current .meta .dt { color: var(--on-accent-soft, var(--text-secondary)); }
html:is(.loc-font-devanagari,.loc-font-bengali,.loc-font-arabic) :is(.scores-sub, .scores-sec, .scores-row .meta .lv) { letter-spacing: 0; }

/* ================================================================
 * Settings + Times-Table picker — card-per-section, matched to
 * activity_options_modern.xml / activity_times_table_menu_modern.xml
 * ================================================================ */
/* back chevron (top-left), mirrors the menu gear FAB */
.back-fab {
  position: absolute;
  top: max(calc(14 * var(--u)), env(safe-area-inset-top));
  left: calc(14 * var(--u));
  width: calc(44 * var(--u)); height: calc(44 * var(--u));
  min-width: 44px; min-height: 44px;
  padding: calc(10 * var(--u));
  border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; z-index: 2;
}
.back-fab:active { transform: scale(0.92); }
/* 48 px tap areas for the 44 px corner buttons, the look unchanged: an invisible ring round each, just enough for 48 x 48
   (on a short window the column scales them down to 36 px; layout audit, 23 Nov 2026). :where() keeps any other position
   rule of theirs; not the dark "?" (static in its header row, a ring there would cover the row). */
.back-fab::after, .brief-q:not(.brief-q-dark)::after, .intro-lang::after, .intro-mute::after, .modal-x::after, .game-pause-btn::after, .game-back-btn::after,
.m-help::after, .ta-help::after, .wi-mute::after, .rd-bomb::after, .au-nav::after {
  content: ''; position: absolute; top: min(0px, calc((100% - 48px) / 2)); bottom: min(0px, calc((100% - 48px) / 2));
  left: min(0px, calc((100% - 48px) / 2)); right: min(0px, calc((100% - 48px) / 2)); border-radius: 50%; }
:where(.game-pause-btn, .game-back-btn, .ta-help) { position: relative; }
.back-fab svg { width: 100%; height: 100%; }

/* bottom-anchored primary action: the content scrolls, the action button stays
 * pinned to the bottom of the viewport (the app-wide pattern). */
.screen-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; transform: translateZ(0); background: var(--scroll-bg); }
.set-cols { display: contents; }   /* Settings' cards wrapper: no box here (desktop.css makes it two columns on a wide window) */
/* Settings sections (ui/settings/sections.js): a heading in the home's section-label look (home2.css .h2-sec) over its cards */
.set-group { flex: 0 0 auto; }
.set-sec { margin: calc(12 * var(--u)) calc(4 * var(--u)) calc(8 * var(--u)); font-size: calc(12.5 * var(--u)); font-weight: 900; letter-spacing: .09em; text-transform: uppercase; color: var(--text-secondary); }
.set-cols > .set-group:first-child > .set-sec, .adm-setcard + .set-group > .set-sec { margin-top: calc(2 * var(--u)); }
:is(:lang(zh), :lang(ja), :lang(ko), :lang(hi), :lang(bn), :lang(ar), :lang(ur)) .set-sec { letter-spacing: 0; font-size: calc(13.5 * var(--u)); }
.set-group:last-child > :last-child { margin-bottom: calc(28 * var(--u)); }
.set-del { padding-block: calc(4 * var(--u)); }
.set-del > :is(.acct-delete, .acct-delete-account) { display: flex; align-items: center; width: 100%; min-height: 48px; margin: 0; padding: 0; background: none; border: 0;
  text-align: start; font-size: calc(14 * var(--u)); font-weight: 700; color: var(--text-secondary); text-decoration: underline; }
.set-link, .set-langrow { display: flex; align-items: center; gap: calc(10 * var(--u)); width: 100%; min-height: 48px; padding: calc(4 * var(--u)) 0; background: none; border: 0;
  color: var(--text-primary); font-weight: 900; font-size: calc(16 * var(--u)); text-align: start; text-decoration: none; }
.set-link + .set-link { border-top: calc(2 * var(--u)) solid rgba(0, 0, 0, .1); border-top-color: color-mix(in srgb, var(--stroke) 14%, transparent); }
.set-link > span, .set-langrow > span { flex: 1; }
.set-chev { flex: 0 0 auto; color: var(--text-secondary); }
[dir="rtl"] .set-chev { transform: scaleX(-1); }
.lang-grid[hidden] { display: none; }
.set-langrow .lang-flag { width: calc(30 * var(--u)); height: auto; border-radius: calc(4 * var(--u)); }
.set-ver { margin: calc(4 * var(--u)) calc(4 * var(--u)) 0; font-size: calc(12.5 * var(--u)); color: var(--text-secondary); text-align: center; unicode-bidi: isolate; }
.set-autoname .lb-name-save { display: none; }
.set-namebox { position: relative; margin-top: calc(8 * var(--u)); }
.set-namebox .wc-handle { margin-top: 0; }
.set-saved { position: absolute; inset-inline-end: calc(14 * var(--u)); top: 50%; transform: translateY(-50%); display: flex; color: var(--good-green, #1A8F3C); opacity: 0; transition: opacity .2s; pointer-events: none; }
.set-saved.on { opacity: 1; }
.screen-action { flex: 0 0 auto; align-self: stretch; margin-top: calc(12 * var(--u)); }

/* Android-style fading edge: content fades out at whichever edge has more to scroll (lib/scrollfade.js sets --ft / --fb:
 * 0 at an edge at its end, 28 px where more waits beyond it). Owner, 23 Nov 2026: "anything that is scrollable needs a bit of
 * a fade to indicate scrollableness in the UI". The boxes listed after .scroll-fade take it without a class of their own;
 * .sf-only boxes (cards with a shadow, every screen: main.js show) have the mask only while they really scroll (sf-on); a
 * full-window sheet whose backdrop scrolls (FADE_CARD in lib/scrollfade.js) fades its card, never the backdrop. Each box
 * attaches itself when it enters the page: the 1 ms mwSfIn animation, caught once by lib/scrollfade.js. A result screen
 * (a game screen holding its score) needs :has() (Chrome 105+; older engines simply show no fade there). */
:is(.scroll-fade, .m-scroll, .gm-lb-rows, .rd-board-rows, .yap-list, .run-hub .screen-scroll, .run-end-body, .ta-res-card, .game-screen:has(> .score-wrap), .au-sheet, .lang-card, .ta-watch-card, .wn-slide) {
  --ft: 0px; --fb: 0px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--ft), #000 calc(100% - var(--fb)), transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 var(--ft), #000 calc(100% - var(--fb)), transparent 100%);
  animation: mwSfIn 1ms;
}
:is(.sf-only, .ta-res-card, .game-screen, .au-sheet, .lang-card, .ta-watch-card, .wn-slide):not(.sf-on) { -webkit-mask-image: none; mask-image: none; }
/* (.wn-slide: a What's new slide whose words outgrow it, a long language with large text on a short window, mw-v237) */
/* sideways (--fs / --fe at the start / end edge; mirrored right to left) */
.scroll-fade-x {
  --fs: 0px; --fe: 0px;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fs), #000 calc(100% - var(--fe)), transparent 100%);
          mask-image: linear-gradient(to right, transparent 0, #000 var(--fs), #000 calc(100% - var(--fe)), transparent 100%);
  animation: mwSfIn 1ms;
}
[dir="rtl"] .scroll-fade-x {
  -webkit-mask-image: linear-gradient(to left, transparent 0, #000 var(--fs), #000 calc(100% - var(--fe)), transparent 100%);
          mask-image: linear-gradient(to left, transparent 0, #000 var(--fs), #000 calc(100% - var(--fe)), transparent 100%);
}
/* the full-window sheets (the Pro sheet, sign in, Galaxy Run's result card): the card fades at the window's edges */
:is(.pw-overlay.pw3, .sw-overlay, .gx-mission .bl-end) { --ft: 0px; --fb: 0px; animation: mwSfIn 1ms; }
:is(.pw-overlay.pw3, .sw-overlay, .gx-mission .bl-end).sf-on > :is(.pw-card, .sw-card, .bl-end-card) {
  -webkit-mask-image: linear-gradient(to bottom, transparent var(--sf-t0, 0px), #000 calc(var(--sf-t0, 0px) + var(--ft)), #000 calc(var(--sf-b0, 100%) - var(--fb)), transparent var(--sf-b0, 100%));
          mask-image: linear-gradient(to bottom, transparent var(--sf-t0, 0px), #000 calc(var(--sf-t0, 0px) + var(--ft)), #000 calc(var(--sf-b0, 100%) - var(--fb)), transparent var(--sf-b0, 100%));
}
@keyframes mwSfIn { from { --sf-in: 0; } to { --sf-in: 1; } }
/* a scroll box the keys focused (Today's scores, lib/spatial.js): the fade would mask its
 * focus ring away, so it drops while the ring shows, and the ring sits inside the box, where
 * a clipping parent cannot cut it (a tap never shows it: :focus-visible) */
.scroll-fade:focus-visible, .scroll-fade-x:focus-visible { -webkit-mask-image: none; mask-image: none; }
.scroll-fade:focus-visible, [data-nav-stop]:focus-visible { outline-offset: -3px; }

/* plain dark page title (Settings — NOT outlined, per Android) */
.opt-title { text-align: center; font-weight: 900; font-size: calc(28 * var(--u)); color: var(--text-primary); letter-spacing: 0.08em; margin: calc(10 * var(--u)) 0 calc(20 * var(--u)); }

/* a bg_game_card section */
.opt-card { padding: calc(18 * var(--u)); margin-bottom: calc(16 * var(--u)); }
/* small-caps secondary section label */
.opt-label { font-weight: 900; font-size: calc(12 * var(--u)); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: calc(12 * var(--u)); }

/* segmented single-select group (outlined buttons, selected = accent) */
.opt-seg { display: flex; gap: calc(8 * var(--u)); }
.opt-seg.vertical { flex-direction: column; }
.seg-btn {
  flex: 1; border: calc(3 * var(--u)) solid var(--stroke); border-radius: calc(14 * var(--u));
  background: transparent; color: var(--text-primary); font-family: inherit; font-weight: 900;
  font-size: calc(16 * var(--u)); padding: calc(12 * var(--u)) calc(10 * var(--u)); cursor: pointer;
}
.seg-btn.on { background: var(--accent1); color: var(--on-accent); }
/* Settings > Keypad layout (ui/settings.js keypadCard): each choice draws its keypad's top row
   (1 2 3 or 7 8 9) as small keycaps over a faint second row; the keypads' own direction, so a
   right to left page mirrors it like the real keypad */
.kp-seg .seg-btn { display: flex; flex-direction: column; align-items: center; gap: calc(8 * var(--u)); }
.kp-pv { display: grid; grid-template-columns: repeat(3, calc(24 * var(--u))); gap: calc(4 * var(--u)); }
.kp-pv i { display: flex; align-items: center; justify-content: center; height: calc(24 * var(--u)); border: calc(2 * var(--u)) solid var(--stroke);
  border-radius: calc(7 * var(--u)); background: var(--face); color: var(--text-primary); font-style: normal; font-size: calc(14 * var(--u)); line-height: 1;
  font-variant-numeric: tabular-nums; box-shadow: 0 calc(2 * var(--u)) 0 var(--stroke); }
.kp-pv b { height: calc(7 * var(--u)); margin-top: calc(2 * var(--u)); border-radius: calc(3 * var(--u)); background: currentColor; opacity: 0.22; }

/* a title+subtitle row with a control on the right (reminders/sound/random) */
.opt-row { display: flex; align-items: center; gap: calc(12 * var(--u)); }
.opt-row-sub { margin-top: calc(12 * var(--u)); padding-top: calc(12 * var(--u)); border-top: calc(2 * var(--u)) solid color-mix(in srgb, var(--stroke) 14%, transparent); }
.opt-row .opt-text { flex: 1; }
.opt-row .opt-text .t { font-weight: 900; font-size: calc(16 * var(--u)); color: var(--text-primary); }
.opt-row .opt-text .s { margin-top: calc(2 * var(--u)); font-size: calc(12 * var(--u)); color: var(--text-secondary); }
/* Settings Computer card (ui/settings/computer.js): its first row sits right under the label,
   and the Install button keeps its own width beside the text (.opt-cta is full width) */
.dt-computer-card .opt-label + .opt-row-sub { margin-top: 0; padding-top: 0; border-top: 0; }
.opt-row .dt-install { flex: 0 0 auto; width: auto; margin-top: 0; min-height: 48px; padding-inline: calc(18 * var(--u)); }

/* custom switch (no emoji, chunky) */
.mw-switch { flex: 0 0 auto; width: calc(54 * var(--u)); height: calc(30 * var(--u)); border-radius: calc(30 * var(--u)); border: calc(3 * var(--u)) solid var(--stroke); background: var(--panel-face); position: relative; cursor: pointer; transition: background 120ms; }
.mw-switch::after { content: ''; position: absolute; top: calc(2 * var(--u)); left: calc(2 * var(--u)); width: calc(22 * var(--u)); height: calc(22 * var(--u)); border-radius: 50%; background: var(--stroke); transition: transform 120ms; }
.mw-switch.on { background: var(--accent1); }
.mw-switch.on::after { transform: translateX(calc(24 * var(--u))); }
.mw-switch:focus-visible { outline: 3px solid var(--text-primary); outline-offset: 2px; }

/* Theme card (ui/themepicker.js): a Colours strip and a Patterns strip. Each scrolls
 * sideways and says so: 5.5 swatches show (the next one peeks half out), the edges fade
 * where there is more, and a round arrow button at the end scrolls on tap. The swatch
 * ring colours come from the CURRENT theme (--sw-* are resolved on the row and
 * inherited), while a pattern swatch carries its own theme's tokens ([data-swatch]). */
.theme-card:empty { min-height: calc(268 * var(--u)); }
.theme-head { display: flex; align-items: baseline; justify-content: space-between; gap: calc(10 * var(--u)); margin-bottom: calc(10 * var(--u)); }
.theme-head .opt-label { margin-bottom: 0; }
.theme-swipe { display: inline-flex; align-items: center; gap: calc(4 * var(--u)); font-size: calc(12.5 * var(--u)); font-weight: 800; color: var(--text-secondary); white-space: nowrap; transition: opacity .3s ease; }
.theme-swipe[hidden] { display: none; }
.theme-swipe.gone { opacity: 0; }
.theme-swipe-ico { display: inline-block; width: calc(13 * var(--u)); height: calc(13 * var(--u)); animation: themeSwipeNudge 1.4s ease-in-out infinite; }
[dir="rtl"] .theme-swipe-ico svg { transform: scaleX(-1); }
@keyframes themeSwipeNudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(calc(4 * var(--u))); } }
[dir="rtl"] .theme-swipe-ico { animation-name: themeSwipeNudgeRtl; }
@keyframes themeSwipeNudgeRtl { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(calc(-4 * var(--u))); } }
.theme-sub { font-size: calc(12.5 * var(--u)); font-weight: 800; color: var(--text-secondary); margin: calc(6 * var(--u)) 0 calc(2 * var(--u)); }
.theme-strip { display: flex; align-items: center; gap: calc(6 * var(--u)); }
.theme-row { --gap: calc(10 * var(--u)); --sw-ring: var(--stroke); --sw-on: var(--text-primary); --sw-veil: var(--face);
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: var(--gap); overflow-x: auto; overscroll-behavior-x: contain;
  padding: calc(6 * var(--u)) calc(3 * var(--u)) calc(9 * var(--u)); scroll-behavior: smooth;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--hl, 0px), #000 calc(100% - var(--hr, 0px)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--hl, 0px), #000 calc(100% - var(--hr, 0px)), transparent 100%); }
.theme-row::-webkit-scrollbar { display: none; }
.theme-sw { position: relative; flex: 0 0 calc((100% - 5 * var(--gap)) / 5.5); aspect-ratio: 1; height: auto; padding: 0; overflow: hidden;
  border-radius: calc(12 * var(--u)); border: calc(3 * var(--u)) solid var(--sw-ring); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.theme-sw.on { border-width: calc(5 * var(--u)); border-color: var(--sw-on); }
.theme-sw:focus-visible { outline-color: var(--sw-on); }   /* a pattern swatch carries its own --text-primary */
/* a pattern swatch: its theme's real background (scaled down) and a mini card face */
.theme-sw.pat { --ps: calc(0.66 * var(--u)); background: var(--bg-paint); }
.theme-sw.pat::after { content: ''; position: absolute; left: 24%; right: 24%; bottom: 15%; height: 26%; border-radius: calc(4 * var(--u));
  background: linear-gradient(var(--accent1), var(--accent1)) 50% 50% / 54% calc(3.5 * var(--u)) no-repeat, linear-gradient(to bottom, var(--face-top), var(--face));
  border: calc(2 * var(--u)) solid var(--stroke); box-shadow: 0 calc(2 * var(--u)) 0 0 var(--shadow); }
/* locked (no Pro, free changes used): a veil in the current card colour + a lock chip */
.theme-sw.locked::before { content: ''; position: absolute; inset: 0; z-index: 1; background: color-mix(in srgb, var(--sw-veil) 52%, transparent); }
.theme-lock { position: absolute; z-index: 2; top: calc(3 * var(--u)); inset-inline-end: calc(3 * var(--u)); width: calc(17 * var(--u)); height: calc(17 * var(--u));
  padding: calc(3 * var(--u)); border-radius: 50%; background: var(--sw-on); color: var(--sw-veil); display: block; }
.theme-more { position: relative; flex: 0 0 auto; width: calc(34 * var(--u)); height: calc(34 * var(--u)); margin-bottom: calc(3 * var(--u));
  display: grid; place-items: center; padding: calc(8 * var(--u)); border-radius: 50%; cursor: pointer; -webkit-tap-highlight-color: transparent;
  background: linear-gradient(to bottom, var(--face-top), var(--face)); border: calc(3 * var(--u)) solid var(--stroke);
  box-shadow: 0 calc(3 * var(--u)) 0 0 var(--shadow); color: var(--text-primary); transition: transform 90ms ease-out, box-shadow 90ms ease-out; }
.theme-more::after { content: ''; position: absolute; inset: calc(-6 * var(--u)); }   /* a 44pt-class hit area */
.theme-more[hidden] { display: none; }
.theme-more svg { transition: transform .25s ease; }
.theme-more.back svg { transform: rotate(180deg); }
[dir="rtl"] .theme-more svg { transform: rotate(180deg); }
[dir="rtl"] .theme-more.back svg { transform: none; }
.theme-more:active { transform: translateY(calc(2 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 0 var(--shadow); }
.theme-more.pulse { animation: themeMorePulse 0.9s ease-in-out 2; }
@keyframes themeMorePulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }
@media (prefers-reduced-motion: reduce) { .theme-swipe-ico, .theme-more.pulse { animation: none; } .theme-row { scroll-behavior: auto; } }
.theme-current { margin-top: calc(10 * var(--u)); font-size: calc(12 * var(--u)); color: var(--text-secondary); }

/* shared "Quit workout?" confirm (timed modes) — opaque cover hides the question,
 * the game loop/timer keeps running underneath (anti-cheat) */
.quit-confirm { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: calc(24 * var(--u)); background: rgba(6,8,14,0.94); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.quit-card { width: 100%; max-width: calc(340 * var(--u)); display: flex; flex-direction: column; align-items: stretch; gap: calc(14 * var(--u)); text-align: center; padding: calc(24 * var(--u)); }
.quit-title { font-size: calc(30 * var(--u)); color: var(--text-primary); }
.quit-sub { font-size: calc(13 * var(--u)); color: var(--text-secondary); line-height: 1.35; }
.quit-confirm .score-actions { width: 100%; flex-direction: column; }
.quit-confirm .score-actions .mw-btn { flex: 0 0 auto; }

/* ---- Pro upgrade sheet / soft nag ---- */
/* scrolls on short screens; the card's auto margins centre it when it fits and
 * top-align it (close X reachable) when it doesn't */
.pw-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: calc(20 * var(--u)); overflow-y: auto; -webkit-overflow-scrolling: touch; background: rgba(6,8,14,0.94); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pw-card { position: relative; margin: auto 0; flex-shrink: 0; width: 100%; max-width: calc(360 * var(--u)); display: flex; flex-direction: column; align-items: stretch; gap: calc(12 * var(--u)); text-align: center; padding: calc(26 * var(--u)) calc(22 * var(--u)) calc(22 * var(--u)); opacity: 0; transform: translateY(calc(16 * var(--u))) scale(0.97); transition: opacity 0.22s, transform 0.22s; }
.pw-card.in { opacity: 1; transform: none; }
/* a 48 px target (T-Touch_Targets) around the same 20u cross, which stays where it was */
.pw-close { --pwc: max(48px, calc(34 * var(--u))); position: absolute; top: calc(15 * var(--u) - (var(--pwc) - 20 * var(--u)) / 2); right: calc(15 * var(--u) - (var(--pwc) - 20 * var(--u)) / 2); width: var(--pwc); height: var(--pwc); padding: calc((var(--pwc) - 20 * var(--u)) / 2); background: transparent; border: none; }
.pw-close svg { display: block; width: 100%; height: 100%; }
/* the Pro mark (ui/proicon.js) mirrors in Arabic and Urdu (the hat's tassel hangs on the other side) */
[dir="rtl"] .pro-ico { transform: scaleX(-1); }
.pw-badge { width: calc(64 * var(--u)); height: calc(64 * var(--u)); margin: 0 auto calc(2 * var(--u)); }
.pw-title { font-size: calc(26 * var(--u)); color: var(--text-primary); }
.pw-sub { font-size: calc(14 * var(--u)); color: var(--text-secondary); }
/* contextual reason banner at the top of the paywall (e.g. daily World Challenge used up) */
.pw-note { margin: calc(2 * var(--u)) auto calc(12 * var(--u)); max-width: 94%; font-size: calc(13.5 * var(--u));
  font-weight: 700; line-height: 1.42; color: var(--text-primary); text-align: center;
  background: color-mix(in srgb, var(--accent1) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent1) 32%, transparent);
  border-radius: calc(12 * var(--u)); padding: calc(10 * var(--u)) calc(14 * var(--u)); }
.pw-benefits { list-style: none; margin: calc(6 * var(--u)) 0; padding: 0; display: flex; flex-direction: column; gap: calc(9 * var(--u)); text-align: left; }
.pw-benefits li { display: flex; align-items: flex-start; gap: calc(9 * var(--u)); font-size: calc(13.5 * var(--u)); color: var(--text-primary); line-height: 1.32; }
.pw-chk { flex: 0 0 auto; width: calc(20 * var(--u)); height: calc(20 * var(--u)); margin-top: calc(1 * var(--u)); }
.pw-chk svg { display: block; width: 100%; height: 100%; }
.pw-buy { display: contents; }   /* no box: price, terms, buttons and code box stay items of the card (the desktop layout makes it a column, desktop.css) */
.pw-actions { display: flex; flex-direction: column; gap: calc(8 * var(--u)); margin-top: calc(4 * var(--u)); }
.pw-redeem-toggle, .pw-later, .pw-restore, .pw-recover { background: transparent; border: none; color: var(--text-secondary); font-size: calc(13 * var(--u)); font-weight: 700; padding: calc(6 * var(--u)); text-decoration: underline; }
.pw-recover[hidden], .pw-go[hidden] { display: none; }   /* .mw-btn sets display, so [hidden] alone would not hide the CTA */
.pw-redeem { display: flex; flex-direction: column; gap: calc(8 * var(--u)); margin-top: calc(2 * var(--u)); }
.pw-redeem[hidden] { display: none; }
.pw-redeem-row { display: flex; gap: calc(8 * var(--u)); }
.pw-code { flex: 1; min-width: 0; padding: calc(12 * var(--u)); border-radius: calc(12 * var(--u)); border: calc(2 * var(--u)) solid var(--stroke); background: var(--face); color: var(--text-primary); font-weight: 900; font-size: calc(18 * var(--u)); letter-spacing: calc(3 * var(--u)); text-align: center; text-transform: uppercase; }
.pw-redeem-go { flex: 0 0 auto; padding-left: calc(16 * var(--u)); padding-right: calc(16 * var(--u)); }
.pw-msg { font-size: calc(12.5 * var(--u)); min-height: calc(16 * var(--u)); color: var(--text-secondary); }
.pw-msg.err { color: #E5484D; }
.pw-msg.ok { color: #2E9E5B; }

/* Price block: the ONLY place the price appears, and only a price that will
 * really be charged (see paywall.js). Plain = the one real price. The one-time
 * offer = the real full price struck out while the real discounted price slams in
 * with a sparkle burst (triggered by .pw-card.deal-go), a calm offer pill and a
 * "Save N%" line. Hidden entirely until a real price is known. */
.pw-deal { margin: calc(2 * var(--u)) 0; padding: calc(12 * var(--u)) calc(10 * var(--u)) calc(11 * var(--u)); border-radius: calc(16 * var(--u)); background: linear-gradient(to bottom, #FFF6DE, #FFE9B8); border: calc(2 * var(--u)) dashed #E8A41E; display: flex; flex-direction: column; align-items: center; gap: calc(7 * var(--u)); overflow: visible; }
.pw-deal-prices { position: relative; display: flex; align-items: center; justify-content: center; gap: calc(12 * var(--u)); }
.pw-was { position: relative; font-weight: 900; font-size: calc(24 * var(--u)); color: #8a6d2f; transition: transform 0.35s ease-out, opacity 0.35s ease-out; }
.pw-was::after { content: ''; position: absolute; left: -6%; top: 52%; width: 0; height: calc(3 * var(--u)); background: #E5484D; border-radius: 2px; transform: rotate(-9deg); transform-origin: left center; }
.pw-now { position: relative; font-weight: 900; font-size: calc(42 * var(--u)); line-height: 1; color: #1A8F3C; opacity: 0; transform: scale(0.2) rotate(-12deg); }
.pw-offer { font-weight: 900; font-size: calc(11 * var(--u)); letter-spacing: 0.03em; color: #fff; background: linear-gradient(to bottom, #FF7043, #E5391C); padding: calc(4 * var(--u)) calc(11 * var(--u)); border-radius: calc(20 * var(--u)); box-shadow: 0 calc(2 * var(--u)) calc(6 * var(--u)) rgba(229,57,28,0.4); }
.pw-save { font-weight: 900; font-size: calc(12.5 * var(--u)); color: #1A8F3C; }
.pw-deal[hidden], .pw-offer[hidden], .pw-save[hidden], .pw-was[hidden] { display: none; }
.pw-card.pw-plain .pw-now { opacity: 1; transform: none; font-size: calc(34 * var(--u)); }
.pw-card.pw-plain .pw-sparks { display: none; }
.pw-terms { margin-top: calc(-4 * var(--u)); font-size: calc(12 * var(--u)); font-weight: 700; color: var(--text-secondary); }

.pw-card.deal-go .pw-was { transform: scale(0.66) translateX(calc(-4 * var(--u))); opacity: 0.55; }
.pw-card.deal-go .pw-was::after { width: 112%; transition: width 0.4s ease-out 0.18s; }
.pw-card.deal-go .pw-now { animation: pwSlam 0.55s cubic-bezier(0.2, 1.5, 0.4, 1) forwards; }
@keyframes pwSlam {
  0% { opacity: 0; transform: scale(0.2) rotate(-12deg); }
  55% { opacity: 1; transform: scale(1.2) rotate(3deg); }
  78% { transform: scale(0.94) rotate(-1.5deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

/* sparkle burst around the live price */
.pw-sparks { position: absolute; inset: 0; pointer-events: none; }
.pw-spark { position: absolute; left: 50%; top: 50%; width: calc(14 * var(--u)); height: calc(14 * var(--u)); margin: calc(-7 * var(--u)) 0 0 calc(-7 * var(--u)); opacity: 0; --tx: 0px; --ty: 0px; }
.pw-spark svg { display: block; width: 100%; height: 100%; }
.pw-spark-0 { --tx: calc(-46 * var(--u)); --ty: calc(-30 * var(--u)); }
.pw-spark-1 { --tx: calc(46 * var(--u)); --ty: calc(-34 * var(--u)); }
.pw-spark-2 { --tx: calc(-56 * var(--u)); --ty: calc(8 * var(--u)); }
.pw-spark-3 { --tx: calc(58 * var(--u)); --ty: calc(12 * var(--u)); }
.pw-spark-4 { --tx: calc(-28 * var(--u)); --ty: calc(34 * var(--u)); }
.pw-spark-5 { --tx: calc(34 * var(--u)); --ty: calc(36 * var(--u)); }
.pw-spark-6 { --tx: calc(2 * var(--u)); --ty: calc(-48 * var(--u)); }
.pw-card.deal-go .pw-spark { animation: pwSpark 0.72s ease-out forwards; }
.pw-card.deal-go .pw-spark-0 { animation-delay: 0.42s; }
.pw-card.deal-go .pw-spark-1 { animation-delay: 0.50s; }
.pw-card.deal-go .pw-spark-2 { animation-delay: 0.46s; }
.pw-card.deal-go .pw-spark-3 { animation-delay: 0.54s; }
.pw-card.deal-go .pw-spark-4 { animation-delay: 0.58s; }
.pw-card.deal-go .pw-spark-5 { animation-delay: 0.50s; }
.pw-card.deal-go .pw-spark-6 { animation-delay: 0.62s; }
@keyframes pwSpark {
  0% { opacity: 0; transform: translate(0, 0) scale(0.2) rotate(0); }
  35% { opacity: 1; transform: translate(calc(var(--tx) * 0.6), calc(var(--ty) * 0.6)) scale(1) rotate(60deg); }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0.4) rotate(150deg); }
}
/* Settings Pro card */
.pro-status { display: flex; align-items: center; gap: calc(8 * var(--u)); font-weight: 800; color: var(--text-primary); }
.pro-status .pw-chk { width: calc(22 * var(--u)); height: calc(22 * var(--u)); }

/* ---- Auth sheet ---- */
.auth-fields { display: flex; flex-direction: column; gap: calc(8 * var(--u)); margin-top: calc(4 * var(--u)); }
.auth-input { letter-spacing: normal; text-transform: none; text-align: left; font-size: calc(16 * var(--u)); font-weight: 600; }
.auth-input[hidden] { display: none; }
.auth-toggle { background: none; border: none; color: var(--text-secondary); font-weight: 700; font-size: calc(13 * var(--u)); text-decoration: underline; padding: calc(6 * var(--u)); }
.auth-google { display: flex; justify-content: center; min-height: calc(40 * var(--u)); }
.auth-google[hidden] { display: none; }
/* native Google Sign-In button (custom — GIS renders its own in the browser) */
.auth-gbtn { display: inline-flex; align-items: center; justify-content: center; gap: calc(10 * var(--u)); width: 280px; max-width: 100%; min-height: calc(44 * var(--u)); padding: 0 calc(16 * var(--u)); border-radius: 999px; border: 1px solid #DADCE0; background: #fff; color: #3c4043; font-family: inherit; font-weight: 600; font-size: calc(14 * var(--u)); letter-spacing: normal; text-transform: none; cursor: pointer; }
.auth-gbtn:active { background: #f1f3f4; }
.auth-gbtn .auth-g { flex: 0 0 auto; }
.auth-msg { min-height: calc(16 * var(--u)); }
/* Settings account card */
.acct-row { display: flex; align-items: center; justify-content: space-between; gap: calc(10 * var(--u)); }
.acct-who { display: flex; flex-direction: column; gap: calc(2 * var(--u)); min-width: 0; }
.acct-name { font-weight: 800; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-email { font-size: calc(12 * var(--u)); color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-actions { display: flex; gap: calc(8 * var(--u)); margin-top: calc(10 * var(--u)); }
.acct-actions .mw-btn { flex: 1; }
.acct-link { background: none; border: none; color: var(--text-secondary); font-weight: 700; font-size: calc(13 * var(--u)); text-decoration: underline; padding: calc(6 * var(--u)); }
/* sync status (ui/syncstatus.js, spec 6.8): the Account card line + "Sync now", and the dot
   on the home Settings gear when the session expired or an error has lasted a day */
.sync-status { display: flex; align-items: center; gap: calc(8 * var(--u)); margin-top: calc(10 * var(--u)); color: var(--text-secondary); font-weight: 700; font-size: calc(13 * var(--u)); }
.sync-status[hidden] { display: none; }
.sync-status .sync-glyph { display: inline-flex; flex: 0 0 auto; color: var(--text-primary); }
.sync-status[data-state="error"] .sync-glyph, .sync-status[data-state="auth"] .sync-glyph { color: var(--wrong, #D32F2F); }
.sync-status .sync-text { flex: 1 1 auto; min-width: 0; }
.sync-status .sync-now { flex: 0 0 auto; min-height: 48px; padding-inline: calc(14 * var(--u)); font-size: calc(14 * var(--u)); }
.sync-chip { display: inline-flex; color: var(--text-secondary); }
.sync-chip[hidden] { display: none; }
.menu-fab.sync-dot::after { content: ''; position: absolute; top: calc(6 * var(--u)); right: calc(6 * var(--u)); width: calc(10 * var(--u)); height: calc(10 * var(--u)); min-width: 8px; min-height: 8px; border-radius: 50%; background: var(--wrong, #D32F2F); box-shadow: 0 0 0 2px var(--face, #fff); }
[dir="rtl"] .menu-fab.sync-dot::after { right: auto; left: calc(6 * var(--u)); }
/* keyboard helpers inside the modes (Brain Age typing line and key hint, keycap badges): a
   keyboard player on a phone or tablet layout sees them too (desktop.css restyles them) */
.ba-typed { min-height: 1.4em; margin-top: 6px; text-align: center; font-weight: 800; font-size: calc(16 * var(--u)); line-height: 1.4; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.ba-kbd-hint { text-align: center; font-weight: 600; font-size: calc(14 * var(--u)); line-height: 1.3; color: var(--text-secondary); margin-bottom: 4px; }
.kbd-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6em; margin-inline: 6px; padding: 1px 6px; border: 2px solid currentColor; border-radius: 6px; font-weight: 800; font-size: calc(12 * var(--u)); line-height: 1.3; opacity: 0.8; }
/* themed, full-width CTA + link used by the Pro + Account cards */
.opt-cta { width: 100%; margin-top: calc(12 * var(--u)); }
/* the share CTA carries the brand name via %{brand} (mixed-case "Math Bro"); the
   original copy was hand-uppercased, so force uppercase to keep the chunky look */
.invite-btn { text-transform: uppercase; }

/* ---- Coach (Math Bro: "Max") -------------------------------------------- */
/* end-of-workout verdict card appended after the score reveal */
.coach-card {
  display: flex; align-items: center; gap: calc(12 * var(--u));
  margin-top: calc(10 * var(--u)); padding: calc(11 * var(--u)) calc(14 * var(--u));
  opacity: 0; transform: translateY(calc(10 * var(--u)));
  transition: opacity .35s ease, transform .35s ease;
}
/* mastery summary spoken in Max's box (folded in from the standalone rows) */
.coach-extra { margin-top: calc(5 * var(--u)); display: flex; flex-direction: column; gap: calc(2 * var(--u)); }
.coach-extra-line { font-weight: 800; font-size: calc(13 * var(--u)); line-height: 1.2; }
/* difficulty-autopilot offer: coach avatar + ask + Yes/No (or a single Play-now) */
.coach-levelup { align-items: flex-start; }
.coach-levelup .lvl-actions { display: flex; gap: calc(8 * var(--u)); margin-top: calc(10 * var(--u)); }
.coach-levelup .lvl-actions .mw-btn { flex: 1; min-height: calc(44 * var(--u)); font-size: calc(14 * var(--u)); }
.coach-card.in { opacity: 1; transform: none; }
.coach-avatar { width: calc(56 * var(--u)); height: calc(56 * var(--u)); flex: 0 0 auto; }
.coach-body { text-align: left; min-width: 0; }
[dir="rtl"] .coach-body { text-align: right; }
.coach-name {
  font-weight: 900; font-size: calc(12 * var(--u)); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-secondary); margin-bottom: calc(2 * var(--u));
}
.coach-line { font-weight: 800; font-size: calc(15 * var(--u)); line-height: 1.25; color: var(--text-primary); }
/* onboarding: Max greets the user */
.intro-coach-avatar { width: calc(122 * var(--u)); height: calc(122 * var(--u)); margin: 0 auto calc(10 * var(--u)); }

/* ---- Max "alive": idle bob + talking sway/mouth + typewriter caret ---------- */
.coach-anim .coach-avatar-svg { animation: maxIdle 3.2s ease-in-out infinite; transform-origin: 50% 90%; }
.coach-talking .coach-avatar-svg { animation: maxTalk 0.9s ease-in-out infinite; }
.coach-talking .max-mouth { transform-box: fill-box; transform-origin: center; animation: maxMouth 0.26s steps(2, end) infinite; }
@keyframes maxIdle {
  0%, 100% { transform: rotate(-1.5deg) translateY(0); }
  50% { transform: rotate(1.5deg) translateY(calc(-2 * var(--u))); }
}
@keyframes maxTalk {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50% { transform: rotate(4deg) translateY(calc(-3 * var(--u))); }
}
@keyframes maxMouth {
  0% { transform: scaleY(0.5); }
  50% { transform: scaleY(1.5); }
  100% { transform: scaleY(0.5); }
}
@media (prefers-reduced-motion: reduce) {
  .coach-anim .coach-avatar-svg, .coach-talking .coach-avatar-svg, .coach-talking .max-mouth, .coach-talking .d3-ava .d3-talk { animation: none; }
}
/* Max's voice: his quotes use the distinctive brand display font (Fredoka) so
   he reads differently from the app's Roboto body text. */
.max-voice { font-family: 'Fredoka', 'Roboto', system-ui, sans-serif; font-weight: 600; letter-spacing: 0.005em; }
/* Fredoka has no Turkish Ğ İ Ş at all (upstream, not only Google's subset), so a Turkish
 * coach line would switch faces in the middle of a word: Turkish sets the coach's voice in
 * Roboto instead (500 is the loaded weight closest to Fredoka 600). */
html:lang(tr) .max-voice { font-family: 'Roboto', system-ui, sans-serif; font-weight: 500; }

/* typewriter blinking caret while a line types out */
.tw::after { content: '▌'; margin-left: 0.06em; opacity: 0.7; animation: twCaret 0.7s steps(1) infinite; color: var(--text-secondary); }
@keyframes twCaret { 0%, 50% { opacity: 0.7; } 50.01%, 100% { opacity: 0; } }

/* first-load splash: the Operator Morph mark (see the busy loader below) over the theme background */
#splash { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: var(--bg, #EAEAEA); transition: opacity 0.45s ease; }
#splash.gone { opacity: 0; pointer-events: none; }
/* sized in viewport units, not --u: the desktop shell changes --u while the splash is still up */
.splash-mark { width: min(34vw, 22vh, 150px); height: min(34vw, 22vh, 150px); }

/* intro science-fact chip */
.intro-fact {
  display: flex; gap: calc(8 * var(--u)); align-items: flex-start; text-align: left;
  margin-top: calc(12 * var(--u)); padding: calc(10 * var(--u)) calc(12 * var(--u));
  background: var(--panel-face, var(--face)); border-radius: calc(12 * var(--u));
  font-size: calc(12.5 * var(--u)); font-weight: 600; line-height: 1.35; color: var(--text-secondary);
}
.intro-fact-ic { width: calc(20 * var(--u)); height: calc(20 * var(--u)); flex: 0 0 auto; margin-top: calc(1 * var(--u)); }
[dir="rtl"] .intro-fact { text-align: right; }
.intro-coach-tag {
  font-weight: 900; font-size: calc(12 * var(--u)); letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-secondary); margin-bottom: calc(8 * var(--u));
}
/* Brain Age inline Max line (staggered with the reveal) */
.ba-coach { opacity: 0; transition: opacity .4s ease; margin-top: calc(10 * var(--u)); font-weight: 800; font-size: calc(14 * var(--u)); color: var(--text-primary); }
.ba-coach.show { opacity: 1; }
.ba-coach b { color: var(--text-secondary); }

/* ---- Post-purchase thank-you overlay -------------------------------------- */
.ty-overlay {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  padding: calc(20 * var(--u)); background: rgba(8, 10, 22, 0.55);
  opacity: 0; transition: opacity .22s ease;
}
.ty-overlay.in { opacity: 1; }
.ty-card {
  position: relative;
  width: 100%; max-width: calc(360 * var(--u)); max-height: 92vh; overflow-y: auto;
  padding: calc(22 * var(--u)) calc(20 * var(--u)); text-align: center;
  transform: translateY(calc(16 * var(--u))) scale(0.97); transition: transform .26s cubic-bezier(.2,.9,.3,1.2);
}
.ty-close {
  position: absolute; top: calc(10 * var(--u)); right: calc(10 * var(--u)); z-index: 2;
  width: calc(34 * var(--u)); height: calc(34 * var(--u)); padding: calc(7 * var(--u));
  border: none; background: none; cursor: pointer; border-radius: 50%;
}
[dir="rtl"] .ty-close { right: auto; left: calc(10 * var(--u)); }
.ty-overlay.in .ty-card { transform: none; }
.ty-art { width: calc(104 * var(--u)); height: calc(104 * var(--u)); margin: 0 auto calc(8 * var(--u)); }
.ty-title { font-weight: 900; font-size: calc(30 * var(--u)); line-height: 1.05; margin-bottom: calc(8 * var(--u)); }
.ty-body { font-weight: 600; font-size: calc(15 * var(--u)); line-height: 1.4; color: var(--text-secondary); margin-bottom: calc(16 * var(--u)); }
.ty-fb { text-align: left; background: var(--panel-face, var(--face)); border-radius: calc(16 * var(--u)); padding: calc(14 * var(--u)); margin-bottom: calc(14 * var(--u)); }
.ty-fb-label { font-weight: 900; font-size: calc(12 * var(--u)); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: calc(8 * var(--u)); }
.ty-msg, .ty-email {
  width: 100%; font-family: inherit; font-size: calc(15 * var(--u)); color: var(--text-primary);
  background: var(--face); border: calc(2 * var(--u)) solid var(--stroke); border-radius: calc(12 * var(--u));
  padding: calc(10 * var(--u)) calc(12 * var(--u)); margin-bottom: calc(8 * var(--u)); resize: vertical;
}
.ty-email { margin-bottom: calc(10 * var(--u)); }
.ty-send { width: 100%; }
.ty-status { font-weight: 700; font-size: calc(13 * var(--u)); text-align: center; margin-top: calc(8 * var(--u)); min-height: calc(16 * var(--u)); color: var(--text-secondary); }
.ty-status.ok { color: #1f9d57; }
.ty-status.err { color: #e5484d; }
.ty-fb.sent .ty-msg, .ty-fb.sent .ty-email, .ty-fb.sent .ty-send, .ty-fb.sent .ty-fb-label { display: none; }
[dir="rtl"] .ty-fb { text-align: right; }
.opt-link { display: block; width: 100%; text-align: center; background: none; border: none; color: var(--text-secondary); font-weight: 700; font-size: calc(13 * var(--u)); text-decoration: underline; margin-top: calc(8 * var(--u)); padding: calc(6 * var(--u)); }

/* mobile-only gate — desktop visitors get this instead of the app */
.desktop-block { align-items: center; justify-content: center; padding: calc(24 * var(--u)); }
.db-card { width: 100%; max-width: calc(360 * var(--u)); display: flex; flex-direction: column; align-items: center; text-align: center; gap: calc(10 * var(--u)); padding: calc(32 * var(--u)) calc(24 * var(--u)); }
.db-logo { width: calc(96 * var(--u)); height: calc(96 * var(--u)); border-radius: calc(22 * var(--u)); box-shadow: 0 calc(6 * var(--u)) calc(18 * var(--u)) rgba(0,0,0,0.25); }
.db-title { font-size: calc(30 * var(--u)); color: var(--text-primary); margin-top: calc(6 * var(--u)); }
.db-sub { font-weight: 900; font-size: calc(13 * var(--u)); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent1); }
.db-body { font-size: calc(15 * var(--u)); color: var(--text-secondary); line-height: 1.45; margin: calc(4 * var(--u)) 0; }
.db-cta { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.db-link { margin-top: calc(4 * var(--u)); color: var(--text-secondary); font-weight: 700; font-size: calc(13 * var(--u)); text-decoration: underline; }

/* Times-Table picker */
.tt-titlecard { text-align: center; padding: calc(20 * var(--u)) calc(20 * var(--u)) calc(24 * var(--u)); margin-bottom: calc(8 * var(--u)); }
.tt-titlecard .mw-outline { font-size: calc(32 * var(--u)); line-height: 0.98; color: var(--text-primary); }
.tt-titlecard .sub { margin-top: calc(8 * var(--u)); font-size: calc(13 * var(--u)); color: var(--text-secondary); }
.tt-hint { text-align: center; font-weight: 900; font-size: calc(12 * var(--u)); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-secondary); margin: calc(16 * var(--u)) 0 calc(10 * var(--u)); }
/* AI adaptive mode tiles (×12 / ×15) */
.ai-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(10 * var(--u)); margin-bottom: calc(4 * var(--u)); }
/* AI adaptive tiles — light lavender when OFF, bold AI-purple + glow + lift when SELECTED */
.ai-tile { height: calc(64 * var(--u)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(1 * var(--u));
  background: linear-gradient(180deg, #efe9fc 0%, #ddd1f6 100%);
  border-color: #c3b2ec; box-shadow: 0 calc(5 * var(--u)) 0 0 #c8b9ee; color: #6c4ce0;
  transition: transform .12s ease, box-shadow .12s ease; }
.ai-tile::before { opacity: .5; }
.ai-tile-top { font-size: calc(13 * var(--u)); font-weight: 900; letter-spacing: 0.14em; color: #5E3FD0; }   /* 4.5:1+ on the lavender face (was 65% alpha, about 2.6:1) */
.ai-tile-bot { font-size: calc(22 * var(--u)); font-weight: 900; color: #5E3FD0; }
.ai-tile.selected { background: linear-gradient(180deg, #9b82ff 0%, #6c4ce0 56%, #553acb 100%);
  border-color: #34197f; box-shadow: 0 calc(5 * var(--u)) 0 0 #34197f, 0 0 0 calc(3 * var(--u)) rgba(124,108,255,0.55); transform: translateY(calc(-2 * var(--u))); }
.ai-tile.selected::before { opacity: .3; }
.ai-tile.selected .ai-tile-top { color: rgba(255,255,255,0.85); }
.ai-tile.selected .ai-tile-bot { color: #fff; }
/* AI game streak counter + goal line */
.ai-streak { font-variant-numeric: tabular-nums; font-weight: 900; font-size: calc(18 * var(--u)); min-width: calc(56 * var(--u)); text-align: right; color: var(--text-primary); }
.ai-goal { color: var(--text-secondary); }

.tt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: calc(10 * var(--u)); }
.tt-tile { height: calc(58 * var(--u)); font-size: calc(20 * var(--u)); display: flex; align-items: center; justify-content: center; }
.tt-tile.selected { background: var(--accent1); color: var(--on-accent); }
.tt-tile.selected::before { opacity: 0; }
.tt-desc { text-align: center; padding: calc(16 * var(--u)); margin: calc(16 * var(--u)) 0; font-size: calc(14 * var(--u)); color: var(--text-secondary); }

/* ================================================================
 * Pressure tiles: Mental Math Master's menu (the Brain Cruncher hub has its own, styles/cruncher.css)
 * ================================================================ */
.bc-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(10 * var(--u)); }
.bc-level { height: calc(72 * var(--u)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(2 * var(--u)); }
.bc-level.selected { background: var(--accent1); }
.bc-level.selected::before { opacity: 0; }
.bc-level.selected .bc-lvl-top { color: var(--on-accent); }
.bc-level.selected .bc-lvl-bot { color: var(--on-accent-soft); }
.bc-lvl-top { font-size: calc(18 * var(--u)); font-weight: 900; color: var(--text-primary); }
.bc-lvl-bot { font-size: calc(10 * var(--u)); font-weight: 900; letter-spacing: 0.1em; color: var(--text-secondary); }
.bc-lock { width: calc(30 * var(--u)); height: calc(30 * var(--u)); }

/* the chain stage, the answer and the result: styles/cruncher.css (lazy, Brain Cruncher v2) */

/* ================================================================
 * Galaxy Run / Math Blaster (Three.js, hardcoded dark space theme)
 * ================================================================ */
.blaster-screen { background: #06070f; padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.blaster-gl { flex: 1; min-height: 0; position: relative; }
.blaster-gl canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; z-index: 0; }
/* Equation Raiders steers by swiping the canvas — stop the browser treating the
   drag as a scroll/zoom (which fires pointercancel and makes steering jagged). */
.raiders-gl, .raiders-gl canvas { touch-action: none; }
.blaster-hud { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: calc(10 * var(--u)); padding: max(calc(10 * var(--u)), env(safe-area-inset-top)) calc(14 * var(--u)) calc(8 * var(--u)); z-index: 3; color: #eaf6ff; }
.blaster-quit { flex: 0 0 auto; }
.blaster-quit svg path { stroke: #cfe3ff; }
.bl-lives { display: flex; gap: calc(4 * var(--u)); }
.bl-life { width: calc(20 * var(--u)); height: calc(20 * var(--u)); display: inline-block; }
.bl-life svg { display: block; width: 100%; height: 100%; }
.bl-wave { flex: 1; min-width: 0; overflow-wrap: anywhere; text-align: center; font-weight: 900; font-size: calc(14 * var(--u)); letter-spacing: 0.08em; color: #9fb6d8; }
.bl-score { font-variant-numeric: tabular-nums; font-weight: 900; font-size: calc(20 * var(--u)); }
/* a deep run's score (2,211,810) steps down so the row keeps its buttons (the wave label beside
 * it shrinks and wraps, mid-word only as a last resort, and never pushes mute out) */
.bl-score.bl-long { font-size: calc(16 * var(--u)); }
.bl-score.bl-xlong { font-size: calc(14 * var(--u)); }
.bl-mute { flex: 0 0 auto; width: calc(34 * var(--u)); height: calc(34 * var(--u)); padding: calc(5 * var(--u)); background: transparent; border: none; }
.bl-mute svg { display: block; width: 100%; height: 100%; }
/* answer overlay bottom-LEFT, leaving the bottom-right for the bomb button */
.bl-answer { position: absolute; left: calc(18 * var(--u)); right: calc(90 * var(--u)); bottom: calc(14 * var(--u)); z-index: 2; pointer-events: none; text-align: left; font-weight: 900; font-size: calc(34 * var(--u)); color: #9bf6ff; font-variant-numeric: tabular-nums; text-shadow: 0 calc(2 * var(--u)) calc(6 * var(--u)) rgba(0,0,0,0.7); }
/* Galaxy Run miss (a typed entry that starts no answer on the field): a red flash while the box clears */
.bl-answer.bl-miss { color: #ff6b6b; background: rgba(255, 70, 70, 0.22); border-radius: calc(10 * var(--u)); }
/* floating smart-bomb button, bottom-right of the playfield */
.bl-bomb { position: absolute; right: calc(14 * var(--u)); bottom: calc(10 * var(--u)); width: calc(64 * var(--u)); height: calc(64 * var(--u)); z-index: 4; padding: calc(8 * var(--u)); border-radius: 50%; border: calc(3 * var(--u)) solid #ffd166;
  background: radial-gradient(circle at 38% 30%, #3a486c 0%, #1b2338 55%, #0b1120 100%);
  box-shadow: 0 calc(5 * var(--u)) calc(13 * var(--u)) rgba(0,0,0,0.55), inset 0 calc(2 * var(--u)) calc(3 * var(--u)) rgba(255,255,255,0.2), inset 0 calc(-3 * var(--u)) calc(6 * var(--u)) rgba(0,0,0,0.45); transition: transform .08s; }
.bl-bomb svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 calc(1 * var(--u)) calc(2 * var(--u)) rgba(0,0,0,0.5)); }
.bl-bomb:active { transform: translateY(calc(2 * var(--u))) scale(0.96); }
/* center-screen wave / boss banner (notifyEvent) */
.bl-announce { position: absolute; top: 40%; left: 50%; transform: translate(-50%,-50%); z-index: 5; pointer-events: none; white-space: nowrap; text-align: center; font-weight: 900; font-family: 'Arial Black', system-ui, sans-serif; font-size: calc(46 * var(--u)); letter-spacing: 0.04em; -webkit-text-stroke: calc(2 * var(--u)) #0a0e1a; text-shadow: 0 0 calc(12 * var(--u)) rgba(0,0,0,0.85), 0 calc(3 * var(--u)) calc(6 * var(--u)) rgba(0,0,0,0.6); }
.bl-announce[hidden] { display: none; }
/* Prime Raiders banners can be long (act names, "PERFECT RESCUE", the pod hint) —
 * wrap + shrink + clamp width so they never bleed off-screen (Galaxy Run untouched). */
.raiders-screen .bl-announce { white-space: normal; max-width: 88vw; font-size: calc(34 * var(--u)); line-height: 1.05; }
.raiders-screen .rd-act { max-width: 90vw; margin: calc(1 * var(--u)) auto 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* sci-fi display font (self-hosted Orbitron, offline-safe) for the Prime Raiders HUD/banners */
@font-face { font-family: 'Orbitron'; font-style: normal; font-weight: 400 900; font-display: swap; src: url('../../assets/fonts/orbitron.woff2') format('woff2'); }
.raiders-screen .rd-wave, .raiders-screen .rd-act, .raiders-screen .rd-score,
.raiders-screen .rd-cd, .raiders-screen .bl-announce, .raiders-screen .rd-pop,
.raiders-screen .rd-bomb-count, .raiders-screen .rd-over-title, .raiders-screen .rd-over-score,
.raiders-screen .rd-board-title, .raiders-screen .rd-rank {
  font-family: 'Orbitron', 'Arial Black', system-ui, sans-serif;
}
/* wave/act countdown LABELS must fit the screen (Orbitron is wide) — wrap + shrink;
 * the big 3-2-1 DIGIT stays large (single char, always fits). */
.raiders-screen .rd-cd { max-width: 92vw; white-space: normal; text-align: center; line-height: 1.02; letter-spacing: 0; }
.raiders-screen .rd-cd:not(.rd-cd-num) { font-size: calc(36 * var(--u)); }
.raiders-screen .rd-cd.rd-cd-num { font-size: calc(130 * var(--u)); white-space: nowrap; }
/* Orbitron has no Turkish letters (Ğ İ Ş; in Turkish CSS also upper-cases i to İ), so a
 * Turkish label would switch faces in the middle of a word. Set the WORDS in the fallback
 * face instead; the pure-number pieces (score, counters, keys, the 3-2-1) keep Orbitron. */
html:lang(tr) :is(.rd-wave, .rd-act, .rd-cd:not(.rd-cd-num), .bl-announce, .rd-pop, .rd-over-title, .rd-board-title, .rd-rank,
  .rd-dropoff, .rd-pilot-name, .rd-pilot-status, .rd-continue-title, .rd-continue-sub, .rd-gate-name, .rd-gate-prog, .rd-bossbar-name, .rd-cargo) {
  font-family: 'Arial Black', system-ui, sans-serif;
}
.bl-bomb-count { position: absolute; top: calc(-6 * var(--u)); right: calc(-6 * var(--u)); min-width: calc(24 * var(--u)); height: calc(24 * var(--u)); padding: 0 calc(5 * var(--u)); border-radius: calc(12 * var(--u)); background: linear-gradient(180deg, #ff9a52, #f4511e); border: calc(2.5 * var(--u)) solid #fff; color: #fff; font-weight: 900; font-size: calc(14 * var(--u)); line-height: 1; display: flex; align-items: center; justify-content: center; box-shadow: 0 calc(2 * var(--u)) calc(5 * var(--u)) rgba(0,0,0,0.5); font-variant-numeric: tabular-nums; }
.bl-bomb.empty { opacity: 0.4; }
.bl-bomb.judder { animation: bl-judder 0.3s; }
.bomb-spark { transform-origin: 39px 6.5px; animation: bombSpark .5s ease-in-out infinite; }
@keyframes bombSpark { 0%,100% { opacity: .8; transform: scale(.82); } 50% { opacity: 1; transform: scale(1.18); } }

/* Pro-locked controls (Hard/Very Hard difficulty, themes after the free changes) */
.seg-btn.locked { opacity: 0.62; }
.seg-btn .seg-lock { vertical-align: -1px; margin-left: calc(4 * var(--u)); opacity: 0.85; }
@keyframes bl-judder { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }

/* ---- Equation Raiders (3D thumb shooter) ---- */
/* top stack: HUD row + goal, anchored to the top; canvas (swipe area) shows through */
.rd-top { position: absolute; top: 0; left: 0; right: 0; z-index: 3; pointer-events: none; padding-top: max(calc(8 * var(--u)), env(safe-area-inset-top)); }
.rd-top button { pointer-events: auto; }
.rd-hudrow { display: flex; align-items: center; gap: calc(8 * var(--u)); padding: calc(6 * var(--u)) calc(12 * var(--u)); color: #eaf6ff; }
.rd-spacer { flex: 1; }
.rd-lives { display: flex; gap: calc(4 * var(--u)); }
.rd-heart { width: calc(21 * var(--u)); height: calc(21 * var(--u)); display: block; }
.rd-score { font-variant-numeric: tabular-nums; font-weight: 900; font-size: calc(20 * var(--u)); color: #eaf6ff; }
.rd-fx { display: flex; gap: calc(4 * var(--u)); }
.rd-chip { font-weight: 900; font-size: calc(12 * var(--u)); border-radius: calc(9 * var(--u)); padding: calc(2 * var(--u)) calc(7 * var(--u)); color: #08121c; font-variant-numeric: tabular-nums; }
.rd-chip-slow { background: #54cfe6; }
.rd-chip-mult { background: #d8a8ff; }
.rd-chip-combo { background: #ffd24a; }
.rd-shield { width: calc(72 * var(--u)); height: calc(9 * var(--u)); border-radius: calc(6 * var(--u)); background: rgba(20,40,70,0.6); border: calc(1.5 * var(--u)) solid #2f6fd0; overflow: hidden; box-shadow: inset 0 0 calc(8 * var(--u)) rgba(80,160,255,0.25); }
.rd-shield-fill { height: 100%; width: 100%; background: linear-gradient(90deg,#4fd0ff,#9be8ff); transition: width .18s ease-out; box-shadow: 0 0 calc(8 * var(--u)) rgba(120,220,255,0.6); }
.rd-progress { text-align: center; margin-top: calc(2 * var(--u)); }
.rd-wave { font-weight: 900; font-size: calc(20 * var(--u)); line-height: 1.04; color: #FFFFFF; text-transform: uppercase; letter-spacing: 0.05em; }
.rd-act { font-weight: 800; font-size: calc(12 * var(--u)); color: #9fb6d8; text-transform: uppercase; letter-spacing: 0.12em; margin-top: calc(1 * var(--u)); }
/* 3-2-1 countdown — big, centered, hype */
.rd-cd { position: absolute; top: 44%; left: 50%; transform: translate(-50%, -50%); z-index: 6; pointer-events: none; white-space: nowrap; font-weight: 900; font-family: 'Arial Black', system-ui, sans-serif; font-size: calc(60 * var(--u)); letter-spacing: 0.02em; -webkit-text-stroke: calc(2.5 * var(--u)) #0a1018; text-shadow: 0 0 calc(22 * var(--u)) rgba(90,200,255,0.55), 0 calc(3 * var(--u)) calc(8 * var(--u)) rgba(0,0,0,0.6); }
.rd-cd.rd-cd-num { font-size: calc(150 * var(--u)); }
.rd-cd[hidden] { display: none; }
/* swipe-to-steer teaching finger (during the countdown) */
.rd-swipe { position: absolute; bottom: 15%; left: 50%; z-index: 6; pointer-events: none; width: calc(40 * var(--u)); height: calc(50 * var(--u)); filter: drop-shadow(0 calc(3 * var(--u)) calc(6 * var(--u)) rgba(0,0,0,0.55)); animation: rdSwipeMove 1.5s ease-in-out infinite; }
.rd-swipe[hidden] { display: none; }
@keyframes rdSwipeMove {
  0%   { transform: translateX(calc(-50% - 80 * var(--u))) rotate(-10deg); opacity: 0; }
  14%  { opacity: 1; }
  58%  { transform: translateX(calc(-50% + 80 * var(--u))) rotate(8deg); opacity: 1; }
  76%  { transform: translateX(calc(-50% + 80 * var(--u))) rotate(8deg); opacity: 0; }
  100% { transform: translateX(calc(-50% - 80 * var(--u))) rotate(-10deg); opacity: 0; }
}
/* drop-off wave: up/down finger hint, orb-cargo pill, 30s countdown bar */
.rd-swipe-v { position: absolute; left: 50%; top: 42%; z-index: 6; pointer-events: none; width: calc(40 * var(--u)); height: calc(50 * var(--u)); filter: drop-shadow(0 calc(3 * var(--u)) calc(6 * var(--u)) rgba(0,0,0,0.55)); animation: rdSwipeMoveV 1.4s ease-in-out infinite; }
.rd-swipe-v[hidden] { display: none; }
@keyframes rdSwipeMoveV {
  0%   { transform: translate(-50%, calc(-50% - 46 * var(--u))); opacity: 0; }
  14%  { opacity: 1; }
  58%  { transform: translate(-50%, calc(-50% + 46 * var(--u))); opacity: 1; }
  76%  { transform: translate(-50%, calc(-50% + 46 * var(--u))); opacity: 0; }
  100% { transform: translate(-50%, calc(-50% - 46 * var(--u))); opacity: 0; }
}
.rd-orbs { position: absolute; right: calc(80 * var(--u)); bottom: calc(92 * var(--u)); z-index: 5; pointer-events: none; display: flex; align-items: center; gap: calc(5 * var(--u)); padding: calc(5 * var(--u)) calc(11 * var(--u)) calc(5 * var(--u)) calc(7 * var(--u)); background: linear-gradient(180deg, rgba(10,30,22,0.9), rgba(6,20,14,0.9)); border: calc(2 * var(--u)) solid #2a8a5a; border-radius: calc(22 * var(--u)); box-shadow: 0 0 calc(12 * var(--u)) rgba(80,255,160,0.3); }
.rd-orbs[hidden] { display: none; }
.rd-orbs-glyph { display: flex; line-height: 0; }
.rd-orbs-count { font-weight: 900; font-size: calc(16 * var(--u)); color: #d6ffe9; font-variant-numeric: tabular-nums; font-family: 'Orbitron','Arial Black',sans-serif; }
.rd-dropoff { position: absolute; top: calc(66 * var(--u)); left: 50%; transform: translateX(-50%); z-index: 6; pointer-events: none; padding: calc(3 * var(--u)) calc(14 * var(--u)); border-radius: calc(20 * var(--u)); background: rgba(8,24,40,0.82); border: calc(2 * var(--u)) solid #4fd0ff; color: #eaf6ff; font-weight: 900; font-size: calc(20 * var(--u)); font-variant-numeric: tabular-nums; font-family: 'Orbitron','Arial Black',sans-serif; letter-spacing: 0.06em; box-shadow: 0 0 calc(14 * var(--u)) rgba(80,200,255,0.4); text-shadow: 0 0 calc(8 * var(--u)) rgba(80,200,255,0.7); }
.rd-dropoff[hidden] { display: none; }
/* "Tap to fire" — the second teaching hint (after swipe-to-steer). A tapping
 * finger over a glowing label, centred low on the playfield; pulse ring conveys
 * the tap contact. Dismissed on the first shot. */
.rd-tap { position: absolute; bottom: 26%; left: 50%; transform: translateX(-50%); z-index: 6;
  pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: calc(6 * var(--u)); }
.rd-tap[hidden] { display: none; }
.rd-tap-finger { position: relative; width: calc(46 * var(--u)); height: calc(46 * var(--u));
  filter: drop-shadow(0 calc(3 * var(--u)) calc(6 * var(--u)) rgba(0,0,0,0.55));
  animation: rdTapPress 1.05s ease-in-out infinite; }
.rd-tap-finger::after { content: ''; position: absolute; left: 50%; top: calc(10 * var(--u));
  width: calc(40 * var(--u)); height: calc(40 * var(--u)); transform: translate(-50%,-50%);
  border: calc(3 * var(--u)) solid rgba(155,246,255,0.9); border-radius: 50%;
  animation: rdTapRing 1.05s ease-out infinite; }
.rd-tap-label { font-weight: 900; font-size: calc(15 * var(--u)); letter-spacing: 0.04em;
  color: #9bf6ff; text-shadow: 0 calc(2 * var(--u)) calc(8 * var(--u)) rgba(0,0,0,0.7);
  background: rgba(12,28,52,0.6); padding: calc(4 * var(--u)) calc(12 * var(--u)); border-radius: calc(10 * var(--u)); }
@keyframes rdTapPress { 0%,100% { transform: translateY(calc(-6 * var(--u))) scale(1); }
  45% { transform: translateY(calc(2 * var(--u))) scale(0.9); } }
@keyframes rdTapRing { 0% { opacity: 0; transform: translate(-50%,-50%) scale(0.4); }
  35% { opacity: 0.9; } 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.5); } }
/* smart-bomb button (bottom-right of the playfield) */
.rd-bomb { position: absolute; right: calc(14 * var(--u)); bottom: calc(88 * var(--u)); z-index: 5; width: calc(56 * var(--u)); height: calc(56 * var(--u)); border-radius: 50%; background: radial-gradient(circle at 38% 32%, #ff8a8a, #c01530); border: calc(2 * var(--u)) solid #2a0a12; color: #fff; pointer-events: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 calc(3 * var(--u)) calc(10 * var(--u)) rgba(0,0,0,0.5); }
.rd-bomb[hidden] { display: none; }
.rd-bomb[data-empty="1"] { opacity: 0.4; }
.rd-bomb-glyph { display: flex; line-height: 0; }
.rd-bomb-count { font-weight: 900; font-size: calc(13 * var(--u)); font-variant-numeric: tabular-nums; margin-top: calc(-2 * var(--u)); }
/* floating score numbers */
.rd-pop { position: absolute; z-index: 4; pointer-events: none; font-weight: 900; font-size: calc(17 * var(--u)); transform: translate(-50%,-50%); text-shadow: 0 calc(2 * var(--u)) calc(6 * var(--u)) rgba(0,0,0,0.7); white-space: nowrap; }
/* friendly-pod speech bubble ("Save me!" / "Don't shoot!") */
.rd-podsay { position: absolute; z-index: 4; pointer-events: none; transform: translate(-50%, -100%); white-space: nowrap;
  font-weight: 800; font-size: calc(12 * var(--u)); color: #0a2a18; background: #c9f7df; border: calc(2 * var(--u)) solid #2a8a5a;
  border-radius: calc(10 * var(--u)); padding: calc(3 * var(--u)) calc(9 * var(--u)); box-shadow: 0 calc(2 * var(--u)) calc(6 * var(--u)) rgba(0,0,0,0.4); animation: rdPodSay .22s ease-out; }
.rd-podsay::after { content: ''; position: absolute; left: 50%; bottom: calc(-6 * var(--u)); transform: translateX(-50%); border: calc(6 * var(--u)) solid transparent; border-top-color: #2a8a5a; }
@keyframes rdPodSay { from { opacity: 0; transform: translate(-50%, -88%) scale(0.7); } to { opacity: 1; transform: translate(-50%, -100%) scale(1); } }
/* UN-Squadron-style fox pilot panel (bottom-left, in the dead space under the ship) */
.rd-pilot { position: absolute; left: calc(10 * var(--u)); bottom: calc(88 * var(--u)); z-index: 5; pointer-events: none;
  display: flex; align-items: center; gap: calc(7 * var(--u));
  background: linear-gradient(180deg, rgba(10,22,40,0.88), rgba(6,14,28,0.88));
  border: calc(2 * var(--u)) solid #2f6fd0; border-radius: calc(12 * var(--u));
  padding: calc(4 * var(--u)) calc(11 * var(--u)) calc(4 * var(--u)) calc(4 * var(--u));
  box-shadow: 0 0 calc(14 * var(--u)) rgba(60,140,255,0.3), inset 0 0 calc(10 * var(--u)) rgba(40,100,200,0.2); }
.rd-pilot[hidden] { display: none; }
.rd-pilot-face { width: calc(50 * var(--u)); height: calc(50 * var(--u)); flex: 0 0 auto; border-radius: calc(10 * var(--u)); overflow: hidden;
  background: radial-gradient(circle at 50% 38%, rgba(80,160,255,0.22), rgba(6,14,28,0) 72%); }
.rd-pilot-meta { display: flex; flex-direction: column; line-height: 1.12; width: calc(156 * var(--u)); }   /* wider so Fox's spoken comments fit inside his box */
.rd-pilot-name { font-family: 'Orbitron','Arial Black',sans-serif; font-weight: 900; font-size: calc(13 * var(--u)); color: #4fd0ff; letter-spacing: 0.1em; text-shadow: 0 0 calc(6 * var(--u)) rgba(80,200,255,0.6); }
.rd-pilot-status { font-family: 'Orbitron','Arial Black',sans-serif; font-weight: 700; font-size: calc(10.5 * var(--u)); color: #dfe9ff; letter-spacing: 0.03em; margin-top: calc(2 * var(--u)); line-height: 1.14; }
/* Fox pilot life: idle bob (whole chip), reaction pop (face); his spoken comments show on the status line, brighter */
.rd-pilot:not([hidden]) { animation: rdPilotBob 3.4s ease-in-out infinite; }
@keyframes rdPilotBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(calc(-3 * var(--u))); } }
.rd-pilot-pop { animation: rdPilotPop 380ms cubic-bezier(.34, 1.56, .64, 1); }
@keyframes rdPilotPop { 0% { transform: scale(0.82); } 60% { transform: scale(1.13); } 100% { transform: scale(1); } }
.rd-pilot.talking .rd-pilot-status { color: #aef0ff; font-weight: 800; }
/* warp-speed transition between Acts (radial speed-line tunnel) */
.rd-warp { position: absolute; inset: 0; z-index: 7; pointer-events: none; opacity: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.95) 0%, rgba(180,220,255,0) 13%),
    repeating-conic-gradient(from 0deg at 50% 50%, rgba(255,255,255,0) 0deg, rgba(190,225,255,0.6) 0.5deg, rgba(255,255,255,0) 2.4deg);
  -webkit-mask: radial-gradient(circle at 50% 50%, transparent 3%, #000 44%);
          mask: radial-gradient(circle at 50% 50%, transparent 3%, #000 44%); }
.rd-warp[hidden] { display: none; }
.rd-warp.on { animation: rdWarp 1.15s ease-in forwards; }
@keyframes rdWarp { 0% { opacity: 0; transform: scale(0.6); } 22% { opacity: 1; } 100% { opacity: 1; transform: scale(2.8); } }
/* Arcade Continue countdown (shown on death before the score/name screen) */
.rd-continue { position: absolute; inset: 0; z-index: 9; pointer-events: auto; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 42%, rgba(30,10,18,0.82), rgba(4,4,10,0.94) 76%);
  opacity: 0; transition: opacity .3s ease; }
.rd-continue.in { opacity: 1; }
.rd-continue-card { display: flex; flex-direction: column; align-items: center; gap: calc(10 * var(--u)); padding: calc(16 * var(--u)); text-align: center; }
.rd-continue-title { font-family: 'Orbitron','Arial Black',sans-serif; font-weight: 900; font-size: calc(34 * var(--u)); letter-spacing: 0.08em; color: #FFFFFF; }
.rd-continue-num { font-family: 'Orbitron','Arial Black',sans-serif; font-weight: 900; font-size: calc(108 * var(--u)); line-height: 1; color: #fff;
  text-shadow: 0 0 calc(22 * var(--u)) rgba(255,90,118,0.85), 0 calc(3 * var(--u)) 0 #b3243c; }
.rd-continue-num.go { animation: rdContPop .5s ease-out; }
@keyframes rdContPop { 0% { transform: scale(1.6); color: #ff5a76; } 55% { transform: scale(0.92); } 100% { transform: scale(1); color: #fff; } }
.rd-continue-sub { font-family: 'Orbitron','Arial Black',sans-serif; font-weight: 700; font-size: calc(15 * var(--u)); letter-spacing: 0.04em; color: #cfe6ff; opacity: 0.9; }
.rd-continue-actions { display: flex; gap: calc(14 * var(--u)); margin-top: calc(4 * var(--u)); }
.rd-continue-actions .mw-btn { min-width: calc(118 * var(--u)); font-size: calc(20 * var(--u)); }
/* Phase-2 boss math-gate (themed per boss via --bcol/--bacc set inline) */
.rd-gate { position: absolute; inset: 0; z-index: 8; pointer-events: auto; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 36%, color-mix(in srgb, var(--bcol) 30%, #060912), #04060e 78%); opacity: 0; transition: opacity .35s ease; }
.rd-gate.in { opacity: 1; }
.rd-gate.out { opacity: 0; }
.rd-gate-stage { width: min(94vw, calc(440 * var(--u))); max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: calc(6 * var(--u)); padding: calc(10 * var(--u)); }
.rd-gate-portrait { width: calc(112 * var(--u)); height: calc(112 * var(--u)); flex: 0 0 auto; filter: drop-shadow(0 0 calc(18 * var(--u)) color-mix(in srgb, var(--bacc) 60%, transparent)); animation: rdGateFloat 3s ease-in-out infinite; }
@keyframes rdGateFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(calc(-6 * var(--u))); } }
.rd-gate-name { font-family: 'Orbitron','Arial Black',sans-serif; font-weight: 900; font-size: calc(24 * var(--u)); color: var(--bacc); letter-spacing: 0.06em; text-align: center; }
.rd-gate-taunt { font-style: italic; font-size: calc(14 * var(--u)); color: #dfe9ff; text-align: center; max-width: 90%; line-height: 1.3; }
.rd-gate-q { display: flex; flex-direction: column; align-items: center; gap: calc(7 * var(--u)); width: 100%; margin-top: calc(2 * var(--u)); }
.rd-gate-prog { font-family: 'Orbitron','Arial Black',sans-serif; font-weight: 800; font-size: calc(11 * var(--u)); color: var(--bacc); letter-spacing: 0.12em; text-transform: uppercase; }
.rd-gate-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: calc(4 * var(--u)) calc(12 * var(--u)); max-width: 100%; }
/* the gate covers the HUD, so it has its own pause button (top start corner) */
.rd-gate .rd-gate-pause { position: absolute; z-index: 1; margin: 0; top: max(calc(8 * var(--u)), env(safe-area-inset-top)); inset-inline-start: calc(10 * var(--u));
  background: rgba(255,255,255,0.12); }
.rd-gate .rd-gate-pause:active { background: rgba(255,255,255,0.22); }
.rd-gate .rd-gate-pause svg rect { fill: #eaf6ff; }
/* QA test run (localStorage mw_rd_test_wave, raidersplan.js): above the HUD and the gate */
.rd-test { position: absolute; z-index: 9; pointer-events: none; inset-inline-start: calc(12 * var(--u));
  top: calc(max(calc(8 * var(--u)), env(safe-area-inset-top)) + 58 * var(--u));
  padding: calc(2 * var(--u)) calc(8 * var(--u)); border-radius: calc(10 * var(--u)); background: #ff5a76; color: #1a0610;
  font-weight: 900; font-size: calc(11 * var(--u)); letter-spacing: 0.1em; line-height: 1.4; }
/* three miss pips: each timed-out answer lights one, the third costs a ship and resets them */
.rd-gate-miss { display: flex; gap: calc(5 * var(--u)); }
.rd-gate-miss i { width: calc(9 * var(--u)); height: calc(9 * var(--u)); border-radius: 50%; border: calc(1.5 * var(--u)) solid rgba(155, 232, 255, 0.6); border: calc(1.5 * var(--u)) solid color-mix(in srgb, var(--bacc) 60%, transparent); background: transparent; transition: background-color .2s, border-color .2s; }
.rd-gate-miss i.on { background: #ff5a76; border-color: #ff5a76; box-shadow: 0 0 calc(6 * var(--u)) rgba(255,90,118,.7); }
.rd-gate-timer { width: 86%; height: calc(8 * var(--u)); border-radius: calc(5 * var(--u)); background: rgba(20,30,50,0.7); overflow: hidden; border: calc(1.5 * var(--u)) solid color-mix(in srgb, var(--bacc) 50%, transparent); }
.rd-gate-timer-fill { height: 100%; width: 100%; background: var(--bacc); }
.rd-gate-question { font-family: 'Orbitron','Arial Black',sans-serif; font-weight: 900; font-size: calc(34 * var(--u)); color: #fff; letter-spacing: 0.02em; }
.rd-gate-answer { width: 84%; text-align: center; padding: calc(7 * var(--u)); border-radius: calc(13 * var(--u)); background: rgba(8,16,30,0.85); border: calc(2.5 * var(--u)) solid var(--bacc); }
.rd-gate-answer.ok { border-color: #46e0b0; box-shadow: 0 0 calc(16 * var(--u)) rgba(70,224,176,0.6); }
.rd-gate-ink { font-family: 'Orbitron','Arial Black',sans-serif; font-weight: 900; font-size: calc(32 * var(--u)); color: #eaf2ff; }
.rd-gate-ink.placeholder { color: #56688a; }
.rd-gate-pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(8 * var(--u)); width: 84%; margin-top: calc(2 * var(--u)); }
.rd-key { font-family: 'Orbitron','Arial Black',sans-serif; font-weight: 900; font-size: calc(21 * var(--u)); min-height: calc(44 * var(--u)); border-radius: calc(12 * var(--u)); color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bcol) 55%, #0c1a30), color-mix(in srgb, var(--bcol) 28%, #060f1e));
  border: calc(2 * var(--u)) solid color-mix(in srgb, var(--bacc) 60%, transparent); box-shadow: 0 calc(3 * var(--u)) 0 rgba(0,0,0,0.45); cursor: pointer; }
.rd-key:active { transform: translateY(calc(2 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 rgba(0,0,0,0.45); }
/* boss HP bar (top, hidden default) */
.rd-bossbar { display: flex; flex-direction: column; align-items: center; gap: calc(2 * var(--u)); margin-top: calc(4 * var(--u)); }
.rd-bossbar[hidden] { display: none; }
.rd-bossbar-name { font-family: 'Orbitron','Arial Black',sans-serif; font-weight: 900; font-size: calc(12 * var(--u)); color: #ff8a9a; letter-spacing: 0.12em; text-transform: uppercase; text-shadow: 0 0 calc(6 * var(--u)) rgba(255,80,110,0.5); }
.rd-bossbar-track { width: min(80vw, calc(360 * var(--u))); height: calc(11 * var(--u)); border-radius: calc(6 * var(--u)); background: rgba(30,10,16,0.8); border: calc(1.5 * var(--u)) solid #c0304a; overflow: hidden; }
.rd-bossbar-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff5a76, #ffd23f); transition: width .25s ease-out; box-shadow: 0 0 calc(8 * var(--u)) rgba(255,90,120,0.6); }
/* Phase-3 rescue cargo chip */
.rd-cargo { margin: calc(3 * var(--u)) auto 0; padding: calc(2 * var(--u)) calc(10 * var(--u)); width: max-content;
  font-family: 'Orbitron','Arial Black',sans-serif; font-weight: 900; font-size: calc(12 * var(--u)); letter-spacing: 0.08em;
  color: #cfeeff; background: rgba(20,40,56,0.78); border: calc(1.5 * var(--u)) solid #4fd0ff; border-radius: calc(7 * var(--u));
  text-shadow: 0 0 calc(6 * var(--u)) rgba(80,200,255,0.5); box-shadow: 0 0 calc(9 * var(--u)) rgba(80,200,255,0.3); }
.rd-cargo[hidden] { display: none; }
.rd-hint { position: absolute; bottom: calc(10 * var(--u)); left: 0; right: 0; text-align: center; z-index: 3; pointer-events: none; color: #8197b8; font-weight: 700; font-size: calc(13 * var(--u)); transition: opacity .4s ease; }
.rd-hint.gone { opacity: 0; }

/* first-run "how to play" with Max */
.rd-intro { position: absolute; inset: 0; z-index: 7; display: flex; align-items: center; justify-content: center; background: rgba(6,8,16,0.82); padding: calc(20 * var(--u)); }
.rd-intro[hidden] { display: none; }
/* the how-to's own back arrow, where the HUD's sits (the dim covers that one): shown on the
 * desktop layout (desktop.css) and to a keyboard; visually hidden on a touch phone, so the
 * phone screen looks as before while Esc still finds it */
.rd-intro-back { position: absolute; z-index: 1; top: calc(max(calc(8 * var(--u)), env(safe-area-inset-top)) + 6 * var(--u)); inset-inline-start: calc(12 * var(--u)); }
.rd-intro-back:not(:focus-visible) { width: 1px; height: 1px; min-width: 0; min-height: 0; padding: 0; overflow: hidden; clip-path: inset(50%); opacity: 0; }
.rd-intro-card { padding: calc(22 * var(--u)); display: flex; flex-direction: column; align-items: center; gap: calc(7 * var(--u)); text-align: center; max-width: calc(360 * var(--u)); }
.rd-intro-ava { width: calc(72 * var(--u)); height: calc(72 * var(--u)); }
.rd-intro-title { font-size: calc(26 * var(--u)); color: var(--accent1); }
.rd-intro-name { font-weight: 900; font-size: calc(12 * var(--u)); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-secondary); margin-top: calc(-2 * var(--u)); }
.rd-intro-lines { display: flex; flex-direction: column; gap: calc(6 * var(--u)); margin: calc(6 * var(--u)) 0; }
.rd-intro-line { font-weight: 700; font-size: calc(14 * var(--u)); color: var(--text-primary); line-height: 1.3; }
.rd-intro .rd-start { margin-top: calc(6 * var(--u)); min-width: calc(180 * var(--u)); }

/* game over + leaderboard */
.rd-over { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; background: rgba(6,8,16,0.78); opacity: 0; transition: opacity .3s ease; padding: calc(18 * var(--u)); }
.rd-over.in { opacity: 1; }
.rd-over-card { padding: calc(22 * var(--u)); display: flex; flex-direction: column; align-items: center; gap: calc(6 * var(--u)); text-align: center; min-width: calc(250 * var(--u)); max-width: calc(360 * var(--u)); }
.rd-over-title { font-size: calc(28 * var(--u)); color: #ff6a80; }
.rd-over-score { font-weight: 900; font-size: calc(52 * var(--u)); color: var(--text-primary); font-variant-numeric: tabular-nums; line-height: 1; }
.rd-over-best { color: var(--text-secondary); font-weight: 800; font-size: calc(13 * var(--u)); }
.rd-submit-area { display: flex; flex-direction: column; align-items: center; gap: calc(6 * var(--u)); margin-top: calc(4 * var(--u)); align-self: stretch; }
.rd-submit-note { color: var(--text-secondary); font-weight: 700; font-size: calc(13 * var(--u)); }
/* the screen's own ink, never the pale accent under an outline (owner, 23 Nov 2026: the old rank style looked cheap) */
.rd-rank { font-weight: 900; font-size: calc(26 * var(--u)); color: var(--text-primary); }
.rd-handle { width: 100%; box-sizing: border-box; padding: calc(10 * var(--u)) calc(12 * var(--u)); border-radius: calc(12 * var(--u)); border: calc(2 * var(--u)) solid var(--stroke); background: var(--face); color: var(--text-primary); font-weight: 800; font-size: calc(15 * var(--u)); text-align: center; }
.rd-submit-btn, .rd-board-btn { min-height: calc(48 * var(--u)); align-self: stretch; }
.rd-over-card .score-actions { margin-top: calc(10 * var(--u)); align-self: stretch; }
.rd-board { position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; background: rgba(6,8,16,0.8); opacity: 0; transition: opacity .25s ease; padding: calc(18 * var(--u)); }
.rd-board.in { opacity: 1; }
.rd-board-card { padding: calc(20 * var(--u)); display: flex; flex-direction: column; gap: calc(8 * var(--u)); width: 100%; max-width: calc(340 * var(--u)); }
.rd-board-title { font-size: calc(22 * var(--u)); color: var(--accent1); text-align: center; }
.rd-board-rows { display: flex; flex-direction: column; gap: calc(3 * var(--u)); max-height: calc(320 * var(--u)); overflow-y: auto; }
.rd-board-row { display: flex; align-items: center; gap: calc(8 * var(--u)); padding: calc(6 * var(--u)) calc(8 * var(--u)); border-radius: calc(8 * var(--u)); background: color-mix(in srgb, var(--text-primary) 6%, transparent); font-weight: 800; font-size: calc(14 * var(--u)); }
.rd-board-rank { width: calc(24 * var(--u)); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.rd-board-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.rd-board-score { color: color-mix(in srgb, var(--accent1) 40%, var(--text-primary)); font-weight: 900; font-variant-numeric: tabular-nums; }
.rd-board-close { margin-top: calc(4 * var(--u)); }
/* Report or hide a name (ui/lbreport.js, lib/lbhide.js; App Review guideline 1.2): the board's button (a keyboard stop,
   48 px), a name this device hid, and the rows a tap opens the sheet from */
.lbr-hint { display: inline-flex; align-self: center; flex: 0 0 auto; gap: calc(8 * var(--u)); max-width: 100%; box-sizing: border-box;
  min-height: max(48px, calc(50 * var(--u))); margin: calc(10 * var(--u)) auto calc(4 * var(--u)); padding: calc(5 * var(--u)) calc(18 * var(--u)) calc(9 * var(--u));
  border-radius: calc(26 * var(--u)); box-shadow: 0 calc(4 * var(--u)) 0 0 var(--shadow);
  font-size: calc(14 * var(--u)); letter-spacing: 0.04em; line-height: 1.15; text-align: center; white-space: normal; overflow-wrap: anywhere; }
.lbr-hint::before { top: calc(6 * var(--u)); bottom: 52%; left: calc(12 * var(--u)); right: calc(12 * var(--u)); border-radius: calc(14 * var(--u)); }
.lbr-hint:active, .lbr-hint.pressed { transform: translateY(calc(3 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 0 var(--shadow); }
.lbr-hint[hidden] { display: none; }
.lbr-ic { flex: 0 0 auto; width: calc(24 * var(--u)); height: calc(24 * var(--u)); margin-top: calc(1 * var(--u)); }
/* the space boards (Top Pilots, Top Runners, Top Hoppers): the navy glass of their CLOSE */
.gm-lb-panel .lbr-hint { color: var(--gx-ink, #F1F6FF); border-color: var(--gx-stroke, #050919); box-shadow: 0 calc(4 * var(--u)) 0 0 var(--gx-shadow, #02030b);
  background: linear-gradient(to bottom, #3a4f8e 0%, #24356c 55%, #1a2858 100%); }
.gm-lb-panel .lbr-hint:active { box-shadow: 0 calc(1 * var(--u)) 0 0 var(--gx-shadow, #02030b); }
.gm-lb-panel .lbr-hint::before { opacity: 0.35; }
.lb-hid { font-style: italic; opacity: 0.75; }
@media (hover: hover) { .gm-lb-rows [data-i]:not(.me), .rd-board-rows [data-i], .lb-list .lb-row[data-i]:not(.me) { cursor: pointer; } }

/* locked mode card (Equation Raiders before Galaxy Run is cleared) */
.menu-card.locked { opacity: 0.66; filter: saturate(0.5); }
.menu-card.locked .mc-icon { filter: grayscale(0.7); }
.mc-lock { width: calc(30 * var(--u)); height: calc(30 * var(--u)); flex: 0 0 auto; opacity: 0.85; align-self: center; }
/* GENERAL OBELUS boss bar — 12 crimson segments, drains right→left */
.bl-bossbar { position: absolute; left: calc(14 * var(--u)); right: calc(14 * var(--u)); top: calc(env(safe-area-inset-top, 0px) + 44 * var(--u)); height: calc(12 * var(--u)); z-index: 3; display: flex; gap: calc(2 * var(--u)); }
.bl-bossseg { flex: 1; border-radius: calc(2 * var(--u)); background: linear-gradient(to bottom, #ff5a5a, #b3122a); box-shadow: 0 0 calc(4 * var(--u)) rgba(255,60,60,0.6); transition: opacity 0.2s; }
.bl-bossseg:not(:last-child) { border-right: calc(1 * var(--u)) solid rgba(255,215,64,0.5); }
.bl-bossseg.dead { background: #2a1016; box-shadow: none; opacity: 0.45; }
/* pause modal — opaque cover so the descending questions can't be read while paused */
.bl-pause { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: calc(24 * var(--u)); background: rgba(6,7,15,0.98); }
.bl-pause[hidden] { display: none; }
.bl-pause-card { display: flex; flex-direction: column; align-items: center; gap: calc(16 * var(--u)); text-align: center; }
.bl-pause-title { font-size: calc(44 * var(--u)); color: #9bf6ff; }
.bl-pause-sub { font-size: calc(13 * var(--u)); color: #9fb6d8; letter-spacing: 0.04em; }
.bl-pause .score-actions { width: 100%; max-width: calc(320 * var(--u)); }
.blaster-keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(8 * var(--u)); padding: 0 calc(12 * var(--u)) max(calc(12 * var(--u)), env(safe-area-inset-bottom)); }
.blaster-keypad .mw-tile { height: calc(48 * var(--u)); font-size: calc(24 * var(--u)); display: flex; align-items: center; justify-content: center; background: linear-gradient(to bottom, #1b2740, #131c30); border: calc(3 * var(--u)) solid #38507e; color: #dfeaff; box-shadow: 0 calc(4 * var(--u)) 0 0 #0a1120; }
.blaster-keypad .mw-tile::before { opacity: 0; }
/* ---- Galaxy Run Fly On runs (Galaxy spec 2.4) ---- */
/* the HUD: the run total, the chain chip hanging under it (a drawn link, x2.4, a fill to the x3.0
 * cap); out of the row's flow, so the HUD row keeps today's widths (WAVE n/3 stays on one line) */
.bl-scorebox { position: relative; }
.bl-chain { position: absolute; top: calc(100% + 3 * var(--u)); inset-inline-end: 0; white-space: nowrap; overflow: hidden; display: inline-flex; align-items: center; gap: calc(3 * var(--u)); min-width: calc(54 * var(--u));
  padding: calc(2 * var(--u)) calc(7 * var(--u)) calc(3.5 * var(--u)); border-radius: 999px; background: rgba(13,23,40,0.72);
  border: calc(1.5 * var(--u)) solid #2a3a5c; color: #9fd8ff; font-weight: 900; font-size: calc(13 * var(--u)); line-height: 1.1;
  font-variant-numeric: tabular-nums; transition: color .2s, border-color .2s, opacity .2s; }
.bl-chain-ico { display: inline-block; width: calc(13 * var(--u)); height: calc(13 * var(--u)); flex: 0 0 auto; }
.bl-chain-ico svg { display: block; }
.bl-chain-fill { position: absolute; left: 0; right: 0; bottom: 0; height: calc(2.5 * var(--u)); background: #46e0b0;
  transform: scaleX(var(--fill, 0)); transform-origin: left center; transition: transform .25s ease-out; }
[dir="rtl"] .bl-chain-fill { transform-origin: right center; }
.bl-chain.zero { opacity: 0.6; }
.bl-chain.drain .bl-chain-fill { transition-duration: .7s; transition-timing-function: ease-in; }
.bl-chain.max { color: #ffd740; border-color: #b8860b; background: rgba(48,34,4,0.82); }
.bl-chain.max .bl-chain-fill { background: #ffd740; }
.bl-chain.shake { animation: bl-judder 0.3s; }
/* "+N" from a kill (a fixed pool; transform and opacity only) */
.bl-float { position: absolute; z-index: 4; pointer-events: none; transform: translate(-50%,-50%); white-space: nowrap; font-weight: 900;
  font-size: calc(17 * var(--u)); color: #9bf6ff; font-variant-numeric: tabular-nums; text-shadow: 0 calc(2 * var(--u)) calc(6 * var(--u)) rgba(0,0,0,0.75); }
.bl-float.gold { color: #FFFFFF; }
.bl-float-x2 { display: inline-block; width: calc(30 * var(--u)); height: calc(20 * var(--u)); vertical-align: middle; margin-left: calc(4 * var(--u)); }
.bl-float-x2 svg { display: block; }
.bl-float[hidden] { display: none; }
/* banners wrap (a planet name such as THE INFINITY GATE, or a long localised word): as wide as the
 * text, at most 74% of the playfield (88% at the banner's 1.2 pop), then the next line */
.bl-announce.bl-wrap { white-space: normal; width: max-content; max-width: min(74%, 74vw); font-size: calc(34 * var(--u)); line-height: 1.05; overflow-wrap: anywhere; }
.bl-quit-banks { color: #ffd166; max-width: calc(300 * var(--u)); line-height: 1.35; }
.bl-nowebgl { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: calc(24 * var(--u));
  color: #cfe3ff; font-weight: 800; font-size: calc(16 * var(--u)); line-height: 1.4; }
@media (prefers-reduced-motion: reduce) {
  .bl-chain, .bl-chain-fill { transition: none; }
  .bl-chain.shake { animation: none; }
}

/* ---- Galaxy Run missions: the Toy Galaxy look (phase 2, galaxy-map-proto screens/hud + ready) ----
 * The app's chunky glossy recipes (mw-card, mw-btn, mw-tile: a thick dark stroke, a solid drop
 * shadow, a gloss band behind the label) in space colours: navy glass, mint for the pilot, gold for
 * the score and bombs, the planet's own colour (--pc, --pl and the tints blaster.js mixes once) as
 * the accent. Fredoka for display words, Roboto 900 for numbers, drawn icons only. Scoped to
 * .gx-mission: Prime Raiders shares the blaster-screen classes and keeps its own look. */
.gx-mission { --gx-stroke: #050919; --gx-shadow: #02030b; --gx-hi: rgba(255,255,255,0.16); --gx-ink: #F1F6FF; --gx-ink2: #AFC1E6;
  --gx-mint: #46E0B0; --gx-gold: #FFC930; --gx-display: 'Fredoka', 'Roboto', system-ui, sans-serif; --gx-ready-y: 56%; background: #04050d; }
/* the HUD bar: navy glass, denser at the top, so a tag coming in under it stays readable */
.gx-mission .blaster-hud { gap: calc(6 * var(--u)); padding: max(calc(8 * var(--u)), env(safe-area-inset-top)) calc(8 * var(--u)) calc(8 * var(--u));
  background: linear-gradient(to bottom, rgba(18,26,62,0.92) 0%, rgba(14,21,52,0.78) 55%, rgba(12,18,46,0.6) 100%);
  border-bottom: calc(3 * var(--u)) solid var(--gx-stroke); box-shadow: 0 calc(4 * var(--u)) 0 rgba(0,0,0,0.3); }
/* round glass buttons (pause, mute): 48 px at every size */
.gx-mission :is(.blaster-quit, .bl-mute) { flex: 0 0 auto; width: max(48px, calc(46 * var(--u))); height: max(48px, calc(46 * var(--u))); min-width: 48px; min-height: 48px;
  margin: 0; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: #DCE8FF;
  background: linear-gradient(to bottom, #2f4584, #1b2858); border: calc(3 * var(--u)) solid var(--gx-stroke);
  box-shadow: 0 calc(4 * var(--u)) 0 var(--gx-shadow), inset 0 calc(2 * var(--u)) 0 var(--gx-hi); -webkit-tap-highlight-color: transparent; transition: transform 90ms ease-out, box-shadow 90ms ease-out; }
.gx-mission .blaster-quit svg { width: 44%; height: 44%; display: block; }
.gx-mission .bl-mute svg { width: 54%; height: 54%; display: block; }
.gx-mission :is(.blaster-quit, .bl-mute):active { transform: translateY(calc(3 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 var(--gx-shadow), inset 0 calc(2 * var(--u)) 0 var(--gx-hi);
  background: linear-gradient(to bottom, #2f4584, #1b2858); }
/* the ships in a pill (the lost ones dimmed) */
.gx-mission .bl-lives { flex: 0 0 auto; display: inline-flex; align-items: center; gap: calc(2 * var(--u)); padding: calc(5 * var(--u)) calc(7 * var(--u));
  border-radius: 999px; background: rgba(4,7,20,0.7); border: calc(2 * var(--u)) solid #2a3a70; }
.gx-mission .bl-lives :is(.bl-life, .bl-life-lost) { width: calc(17 * var(--u)); height: calc(17 * var(--u)); display: inline-block; }
.gx-mission .bl-life-lost svg { display: block; width: 100%; height: 100%; }
.gx-mission .bl-life-lost { opacity: 0.22; filter: grayscale(1); }
/* the middle: the planet (a mini orb and its name) and the wave (the word and three pips) */
.gx-mission .bl-mid { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(3 * var(--u)); }
.gx-mission .bl-planet { display: inline-flex; align-items: center; justify-content: center; gap: calc(5 * var(--u)); max-width: 100%; min-width: 0; }
.gx-mission .bl-planet .bl-orb { width: calc(16 * var(--u)); height: calc(16 * var(--u)); flex: 0 0 auto; box-shadow: 0 0 0 calc(2 * var(--u)) var(--gx-stroke); }
.gx-mission .bl-planet-n { min-width: 0; font-family: var(--gx-display); font-weight: 700; font-size: calc(13 * var(--u)); letter-spacing: 0.07em; line-height: 1.05;
  color: var(--pl); text-align: center; overflow-wrap: anywhere; text-wrap: balance; }
.gx-mission .bl-planet-n.bl-mid-len { font-size: calc(11.5 * var(--u)); letter-spacing: 0.05em; }
.gx-mission .bl-planet-n.bl-long { font-size: calc(10.5 * var(--u)); letter-spacing: 0.03em; }
.gx-mission .bl-wave { flex: 0 1 auto; min-width: 0; max-width: 100%; display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: calc(2 * var(--u)) calc(5 * var(--u));
  font-family: var(--gx-display); font-weight: 700; font-size: calc(10.5 * var(--u)); letter-spacing: 0.1em; line-height: 1.1; color: var(--gx-ink2); text-align: center; overflow-wrap: anywhere; }
.gx-mission .bl-wave-t:empty { display: none; }
.gx-mission .bl-pips { display: inline-flex; gap: calc(4 * var(--u)); flex: 0 0 auto; direction: ltr; }
[dir="rtl"] .gx-mission .bl-pips { direction: rtl; }
.gx-mission .bl-pips i { width: calc(16 * var(--u)); height: calc(6 * var(--u)); border-radius: calc(3 * var(--u)); background: #26346a; border: 1.5px solid var(--gx-stroke); }
.gx-mission .bl-pips i.on { background: linear-gradient(var(--pl), var(--pc)); }
.gx-mission .bl-wave.boss { color: #ff9a9a; letter-spacing: 0.08em; }
.gx-mission .bl-wave.boss .bl-pips { display: none; }
/* the score (gold) with the chain chip under it */
.gx-mission .bl-scorebox { flex: 0 0 auto; position: static; display: flex; flex-direction: column; align-items: flex-end; gap: calc(3 * var(--u)); }
.gx-mission .bl-score { flex: 0 0 auto; color: #FFFFFF; font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; font-size: calc(21 * var(--u)); line-height: 1; text-shadow: 0 calc(2 * var(--u)) 0 var(--gx-stroke); }
.gx-mission .bl-score.bl-long { font-size: calc(16 * var(--u)); }
.gx-mission .bl-score.bl-xlong { font-size: calc(13.5 * var(--u)); }
.gx-mission .bl-chain { position: relative; top: auto; inset-inline-end: auto; min-width: 0; padding: calc(1 * var(--u)) calc(7 * var(--u)) calc(3 * var(--u)); border-radius: 999px;
  background: rgba(4,7,20,0.82); border: calc(2 * var(--u)) solid #1f6e5a; color: #9ff3d8; font-family: 'Roboto', system-ui, sans-serif; font-size: calc(11.5 * var(--u)); line-height: 1.15; }
.gx-mission .bl-chain-ico { width: calc(12 * var(--u)); height: calc(12 * var(--u)); }
.gx-mission .bl-chain-fill { height: calc(2.5 * var(--u)); background: var(--gx-mint); }
.gx-mission .bl-chain.max { color: #FFE38A; border-color: #b8860b; background: rgba(48,34,4,0.86); }
.gx-mission .bl-chain.max .bl-chain-fill { background: #FFD740; }
/* the target chip (Bondaria: MAKE 10): a chunky pill ringed in the planet's colour */
.gx-mission .bl-target { gap: calc(7 * var(--u)); padding: calc(5 * var(--u)) calc(16 * var(--u)) calc(6 * var(--u)) calc(10 * var(--u)); border-radius: 999px; color: var(--pl);
  background: linear-gradient(#2c4180, #18234f); border: calc(3 * var(--u)) solid var(--gx-stroke);
  box-shadow: 0 calc(4 * var(--u)) 0 var(--gx-shadow), inset 0 0 0 calc(2 * var(--u)) var(--tc, var(--pc)), 0 0 calc(18 * var(--u)) var(--pc-glow); }
.gx-mission .bl-target-ico { width: calc(22 * var(--u)); height: calc(22 * var(--u)); color: var(--pl); }
.gx-mission .bl-target-n { display: inline-flex; align-items: center; gap: calc(7 * var(--u)); color: #ffffff; }
.gx-mission .bl-target-w { font-family: var(--gx-display); font-weight: 700; font-size: calc(12.5 * var(--u)); letter-spacing: 0.12em; color: var(--pl); }
.gx-mission .bl-target-num { font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; font-size: calc(26 * var(--u)); line-height: 1; color: #ffffff; letter-spacing: 0.02em; }
/* the answer pod (bottom left): the typed number and a caret; LOCK ON with the matched number in mint
 * for a moment after a lock; red on a miss. Left to right in every language (as the keypad). */
.gx-mission .bl-pod { position: absolute; z-index: 2; left: calc(12 * var(--u)); bottom: calc(14 * var(--u)); min-width: calc(112 * var(--u)); max-width: calc(50% - 46 * var(--u));
  height: calc(56 * var(--u)); padding: 0 calc(14 * var(--u)); display: flex; align-items: center; gap: calc(6 * var(--u)); direction: ltr; pointer-events: none;
  border-radius: calc(20 * var(--u)); background: linear-gradient(#24356c, #121b42); border: calc(3 * var(--u)) solid var(--gx-stroke);
  box-shadow: 0 calc(5 * var(--u)) 0 var(--gx-shadow), inset 0 calc(2 * var(--u)) 0 rgba(255,255,255,0.14); transition: background-color .12s; }
.gx-mission .bl-answer { position: static; left: auto; right: auto; bottom: auto; flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-align: start;
  font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; font-size: calc(34 * var(--u)); line-height: 1.05; color: #9bf6ff; text-shadow: none; }
.gx-mission .bl-answer.bl-miss { color: #ff6b6b; background: none; border-radius: 0; }
.gx-mission .bl-caret { flex: 0 0 auto; width: calc(4 * var(--u)); height: calc(30 * var(--u)); border-radius: 2px; background: #9bf6ff; opacity: 0.75; }
.gx-mission .bl-pod-lock { display: none; align-items: center; gap: calc(8 * var(--u)); min-width: 0; }
.gx-mission .bl-pod-num { flex: none; white-space: nowrap; font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; font-size: calc(34 * var(--u)); line-height: 1.05; color: #E8FFF8; }
/* LOCK ON breaks only between words, never inside one (the de / tr / id / ko page rule overflow-wrap: anywhere split
 * Turkish KİLİTLENDİ); a word too long for the room beside the number is stepped down by blaster.js fitPod (the pod keeps its
 * max-width: wider, it would cover the pilot's ship) */
.gx-mission .bl-pod-l { min-width: 0; max-width: calc(76 * var(--u)); font-family: var(--gx-display); font-weight: 700; font-size: calc(11 * var(--u)); letter-spacing: 0.1em; line-height: 1.05; color: #BFFFE9;
  overflow-wrap: normal; word-break: keep-all; -webkit-hyphens: manual; hyphens: manual; }
.gx-mission .bl-pod.lock { background: linear-gradient(#2f8f73, #155a47); }
.gx-mission .bl-pod.lock :is(.bl-answer, .bl-caret) { display: none; }
.gx-mission .bl-pod.lock .bl-pod-lock { display: inline-flex; }
/* the label under the number when the two never fit side by side (modes/galaxy/blaster.js fitPod, mw-v237) */
.gx-mission .bl-pod.bl-pod-stack .bl-pod-lock { flex-direction: column; align-items: center; gap: 0; }
.gx-mission .bl-pod.bl-pod-stack .bl-pod-l { max-width: none; text-align: center; }
.gx-mission .bl-pod.miss { background: linear-gradient(#6e2836, #3a1220); }
.gx-mission .bl-pod.miss .bl-caret { background: #ff6b6b; }
/* the smart bomb: a chunky red button, its count on a gold coin */
.gx-mission .bl-bomb { right: calc(12 * var(--u)); bottom: calc(12 * var(--u)); width: calc(66 * var(--u)); height: calc(66 * var(--u)); padding: calc(8 * var(--u));
  border-radius: 50%; border: calc(3 * var(--u)) solid var(--gx-stroke); background: radial-gradient(circle at 40% 30%, #ff9a6b, #e8452c 55%, #9c1f13);
  box-shadow: 0 calc(5 * var(--u)) 0 var(--gx-shadow), inset 0 calc(3 * var(--u)) 0 rgba(255,255,255,0.35); }
.gx-mission .bl-bomb:active { transform: translateY(calc(4 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 var(--gx-shadow), inset 0 calc(3 * var(--u)) 0 rgba(255,255,255,0.35); }
.gx-mission .bl-bomb-count { top: calc(-6 * var(--u)); right: calc(-6 * var(--u)); min-width: calc(26 * var(--u)); height: calc(26 * var(--u)); padding: 0 calc(5 * var(--u));
  border-radius: calc(13 * var(--u)); background: linear-gradient(#FFE38A, #FFB300); color: #3A2606; border: calc(2.5 * var(--u)) solid var(--gx-stroke);
  box-shadow: 0 calc(2 * var(--u)) 0 var(--gx-shadow); font-family: 'Roboto', system-ui, sans-serif; font-size: calc(14 * var(--u)); }
.gx-mission .bl-bomb.empty .bl-bomb-count { background: linear-gradient(#c9ced9, #8b93a6); }
/* GENERAL OBELUS's shield bar: his sign, then 12 segments in a glass track (drains right to left) */
.gx-mission .bl-bossbar { left: calc(12 * var(--u)); right: calc(12 * var(--u)); height: calc(26 * var(--u)); gap: calc(6 * var(--u)); align-items: center; }
.gx-mission .bl-boss-sig { flex: 0 0 auto; width: calc(26 * var(--u)); height: calc(26 * var(--u)); filter: drop-shadow(0 calc(2 * var(--u)) 0 var(--gx-shadow)); }
.gx-mission .bl-boss-sig svg { display: block; }
.gx-mission .bl-bosstrack { flex: 1; min-width: 0; height: calc(18 * var(--u)); display: flex; gap: calc(2 * var(--u)); padding: calc(2 * var(--u));
  border-radius: 999px; background: rgba(4,7,20,0.86); border: calc(2.5 * var(--u)) solid var(--gx-stroke); box-shadow: 0 calc(3 * var(--u)) 0 var(--gx-shadow), inset 0 0 0 calc(1.5 * var(--u)) #6b1622; }
.gx-mission .bl-bossseg { position: relative; border-radius: calc(4 * var(--u)); background: linear-gradient(to bottom, #ff8a8a 0%, #ff4d5e 40%, #b3122a 100%); box-shadow: 0 0 calc(5 * var(--u)) rgba(255,60,80,0.55); }
.gx-mission .bl-bossseg:first-child { border-start-start-radius: 999px; border-end-start-radius: 999px; }
.gx-mission .bl-bossseg:last-child { border-start-end-radius: 999px; border-end-end-radius: 999px; }
.gx-mission .bl-bossseg:not(:last-child) { border-right: 0; }
.gx-mission .bl-bossseg.dead { background: #2a1016; box-shadow: none; opacity: 0.6; }
/* the READY moment: the planet above READY? (its stop and skill, a toy orb, its name) */
.gx-mission .bl-ready { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.gx-mission .bl-ready[hidden] { display: none; }
.gx-mission .bl-ready-top { position: absolute; left: calc(12 * var(--u)); right: calc(12 * var(--u)); top: calc(var(--gx-hud-b, 66px) + 14 * var(--u));
  bottom: calc(100% - var(--gx-ready-y) + 46 * var(--u)); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: calc(7 * var(--u)); }
.gx-mission .bl-ready-stop { flex: 0 0 auto; max-width: 100%; font-family: var(--gx-display); font-weight: 700; font-size: calc(13 * var(--u)); letter-spacing: 0.13em; line-height: 1.25;
  color: var(--gx-ink2); text-align: center; text-wrap: balance; text-shadow: 0 calc(2 * var(--u)) 0 var(--gx-stroke); }
.gx-mission .bl-ready-orb { flex: 0 1 auto; height: min(calc(150 * var(--u)), 64%); min-height: calc(36 * var(--u)); aspect-ratio: 1 / 1; }
.gx-mission .bl-ready-name { flex: 0 0 auto; max-width: 100%; font-family: var(--gx-display); font-weight: 700; font-size: calc(34 * var(--u)); letter-spacing: 0.07em; line-height: 1.02;
  color: var(--pl); text-align: center; text-wrap: balance; overflow-wrap: anywhere; -webkit-text-stroke: calc(4 * var(--u)) var(--gx-stroke); paint-order: stroke fill;
  text-shadow: 0 calc(4 * var(--u)) 0 var(--gx-stroke), 0 0 calc(22 * var(--u)) var(--pc-glow); }
.gx-mission .bl-ready-name:empty { display: none; }
/* the banners (READY?, GO!, WAVE 2!, the planet's name on a carried leg): the kit's outlined Fredoka */
.gx-mission .bl-announce { font-family: var(--gx-display); font-weight: 700; letter-spacing: 0.06em; -webkit-text-stroke: calc(4 * var(--u)) var(--gx-stroke); paint-order: stroke fill;
  text-shadow: 0 calc(4 * var(--u)) 0 var(--gx-stroke), 0 0 calc(24 * var(--u)) rgba(255,255,255,0.32); }
.gx-mission .bl-announce.bl-at-ready { top: var(--gx-ready-y); }
.gx-mission .bl-announce.bl-at-ready.bl-word { font-size: calc(60 * var(--u)); }
/* Doc's bubble at the foot of the field during READY: the leg's reminder or the first-visit tip */
.gx-mission .bl-doc { position: absolute; z-index: 6; left: calc(12 * var(--u)); right: calc(12 * var(--u)); bottom: calc(10 * var(--u)); display: flex; align-items: flex-end; gap: calc(9 * var(--u)); pointer-events: none; }
.gx-mission .bl-doc[hidden] { display: none; }
.gx-mission .bl-pod { transition: background-color .12s, opacity .2s ease-out; }
.gx-mission .bl-bomb { transition: transform .08s, opacity .2s ease-out; }
.gx-mission.bl-doc-on :is(.bl-pod, .bl-bomb) { opacity: 0; pointer-events: none; }   /* under Doc's bubble for the READY moment */
.gx-mission .bl-doc-coach { flex: 0 0 auto; width: calc(60 * var(--u)); height: calc(60 * var(--u)); --accent1: #46E0B0; --accent2: #E73C7E; --stroke: #050919;
  filter: drop-shadow(0 calc(3 * var(--u)) 0 var(--gx-shadow)); }
.gx-mission .bl-doc-coach svg { display: block; }
.gx-mission .bl-doc.no-coach .bl-doc-coach { display: none; }
.gx-mission .bl-doc-bubble { position: relative; flex: 1 1 auto; min-width: 0; padding: calc(9 * var(--u)) calc(13 * var(--u)) calc(10 * var(--u)); border-radius: calc(16 * var(--u));
  background: #F4F7FF; color: #18204a; border: calc(3 * var(--u)) solid var(--gx-stroke); box-shadow: 0 calc(4 * var(--u)) 0 var(--gx-shadow);
  font-family: var(--gx-display); font-weight: 600; font-size: calc(15 * var(--u)); line-height: 1.3; text-align: start; text-wrap: pretty; }
.gx-mission .bl-doc-bubble::before { content: ''; position: absolute; inset-inline-start: calc(-12 * var(--u)); bottom: calc(14 * var(--u)); border: calc(8 * var(--u)) solid transparent;
  border-inline-end-color: var(--gx-stroke); }
.gx-mission .bl-doc.no-coach .bl-doc-bubble::before { display: none; }
.gx-mission .bl-remind { position: static; left: auto; top: auto; transform: none; z-index: auto; width: auto; max-width: none; padding: 0; border: 0; border-radius: 0;
  background: none; color: inherit; font: inherit; text-align: inherit; text-wrap: pretty; }
.gx-mission :is(.bl-remind, .bl-tip)[hidden] { display: none; }
/* the keypad: the app's tiles in navy glass with their gloss band, the pressed key in the planet's
 * colour, the top edge in the planet's colour; 48 px keys at every size; it follows the page's
 * direction like the app's other keypads (Arabic and Urdu mirror it: 1 on the right, C 0 ⌫) */
.gx-mission .blaster-keypad { gap: calc(7 * var(--u)); margin-top: 0; padding: calc(9 * var(--u)) calc(10 * var(--u)) max(calc(12 * var(--u)), env(safe-area-inset-bottom));
  background: linear-gradient(#0b1030, #070a1c); border-top: calc(3 * var(--u)) solid var(--pc-edge); }
.gx-mission .blaster-keypad .mw-tile { height: max(48px, calc(50 * var(--u))); min-height: 48px; font-family: 'Roboto', system-ui, sans-serif; font-size: calc(26 * var(--u)); color: #F1F6FF;
  border: calc(3 * var(--u)) solid var(--gx-stroke); border-radius: calc(16 * var(--u)); box-shadow: 0 calc(5 * var(--u)) 0 var(--gx-shadow);
  background: linear-gradient(to bottom, #34488a 0%, #22326a 50%, #1a2758 100%); -webkit-tap-highlight-color: transparent; }
.gx-mission .blaster-keypad .mw-tile::before { opacity: 1; left: calc(8 * var(--u)); right: calc(8 * var(--u)); top: calc(5 * var(--u)); bottom: auto; height: 40%;
  border-radius: calc(10 * var(--u)); background: linear-gradient(rgba(255,255,255,0.32), rgba(255,255,255,0.04)); }
.gx-mission .blaster-keypad .mw-tile.bl-fn { color: #AFC1E6; font-size: calc(22 * var(--u)); background: linear-gradient(to bottom, #2a335c 0%, #1a2045 60%, #141938 100%); }
.gx-mission .blaster-keypad .mw-tile svg { width: calc(26 * var(--u)); height: calc(26 * var(--u)); display: block; }
.gx-mission .blaster-keypad .mw-tile:is(:active, .pressed) { transform: translateY(calc(4 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 var(--gx-shadow);
  background: linear-gradient(to bottom, var(--pc-key-top), var(--pc-key-bot)); color: #ffffff; }
.gx-mission .blaster-keypad .mw-tile:is(:active, .pressed)::before { opacity: 0.55; }
/* a touch screen (4 Nov 2026, owner: "the keypad takes up too much of the screen"): three rows of four (bl-kp4,
 * blaster.js), 48 px keys (never less), tighter gaps and padding: about 175 px at 412 px wide (was 246, four
 * rows of three). Keys at most 104 px wide and 54 px tall, the rows centred, so an open Fold or a tablet gets
 * no giant keys. The desktop layout keeps its two rows of six (desktop.css). */
.gx-mission .blaster-keypad.bl-kp4 { grid-template-columns: repeat(4, minmax(0, 104px)); justify-content: center; gap: calc(6 * var(--u));
  padding: calc(7 * var(--u)) calc(9 * var(--u)) max(calc(9 * var(--u)), env(safe-area-inset-bottom)); }
.gx-mission .blaster-keypad.bl-kp4 .mw-tile { height: max(48px, min(calc(48 * var(--u)), 54px)); font-size: min(calc(26 * var(--u)), 29px); box-shadow: 0 calc(4 * var(--u)) 0 var(--gx-shadow); }
.gx-mission .blaster-keypad.bl-kp4 .mw-tile.bl-fn { font-size: min(calc(22 * var(--u)), 25px); }
.gx-mission .blaster-keypad.bl-kp4 .mw-tile svg { width: min(calc(26 * var(--u)), 29px); height: min(calc(26 * var(--u)), 29px); }
.gx-mission .blaster-keypad.bl-kp4 .mw-tile:is(:active, .pressed) { transform: translateY(calc(3 * var(--u))); }
/* the pause sheet: opaque (the questions stay hidden), a glass card */
.gx-mission .bl-pause { background: radial-gradient(ellipse at 50% 30%, #101846 0%, #070a22 55%, #03040d 100%); padding: calc(18 * var(--u)); }
.gx-mission .bl-pause-card { width: 100%; max-width: calc(350 * var(--u)); gap: calc(12 * var(--u)); padding: calc(20 * var(--u)) calc(16 * var(--u)) calc(18 * var(--u));
  background: linear-gradient(to bottom, #2c4180 0%, #1b2858 38%, #141e47 100%); border: calc(3 * var(--u)) solid var(--gx-stroke); border-radius: calc(22 * var(--u));
  box-shadow: 0 calc(6 * var(--u)) 0 0 var(--gx-shadow), inset 0 calc(2 * var(--u)) 0 var(--gx-hi), 0 calc(14 * var(--u)) calc(30 * var(--u)) rgba(0,0,0,0.45); }
.gx-mission .bl-pause-ico { width: calc(60 * var(--u)); height: calc(60 * var(--u)); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #DCE8FF;
  background: linear-gradient(to bottom, #3a4f8e, #1b2858); border: calc(3 * var(--u)) solid var(--gx-stroke); box-shadow: 0 calc(4 * var(--u)) 0 var(--gx-shadow), inset 0 calc(2 * var(--u)) 0 var(--gx-hi); }
.gx-mission .bl-pause-ico svg { width: 44%; height: 44%; display: block; }
.gx-mission .bl-pause-title { font-family: var(--gx-display); font-weight: 700; font-size: calc(40 * var(--u)); letter-spacing: 0.07em; color: #9bf6ff; }
.gx-mission .bl-pause-sub { color: var(--gx-ink2); font-size: calc(13.5 * var(--u)); line-height: 1.35; }
.gx-mission .bl-pause .bl-quit-banks { color: #FFE38A; }
.gx-mission .bl-pause .score-actions { gap: calc(10 * var(--u)); margin-top: calc(4 * var(--u)); }
.gx-mission .bl-pause .score-actions .mw-btn { flex: 1 1 0; min-width: 0; min-height: max(48px, calc(56 * var(--u))); border: calc(3 * var(--u)) solid var(--gx-stroke);
  font-family: var(--gx-display); font-weight: 700; letter-spacing: 0.06em; color: var(--gx-ink); box-shadow: 0 calc(5 * var(--u)) 0 0 var(--gx-shadow);
  background: linear-gradient(to bottom, #3a4f8e 0%, #24356c 55%, #1a2858 100%); }
.gx-mission .bl-pause .score-actions .bl-resume { flex-grow: 1.5; background: linear-gradient(to bottom, #8CF5B5 0%, #35D676 45%, #1EAA55 100%); border-color: #0B4F26;
  box-shadow: 0 calc(5 * var(--u)) 0 0 #093D1E; color: #06331A; }
.gx-mission .bl-pause .score-actions .mw-btn:active { transform: translateY(calc(4 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 0 var(--gx-shadow); }
.gx-mission .bl-pause .score-actions .bl-resume:active { box-shadow: 0 calc(1 * var(--u)) 0 0 #093D1E; }
/* a short phone (360 x 640 class): READY sits lower and the planet's name a size down, so its orb keeps a size */
@media (max-height: 700px) {
  .gx-mission { --gx-ready-y: 62%; }
  .gx-mission .bl-ready-name { font-size: calc(28 * var(--u)); }
  .gx-mission .bl-ready-stop { font-size: calc(12 * var(--u)); }
  .gx-mission .bl-ready-top { gap: calc(5 * var(--u)); }
}
/* Turkish: Fredoka has no Ğ İ Ş, so the display words use Roboto (as on the map) */
.gx-mission :is(.bl-wave, .bl-target-w, .bl-pod-l, .bl-ready-stop, .bl-ready-name, .bl-announce, .bl-doc-bubble, .bl-pause-title, .bl-pause .mw-btn):lang(tr) { font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; }
@media (prefers-reduced-motion: reduce) {
  .gx-mission :is(.blaster-quit, .bl-mute, .bl-pod), .gx-mission .blaster-keypad .mw-tile { transition: none; }
}
/* A ship lost (blaster.js lifeLostFx; owner, 25 Nov 2026): the playfield and the keypad shake together for 0.42 s
 * (transform only: the layout, the scroll and the keys' places are untouched; the class goes at 0.52 s), one red
 * edge flash over the field, and the lost ship pops out of the HUD pill, turning red, then settles as the dimmed slot.
 * Reduced motion: no shake, no pop or ring (a red glow, then the dimmed slot), a softer flash. One flash per loss and
 * at most about 2 a second (blaster.js lets losses close together share one). Never the miss's look (the red pod). */
.gx-mission.bl-hit :is(.blaster-gl, .blaster-keypad) { animation: bl-hit-shake 0.42s cubic-bezier(.36,.07,.19,.97); }
@keyframes bl-hit-shake { 0%, 100% { transform: none; } 10% { transform: translate3d(-9px, 2px, 0); } 22% { transform: translate3d(8px, -2px, 0); }
  36% { transform: translate3d(-7px, 1px, 0); } 50% { transform: translate3d(5px, -1px, 0); } 64% { transform: translate3d(-3px, 0, 0); } 80% { transform: translate3d(2px, 0, 0); } }
.gx-mission .bl-hitflash { position: absolute; inset: 0; z-index: 6; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(255,36,64,0) 50%, rgba(255,36,64,0.34) 80%, rgba(255,36,64,0.72) 100%);
  box-shadow: inset 0 0 0 calc(4 * var(--u)) rgba(255,64,88,0.9), inset 0 0 calc(40 * var(--u)) rgba(255,36,64,0.55); }
.gx-mission .bl-hitflash.on { animation: bl-hit-flash 0.46s ease-out; }
.gx-mission .bl-hitflash.on.soft { animation-name: bl-hit-flash-soft; animation-duration: 0.5s; }
@keyframes bl-hit-flash { 0% { opacity: 0; } 14% { opacity: 1; } 100% { opacity: 0; } }
@keyframes bl-hit-flash-soft { 0% { opacity: 0; } 24% { opacity: 0.5; } 100% { opacity: 0; } }
.gx-mission .bl-lives .bl-life-pop { position: relative; animation: bl-life-pop 0.6s ease-out; }
.gx-mission .bl-life-pop svg path { animation: bl-life-red 0.6s ease-out; }
.gx-mission .bl-life-pop::after { content: ''; position: absolute; inset: -35%; border-radius: 50%; border: calc(2 * var(--u)) solid #ff4d6d; opacity: 0; pointer-events: none;
  animation: bl-life-ring 0.5s ease-out; }
@keyframes bl-life-pop { 0% { opacity: 1; filter: none; transform: none; } 24% { opacity: 1; filter: drop-shadow(0 0 calc(5 * var(--u)) #ff3b5c); transform: scale(1.8) rotate(-14deg); }
  55% { opacity: 0.85; filter: drop-shadow(0 0 calc(3 * var(--u)) #ff3b5c); transform: scale(1.05) translateY(calc(3 * var(--u))) rotate(10deg); }
  100% { opacity: 0.22; filter: grayscale(1); transform: none; } }
@keyframes bl-life-red { 0%, 60% { fill: #ff4d6d; } 100% { fill: #46e0b0; } }
@keyframes bl-life-ring { 0% { opacity: 1; transform: scale(0.4); } 100% { opacity: 0; transform: scale(1.5); } }
@keyframes bl-life-glow { 0% { opacity: 1; filter: none; } 30% { opacity: 1; filter: drop-shadow(0 0 calc(5 * var(--u)) #ff3b5c); } 100% { opacity: 0.22; filter: grayscale(1); } }
@media (prefers-reduced-motion: reduce) {
  .gx-mission.bl-hit :is(.blaster-gl, .blaster-keypad) { animation: none; }
  .gx-mission .bl-hitflash.on { animation-name: bl-hit-flash-soft; animation-duration: 0.5s; }
  .gx-mission .bl-lives .bl-life-pop { animation-name: bl-life-glow; }
  .gx-mission .bl-life-pop::after { animation: none; }
}
/* ---- Galaxy Run result screens: the Toy Galaxy look (phase 3, galaxy-map-proto screens/cleared,
 * gameover, finale, pro). One glass card edged in --acc (the planet's colour; pink for a game over,
 * gold for the finale and the Pro road), centred and scrolling when the window is short; the hero
 * (the medal coin, the Gate) stands over its top edge. A desktop window: desktop.css (the stage,
 * two columns). */
.gx-mission .bl-end { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; overflow-x: hidden; overflow-y: auto;
  padding: calc(14 * var(--u)) calc(12 * var(--u)) max(calc(14 * var(--u)), env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 28%, rgba(18,28,82,0.86) 0%, rgba(5,8,26,0.9) 60%, rgba(3,4,13,0.94) 100%); }
.gx-mission .bl-end.bl-has-hero { padding-top: calc(62 * var(--u)); }
.gx-mission .bl-end.bl-k-legend.bl-has-hero { padding-top: calc(78 * var(--u)); }
.gx-mission .bl-end-card { position: relative; width: 100%; max-width: calc(392 * var(--u)); margin: auto 0; flex: 0 0 auto; color: var(--gx-ink); text-align: center;
  padding: calc(14 * var(--u)) calc(14 * var(--u)) calc(14 * var(--u)); border-radius: calc(24 * var(--u));
  background: linear-gradient(to bottom, #2c4180 0%, #1b2858 38%, #141e47 100%);
  border: calc(3 * var(--u)) solid var(--gx-stroke); border-top: calc(5 * var(--u)) solid var(--acc, var(--gx-mint));
  box-shadow: 0 calc(6 * var(--u)) 0 0 var(--gx-shadow), inset 0 calc(2 * var(--u)) 0 var(--gx-hi), 0 calc(14 * var(--u)) calc(34 * var(--u)) rgba(0,0,0,0.5); }
.gx-mission .bl-end-a, .gx-mission .bl-end-b { display: flex; flex-direction: column; align-items: center; gap: calc(9 * var(--u)); min-width: 0; }
.gx-mission .bl-end-b { margin-top: calc(9 * var(--u)); }
.gx-mission .bl-end-a > *, .gx-mission .bl-end-b > * { max-width: 100%; }
/* the hero over the card's top edge: the medal coin (a clear), the Gate (the finale) */
.gx-mission .bl-end-hero { display: block; flex: 0 0 auto; width: calc(92 * var(--u)); height: calc(92 * var(--u)); margin-top: calc(-64 * var(--u)); margin-bottom: calc(-2 * var(--u)); }
.gx-mission .bl-end-hero svg { display: block; overflow: visible; }
.gx-mission .bl-end-coin { filter: drop-shadow(0 0 calc(16 * var(--u)) rgba(255,201,48,0.55)); animation: bl-hero-in 560ms cubic-bezier(.2, 1.4, .4, 1) both; }
.gx-mission .bl-end-portal { width: calc(124 * var(--u)); height: calc(124 * var(--u)); margin-top: calc(-80 * var(--u)); filter: drop-shadow(0 0 calc(20 * var(--u)) rgba(255,90,60,0.7));
  animation: bl-hero-in 640ms cubic-bezier(.2, 1.4, .4, 1) both; }
.gx-mission .bl-vortex { transform-origin: 60px 60px; transform-box: view-box; animation: bl-vortex 9s linear infinite; }
@keyframes bl-hero-in { 0% { opacity: 0; transform: scale(0.4) rotate(-20deg); } 70% { opacity: 1; transform: scale(1.08) rotate(4deg); } 100% { opacity: 1; transform: none; } }
@keyframes bl-vortex { to { transform: rotate(360deg); } }
/* chips: the kit's pills (a dark face, a coloured edge, Fredoka) */
.gx-mission .bl-chip { display: inline-flex; align-items: center; justify-content: center; gap: calc(5 * var(--u)); max-width: 100%; padding: calc(3 * var(--u)) calc(10 * var(--u)) calc(4 * var(--u));
  border-radius: 999px; background: rgba(8,12,34,0.78); border: calc(2 * var(--u)) solid var(--chip, #3a4f8e); color: var(--chipc, var(--gx-ink));
  font-family: var(--gx-display); font-weight: 700; font-size: calc(12 * var(--u)); letter-spacing: 0.06em; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.gx-mission .bl-chip svg { width: 1.2em; height: 1.2em; flex: 0 0 auto; display: block; }
.gx-mission .bl-chip .bl-life { width: 1.25em; height: 1.25em; display: inline-block; flex: 0 0 auto; }
.gx-mission .bl-chip.gold { --chip: #FFC930; --chipc: #FFE38A; }
.gx-mission .bl-chip.silver { --chip: #C9D3DC; --chipc: #F4F8FB; }
.gx-mission .bl-chip.bronze { --chip: #D08A4E; --chipc: #F6C79C; }
.gx-mission .bl-chip.mint { --chip: #46E0B0; --chipc: #BFFFE9; }
.gx-mission .bl-chip.bl-top { font-size: calc(13 * var(--u)); padding: calc(4 * var(--u)) calc(14 * var(--u)) calc(5 * var(--u)); border-width: calc(2.5 * var(--u)); }
.gx-mission .bl-end-chain { --chip: #2a7a66; --chipc: #9ff3d8; }
/* the title: the kit's outlined Fredoka */
.gx-mission .bl-end-title { max-width: 100%; font-family: var(--gx-display); font-weight: 700; font-size: calc(38 * var(--u)); letter-spacing: 0.05em; line-height: 1.04;
  color: #7CF2C5; text-align: center; text-wrap: balance; overflow-wrap: anywhere; -webkit-text-stroke: calc(4 * var(--u)) var(--gx-stroke); paint-order: stroke fill;
  text-shadow: 0 calc(4 * var(--u)) 0 var(--gx-stroke), 0 0 calc(22 * var(--u)) rgba(70,224,176,0.35); outline-offset: calc(4 * var(--u)); }
.gx-mission .bl-k-over .bl-end-title { color: #FF9AA8; text-shadow: 0 calc(4 * var(--u)) 0 var(--gx-stroke), 0 0 calc(22 * var(--u)) rgba(255,122,147,0.35); }
.gx-mission .bl-k-legend .bl-end-title { color: #FFFFFF; font-size: calc(32 * var(--u)); text-shadow: 0 calc(4 * var(--u)) 0 var(--gx-stroke); }
.gx-mission .bl-k-pro .bl-end-title { font-size: calc(31 * var(--u)); }
.gx-mission .bl-end .score-newbest { margin: calc(-2 * var(--u)) 0 0; }
.gx-mission .bl-end .score-ribbon { transform: rotate(-3deg); border: calc(2.5 * var(--u)) solid var(--gx-stroke); box-shadow: 0 calc(3 * var(--u)) 0 var(--gx-shadow); }
/* the score: a small label over the big number */
.gx-mission .bl-end-score { display: flex; flex-direction: column; align-items: center; gap: calc(2 * var(--u)); }
.gx-mission .bl-end-score-l { font-family: var(--gx-display); font-weight: 700; font-size: calc(12 * var(--u)); letter-spacing: 0.12em; color: var(--gx-ink2); }
.gx-mission .bl-end-score-n { font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; font-size: calc(40 * var(--u)); line-height: 1; color: #ffffff;
  font-variant-numeric: tabular-nums; text-shadow: 0 calc(3 * var(--u)) 0 var(--gx-stroke); }
.gx-mission .bl-end-tally { display: inline-flex; align-items: center; justify-content: center; gap: calc(6 * var(--u)); flex-wrap: wrap;
  font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; font-size: calc(15 * var(--u)); color: #FFE38A; font-variant-numeric: tabular-nums; }
.gx-mission .bl-tally-ships { display: inline-flex; gap: calc(3 * var(--u)); }
.gx-mission .bl-end-tally .bl-life { width: calc(18 * var(--u)); height: calc(18 * var(--u)); display: inline-block; }
.gx-mission .bl-end-stats { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: calc(6 * var(--u)) calc(8 * var(--u)); }
/* how far a lost run got, and a continued run's line */
.gx-mission .bl-end-reach { font-family: var(--gx-display); font-weight: 600; font-size: calc(15 * var(--u)); line-height: 1.3; color: var(--gx-ink); text-wrap: balance; }
.gx-mission .bl-end-reach .bl-hl { color: var(--pl); font-weight: 700; letter-spacing: 0.03em; }
.gx-mission .bl-end-cont { font-family: var(--gx-display); font-weight: 600; font-size: calc(13 * var(--u)); line-height: 1.35; color: #FFE38A; text-wrap: balance;
  padding: calc(5 * var(--u)) calc(12 * var(--u)); border-radius: calc(12 * var(--u)); background: rgba(48,34,4,0.55); border: calc(2 * var(--u)) solid rgba(255,201,48,0.55); }
.gx-mission .bl-end-cont .bl-hl { color: #ffffff; font-weight: 700; }
/* the run's path strip: ten beads on a lane, lit to the run's reach (mirrored right to left) */
.gx-mission .bl-route-wrap { width: 100%; }
.gx-mission .bl-route { position: relative; display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: calc(330 * var(--u)); height: calc(30 * var(--u));
  margin: 0 auto; padding: 0 calc(2 * var(--u)); }
.gx-mission .bl-route::before { content: ''; position: absolute; left: calc(9 * var(--u)); right: calc(9 * var(--u)); top: 50%; height: calc(4 * var(--u)); transform: translateY(-50%); border-radius: 4px;
  background: linear-gradient(90deg, #46E0B0 0, #46E0B0 var(--reach, 0%), #2a3766 var(--reach, 0%)); }
[dir="rtl"] .gx-mission .bl-route::before { background: linear-gradient(270deg, #46E0B0 0, #46E0B0 var(--reach, 0%), #2a3766 var(--reach, 0%)); }
.gx-mission .bl-route b { position: relative; flex: 0 0 auto; width: calc(17 * var(--u)); height: calc(17 * var(--u)); border-radius: 50%; border: calc(2 * var(--u)) solid var(--gx-stroke);
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.65), rgba(255,255,255,0) 55%), var(--c); }
.gx-mission .bl-route b.bl-flown-disc { box-shadow: 0 0 calc(7 * var(--u)) var(--c); }
.gx-mission .bl-route b.dim { filter: saturate(0.25) brightness(0.5); }
.gx-mission .bl-route b.prior { opacity: 0.7; filter: saturate(0.6); }
.gx-mission .bl-route b.gate { width: calc(21 * var(--u)); height: calc(21 * var(--u)); background: radial-gradient(circle, #ffd56a 0 28%, #b3122a 30% 58%, #ffc930 60%); }
.gx-mission .bl-route b.at, .gx-mission .bl-route b.next { outline: calc(2.5 * var(--u)) solid #ffffff; outline-offset: calc(2.5 * var(--u)); }
.gx-mission .bl-route b.next { outline-color: rgba(255,255,255,0.8); }
.gx-mission .bl-route-flag { position: absolute; inset-inline-start: 30%; bottom: 88%; width: calc(14 * var(--u)); height: calc(14 * var(--u)); color: #46E0B0; }
.gx-mission .bl-route-flag svg, .gx-mission .bl-bead-lock svg { display: block; width: 100%; height: 100%; }
.gx-mission .bl-route .bl-bead-lock { position: absolute; inset-inline-end: calc(-6 * var(--u)); bottom: calc(-6 * var(--u)); width: calc(11 * var(--u)); height: calc(11 * var(--u)); }
/* NEXT: the planet the run flies to, its orb and its skill */
.gx-mission .bl-end-next { display: flex; align-items: center; gap: calc(10 * var(--u)); width: 100%; padding: calc(8 * var(--u)) calc(12 * var(--u)); border-radius: calc(16 * var(--u));
  background: rgba(4,7,20,0.55); border: calc(2 * var(--u)) solid #2a3a70; text-align: start; }
.gx-mission .bl-next-orb { width: calc(40 * var(--u)); height: calc(40 * var(--u)); }
.gx-mission .bl-next-t { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.gx-mission .bl-next-l { font-family: var(--gx-display); font-weight: 700; font-size: calc(11 * var(--u)); letter-spacing: 0.12em; color: var(--gx-ink2); }
.gx-mission .bl-next-w { font-family: var(--gx-display); font-weight: 700; font-size: calc(19 * var(--u)); letter-spacing: 0.04em; line-height: 1.1; color: var(--nl); overflow-wrap: anywhere; }
.gx-mission .bl-next-skill { --chip: var(--nc); --chipc: var(--nl); flex: 0 1 auto; max-width: 48%; font-size: calc(11 * var(--u)); }
/* the finale's next galaxy */
.gx-mission .bl-end-back { display: flex; align-items: center; gap: calc(8 * var(--u)); width: 100%; padding: calc(8 * var(--u)) calc(12 * var(--u)); border-radius: calc(14 * var(--u));
  background: rgba(4,7,20,0.6); border: calc(2 * var(--u)) solid #46E0B0; text-align: start; }
.gx-mission .bl-end-back-ico { flex: 0 0 auto; width: calc(26 * var(--u)); height: calc(26 * var(--u)); color: #46E0B0; }
.gx-mission .bl-end-back-ico svg { display: block; width: 100%; height: 100%; }
.gx-mission .bl-end-back-t { font-family: var(--gx-display); font-weight: 600; font-size: calc(13.5 * var(--u)); line-height: 1.3; color: #DFFFF4; text-wrap: pretty; }
/* Doc on the card (the bubble's look is the READY bubble's) */
.gx-mission .bl-end-doc { display: flex; align-items: flex-end; gap: calc(9 * var(--u)); width: 100%; text-align: start; }
.gx-mission .bl-end-doc .bl-doc-coach { position: relative; width: calc(58 * var(--u)); height: calc(58 * var(--u)); }
.gx-mission .bl-end-doc .bl-doc-bubble { font-size: calc(14 * var(--u)); padding: calc(8 * var(--u)) calc(12 * var(--u)) calc(9 * var(--u)); }
.gx-mission .bl-end-doc .bl-doc-bubble .bl-hl { color: #7a3b9e; font-weight: 700; }
.gx-mission .bl-end-doc.no-coach .bl-doc-bubble::before { display: none; }
.gx-mission .bl-gold-coin { --accent1: #FFC930; }
.gx-mission .bl-helmet { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.gx-mission .bl-licence { position: absolute; inset-inline-end: calc(-14 * var(--u)); bottom: calc(-3 * var(--u)); width: calc(32 * var(--u)); height: calc(23 * var(--u)); transform: rotate(-10deg);
  filter: drop-shadow(0 calc(2 * var(--u)) 0 var(--gx-shadow)); }
.gx-mission .bl-licence svg { display: block; }
.gx-mission .bl-pro-doc .bl-doc-coach { margin-inline-end: calc(10 * var(--u)); }
/* the Pro road: the Pro planets ahead, dimmed and padlocked, in a dashed gold lane */
.gx-mission .bl-end-pro { width: 100%; display: flex; flex-direction: column; align-items: stretch; gap: calc(9 * var(--u)); }
.gx-mission .bl-road-h { font-family: var(--gx-display); font-weight: 700; font-size: calc(13 * var(--u)); letter-spacing: 0.12em; color: #FFC930; text-align: center; }
.gx-mission .bl-road { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: calc(5 * var(--u)); padding: calc(9 * var(--u)) calc(6 * var(--u)); border-radius: calc(16 * var(--u));
  background: linear-gradient(rgba(255,201,48,0.16), rgba(255,201,48,0.05)); border: calc(2 * var(--u)) dashed rgba(255,201,48,0.8); }
.gx-mission .bl-road-st { display: flex; flex-direction: column; align-items: center; gap: calc(4 * var(--u)); min-width: 0; }
.gx-mission .bl-road-orb { position: relative; display: block; width: calc(32 * var(--u)); height: calc(32 * var(--u)); }
.gx-mission .bl-road-orb .bl-orb { width: 100%; height: 100%; filter: saturate(0.3) brightness(0.62); box-shadow: 0 0 0 calc(2 * var(--u)) #050919; }
.gx-mission .bl-road-orb .bl-bead-lock { position: absolute; inset-inline-end: calc(-5 * var(--u)); bottom: calc(-3 * var(--u)); width: calc(16 * var(--u)); height: calc(16 * var(--u)); }
.gx-mission .bl-road-n { max-width: 100%; font-family: var(--gx-display); font-weight: 600; font-size: calc(9 * var(--u)); letter-spacing: 0.02em; line-height: 1.1; color: #FFE9B0; overflow-wrap: normal; }
.gx-mission .bl-end-pro-t { margin: 0; }
.gx-mission .bl-end-pro-btn { width: 100%; min-height: max(48px, calc(58 * var(--u))); gap: calc(8 * var(--u)); padding: calc(4 * var(--u)) calc(16 * var(--u)) calc(8 * var(--u));
  font-family: var(--gx-display); font-weight: 700; font-size: calc(19 * var(--u)); letter-spacing: 0.06em; border: calc(3 * var(--u)) solid #7A4E04; box-shadow: 0 calc(5 * var(--u)) 0 0 #5E3B02; }
.gx-mission .bl-end-pro-star { display: inline-block; width: calc(20 * var(--u)); height: calc(20 * var(--u)); flex: 0 0 auto; }
.gx-mission .bl-end-pro-star svg { display: block; }
/* the rank with its round share button, the pilots today, the pilot-name prompt */
.gx-mission .bl-submit-area { width: 100%; display: flex; flex-direction: column; align-items: center; gap: calc(3 * var(--u)); }
.gx-mission .bl-submit-area:empty { display: none; }
/* the room the rank line and the pilots line take, kept from the first frame: MAP and FLY ON never
 * move under a finger reaching for them when the checkpoint's rank arrives */
.gx-mission .bl-end.bl-run .bl-submit-area { min-height: calc(max(48px, 46 * var(--u)) + 21 * var(--u)); }
.gx-mission .bl-rankline { display: flex; align-items: center; justify-content: center; gap: calc(12 * var(--u)); min-height: max(48px, calc(46 * var(--u))); max-width: 100%; }
.gx-mission .bl-rank { font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; font-size: calc(26 * var(--u)); line-height: 1.1; color: #FFFFFF; letter-spacing: 0.02em;
  -webkit-text-stroke: 0; text-shadow: 0 calc(2 * var(--u)) 0 var(--gx-stroke); }
.gx-mission .bl-submit-note { font-size: calc(12.5 * var(--u)); line-height: 1.35; color: var(--gx-ink2); text-align: center; text-wrap: balance; }
.gx-mission .bl-share-btn { flex: 0 0 auto; width: max(48px, calc(46 * var(--u))); height: max(48px, calc(46 * var(--u))); padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #DCE8FF; cursor: pointer; background: linear-gradient(to bottom, #2f4584, #1b2858); border: calc(3 * var(--u)) solid var(--gx-stroke);
  box-shadow: 0 calc(4 * var(--u)) 0 var(--gx-shadow), inset 0 calc(2 * var(--u)) 0 var(--gx-hi); -webkit-tap-highlight-color: transparent; }
.gx-mission .bl-share-btn svg { width: 50%; height: 50%; display: block; }
.gx-mission .bl-share-btn:active { transform: translateY(calc(3 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 var(--gx-shadow), inset 0 calc(2 * var(--u)) 0 var(--gx-hi); }
.gx-mission .bl-handle { width: 100%; max-width: calc(320 * var(--u)); min-height: 48px; padding: calc(10 * var(--u)) calc(12 * var(--u)); border-radius: calc(14 * var(--u));
  border: calc(2.5 * var(--u)) solid #3a4f8e; background: rgba(4,7,20,0.75); color: #eaf6ff; font-family: inherit; font-weight: 900; font-size: calc(16 * var(--u)); text-align: center; box-sizing: border-box; }
.gx-mission .bl-handle::placeholder { color: #6a7fa8; }
.gx-mission .bl-submit-area .name-hint { margin-top: 0; color: #ff9aa8; }
.gx-mission .bl-submit-area .name-hint.ok { color: var(--gx-ink2); }
.gx-mission .bl-submit-btn { width: 100%; max-width: calc(320 * var(--u)); min-height: max(48px, calc(52 * var(--u))); padding: calc(4 * var(--u)) calc(14 * var(--u)) calc(8 * var(--u));
  font-family: var(--gx-display); font-weight: 700; font-size: calc(16 * var(--u)); letter-spacing: 0.06em; color: var(--gx-ink); border: calc(3 * var(--u)) solid var(--gx-stroke);
  background: linear-gradient(to bottom, #3a4f8e 0%, #24356c 55%, #1a2858 100%); box-shadow: 0 calc(4 * var(--u)) 0 0 var(--gx-shadow); }
.gx-mission :is(.bl-end-carry, .bl-end-banked) { font-size: calc(12.5 * var(--u)); line-height: 1.35; color: var(--gx-ink2); text-wrap: balance; }
.gx-mission .bl-end .bl-end-patrol .gm-patrol { width: calc(72 * var(--u)); height: calc(11 * var(--u)); }
.gx-mission .bl-end .bl-end-patrol-n { font-size: calc(11.5 * var(--u)); }
/* the buttons: MAP (glass) and the way on (FLY ON, SHARE, AGAIN), the kit's chunky pills */
.gx-mission .bl-end .score-actions { width: 100%; gap: calc(10 * var(--u)); margin-top: calc(2 * var(--u)); }
.gx-mission .bl-end .score-actions .mw-btn { flex: 1 1 0; min-width: 0; min-height: max(48px, calc(60 * var(--u))); gap: calc(8 * var(--u)); padding: calc(4 * var(--u)) calc(12 * var(--u)) calc(9 * var(--u));
  border: calc(3 * var(--u)) solid var(--gx-stroke); box-shadow: 0 calc(5 * var(--u)) 0 0 var(--gx-shadow);
  font-family: var(--gx-display); font-weight: 700; font-size: calc(20 * var(--u)); letter-spacing: 0.06em; line-height: 1.1; }
.gx-mission .bl-end .score-actions :is(.bl-flyon, .bl-share-big, .bl-go) { flex-grow: 1.55; }
.gx-mission .bl-end .score-actions .bl-glass { color: var(--gx-ink); background: linear-gradient(to bottom, #3a4f8e 0%, #24356c 55%, #1a2858 100%); }
.gx-mission .bl-end .score-actions .bl-go { color: #06331A; border-color: #0B4F26; box-shadow: 0 calc(5 * var(--u)) 0 0 #093D1E; background: linear-gradient(to bottom, #8CF5B5 0%, #35D676 45%, #1EAA55 100%); }
.gx-mission .bl-end .score-actions .gold { color: #3A2606; border-color: #7A4E04; box-shadow: 0 calc(5 * var(--u)) 0 0 #5E3B02; background: linear-gradient(to bottom, #FFEDA8 0%, #FFCA3A 50%, #EAA21C 100%); }
.gx-mission .bl-end .score-actions .mw-btn:active { transform: translateY(calc(4 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 0 var(--gx-shadow); }
.gx-mission .bl-btn-ico { display: inline-flex; flex: 0 0 auto; width: calc(22 * var(--u)); height: calc(22 * var(--u)); }
.gx-mission .bl-btn-ico svg { display: block; width: 100%; height: 100%; }
/* a short phone (360 x 640 class): a size tighter, so every card but the Pro road fits without scrolling */
@media (max-height: 700px) {
  .gx-mission .bl-end.bl-has-hero { padding-top: calc(52 * var(--u)); }
  .gx-mission .bl-end.bl-k-legend.bl-has-hero { padding-top: calc(64 * var(--u)); }
  .gx-mission .bl-end-hero { width: calc(78 * var(--u)); height: calc(78 * var(--u)); margin-top: calc(-54 * var(--u)); }
  .gx-mission .bl-end-portal { width: calc(104 * var(--u)); height: calc(104 * var(--u)); margin-top: calc(-66 * var(--u)); }
  .gx-mission .bl-end-title { font-size: calc(32 * var(--u)); }
  .gx-mission .bl-k-legend .bl-end-title, .gx-mission .bl-k-pro .bl-end-title { font-size: calc(28 * var(--u)); }
  .gx-mission .bl-end-score-n { font-size: calc(34 * var(--u)); }
  .gx-mission :is(.bl-end-a, .bl-end-b) { gap: calc(7 * var(--u)); }
  .gx-mission .bl-end-b { margin-top: calc(7 * var(--u)); }
  .gx-mission .bl-end-doc .bl-doc-coach { width: calc(50 * var(--u)); height: calc(50 * var(--u)); }
  .gx-mission .bl-end-doc .bl-doc-bubble { font-size: calc(13.5 * var(--u)); }
  .gx-mission .bl-road { padding: calc(7 * var(--u)) calc(6 * var(--u)); }
  .gx-mission .bl-road-orb { width: calc(28 * var(--u)); height: calc(28 * var(--u)); }
  .gx-mission .bl-end-pro-btn { min-height: max(48px, calc(52 * var(--u))); }
  .gx-mission .bl-end .score-actions .mw-btn { min-height: max(48px, calc(54 * var(--u))); }
  /* the two longest cards (the finale, the Pro road) a little tighter still */
  .gx-mission :is(.bl-k-legend, .bl-k-pro) :is(.bl-end-a, .bl-end-b) { gap: calc(4.5 * var(--u)); }
  .gx-mission :is(.bl-k-legend, .bl-k-pro) .bl-end-b { margin-top: calc(5 * var(--u)); }
  .gx-mission :is(.bl-k-legend, .bl-k-pro) .bl-end-card { padding-top: calc(10 * var(--u)); padding-bottom: calc(10 * var(--u)); }
  .gx-mission .bl-end-back { padding: calc(5 * var(--u)) calc(10 * var(--u)); }
  .gx-mission :is(.bl-k-legend, .bl-k-pro) .bl-end-doc .bl-doc-coach { width: calc(44 * var(--u)); height: calc(44 * var(--u)); }
}
/* Turkish: Fredoka has no Ğ İ Ş (as on the map and the HUD) */
/* (the planet names on the Pro road keep Fredoka: English names, no Turkish letters) */
.gx-mission .bl-end :is(.bl-end-title, .bl-chip, .bl-end-score-l, .bl-next-l, .bl-end-reach, .bl-end-cont, .bl-end-back-t, .bl-doc-bubble, .bl-road-h, .mw-btn):lang(tr) { font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; }
@media (prefers-reduced-motion: reduce) {
  .gx-mission :is(.bl-end-coin, .bl-end-portal, .bl-vortex) { animation: none; }
}
/* the toy planets (CSS only, no image): gloss, the planet's light and colour, a darker edge; each
 * planet a motif of its own (the map's personalities) */
.bl-orb { display: inline-block; position: relative; border-radius: 50%; overflow: hidden; flex: 0 0 auto;
  background: radial-gradient(circle at 33% 28%, rgba(255,255,255,0.95) 0 5%, rgba(255,255,255,0) 14%), radial-gradient(circle at 42% 36%, var(--pl) 0%, var(--pc) 46%, var(--pc-deep) 100%);
  box-shadow: 0 0 0 calc(3 * var(--u)) #050919, 0 0 calc(24 * var(--u)) var(--pc-glow); }
.bl-orb::after { content: ''; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 68% 72%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.32) 75%), radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 62%, rgba(255,255,255,0.18) 70%, rgba(0,0,0,0) 72%); }
.bl-orb::before { content: ''; position: absolute; inset: 0; border-radius: 50%; pointer-events: none; }
.bl-orb[data-p="additron"] { background: radial-gradient(circle at 33% 28%, rgba(255,255,255,0.95) 0 5%, rgba(255,255,255,0) 14%),
  radial-gradient(ellipse 30% 22% at 32% 60%, #8BC34A 0 70%, transparent 72%), radial-gradient(ellipse 24% 30% at 70% 40%, #4CAF50 0 70%, transparent 72%),
  radial-gradient(ellipse 18% 12% at 55% 82%, #7cb342 0 70%, transparent 72%), radial-gradient(circle at 42% 36%, #5ED1C4 0%, #1F8F8A 55%, #0b3a3a 100%); }
.bl-orb[data-p="bondaria"], .bl-orb[data-p="multiplex"] { background: radial-gradient(circle at 33% 28%, rgba(255,255,255,0.95) 0 5%, rgba(255,255,255,0) 14%),
  repeating-linear-gradient(-14deg, rgba(255,255,255,0.2) 0 9%, rgba(0,0,0,0.13) 9% 17%), radial-gradient(circle at 42% 36%, var(--pl) 0%, var(--pc) 46%, var(--pc-deep) 100%); }
.bl-orb[data-p="multiplex"]::before { background: repeating-linear-gradient(-14deg, transparent 0 15%, rgba(255,64,200,0.45) 15% 17%); }
.bl-orb[data-p="subtraxia"]::before { background: radial-gradient(ellipse 46% 16% at 50% 4%, rgba(255,255,255,0.9) 0 70%, transparent 74%), radial-gradient(ellipse 40% 14% at 50% 97%, rgba(255,255,255,0.8) 0 70%, transparent 74%); }
.bl-orb[data-p="cryptara"]::before { inset: 31%; border-radius: 18%; border: calc(2.5 * var(--u)) dashed rgba(230,236,255,0.9); box-shadow: 0 0 calc(10 * var(--u)) rgba(200,210,255,0.9); }
.bl-orb[data-p="primebelt"]::before { background: radial-gradient(circle at 30% 60%, rgba(0,0,0,0.3) 0 7%, transparent 8%), radial-gradient(circle at 64% 30%, rgba(0,0,0,0.26) 0 6%, transparent 7%),
  radial-gradient(circle at 66% 70%, rgba(0,0,0,0.24) 0 9%, transparent 10%), radial-gradient(circle at 46% 44%, rgba(0,0,0,0.2) 0 4%, transparent 5%); }
.bl-orb[data-p="radixia"]::before { background: repeating-radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 0 9%, rgba(0,0,0,0.22) 9% 11%), radial-gradient(circle at 50% 50%, #ffd28a 0 10%, transparent 12%); }
.bl-orb[data-p="dividia"]::before { background: linear-gradient(98deg, transparent 0 46%, #ff8a3d 47%, #ffd166 50%, #ff8a3d 53%, #1a0a0a 54% 55%, transparent 56%); }
.bl-orb[data-p="fractalis"]::before { background: conic-gradient(from 20deg, rgba(255,255,255,0.28), rgba(0,0,0,0.18), rgba(255,255,255,0.12), rgba(0,0,0,0.24), rgba(255,255,255,0.3), rgba(0,0,0,0.12), rgba(255,255,255,0.28)); }
.bl-orb[data-p="infinitygate"] { background: radial-gradient(circle at 50% 50%, #ffd56a 0 9%, #ff5a2a 15%, #b3122a 38%, #3a0612 54%, #ffc930 56%, #ffe9a0 62%, #c98a00 70%, #3a2600 74%, rgba(0,0,0,0) 76%); box-shadow: 0 0 calc(24 * var(--u)) rgba(255,180,60,0.6); }
.bl-orb[data-p="infinitygate"]::after { background: none; }

/* ================================================================
 * Galaxy Run — Mission Control: the Toy Galaxy (map3d.js, WebGL) or the 2D orrery (map.js, the
 * fallback), one chrome for both: the approved prototype's kit (galaxy-map-proto kit.css) on the
 * app's recipes: navy glass cards and chunky round buttons with the app's stroke, drop shadow and
 * gloss, chips, Fredoka for display words, Roboto 900 for numbers, drawn icons only.
 * ================================================================ */
.galaxymap-screen { padding: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 28%, #0d1632 0%, #06070f 72%);
  --gx-glass-top: #2c4180; --gx-glass: #1b2858; --gx-glass-bot: #141e47; --gx-stroke: #050919; --gx-shadow: #02030b; --gx-hi: rgba(255,255,255,0.16);
  --gx-ink: #F1F6FF; --gx-ink2: #AFC1E6; --gx-mint: #46E0B0; --gx-gold: #FFC930;
  --gx-display: 'Fredoka', 'Roboto', system-ui, sans-serif; }
.gm-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; z-index: 0; outline: none; transition: opacity .2s; }
.gm-labels { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.gm-loading { position: absolute; left: 0; right: 0; top: 42%; z-index: 1; display: flex; justify-content: center; pointer-events: none; }
.gm-loading[hidden] { display: none; }
/* the header: Back, the pilot chip, "?" (main.js's briefing replay), mute; the countdown pill on
 * its second line */
.gm-header { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: calc(8 * var(--u)); padding: max(calc(10 * var(--u)), env(safe-area-inset-top)) calc(10 * var(--u)) 0; }
.gm-ibtn { flex: 0 0 auto; width: max(48px, calc(46 * var(--u))); height: max(48px, calc(46 * var(--u))); padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(to bottom, #2f4584, #1b2858); border: calc(3 * var(--u)) solid var(--gx-stroke); box-shadow: 0 calc(4 * var(--u)) 0 var(--gx-shadow), inset 0 calc(2 * var(--u)) 0 var(--gx-hi);
  color: #DCE8FF; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.gm-ibtn svg { width: 54%; height: 54%; display: block; }
.gm-ibtn:active { transform: translateY(calc(3 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 var(--gx-shadow); }
.gm-header .brief-q.brief-q-dark { position: static; flex: 0 0 auto; align-self: center; margin: 0; width: max(48px, calc(46 * var(--u))); height: max(48px, calc(46 * var(--u))); }
.gm-header .brief-q-dark .brief-q-dot { width: 100%; height: 100%; background: linear-gradient(to bottom, #2f4584, #1b2858); border: calc(3 * var(--u)) solid var(--gx-stroke);
  box-shadow: 0 calc(4 * var(--u)) 0 var(--gx-shadow), inset 0 calc(2 * var(--u)) 0 var(--gx-hi); color: #DCE8FF; font-family: var(--gx-display); font-weight: 700; font-size: calc(22 * var(--u)); }
.gm-pilot-chip { flex: 1; min-width: 0; min-height: 48px; padding: calc(6 * var(--u)) calc(12 * var(--u)) calc(7 * var(--u)); border-radius: calc(18 * var(--u)); cursor: pointer;
  background: linear-gradient(to bottom, var(--gx-glass-top) 0%, var(--gx-glass) 38%, var(--gx-glass-bot) 100%); border: calc(3 * var(--u)) solid var(--gx-stroke);
  box-shadow: 0 calc(5 * var(--u)) 0 0 var(--gx-shadow), inset 0 calc(2 * var(--u)) 0 var(--gx-hi); }
.gm-pilot-chip:active { transform: translateY(calc(2 * var(--u))); box-shadow: 0 calc(2 * var(--u)) 0 0 var(--gx-shadow); }
.gm-pilot-row { display: flex; align-items: center; gap: calc(7 * var(--u)); }
.gm-pilot-badge { flex: 0 0 auto; display: inline-flex; width: calc(18 * var(--u)); height: calc(18 * var(--u)); }
.gm-pilot-badge svg { width: 100%; height: 100%; display: block; }
.gm-pilot-name { flex: 1; min-width: 0; font-family: var(--gx-display); font-weight: 700; font-size: calc(15 * var(--u)); color: var(--gx-ink); letter-spacing: 0.06em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-pilot-best { font-weight: 900; font-size: calc(15 * var(--u)); color: var(--gx-gold); font-variant-numeric: tabular-nums; }
.gm-global-rank { font-family: var(--gx-display); font-weight: 600; font-size: calc(var(--gm-rf, 11) * var(--u)); color: var(--gx-ink2); letter-spacing: 0.05em; margin-top: calc(2 * var(--u)); }
.gm-daily { order: 10; flex: 1 1 100%; display: flex; justify-content: center; margin-top: calc(2 * var(--u)); pointer-events: none; min-width: 0; }
.gm-daily[hidden] { display: none; }
.gm-pill { display: inline-flex; align-items: center; gap: calc(5 * var(--u)); max-width: 100%; padding: calc(3 * var(--u)) calc(11 * var(--u)); border-radius: 999px;
  background: rgba(6,10,30,0.72); border: calc(2 * var(--u)) solid #3a4f8e; color: var(--gx-ink2); font-family: var(--gx-display); font-weight: 700; font-size: calc(var(--gm-cf, 11.5) * var(--u));
  letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.gm-pill svg { width: 1.2em; height: 1.2em; flex: 0 0 auto; }
/* (the text sits in a flex item: the last resort's dots after the time, never a hard cut) */
.gm-pill > #gm_cd { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* the pill fits its row (map.js fitPill; owner, 20 Nov 2026: "Fix the pill, two line is fine"; it ended in dots in Russian
 * and German): a measured smaller size on one line (--gm-cf, in u), then two lines (gm-cd2) broken at its " · " (the time,
 * then London's midnight). gm-cdfit holds the row at its one-line height with the pill at its foot, so two lines grow the
 * pill upward into the gap under the chip's row and the header, the map's band and every control stay where they were.
 * gm-cdclamp: each line ending in dots, a last resort no language reaches (galaxy_pill_fit.test.mjs) */
.gm-daily.gm-cdfit { align-items: flex-end; }
.gm-cdfit .gm-pill { box-sizing: border-box; min-height: 100%; }
.gm-cd2 .gm-pill { padding-block: calc(1 * var(--u)); line-height: 1.08; }
.gm-cd2 .gm-pill:is(:lang(hi), :lang(bn), :lang(ar), :lang(ur)) { line-height: 1.25; }
.gm-cd2 .gm-pill > #gm_cd { display: block; overflow: visible; text-overflow: clip; white-space: normal; text-wrap: balance; }
.gm-cd2 .gm-cd-sep { display: none; }
.gm-cd2 :is(.gm-cd-a, .gm-cd-b) { display: block; white-space: nowrap; }
.gm-cd2.gm-cdclamp :is(.gm-cd-a, .gm-cd-b) { overflow: hidden; text-overflow: ellipsis; }
/* the briefing card: the selected planet's glass card, edged in its colour (--acc) */
.gm-briefing { position: absolute; z-index: 2; left: calc(10 * var(--u)); right: calc(10 * var(--u)); bottom: max(calc(12 * var(--u)), env(safe-area-inset-bottom));
  padding: calc(11 * var(--u)) calc(13 * var(--u)) calc(12 * var(--u)); color: var(--gx-ink);
  background: linear-gradient(to bottom, var(--gx-glass-top) 0%, var(--gx-glass) 38%, var(--gx-glass-bot) 100%);
  border: calc(3 * var(--u)) solid var(--gx-stroke); border-top: calc(5 * var(--u)) solid var(--acc, var(--gx-mint)); border-radius: calc(22 * var(--u));
  box-shadow: 0 calc(6 * var(--u)) 0 0 var(--gx-shadow), inset 0 calc(2 * var(--u)) 0 var(--gx-hi), 0 calc(14 * var(--u)) calc(30 * var(--u)) rgba(0,0,0,0.45); }
.gm-card-glow { position: absolute; inset: calc(-3 * var(--u)); border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 calc(2 * var(--u)) rgba(255,255,255,0.12); box-shadow: 0 0 0 calc(2 * var(--u)) color-mix(in srgb, var(--acc, #46e0b0) 65%, transparent), 0 0 calc(20 * var(--u)) color-mix(in srgb, var(--acc, #46e0b0) 30%, transparent); }
.gm-brief-head { display: flex; align-items: center; gap: calc(8 * var(--u)); }
.gm-stop { flex: 0 0 auto; width: calc(28 * var(--u)); height: calc(28 * var(--u)); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: calc(14 * var(--u)); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,0.6); border: calc(2.5 * var(--u)) solid var(--gx-stroke);
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.55), rgba(255,255,255,0) 55%), radial-gradient(circle at 50% 50%, var(--acc, #46E0B0) 55%, #0b1230 130%); }
.gm-stop[hidden] { display: none; }
.gm-world-name { flex: 1; min-width: 0; font-family: var(--gx-display); font-weight: 700; font-size: calc(25 * var(--u)); letter-spacing: 0.06em; line-height: 1.05;
  -webkit-text-stroke: calc(4 * var(--u)) var(--gx-stroke); paint-order: stroke fill; text-shadow: 0 calc(3 * var(--u)) 0 var(--gx-stroke); overflow-wrap: anywhere; }
.gm-world-medal { flex: 0 0 auto; display: inline-flex; align-items: center; gap: calc(5 * var(--u)); font-family: var(--gx-display); font-weight: 700; font-size: calc(12 * var(--u)); letter-spacing: 0.06em; }
.gm-world-medal svg { width: calc(22 * var(--u)); height: calc(22 * var(--u)); flex: 0 0 auto; display: block; }
.gm-world-medal:empty { display: none; }
.gm-chips { display: flex; flex-wrap: wrap; align-items: center; gap: calc(6 * var(--u)); margin-top: calc(8 * var(--u)); }
.gm-chip { display: inline-flex; align-items: center; gap: calc(5 * var(--u)); padding: calc(3 * var(--u)) calc(9 * var(--u)); border-radius: 999px; line-height: 1.25;
  font-family: var(--gx-display); font-weight: 700; font-size: calc(11.5 * var(--u)); letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap;
  background: rgba(8,12,34,0.75); border: calc(2 * var(--u)) solid var(--chip, #3a4f8e); color: var(--chipc, var(--gx-ink)); }
.gm-chip svg { width: 1.15em; height: 1.15em; flex: 0 0 auto; display: block; }
.gm-chip.skill { --chip: var(--acc, #46E0B0); --chipc: var(--accl, #BFFFE9); }
.gm-chip.gold { --chip: #FFC930; --chipc: #FFE38A; }
.gm-chip.mint { --chip: #46E0B0; --chipc: #BFFFE9; }
.gm-chip[hidden] { display: none; }
/* the meta line's chips join the chip row (their "  ·  " joins are for screen readers only) */
.gm-world-meta { display: contents; }
.gm-world-meta .gm-sep { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.gm-world-meta.hard .gm-chip.skill { --chipc: #FFAB91; }
.gm-world-meta.pro, .gm-world-meta.locked { display: inline-flex; align-items: center; font-family: var(--gx-display); font-weight: 700; font-size: calc(12 * var(--u)); letter-spacing: 0.05em;
  padding: calc(3 * var(--u)) calc(10 * var(--u)); border-radius: 999px; background: rgba(48,34,4,0.72); border: calc(2 * var(--u)) solid #b8860b; color: #FFD740; }
.gm-world-meta.locked { background: rgba(8,12,34,0.75); border-color: #546E7A; color: #90A4AE; }
.gm-world-threat .gm-bars { display: inline-flex; align-items: flex-end; gap: calc(2.5 * var(--u)); }
.gm-world-threat .gm-bars i { width: calc(5 * var(--u)); border-radius: 2px; background: #2c3866; }
.gm-world-threat .gm-bars i.on { background: var(--tcol, #69F0AE); }
.gm-world-info { font-size: calc(13.5 * var(--u)); line-height: 1.38; color: #C9D7F2; margin-top: calc(7 * var(--u)); min-height: calc(37 * var(--u)); }
.gm-world-route { font-size: calc(12 * var(--u)); line-height: 1.3; color: #9fd8ff; margin-top: calc(4 * var(--u)); font-weight: 800; }
.gm-world-route[hidden], .gm-pro-btn[hidden], .gm-today[hidden] { display: none; }
/* today's route: ten beads lit to today's reach (mirrored right to left) */
.gm-route-row { display: flex; align-items: center; gap: calc(10 * var(--u)); margin-top: calc(9 * var(--u)); }
.gm-route-row[hidden] { display: none; }
.gm-route { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; height: calc(26 * var(--u)); padding: 0 calc(3 * var(--u)); }
.gm-route::before { content: ''; position: absolute; left: calc(9 * var(--u)); right: calc(9 * var(--u)); top: 50%; height: calc(4 * var(--u)); transform: translateY(-50%); border-radius: 4px;
  background: linear-gradient(90deg, #46E0B0 0, #46E0B0 var(--reach, 0%), #2a3766 var(--reach, 0%)); }
[dir="rtl"] .gm-route::before { background: linear-gradient(270deg, #46E0B0 0, #46E0B0 var(--reach, 0%), #2a3766 var(--reach, 0%)); }
.gm-route b { position: relative; width: calc(15 * var(--u)); height: calc(15 * var(--u)); border-radius: 50%; border: calc(2 * var(--u)) solid var(--gx-stroke);
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.6), rgba(255,255,255,0) 55%), var(--c); }
.gm-route b.dim { filter: saturate(0.25) brightness(0.55); }
.gm-route b.gate { width: calc(19 * var(--u)); height: calc(19 * var(--u)); background: radial-gradient(circle, #ffd56a 0 30%, #b3122a 31% 60%, #ffc930 61%); }
.gm-route b.sel { outline: calc(2 * var(--u)) solid #fff; outline-offset: calc(2 * var(--u)); }
.gm-route b.lock::after { content: ''; position: absolute; right: calc(-4 * var(--u)); bottom: calc(-4 * var(--u)); width: calc(8 * var(--u)); height: calc(8 * var(--u)); border-radius: 2px; background: #FFC930; border: 1.5px solid #5E3B02; }
.gm-route-flag { position: absolute; left: 30%; bottom: 85%; width: calc(13 * var(--u)); height: calc(13 * var(--u)); color: #46E0B0; }
.gm-route-flag svg { width: 100%; height: 100%; display: block; }
.gm-route-n { flex: 0 0 auto; font-weight: 900; font-size: calc(11.5 * var(--u)); color: #46E0B0; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gm-launch { width: 100%; margin-top: calc(10 * var(--u)); min-height: calc(62 * var(--u)); gap: calc(10 * var(--u)); padding: calc(6 * var(--u)) calc(16 * var(--u)) calc(10 * var(--u));
  background: linear-gradient(to bottom, #8CF5B5 0%, #35D676 45%, #1EAA55 100%); border-color: #0B4F26; box-shadow: 0 calc(6 * var(--u)) 0 0 #093D1E; color: #06331A;
  font-family: var(--gx-display); font-weight: 700; font-size: calc(21 * var(--u)); letter-spacing: 0.06em; line-height: 1.1; }
.gm-launch-ico { width: calc(26 * var(--u)); height: calc(26 * var(--u)); flex: 0 0 auto; }
.gm-launch:active { transform: translateY(calc(5 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 0 #093D1E; }
.gm-launch:disabled, .gm-launch[aria-disabled="true"] { filter: grayscale(0.5); }
.gm-launch[aria-disabled="true"]:active { transform: none; box-shadow: 0 calc(6 * var(--u)) 0 0 #093D1E; }   /* a locked world's LAUNCH: no press, as when it was disabled */
/* the actions: START FROM ADDITRON, and CONTINUE FROM <planet> (secondary: glass, smaller) under it with its
 * plain line; a short phone sets the two side by side (below) */
.gm-go { display: flex; flex-direction: column; margin-top: calc(10 * var(--u)); }
.gm-go .gm-launch { margin-top: 0; }
.gm-cont-btn { width: 100%; min-height: 48px; margin-top: calc(9 * var(--u)); padding: calc(4 * var(--u)) calc(14 * var(--u)) calc(7 * var(--u)); gap: calc(8 * var(--u));
  background: linear-gradient(to bottom, #3a4f8e 0%, #24356c 55%, #1a2858 100%); border-color: var(--gx-stroke); box-shadow: 0 calc(4 * var(--u)) 0 0 var(--gx-shadow);
  color: var(--gx-ink); font-family: var(--gx-display); font-weight: 700; font-size: calc(15 * var(--u)); letter-spacing: 0.05em; line-height: 1.15; }
.gm-cont-btn[hidden], .gm-cont-note[hidden] { display: none; }
.gm-cont-btn::before { opacity: 0.35; }
.gm-cont-btn:active { transform: translateY(calc(3 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 0 var(--gx-shadow); }
.gm-cont-btn:disabled { filter: grayscale(0.5); }
.gm-cont-note { margin-top: calc(5 * var(--u)); text-align: center; font-size: calc(11.5 * var(--u)); line-height: 1.3; color: #AFC1E6; text-wrap: balance; }
.gm-pro-btn { width: 100%; min-height: 48px; margin-top: calc(9 * var(--u)); padding: calc(4 * var(--u)) calc(16 * var(--u)) calc(7 * var(--u));
  font-family: var(--gx-display); font-weight: 700; font-size: calc(15 * var(--u)); letter-spacing: 0.06em;
  background: linear-gradient(to bottom, #FFEDA8 0%, #FFCA3A 50%, #EAA21C 100%); border-color: #7A4E04; box-shadow: 0 calc(4 * var(--u)) 0 0 #5E3B02; color: #3A2606; }
.gm-pro-btn:active { transform: translateY(calc(3 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 0 #5E3B02; }
.gm-today { text-align: center; margin-top: calc(9 * var(--u)); line-height: 1.3; }
.gm-today-line { font-size: calc(12.5 * var(--u)); font-weight: 900; color: #ffe7a3; letter-spacing: 0.02em; text-wrap: balance; }
.gm-today-sub { font-size: calc(11 * var(--u)); color: #9fb6d8; margin-top: calc(2 * var(--u)); text-wrap: balance; }
.gm-today-sub:empty { display: none; }
.gm-pro-star { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -0.2em; margin-inline-end: 0.35em; }
.gm-pro-star svg { display: block; }
/* Turkish: Fredoka has no Ğ İ Ş, so the chips and the pill use Roboto (as the coach's lines) */
.galaxymap-screen :is(.gm-chip, .gm-pill, .gm-world-meta.pro, .gm-world-meta.locked, .gm-global-rank):lang(tr) { font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; }
/* the planet name tags on the 3D map (screen space, laid out by map3d.js every frame) */
.gm-lbl { position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; will-change: transform; padding: 2px 8px 2px 3px; border-radius: 999px;
  background: rgba(6,10,30,0.8); border: 2px solid var(--b, #3a4f8e); font-family: var(--gx-display); font-weight: 700; font-size: 11px; letter-spacing: 0.07em; color: var(--c, #fff);
  line-height: 1.25; transition: opacity 150ms; opacity: 0; box-shadow: 0 2px 0 rgba(0,0,0,0.6); }
.gm-lbl-n { flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; font-size: 9.5px; letter-spacing: 0;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.5), rgba(255,255,255,0) 55%), var(--b, #3a4f8e); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,0.5); border: 1.5px solid rgba(0,0,0,0.5); }
.gm-lbl-x { display: inline-flex; gap: 4px; }
.gm-lbl-x:empty { display: none; }
.gm-lbl .gm-chip { font-size: 9px; padding: 1px 5px 1px 4px; gap: 3px; border-width: 1.5px; }
.gm-lbl .gm-chip.pro { --plat: 1; --chip: #C9D0D8; --chipc: #EEF2F6; }   /* (Pro platinum: the metal's rim and light on the dark map) */
.gm-lbl .gm-chip.today { --chip: #46E0B0; --chipc: #BFFFE9; }
.gm-lbl.compact { padding: 2px; }
.gm-lbl.compact .gm-lbl-t, .gm-lbl.compact .gm-lbl-x { display: none; }
.gm-lbl.dim { color: #8d9ab6; border-color: #2a3558; }
.gm-lbl.dim .gm-lbl-n { filter: saturate(0.4) brightness(0.8); }
.gm-lbl.sel { background: rgba(10,16,44,0.94); border-color: var(--c, #fff); box-shadow: 0 2px 0 rgba(0,0,0,0.6), 0 0 10px var(--b, #3a4f8e); }
.gm-lbl-start { padding: 2px 9px; border-color: #46E0B0; color: #BFFFE9; font-size: 10px; letter-spacing: 0.14em; }
.gm-lbl-start[hidden] { display: none; }
.gm-wash { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.gm-hint { position: absolute; left: 0; top: 0; pointer-events: none; }
.gm-hint[hidden] { display: none; }
.gm-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; list-style: none; }
.gm-sr[hidden] { display: none; }
.gm-keys[hidden] { display: none; }
/* a short phone (360 x 640 class): a tighter card, so the map keeps its band (no two planets may meet:
 * galaxy_map3d.test.mjs): today's lines and the route strip give way under the card's stack (the map's lit
 * road and flag say the same), the description takes two lines */
@media (max-height: 700px) {
  .galaxymap-screen:not(.gm-wide) .gm-today, .galaxymap-screen:not(.gm-wide) .gm-route-row { display: none; }
  .gm-briefing { padding-top: calc(9 * var(--u)); padding-bottom: calc(10 * var(--u)); }
  .gm-world-name { font-size: calc(22 * var(--u)); }
  .gm-world-info { font-size: calc(12.5 * var(--u)); line-height: 1.32; min-height: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: calc(5 * var(--u)); }
  .gm-chips { margin-top: calc(6 * var(--u)); }
  .gm-route-row { margin-top: calc(6 * var(--u)); }
  .gm-launch { min-height: calc(54 * var(--u)); font-size: calc(19 * var(--u)); }
  .gm-cont-note { margin-top: calc(4 * var(--u)); font-size: calc(11 * var(--u)); }
  .gm-go { margin-top: calc(8 * var(--u)); }
  .galaxymap-screen:not(.gm-wide) .gm-go.two { flex-direction: row; align-items: stretch; gap: calc(8 * var(--u)); }
  .galaxymap-screen:not(.gm-wide) .gm-go.two > .mw-btn { flex: 1 1 0; min-width: 0; margin-top: 0; min-height: max(48px, calc(52 * var(--u)));
    font-size: calc(13.5 * var(--u)); padding-left: calc(8 * var(--u)); padding-right: calc(8 * var(--u)); gap: calc(5 * var(--u)); overflow-wrap: anywhere; }
  .galaxymap-screen:not(.gm-wide) .gm-go.two .gm-launch-ico { width: calc(18 * var(--u)); height: calc(18 * var(--u)); }
  .gm-pro-btn { margin-top: calc(7 * var(--u)); }
  .gm-today { margin-top: calc(6 * var(--u)); }
}
@media (prefers-reduced-motion: reduce) { .gm-canvas, .gm-lbl { transition: none; } }
.gm-addup { align-items: center; text-align: center; gap: calc(10 * var(--u)); padding-top: calc(24 * var(--u)); overflow-y: auto; }
.gm-addup-art { width: 100%; max-width: calc(260 * var(--u)); aspect-ratio: 240 / 136; flex: 0 0 auto; }
.gm-addup-art svg { display: block; }
.gm-addup .gm-lb-title { text-wrap: balance; }
.gm-addup-body { margin: 0; font-size: calc(14 * var(--u)); line-height: 1.45; color: #c3d4ea; }
.gm-addup .gm-addup-ok { margin-top: calc(6 * var(--u)); flex: 0 0 auto; }
.gm-lb-panel .modal-x { color: #cfe3ff; background: rgba(255,255,255,0.1); }
/* Top Pilots dialog */
.gm-lb-overlay { position: absolute; inset: 0; z-index: 20; background: rgba(3,5,12,0.7); display: flex; align-items: center; justify-content: center; padding: calc(20 * var(--u)); }
.gm-lb-panel { width: 100%; max-width: calc(360 * var(--u)); max-height: 82%; display: flex; flex-direction: column; background: #0d1730; border: calc(2 * var(--u)) solid #2a3a5c; border-radius: calc(18 * var(--u)); padding: calc(18 * var(--u)); }
.gm-lb-title { font-weight: 900; font-size: calc(18 * var(--u)); color: #FFFFFF; text-align: center; letter-spacing: 0.08em; }
.gm-lb-rank { font-size: calc(12 * var(--u)); color: #9fb6d8; text-align: center; margin: calc(6 * var(--u)) 0 calc(10 * var(--u)); }
.gm-lb-rows { flex: 1; overflow-y: auto; min-height: 0; }
/* Pilot of the Week — gold crown banner above the daily board (both space modes). */
.gm-lb-weekly, .rd-board-weekly { display: flex; align-items: center; justify-content: center;
  gap: calc(8 * var(--u)); margin: calc(8 * var(--u)) 0 calc(2 * var(--u)); padding: calc(7 * var(--u)) calc(12 * var(--u));
  border-radius: calc(12 * var(--u)); background: rgba(14,11,4,0.82);
  border: calc(1.5 * var(--u)) solid rgba(245,194,51,0.65); }
.gm-lb-weekly[hidden], .rd-board-weekly[hidden] { display: none; }
.gm-lb-crown, .rd-week-crown { width: calc(20 * var(--u)); height: calc(20 * var(--u)); flex: 0 0 auto;
  filter: drop-shadow(0 calc(1 * var(--u)) calc(3 * var(--u)) rgba(0,0,0,0.5)); }
.gm-lb-week-txt, .rd-week-txt { font-size: calc(12.5 * var(--u)); font-weight: 800; color: #ffe7a3;
  letter-spacing: 0.03em; }
.gm-lb-week-txt b, .rd-week-txt b { color: #fff; }
.gm-lb-weekly .lb-flag { width: calc(20 * var(--u)); height: calc(14 * var(--u)); flex: 0 0 auto; }
.gm-lb-row { display: flex; align-items: center; gap: calc(10 * var(--u)); padding: calc(8 * var(--u)) calc(10 * var(--u)); border-radius: calc(8 * var(--u)); }
.gm-lb-row.alt { background: rgba(255,255,255,0.06); }
.gm-lb-row.me { background: rgba(255,215,64,0.16); }
.gm-lb-r { width: calc(28 * var(--u)); font-weight: 900; font-variant-numeric: tabular-nums; }
.gm-lb-n { flex: 1; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-lb-s { font-weight: 900; font-variant-numeric: tabular-nums; color: #eaf6ff; }
.gm-lb-empty { text-align: center; color: #78909C; padding: calc(28 * var(--u)) 0; }
/* country flag chip on leaderboard rows (baked PNGs, like Android) */
.lb-flag { width: calc(22 * var(--u)); height: calc(15 * var(--u)); border-radius: calc(3 * var(--u)); object-fit: cover; vertical-align: middle; flex: 0 0 auto; box-shadow: 0 0 0 1px rgba(0,0,0,0.18); }
.lb-name .lb-flag { margin-right: calc(7 * var(--u)); margin-top: calc(-2 * var(--u)); }
[dir="rtl"] .lb-name .lb-flag { margin-right: 0; margin-left: calc(7 * var(--u)); }
.gm-lb-close { margin-top: calc(12 * var(--u)); }
/* Top Pilots in the Toy Galaxy look (phase 3, galaxy-map-proto screens/pilots): a glass card edged in
 * gold, the outlined gold title, TODAY / THIS WEEK as one chunky switch, the patrol, the pilot of the
 * week, rows with gold / silver / bronze coins for 1 to 3, the flag, the name, how far they flew
 * (the board's best_level out of today's path) and the score; your row in mint */
.gx-lb { --gx-stroke: #050919; --gx-shadow: #02030b; --gx-hi: rgba(255,255,255,0.16); --gx-ink: #F1F6FF; --gx-ink2: #AFC1E6; --gx-mint: #46E0B0; --gx-gold: #FFC930;
  --gx-display: 'Fredoka', 'Roboto', system-ui, sans-serif; background: radial-gradient(ellipse at 50% 30%, rgba(14,22,66,0.78), rgba(3,5,14,0.86) 70%); padding: calc(14 * var(--u)); }
.gx-lb .gm-lb-panel { max-width: calc(392 * var(--u)); max-height: 92%; padding: calc(16 * var(--u)) calc(14 * var(--u)) calc(14 * var(--u)); color: var(--gx-ink); border-radius: calc(24 * var(--u));
  background: linear-gradient(to bottom, #2c4180 0%, #1b2858 38%, #141e47 100%); border: calc(3 * var(--u)) solid var(--gx-stroke); border-top: calc(5 * var(--u)) solid var(--gx-gold);
  box-shadow: 0 calc(6 * var(--u)) 0 0 var(--gx-shadow), inset 0 calc(2 * var(--u)) 0 var(--gx-hi), 0 calc(14 * var(--u)) calc(34 * var(--u)) rgba(0,0,0,0.5); }
.gx-lb .gm-lb-title { font-family: var(--gx-display); font-weight: 700; font-size: calc(25 * var(--u)); letter-spacing: 0.06em; line-height: 1.1; color: #FFFFFF;
  -webkit-text-stroke: calc(4 * var(--u)) var(--gx-stroke); paint-order: stroke fill; text-shadow: 0 calc(3 * var(--u)) 0 var(--gx-stroke); min-height: 44px; display: flex; align-items: center; justify-content: center; }
.gx-lb .modal-x { width: max(44px, calc(42 * var(--u))); height: max(44px, calc(42 * var(--u))); top: calc(10 * var(--u)); inset-inline-end: calc(10 * var(--u)); padding: calc(11 * var(--u)); border-radius: 50%; color: #DCE8FF;
  background: linear-gradient(to bottom, #2f4584, #1b2858); border: calc(3 * var(--u)) solid var(--gx-stroke); box-shadow: 0 calc(3 * var(--u)) 0 var(--gx-shadow), inset 0 calc(2 * var(--u)) 0 var(--gx-hi); }
/* the dialog sits on <body>, outside .galaxymap-screen's white ring (themes.css): a light theme's dark ring
   all but vanished on the navy panel (about 1.6:1); white sits on dark surfaces everywhere in this look */
.gx-lb :focus-visible { outline-color: #FFFFFF; }
.gx-lb .gm-lb-tabs { gap: calc(4 * var(--u)); padding: calc(4 * var(--u)); margin: calc(10 * var(--u)) 0 calc(2 * var(--u)); border-radius: 999px; background: rgba(4,7,20,0.72); border: calc(2 * var(--u)) solid var(--gx-stroke); }
.gx-lb .gm-lb-tab { border-radius: 999px; border: calc(2.5 * var(--u)) solid transparent; background: transparent; color: var(--gx-ink2); box-shadow: none;
  font-family: var(--gx-display); font-weight: 700; font-size: calc(14 * var(--u)); letter-spacing: 0.08em; }
.gx-lb .gm-lb-tab[aria-selected="true"] { background: linear-gradient(to bottom, #FFEDA8 0%, #FFC930 55%, #EAA21C 100%); color: #3A2606; border-color: var(--gx-stroke); box-shadow: 0 calc(3 * var(--u)) 0 #5E3B02; }
@media (hover: hover) { .gx-lb .gm-lb-tab[aria-selected="false"]:hover { background: rgba(255,255,255,0.08); color: var(--gx-ink); } }
.gx-lb .gm-lb-patrol-n { font-family: var(--gx-display); font-weight: 700; color: #FFE38A; letter-spacing: 0.08em; }
.gx-lb .gm-lb-patrol-help, .gx-lb .gm-lb-weekhelp { color: var(--gx-ink2); }
.gx-lb .gm-lb-weekly { border-radius: 999px; border: calc(2 * var(--u)) solid var(--gx-gold); background: rgba(48,34,4,0.62); }
.gx-lb .gm-lb-week-txt { font-family: var(--gx-display); font-weight: 700; color: #FFE7A3; letter-spacing: 0.04em; }
.gx-lb .gm-lb-rank { font-family: var(--gx-display); font-weight: 600; font-size: calc(12.5 * var(--u)); letter-spacing: 0.06em; color: var(--gx-ink2); margin: calc(8 * var(--u)) 0; }
.gx-lb .gm-lb-rows { display: flex; flex-direction: column; gap: calc(5 * var(--u)); }
.gx-lb .gm-lb-row, .gx-lb .gm-lb-row.alt { gap: calc(9 * var(--u)); padding: calc(6 * var(--u)) calc(10 * var(--u)); border-radius: calc(14 * var(--u)); background: rgba(255,255,255,0.05); border: calc(2 * var(--u)) solid transparent; }
.gx-lb .gm-lb-row.me { background: rgba(70,224,176,0.16); border-color: var(--gx-mint); }
.gx-lb .gm-lb-r { flex: 0 0 auto; width: calc(30 * var(--u)); display: inline-flex; align-items: center; justify-content: center; font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; font-size: calc(16 * var(--u)); }
.gx-lb .gm-lb-r.coin { width: calc(28 * var(--u)); height: calc(28 * var(--u)); margin: 0 calc(1 * var(--u)); border-radius: 50%; font-size: calc(13 * var(--u)); border: calc(2 * var(--u)) solid var(--gx-stroke); box-shadow: 0 calc(2 * var(--u)) 0 var(--gx-shadow); }
.gx-lb .gm-lb-r.c1 { background: radial-gradient(circle at 35% 30%, #FFF3C4 0 16%, #FFC930 46%, #C98A12 100%); }
.gx-lb .gm-lb-r.c2 { background: radial-gradient(circle at 35% 30%, #FFFFFF 0 16%, #C9D3DC 46%, #7E8B98 100%); }
.gx-lb .gm-lb-r.c3 { background: radial-gradient(circle at 35% 30%, #FBE0C4 0 16%, #D08A4E 46%, #8A4E22 100%); }
.gx-lb .gm-lb-n { min-width: 0; font-family: var(--gx-display); font-weight: 700; font-size: calc(16 * var(--u)); color: var(--gx-ink); }
.gx-lb .gm-lb-p { flex: 0 0 auto; display: inline-flex; align-items: center; gap: calc(4 * var(--u)); font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; font-size: calc(11.5 * var(--u));
  color: var(--gx-ink2); font-variant-numeric: tabular-nums; }
.gx-lb .gm-lb-pg { display: inline-block; width: calc(17 * var(--u)); height: calc(17 * var(--u)); color: var(--gx-mint); }
.gx-lb .gm-lb-pg svg { display: block; }
.gx-lb .gm-lb-p.full { color: #FFE38A; }
.gx-lb .gm-lb-p.full .gm-lb-pg { color: var(--gx-gold); }
.gx-lb .gm-lb-p.none .gm-lb-pg { color: #55658c; }
.gx-lb .gm-lb-s { flex: 0 0 auto; min-width: calc(62 * var(--u)); text-align: end; font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; font-size: calc(17 * var(--u)); color: #ffffff; }
.gx-lb .gm-lb-empty { color: var(--gx-ink2); }
.gx-lb .gm-lb-close { flex: 0 0 auto; width: 100%; min-height: max(48px, calc(54 * var(--u))); margin-top: calc(12 * var(--u)); padding: calc(4 * var(--u)) calc(14 * var(--u)) calc(8 * var(--u));
  color: var(--gx-ink); border: calc(3 * var(--u)) solid var(--gx-stroke); box-shadow: 0 calc(5 * var(--u)) 0 0 var(--gx-shadow); background: linear-gradient(to bottom, #3a4f8e 0%, #24356c 55%, #1a2858 100%);
  font-family: var(--gx-display); font-weight: 700; font-size: calc(18 * var(--u)); letter-spacing: 0.08em; }
.gx-lb .gm-lb-close:active { transform: translateY(calc(4 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 0 var(--gx-shadow); }
.gx-lb :is(.gm-lb-title, .gm-lb-tab, .gm-lb-patrol-n, .gm-lb-week-txt, .gm-lb-rank, .gm-lb-n, .gm-lb-close):lang(tr) { font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; }

/* Galaxy Phase 2/3 (docs/GALAXY_EXPANSION.md section 4): the patrol pips, the Top Pilots
 * TODAY / THIS WEEK tabs, the flown-planets strip and the bounty ship's live region */
.bl-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.gm-pilot-chip { min-width: 0; }   /* the rank line never pushes the header's buttons out (de, ru, hi) */
.gm-pilot-row2 { display: flex; align-items: center; gap: calc(8 * var(--u)); margin-top: calc(3 * var(--u)); min-width: 0; }
.gm-pilot-row2 .gm-global-rank { flex: 1; min-width: 0; margin-top: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the rank line fits its chip (map.js fitRank; iPhone pass, 20 Nov 2026: VIEW LEADERBOARD ended in dots from 320 to 414 pt
 * wide): a measured smaller size on one line (--gm-rf, in u), then two lines (gm-r2): the patrol strip floats at the
 * line's start and the second line runs under it at the chip's full width; the chip keeps its one-line height (map.js
 * pins it) with its own padding giving the second line its room, so the header and every map control stay where they
 * were. gm-rclamp: the two-line ellipsis, a last resort no language reaches (galaxy_rank_fit.test.mjs) */
.gm-pilot-chip.gm-r2 { display: flex; flex-direction: column; justify-content: center; padding-top: calc(3 * var(--u)); padding-bottom: calc(4 * var(--u)); }
.gm-r2 .gm-pilot-row2 { display: block; margin-top: calc(1 * var(--u)); }
.gm-r2 .gm-pilot-row2 .gm-patrol { float: left; margin-right: calc(8 * var(--u)); margin-top: calc((var(--gm-rf, 11) * 1.12 - 10) * var(--u) / 2); }
[dir="rtl"] .gm-r2 .gm-pilot-row2 .gm-patrol { float: right; margin-right: 0; margin-left: calc(8 * var(--u)); }
.gm-r2 .gm-pilot-row2 .gm-global-rank { display: block; overflow: visible; text-overflow: clip; white-space: normal; line-height: 1.12; overflow-wrap: normal; word-break: normal; hyphens: manual; }
.gm-r2.gm-rclamp .gm-pilot-row2 .gm-global-rank { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.gm-patrol { flex: 0 0 auto; display: inline-block; width: calc(62 * var(--u)); height: calc(10 * var(--u)); }
.gm-patrol svg { display: block; }
[dir="rtl"] .gm-patrol svg { transform: scaleX(-1); }   /* today stays at the reading end */
#gm_lb_title { padding: 0 calc(max(44px, 42 * var(--u)) + 6 * var(--u)); text-wrap: balance; }   /* clear of the corner X (THIS WEEK'S is longer;
   the X is at least 44 px: 30 u let Turkish's EN İYİ ZIPLAYANLAR run 8 px under it on a 360 px phone, mw-v237 audit) */
.gm-lb-tabs { display: flex; gap: calc(8 * var(--u)); margin: calc(10 * var(--u)) 0 calc(2 * var(--u)); }
.gm-lb-tabs[hidden], .gm-lb-patrol[hidden], .gm-lb-patrol-row[hidden], .gm-lb-patrol-help[hidden] { display: none; }
.gm-lb-patrol-help .bd-help-l { display: block; }   /* (one sentence a line: Math Hop's rule, ui/boarddialog.js drawLine) */
.gm-lb-tab { flex: 1; min-width: 0; min-height: 48px; padding: calc(4 * var(--u)) calc(8 * var(--u)); border-radius: calc(12 * var(--u));
  border: calc(2 * var(--u)) solid #2a3a5c; background: rgba(255,255,255,0.05); color: #9fb6d8; font: inherit; font-weight: 900;
  font-size: calc(13 * var(--u)); letter-spacing: 0.06em; line-height: 1.2; cursor: pointer; }
.gm-lb-tab[aria-selected="true"] { background: #ffd740; border-color: #ffd740; color: #1a1030; box-shadow: 0 calc(3 * var(--u)) 0 #9a6a00; }
@media (hover: hover) { .gm-lb-tab[aria-selected="false"]:hover { background: rgba(255,255,255,0.1); color: #eaf6ff; } }
.gm-lb-patrol { text-align: center; margin: calc(8 * var(--u)) 0 0; }
.gm-lb-patrol-row, .bl-end-patrol { display: flex; align-items: center; justify-content: center; gap: calc(8 * var(--u)); flex-wrap: wrap; }
.gm-lb-patrol .gm-patrol, .bl-end-patrol .gm-patrol { width: calc(84 * var(--u)); height: calc(13 * var(--u)); }
.gm-lb-patrol-n, .bl-end-patrol-n { font-weight: 900; font-size: calc(12.5 * var(--u)); color: #ffe7a3; letter-spacing: 0.06em; }
.gm-lb-patrol-help { font-size: calc(11 * var(--u)); color: #7fa0c8; line-height: 1.35; margin-top: calc(3 * var(--u)); text-wrap: pretty; }
/* THIS WEEK: what its number is (each day's best run, added up) */
.gm-lb-weekhelp { text-align: center; font-size: calc(11.5 * var(--u)); color: #b9cbe6; line-height: 1.35; margin: calc(6 * var(--u)) calc(6 * var(--u)) 0; text-wrap: pretty; }
.gm-lb-weekhelp[hidden] { display: none; }
.gm-lb-tp { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* Phase 3 engine (spec 3.8): the HUD target chip (F6; placed under the HUD row by blaster.js),
 * a planet's how-to card (F13) and its "?" in the briefing head */
.bl-target { position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 50 * var(--u)); transform: translateX(-50%); z-index: 3;
  display: inline-flex; align-items: center; gap: calc(6 * var(--u)); padding: calc(4 * var(--u)) calc(12 * var(--u)) calc(4 * var(--u)) calc(8 * var(--u));
  border-radius: 999px; background: rgba(10,22,44,0.82); border: calc(2.5 * var(--u)) solid var(--tc, #ff80ab); color: #ffd6e7; pointer-events: none;
  box-shadow: 0 0 calc(10 * var(--u)) rgba(255,128,171,0.35); perspective: 200px; }
.bl-target[hidden] { display: none; }
.bl-target-ico { display: inline-block; width: calc(20 * var(--u)); height: calc(20 * var(--u)); flex: 0 0 auto; }
.bl-target-ico svg { display: block; }
.bl-target-n { display: inline-block; font-weight: 900; font-size: calc(18 * var(--u)); line-height: 1; color: #ffffff; letter-spacing: 0.04em; white-space: nowrap; text-align: center; }
.bl-target-num { font-size: calc(22 * var(--u)); font-variant-numeric: tabular-nums; }
/* the leg-start reminder under READY on a planet with a how-to card (section 6) */
.bl-remind { position: absolute; left: 50%; top: calc(40% + 46 * var(--u)); transform: translateX(-50%); z-index: 5; pointer-events: none;
  width: max-content; max-width: min(84%, 84vw); padding: calc(8 * var(--u)) calc(14 * var(--u)); border-radius: calc(14 * var(--u));
  background: rgba(10,22,44,0.86); border: calc(2 * var(--u)) solid #5d7aa8; color: #eaf6ff; text-align: center;
  font-weight: 900; font-size: calc(16 * var(--u)); line-height: 1.3; text-wrap: balance; }
.bl-remind[hidden] { display: none; }
.gm-howto-btn { flex: 0 0 auto; align-self: center; width: 48px; height: 48px; margin: calc(-8 * var(--u)) calc(-6 * var(--u)); padding: 0; border: none; background: transparent;
  display: flex; align-items: center; justify-content: center; cursor: pointer; pointer-events: auto; -webkit-tap-highlight-color: transparent; }
.gm-howto-btn[hidden] { display: none; }
.gm-howto-dot { width: calc(30 * var(--u)); height: calc(30 * var(--u)); border-radius: 50%; border: calc(2.5 * var(--u)) solid #5d7aa8; background: #12203d; color: #eaf6ff;
  font-weight: 900; font-size: calc(16 * var(--u)); line-height: 1; display: flex; align-items: center; justify-content: center; }
@media (hover: hover) { .gm-howto-btn:hover .gm-howto-dot { background: #1c3160; border-color: #9fb6d8; } }
/* a planet's how-to card (the Toy Galaxy look, phase 2: galaxy-map-proto screens/howto): a glass card
 * ringed in the planet's colour; its orb, stop and question label, its name; the stage with the real
 * example (the question tag, an arrow, the tag filling in), the keys it is typed on and a small answer
 * pod; Doc's line in a bubble; GOT IT. The overlay sits on <body>: the kit's tokens are set here and
 * the planet's colours inline (howto.js). */
.gm-howto-ov { --gx-stroke: #050919; --gx-shadow: #02030b; --gx-hi: rgba(255,255,255,0.16); --gx-ink: #F1F6FF; --gx-ink2: #AFC1E6;
  --gx-display: 'Fredoka', 'Roboto', system-ui, sans-serif; background: rgba(3,5,14,0.74); }
.gm-howto { max-width: calc(380 * var(--u)); max-height: 94%; align-items: center; text-align: center; gap: calc(10 * var(--u)); padding: calc(16 * var(--u)); overflow-y: auto;
  background: linear-gradient(to bottom, #2c4180 0%, #1b2858 38%, #141e47 100%); border: calc(3 * var(--u)) solid var(--gx-stroke); border-radius: calc(22 * var(--u));
  box-shadow: 0 calc(6 * var(--u)) 0 0 var(--gx-shadow), inset 0 calc(2 * var(--u)) 0 var(--gx-hi), 0 0 0 calc(2 * var(--u)) var(--pc-glow), 0 calc(14 * var(--u)) calc(30 * var(--u)) rgba(0,0,0,0.45); }
.gm-howto-head { display: flex; align-items: center; gap: calc(12 * var(--u)); width: 100%; flex: 0 0 auto; padding-inline-end: 50px; }   /* clear of the corner X */
.gm-howto-orb { width: calc(70 * var(--u)); height: calc(70 * var(--u)); }
.gm-howto-ht { display: flex; flex-direction: column; align-items: flex-start; gap: calc(6 * var(--u)); min-width: 0; text-align: start; }
.gm-howto-chip { display: inline-flex; align-items: center; gap: calc(6 * var(--u)); max-width: 100%; padding: calc(3 * var(--u)) calc(10 * var(--u)) calc(3 * var(--u)) calc(4 * var(--u)); border-radius: 999px;
  background: rgba(8,12,34,0.75); border: calc(2 * var(--u)) solid var(--pc); color: var(--pl); }
.gm-howto-stop { flex: 0 0 auto; width: calc(20 * var(--u)); height: calc(20 * var(--u)); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; font-size: calc(11 * var(--u)); color: #ffffff; text-shadow: 0 1px 0 rgba(0,0,0,0.6); border: calc(2 * var(--u)) solid var(--gx-stroke);
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.55), rgba(255,255,255,0) 55%), var(--pc); }
.gm-howto-q { min-width: 0; font-family: var(--gx-display); font-weight: 700; font-size: calc(12 * var(--u)); letter-spacing: 0.07em; line-height: 1.2; color: var(--pl); overflow-wrap: anywhere; }
.gm-howto .gm-lb-title { font-family: var(--gx-display); font-weight: 700; font-size: calc(30 * var(--u)); letter-spacing: 0.07em; line-height: 1.04; color: var(--pl); text-align: start;
  -webkit-text-stroke: calc(4 * var(--u)) var(--gx-stroke); paint-order: stroke fill; text-shadow: 0 calc(3 * var(--u)) 0 var(--gx-stroke); overflow-wrap: anywhere; }
.gm-howto-stage { display: flex; flex-direction: column; align-items: center; gap: calc(10 * var(--u)); width: 100%; flex: 0 0 auto; padding: calc(14 * var(--u)) calc(10 * var(--u)) calc(12 * var(--u));
  border-radius: calc(18 * var(--u)); background: radial-gradient(ellipse at 50% 0%, var(--pc-stage) 0%, #120a24 80%); border: calc(2.5 * var(--u)) solid var(--gx-stroke); }
.gm-howto-target { display: inline-flex; align-items: center; gap: calc(7 * var(--u)); padding: calc(4 * var(--u)) calc(16 * var(--u)) calc(5 * var(--u)) calc(10 * var(--u)); border-radius: 999px;
  background: linear-gradient(#2c4180, #18234f); border: calc(3 * var(--u)) solid var(--gx-stroke); color: #ffffff; font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; font-size: calc(24 * var(--u)); line-height: 1;
  box-shadow: 0 calc(4 * var(--u)) 0 var(--gx-shadow), inset 0 0 0 calc(2 * var(--u)) var(--pc), 0 0 calc(16 * var(--u)) var(--pc-glow); }
.gm-howto-target-ico { display: inline-block; width: calc(20 * var(--u)); height: calc(20 * var(--u)); color: var(--pl); }
.gm-howto-target-ico svg { display: block; }
.gm-howto-ex { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: calc(8 * var(--u)); width: 100%; }
.gm-howto-pre, .gm-howto-tag { display: block; width: 100%; height: auto; }
.gm-howto-tag { transition: transform .18s ease-out, opacity .18s ease-out, filter .18s ease-out; }
.gm-howto-tag.pending { opacity: 0.45; }
.gm-howto-tag.lit { transform: scale(1.06); filter: drop-shadow(0 0 calc(10 * var(--u)) rgba(70,224,176,0.6)); }
.gm-howto-arrow { display: inline-block; width: calc(24 * var(--u)); height: calc(24 * var(--u)); color: var(--gx-ink2); }
.gm-howto-arrow svg { display: block; }
[dir="rtl"] .gm-howto-arrow svg { transform: scaleX(-1); }
.gm-howto-row { display: flex; align-items: center; justify-content: center; gap: calc(12 * var(--u)); direction: ltr; }
.gm-howto-keys { display: flex; gap: calc(6 * var(--u)); }
.gm-howto-key { position: relative; isolation: isolate; width: calc(44 * var(--u)); height: calc(42 * var(--u)); display: inline-flex; align-items: center; justify-content: center;
  border-radius: calc(12 * var(--u)); border: calc(3 * var(--u)) solid var(--gx-stroke); box-shadow: 0 calc(4 * var(--u)) 0 var(--gx-shadow);
  background: linear-gradient(to bottom, #34488a 0%, #22326a 50%, #1a2758 100%); color: #F1F6FF; font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; font-size: calc(20 * var(--u));
  transition: transform 90ms ease-out, box-shadow 90ms ease-out; }
.gm-howto-key::before { content: ''; position: absolute; z-index: -1; left: calc(6 * var(--u)); right: calc(6 * var(--u)); top: calc(4 * var(--u)); height: 38%; border-radius: calc(7 * var(--u));
  background: linear-gradient(rgba(255,255,255,0.32), rgba(255,255,255,0.04)); }
.gm-howto-key.on { transform: translateY(calc(3 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 var(--gx-shadow); background: linear-gradient(to bottom, var(--pc-key-top), var(--pc-key-bot)); }
.gm-howto-typed { min-width: calc(64 * var(--u)); height: calc(42 * var(--u)); padding: 0 calc(12 * var(--u)); display: inline-flex; align-items: center; justify-content: center;
  border-radius: calc(14 * var(--u)); background: linear-gradient(#24356c, #121b42); border: calc(3 * var(--u)) solid var(--gx-stroke); box-shadow: 0 calc(4 * var(--u)) 0 var(--gx-shadow);
  font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; font-size: calc(24 * var(--u)); color: #9bf6ff; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.gm-howto-dots { display: flex; gap: calc(6 * var(--u)); justify-content: center; }
.gm-howto-dots i { width: calc(8 * var(--u)); height: calc(8 * var(--u)); border-radius: 50%; background: #3a4a80; }
.gm-howto-dots i.on { background: var(--pl); }
.gm-howto-say { display: flex; align-items: flex-end; gap: calc(9 * var(--u)); width: 100%; flex: 0 0 auto; text-align: start; }
.gm-howto-coach { flex: 0 0 auto; width: calc(56 * var(--u)); height: calc(56 * var(--u)); --accent1: #46E0B0; --accent2: #E73C7E; --stroke: #050919; filter: drop-shadow(0 calc(3 * var(--u)) 0 var(--gx-shadow)); }
.gm-howto-coach svg { display: block; }
.gm-howto-say .gm-howto-body { position: relative; flex: 1 1 auto; min-width: 0; margin: 0; padding: calc(9 * var(--u)) calc(12 * var(--u)) calc(10 * var(--u)); border-radius: calc(16 * var(--u));
  background: #F4F7FF; color: #18204a; border: calc(3 * var(--u)) solid var(--gx-stroke); box-shadow: 0 calc(4 * var(--u)) 0 var(--gx-shadow);
  font-family: var(--gx-display); font-weight: 600; font-size: calc(14.5 * var(--u)); line-height: 1.35; text-wrap: pretty; }
.gm-howto-say .gm-howto-body::before { content: ''; position: absolute; inset-inline-start: calc(-12 * var(--u)); bottom: calc(14 * var(--u)); border: calc(8 * var(--u)) solid transparent; border-inline-end-color: var(--gx-stroke); }
.gm-howto-say.no-coach .gm-howto-coach, .gm-howto-say.no-coach .gm-howto-body::before { display: none; }
.gm-howto .gm-howto-ok { margin-top: calc(4 * var(--u)); flex: 0 0 auto; }
.gm-howto :is(.gm-howto-q, .gm-lb-title, .gm-howto-body, .gm-howto-ok):lang(tr) { font-family: 'Roboto', system-ui, sans-serif; font-weight: 900; }
.gm-howto .gm-howto-body:lang(tr) { font-weight: 500; }
@media (prefers-reduced-motion: reduce) { .gm-howto-tag, .gm-howto-key { transition: none; } .gm-howto-tag.lit { transform: none; } }

/* ================================================================
 * Brain Age Check
 * ================================================================ */
.ba-stage { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ba-card { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(14 * var(--u)); padding: calc(18 * var(--u)); margin-bottom: calc(12 * var(--u)); }
.ba-instr { font-weight: 900; font-size: calc(18 * var(--u)); text-align: center; color: var(--text-primary); }
/* connect-the-dots */
.ba-connect { padding: calc(10 * var(--u)); }
.ba-dots { width: 100%; max-width: calc(320 * var(--u)); aspect-ratio: 1; touch-action: none; }
.ba-orb { fill: var(--panel-face); stroke: var(--stroke); stroke-width: 3; }
.ba-orb.lit { fill: var(--accent1); }
.ba-orb-t { font-weight: 900; font-size: 30px; fill: var(--text-primary); pointer-events: none; }
.ba-dot { cursor: pointer; }
.ba-orb { transition: fill 0.12s; }
.ba-trail { fill: none; stroke: var(--accent1); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.8; }
/* divisibility grid */
.ba-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: calc(10 * var(--u)); width: 100%; }
.ba-num { height: calc(54 * var(--u)); font-size: calc(20 * var(--u)); display: flex; align-items: center; justify-content: center; }
.ba-num.selected { background: var(--accent1); color: var(--on-accent); }
.ba-num.selected::before { opacity: 0; }
.ba-num.reveal { background: #1A8F3C; color: #fff; }   /* answer shown after 3 wrongs so a struggling player can't get stuck */
.ba-num.reveal::before { opacity: 0; }
.ba-grid-done { align-self: stretch; margin-top: calc(6 * var(--u)); }
/* shape */
.ba-shape { width: calc(120 * var(--u)); height: calc(120 * var(--u)); }
/* two answers a row; a shape name too long for half the row (ПЯТИУГОЛЬНИК, any at large text) takes a whole row instead of
   pushing the grid off the screen's edge (layout audit, 23 Nov 2026; was a 1fr 1fr grid) */
.ba-choices { display: flex; flex-wrap: wrap; gap: calc(10 * var(--u)); width: 100%; }
.ba-choices > .ba-choice { flex: 1 1 calc(50% - 5 * var(--u)); }
.ba-choice { min-height: calc(60 * var(--u)); }
.ba-choice.correct { background: var(--accent1); color: var(--on-accent); }
/* reveal — tightened so it fits without scrolling on most phones: the score-card's
   22u inter-section gap is collapsed here and the per-section margins removed (they
   stacked on top of the gap), with a smaller hero + compact panels. */
.ba-reveal { display: flex; flex-direction: column; align-items: center; gap: calc(8 * var(--u)); padding-top: calc(14 * var(--u)); padding-bottom: calc(16 * var(--u)); justify-content: center; }
.ba-tier-img { width: calc(118 * var(--u)); height: calc(118 * var(--u)); object-fit: contain; }
.ba-tier-name { font-size: calc(30 * var(--u)); color: var(--accent1); }
/* CJK / Arabic / Indic drop the outline stroke (it floods dense glyphs, see the loc-font
 * rule at the top), which left the tier name as bare pale accent on its card ("喷气机",
 * "जेट", "طائرة نفّاثة"; worst on Math Bro, light blue on light blue). Draw the outline as
 * a ring of hard shadows in the stroke colour: shadows always sit UNDER the fill, so the
 * glyphs keep their shape (the hot-streak .fx-plain recipe). Latin + Cyrillic keep the stroke. */
html:is(.loc-font-cjk,.loc-font-ja,.loc-font-ko,.loc-font-arabic,.loc-font-devanagari,.loc-font-bengali) .ba-tier-name {
  --o: calc(1.7 * var(--u)); --d: calc(1.2 * var(--u));
  text-shadow: var(--o) 0 0 var(--stroke), calc(-1 * var(--o)) 0 0 var(--stroke), 0 var(--o) 0 var(--stroke), 0 calc(-1 * var(--o)) 0 var(--stroke),
    var(--d) var(--d) 0 var(--stroke), calc(-1 * var(--d)) var(--d) 0 var(--stroke), var(--d) calc(-1 * var(--d)) 0 var(--stroke), calc(-1 * var(--d)) calc(-1 * var(--d)) 0 var(--stroke),
    0 calc(2.6 * var(--u)) 0 var(--stroke); }
.ba-age-label { font-weight: 900; font-size: calc(12 * var(--u)); letter-spacing: 0.1em; color: var(--text-secondary); }
.ba-age { font-size: calc(58 * var(--u)); color: var(--text-primary); line-height: 1; }
.ba-advice { font-size: calc(13 * var(--u)); color: var(--text-secondary); text-align: center; }

/* ---- trending brain age (sparkline) ---- */
.ba-trend { width: 100%; padding: calc(8 * var(--u)) calc(12 * var(--u)) calc(7 * var(--u)); border-radius: calc(14 * var(--u)); background: var(--panel-face); border: calc(2 * var(--u)) solid var(--stroke); }
.ba-trend-head { font-weight: 900; font-size: calc(10.5 * var(--u)); letter-spacing: 0.12em; color: var(--text-secondary); text-align: center; }
.ba-spark { display: block; margin: calc(4 * var(--u)) 0 calc(3 * var(--u)); }
.ba-spark-line { stroke: var(--accent1); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ba-spark-dot { fill: var(--accent1); opacity: 0.45; }
.ba-spark-now { fill: var(--accent1); stroke: var(--stroke); stroke-width: 2; }
.ba-trend-line { font-weight: 800; font-size: calc(12.5 * var(--u)); text-align: center; color: var(--text-primary); }
.ba-trend-better { color: #2E9E5B; }
.ba-trend-worse { color: #C9603C; }

/* ---- focus insight / Max tip ---- */
.ba-insight { width: 100%; display: flex; gap: calc(10 * var(--u)); align-items: flex-start; padding: calc(9 * var(--u)) calc(11 * var(--u)); border-radius: calc(14 * var(--u)); background: var(--panel-face); border: calc(2 * var(--u)) solid var(--stroke); text-align: left; }
.ba-insight-ava, .ba-insight-icon { flex: 0 0 auto; width: calc(34 * var(--u)); height: calc(34 * var(--u)); }
.ba-insight-icon { display: flex; align-items: center; justify-content: center; }
.ba-insight-body { flex: 1 1 auto; min-width: 0; }
.ba-insight-name { font-weight: 900; font-size: calc(10.5 * var(--u)); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-secondary); }
.ba-insight-text { font-weight: 700; font-size: calc(13 * var(--u)); color: var(--text-primary); line-height: 1.28; min-height: calc(16 * var(--u)); }
.ba-practice, .ba-learn { min-height: calc(40 * var(--u)); margin-top: calc(8 * var(--u)); padding: calc(5 * var(--u)) calc(15 * var(--u)) calc(9 * var(--u)); font-size: calc(13.5 * var(--u)); border-radius: calc(22 * var(--u)); box-shadow: 0 calc(4 * var(--u)) 0 0 color-mix(in srgb, var(--accent1) 45%, black 55%); display: inline-flex; gap: calc(7 * var(--u)); }
.ba-practice:active, .ba-practice.pressed, .ba-learn:active, .ba-learn.pressed { box-shadow: 0 calc(1 * var(--u)) 0 0 color-mix(in srgb, var(--accent1) 45%, black 55%); }
.ba-practice-arrow { flex: 0 0 auto; }
[dir="rtl"] .ba-practice-arrow { transform: scaleX(-1); }   /* "Practice now" / "Learn a method" arrow points the reading way */

/* compact reveal footer: shorter DONE, tighter than the generic score-actions */
.ba-reveal-wrap .score-actions { margin-top: calc(10 * var(--u)); }
.ba-reveal-wrap .score-actions .mw-btn { min-height: calc(60 * var(--u)); }
/* icon-only share button → compact square so DONE stays the primary full-width action */
.ba-share-btn { flex: 0 0 auto !important; min-width: calc(64 * var(--u)); padding-left: 0; padding-right: 0; }

/* ---- animated tier reveal (Nintendo-Brain-Age style) ---- */
.ba-anim-stage { position: relative; width: 100%; height: calc(120 * var(--u)); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ba-anim-stage .ba-tier-img { position: relative; z-index: 1; }
.ba-smoke { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.ba-puff { position: absolute; border-radius: 50%; filter: blur(1.5px); pointer-events: none; will-change: transform, opacity; }
/* sections build up one at a time */
.ba-sec { opacity: 0; transform: translateY(calc(10 * var(--u))); pointer-events: none; transition: opacity .42s ease, transform .42s ease; }
.ba-sec.show { opacity: 1; transform: none; pointer-events: auto; }
/* per-tier entrance: direction matches the vehicle (rocket up, train/car/bike/turtle from left, jet/fish from right) */
@keyframes baRocket { 0%{transform:translateY(180%) scale(.55);opacity:0} 14%{opacity:1} 68%{transform:translateY(-11%) scale(1.06)} 84%{transform:translateY(4%) scale(.98)} 100%{transform:translateY(0) scale(1);opacity:1} }
@keyframes baJet { 0%{transform:translateX(185%) scale(.85);opacity:0} 18%{opacity:1} 80%{transform:translateX(-9%)} 100%{transform:translateX(0);opacity:1} }
@keyframes baTrain { 0%{transform:translateX(-180%) translateY(0);opacity:0} 14%{opacity:1} 40%{transform:translateX(-58%) translateY(-3%)} 54%{transform:translateX(-34%) translateY(0)} 70%{transform:translateX(-12%) translateY(-2%)} 86%{transform:translateX(3%) translateY(0)} 100%{transform:translateX(0) translateY(0);opacity:1} }
@keyframes baCar { 0%{transform:translateX(-165%);opacity:0} 14%{opacity:1} 70%{transform:translateX(7%)} 85%{transform:translateX(-3%)} 100%{transform:translateX(0);opacity:1} }
@keyframes baBicycle { 0%{transform:translateX(-150%) rotate(-5deg);opacity:0} 14%{opacity:1} 60%{transform:translateX(-10%) rotate(3deg)} 80%{transform:translateX(2%) rotate(-1deg)} 100%{transform:translateX(0) rotate(0);opacity:1} }
@keyframes baFish { 0%{transform:translateX(155%) translateY(0);opacity:0} 14%{opacity:1} 36%{transform:translateX(68%) translateY(-9%)} 56%{transform:translateX(34%) translateY(9%)} 76%{transform:translateX(12%) translateY(-5%)} 100%{transform:translateX(0) translateY(0);opacity:1} }
@keyframes baTurtle { 0%{transform:translateX(-122%);opacity:0} 10%{opacity:1} 100%{transform:translateX(0);opacity:1} }
.ba-enter-rocket  { animation: baRocket 1.2s cubic-bezier(.2,.7,.3,1) both; }
.ba-enter-jet     { animation: baJet .85s cubic-bezier(.15,.8,.25,1) both; }
.ba-enter-train   { animation: baTrain 1.35s ease-out both; }
.ba-enter-car     { animation: baCar 1.05s cubic-bezier(.2,.7,.3,1) both; }
.ba-enter-bicycle { animation: baBicycle 1.3s ease-out both; }
.ba-enter-fish    { animation: baFish 1.4s ease-out both; }
.ba-enter-turtle  { animation: baTurtle 1.7s linear both; }
@media (prefers-reduced-motion: reduce) { .ba-enter-rocket,.ba-enter-jet,.ba-enter-train,.ba-enter-car,.ba-enter-bicycle,.ba-enter-fish,.ba-enter-turtle { animation-duration: .01s; } }

/* ================================================================
 * Mental Math Master (spoken)
 * ================================================================ */
.mmm-listen { display: flex; flex-direction: column; align-items: center; gap: calc(8 * var(--u)); }
.mmm-word { font-weight: 900; font-size: calc(30 * var(--u)); letter-spacing: 0.06em; color: var(--text-primary); }
.q-text.mmm-reveal { font-size: calc(52 * var(--u)); font-weight: 900; }
.q-text.mmm-reveal.revealed { color: #E53935; }
/* out of tries: the correct answer sits in the answer box for a few seconds */
.q-answer.mmm-answer-shown { color: var(--good-green); }
.mmm-again { align-self: center; display: inline-flex; align-items: center; min-height: calc(52 * var(--u)); padding: calc(8 * var(--u)) calc(20 * var(--u)); }
/* the hint under it (try again / last try / the answer) stays centred when it wraps */
.mmm-again ~ .q-hint { text-align: center; text-wrap: balance; }

/* Say It! (answer out loud): menu switch + the mic panel that takes the keypad's slot */
.mmm-sayit-card[hidden], .mmm-sayit-note[hidden], .mmm-voice[hidden], .mmm-voice-note[hidden], .keypad[hidden] { display: none; }
.mmm-sayit-note { margin-top: calc(10 * var(--u)); }
/* the notes stay in the tree (so screen readers announce them) and take no room while empty */
.mmm-sayit-note:empty { margin-top: 0; }
.mw-switch.busy { pointer-events: none; opacity: .6; }
/* same height as the keypad block (4 × 64u rows + 3 × 10u gaps, plus its 8u margin), so swapping never jumps */
.mmm-voice {
  --mic-lvl: 0;
  --rec: #E5332E;   /* "mic is live" red, the universal recording signal */
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: calc(8 * var(--u));
  min-height: calc(286 * var(--u));
  margin-top: calc(8 * var(--u));
}
.mmm-mic {
  position: relative;
  isolation: isolate;   /* keeps the z-index -1 ripples inside the disc's own stacking context */
  width: calc(112 * var(--u)); height: calc(112 * var(--u));
  margin: calc(30 * var(--u)) 0;   /* room for the level ring at full scale (1.45) */
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(to bottom, var(--face-top) 0%, var(--face) 50%, var(--face) 100%);
  border: calc(3 * var(--u)) solid var(--stroke);
  box-shadow: 0 calc(5 * var(--u)) 0 0 var(--shadow);
  color: var(--text-primary);
  transition: opacity 160ms ease-out, background 160ms ease-out;
}
.mmm-mic-ico { width: calc(52 * var(--u)); height: calc(52 * var(--u)); display: block; }
/* grey and still while the question is read out; red and pulsing when it is the player's turn */
.mmm-voice:not([data-state="listen"]) .mmm-mic { opacity: .45; filter: grayscale(1); }
.mmm-voice[data-state="listen"] .mmm-mic { background: linear-gradient(to bottom, #FF6A62 0%, var(--rec) 55%, var(--rec) 100%); color: #fff; }
.mmm-mic::before, .mmm-mic::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  border-radius: 50%; background: var(--rec);
  opacity: 0; pointer-events: none;
}
.mmm-voice[data-state="listen"] .mmm-mic::before { animation: mmmRipple 1.6s ease-out infinite; }
.mmm-voice[data-state="listen"] .mmm-mic::after { animation: mmmRipple 1.6s ease-out .8s infinite; }
@keyframes mmmRipple { 0% { transform: scale(1); opacity: .45; } 100% { transform: scale(1.75); opacity: 0; } }
.mmm-mic-ring {
  position: absolute; inset: calc(-10 * var(--u));
  border: calc(4 * var(--u)) solid color-mix(in srgb, var(--rec) 80%, black 20%);
  border-radius: 50%;
  opacity: 0;
  transform: scale(calc(1 + var(--mic-lvl) * .45));
  transition: transform 90ms linear, opacity 160ms ease-out;
  pointer-events: none;
}
.mmm-voice[data-state="listen"] .mmm-mic-ring { opacity: 1; animation: mmmBreathe 1.6s ease-in-out infinite; }
@keyframes mmmBreathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.mmm-voice-status { min-height: 1.25em; font-weight: 900; font-size: calc(18 * var(--u)); color: var(--text-primary); text-align: center; }
.mmm-voice-heard {
  max-width: 100%; min-height: calc(22 * var(--u));
  font-size: calc(16 * var(--u)); color: var(--text-secondary); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* a plain text link, not a chunky button: the mic is the main action here */
.mmm-type-btn {
  min-height: 44px; padding: calc(6 * var(--u)) calc(14 * var(--u));
  background: none; border: 0; cursor: pointer; touch-action: manipulation;
  color: var(--text-secondary); font-family: inherit; font-weight: 700; font-size: calc(15 * var(--u));
  text-decoration: underline; text-underline-offset: 0.2em;
}
.mmm-voice-note { font-size: calc(14 * var(--u)); color: var(--text-secondary); text-align: center; margin: 0 0 calc(4 * var(--u)); }
.mmm-voice-note:empty { margin: 0; }
.keypad.mmm-kp-in { animation: mw-qin 150ms ease-out; }
@media (prefers-reduced-motion: reduce) {
  /* no breathing and no scaling: only the ring's opacity follows the voice */
  .mmm-mic-ring { transform: none; transition: opacity 90ms linear; }
  .mmm-voice[data-state="listen"] .mmm-mic-ring { animation: none; opacity: calc(.35 + var(--mic-lvl) * .65); }
  .keypad.mmm-kp-in { animation: none; }
  .mmm-voice[data-state="listen"] .mmm-mic::before, .mmm-voice[data-state="listen"] .mmm-mic::after { animation: none; }
}
/* small superscript pill for features still being tuned (e.g. Say It!) */
.beta-tag {
  display: inline-block; vertical-align: super;
  margin-left: calc(6 * var(--u)); padding: calc(1 * var(--u)) calc(6 * var(--u));
  border-radius: 999px; background: var(--accent1); color: var(--on-accent);
  font-size: calc(10 * var(--u)); font-weight: 900; letter-spacing: .08em; line-height: 1.4;
  text-transform: uppercase;
}

/* ================================================================
 * World Challenge
 * ================================================================ */
.wc-globe { width: calc(96 * var(--u)); height: calc(96 * var(--u)); margin: 0 auto calc(6 * var(--u)); }
.wc-note { font-size: calc(13 * var(--u)); color: var(--text-secondary); text-align: center; margin-top: calc(8 * var(--u)); }

/* suspense overlay before the reveal (tap to skip) */
.wc-suspense { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(22 * var(--u)); background: var(--bg-paint); }
.wc-suspense-title { text-align: center; font-size: calc(40 * var(--u)); line-height: 1.02; color: var(--text-primary); }
.wc-pips { display: flex; gap: calc(14 * var(--u)); }
.wc-pips span { width: calc(16 * var(--u)); height: calc(16 * var(--u)); border-radius: 50%; background: var(--panel-face); border: calc(3 * var(--u)) solid var(--stroke); transition: transform 160ms, background 160ms; }
.wc-pips span.on { background: var(--accent1); transform: scale(1.4); }

/* result */
.wc-headline { font-size: calc(58 * var(--u)); color: var(--text-primary); text-align: center; font-variant-numeric: tabular-nums; margin: calc(6 * var(--u)) 0; }
.wc-submit-area { width: 100%; margin-top: calc(16 * var(--u)); display: flex; flex-direction: column; align-items: center; }
.wc-handle { width: 100%; margin-top: calc(8 * var(--u)); padding: calc(12 * var(--u)); border: calc(3 * var(--u)) solid var(--stroke); border-radius: calc(12 * var(--u)); background: var(--face); color: var(--text-primary); font-weight: 900; font-size: calc(16 * var(--u)); text-align: center; }
/* leaderboard-name rule hint (api.js bindHandleInput): shown while the typed name has characters the server can't keep */
.name-hint { margin-top: calc(6 * var(--u)); font-size: calc(12.5 * var(--u)); font-weight: 700; line-height: 1.35; color: var(--stat-red); text-align: center; }
/* .ok = the name was just cleaned + pre-filled and is ready (a cue, not an error) */
.name-hint.ok { color: var(--text-secondary); }
/* a leaderboard name in any script (api.js nameHtml): isolated so an RTL name can't reorder the rank / score text around it (bdi's default, explicit for old WebViews) */
.lb-handle { unicode-bidi: isolate; }
/* the result's stat rows (owner, 23 Nov 2026: the outlined pale rank "looks low quality", "optimise this screen so it
 * doesn't scroll"; worldresult.js): today's RANK is a row of the keypad's two column block (.score-rows below), the place
 * on a solid pill: the screen's own ink with the card's face for the number (any theme, light or dark), gold, silver and
 * bronze for the top three (like the title screen's #1 tile), "of 13" beside it. Never outlined pastel text
 * (no_yellow_text, celebration_text). */
.wc-rank-pv { display: inline-flex; align-items: center; gap: calc(7 * var(--u)); min-width: 0; }
.score-rows .wc-rank-pill { display: inline-block; box-sizing: border-box; height: calc(32 * var(--u)); min-width: 4.5em; padding: 0 calc(11 * var(--u));
  border: calc(2 * var(--u)) solid var(--stroke); border-radius: 999px; background: var(--text-primary); color: var(--face);
  box-shadow: 0 calc(2 * var(--u)) 0 0 var(--shadow); font-weight: 900; font-size: calc(18 * var(--u)); line-height: calc(28 * var(--u));
  text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.wc-rank-1 .wc-rank-pill { background: linear-gradient(to bottom, #FFE9A0, #F5C233 55%, #E8A41E); color: #3A2606; box-shadow: 0 calc(2 * var(--u)) 0 0 #8A5A10; }
.wc-rank-2 .wc-rank-pill { background: linear-gradient(to bottom, #FFFFFF, #CBD5E0); color: #1E2935; box-shadow: 0 calc(2 * var(--u)) 0 0 #4E5D6C; }
.wc-rank-3 .wc-rank-pill { background: linear-gradient(to bottom, #F3D2B6, #CC9468 55%, #A9703F); color: #2A1405; box-shadow: 0 calc(2 * var(--u)) 0 0 #5E3412; }
.wc-rank-of { font-weight: 800; font-size: calc(14 * var(--u)); color: var(--text-secondary); white-space: nowrap; }
/* the card: the keypad score card's tighter rhythm (.kp-score), a step tighter again on short screens, so the whole
 * result (rows, share, "Posting as", MENU / SCORES and Doc's card) fits a 360 x 640 phone without scrolling */
.wc-card { gap: calc(10 * var(--u)); padding: calc(14 * var(--u)) calc(18 * var(--u)) calc(16 * var(--u)); }
.wc-card .wc-headline { margin: 0; line-height: 1.1; }
.wc-card > .wc-submit-area { margin-top: 0; }
.wc-card > .wc-submit-area:empty { display: none; }
.wc-card > .wc-submit-area > .wc-note { margin: 0 0 calc(8 * var(--u)); }
.wc-card > .sr-first { margin-top: calc(-4 * var(--u)); }
.wc-share-btn { align-self: stretch; min-height: max(48px, calc(56 * var(--u))); font-size: calc(15 * var(--u)); gap: calc(8 * var(--u)); padding-top: calc(6 * var(--u)); padding-bottom: calc(12 * var(--u)); }
.wc-share-ic { display: inline-flex; width: calc(22 * var(--u)); height: calc(22 * var(--u)); }
.wc-share-ic svg { display: block; width: 100%; height: 100%; }
.score-wrap > .wc-card + .score-actions { margin-top: calc(12 * var(--u)); }
/* the card keeps its own height (no stretched empty band inside it on a tall phone); the spare height goes above and
 * below the whole column, as the keypad's (.kp-wrap) */
.wc-wrap > .wc-card { flex: 0 0 auto; margin-top: auto; }
.wc-wrap > :last-child { margin-bottom: auto; }
@media (max-height: 800px) {
  .wc-card { gap: calc(6 * var(--u)); padding: calc(8 * var(--u)) calc(14 * var(--u)) calc(10 * var(--u)); }
  .wc-card > .score-stat-label.final { font-size: calc(16 * var(--u)); }
  .wc-card .wc-headline { font-size: calc(44 * var(--u)); }
  .wc-card > .wc-ct { font-size: calc(13 * var(--u)); letter-spacing: .07em; }
  .wc-card > .sr-first { margin-top: 0; font-size: calc(12 * var(--u)); line-height: 1.3; }
  .wc-share-btn { min-height: 48px; padding-top: calc(4 * var(--u)); padding-bottom: calc(9 * var(--u)); }
  .score-wrap > .wc-card + .score-actions { margin-top: calc(10 * var(--u)); }
  .score-wrap > .wc-card + .score-actions .mw-btn { min-height: max(50px, calc(60 * var(--u))); padding-top: calc(5 * var(--u)); padding-bottom: calc(11 * var(--u)); }
}

/* weekly leader banner */
.wc-weekly { display: flex; align-items: center; gap: calc(10 * var(--u)); padding: calc(12 * var(--u)) calc(14 * var(--u)); margin-bottom: calc(12 * var(--u)); font-weight: 900; font-size: calc(13 * var(--u)); color: var(--text-primary); }
.wc-crown { width: calc(24 * var(--u)); height: calc(24 * var(--u)); flex: 0 0 auto; }

/* World Challenge title screen (design A "Leader spotlight", v213): world.js draws a
   skeleton of the final size, worldmenu.js fills it. Every state (skeleton, leader, played,
   first-timer, empty board, offline) keeps one card height: the goal strip reserves two
   lines (--gh) and its texts clamp to two, so nothing jumps when data lands. Fixed golds
   only for the crown, flame, trophy and the #1 badge (like the scores screen's crown). */
.wcm .wc-scores-btn, .wcm .wc-practice { align-self: stretch; }
.wcm .wc-practice { margin-top: calc(10 * var(--u)); }
.wcm-title { padding-bottom: calc(18 * var(--u)); }
/* the date on its own line, the tagline under it */
.wcm-date .wcm-day, .wcm-date .wcm-tag { display: block; }
.wcm-date .wcm-day { font-weight: 700; }
.wcm-meta { display: flex; justify-content: center; min-height: calc(27 * var(--u)); margin-top: calc(12 * var(--u)); }
.wcm-chip { display: inline-flex; align-items: center; gap: calc(6 * var(--u)); max-width: 100%; box-sizing: border-box; padding: calc(4 * var(--u)) calc(11 * var(--u)) calc(4 * var(--u)) calc(7 * var(--u)); padding-inline: calc(7 * var(--u)) calc(11 * var(--u)); border: calc(2 * var(--u)) solid var(--stroke); border-radius: 999px; background: var(--panel-face); color: var(--text-primary); font-weight: 800; font-size: calc(12.5 * var(--u)); line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wcm-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.wcm-chip.is-lit { background: color-mix(in srgb, #F5C233 26%, var(--panel-face)); }
.wcm-ic { width: calc(18 * var(--u)); height: calc(18 * var(--u)); flex: 0 0 auto; display: inline-flex; }
.wcm-lead { --gh: 80; margin: calc(14 * var(--u)) 0 calc(16 * var(--u)); padding: calc(13 * var(--u)) calc(16 * var(--u)) calc(16 * var(--u)); }
/* tappable once a board is shown: opens today's scores (worldmenu.js) */
.wcm-lead.is-tap { cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .12s ease, box-shadow .12s ease; }
.wcm-lead.is-tap:active { transform: translateY(calc(2 * var(--u))); }
@media (prefers-reduced-motion: reduce) { .wcm-lead.is-tap { transition: none; } .wcm-lead.is-tap:active { transform: none; filter: brightness(.97); } }
html:is(.loc-font-arabic,.loc-font-devanagari,.loc-font-bengali) .wcm-lead { --gh: 94; }
.wcm-head { display: flex; align-items: center; justify-content: space-between; gap: calc(10 * var(--u)); min-height: calc(18 * var(--u)); }
.wcm-label { margin: 0; font-weight: 900; font-size: calc(12 * var(--u)); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); white-space: nowrap; }
.wcm-count { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: end; font-weight: 800; font-size: calc(12.5 * var(--u)); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
/* the countries playing today as a small stack of flags (chunky outline, a ring in the card colour where they overlap) */
.wcm-count.has-flags { display: inline-flex; align-items: center; gap: calc(7 * var(--u)); overflow: visible; }
.wcm-flags { display: inline-flex; align-items: center; flex: 0 0 auto; padding-inline-start: calc(2 * var(--u)); }
.wcm-mini, .wcm-more { position: relative; box-sizing: border-box; height: calc(16 * var(--u)); border: calc(1.5 * var(--u)) solid var(--stroke); border-radius: calc(4 * var(--u)); box-shadow: 0 0 0 calc(1.5 * var(--u)) var(--face); }
.wcm-mini { width: calc(22 * var(--u)); object-fit: cover; background: var(--panel-face); }
.wcm-mini + .wcm-mini, .wcm-mini + .wcm-more { margin-inline-start: calc(-6 * var(--u)); }
.wcm-more { z-index: 0; display: inline-flex; align-items: center; justify-content: center; min-width: calc(22 * var(--u)); padding-block: 0; padding-inline: calc(8 * var(--u)) calc(4 * var(--u)); border-radius: 999px; background: var(--panel-face); color: var(--text-primary); font-size: calc(10 * var(--u)); font-weight: 900; line-height: 1; }
.wcm-count-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wcm-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
html:is(.loc-font-arabic,.loc-font-devanagari,.loc-font-bengali) :is(.wcm-label, .wcm-goal-k) { letter-spacing: 0; }
.wcm-body { display: flex; flex-direction: column; min-height: calc((var(--gh) + 80) * var(--u)); }
.wcm-leader { display: flex; align-items: center; gap: calc(12 * var(--u)); margin-top: calc(14 * var(--u)); min-height: calc(52 * var(--u)); }
.wcm-flagwrap { position: relative; flex: 0 0 auto; width: calc(50 * var(--u)); height: calc(34 * var(--u)); margin-top: calc(6 * var(--u)); }
/* the spotlight: a soft gold pool of light behind the leader's flag */
.wcm-flagwrap::before { content: ''; position: absolute; z-index: 0; pointer-events: none; inset: calc(-22 * var(--u)) calc(-24 * var(--u)); background: radial-gradient(closest-side, color-mix(in srgb, #F5C233 34%, transparent), transparent); }
.wcm-flagwrap:has(.wcm-sk-flag)::before { display: none; }
.wcm-flag, .wcm-crown, .wcm-slot, .wcm-sk-flag { position: relative; z-index: 1; }
.wcm-flag { display: block; box-sizing: border-box; width: 100%; height: 100%; object-fit: cover; border: calc(2.5 * var(--u)) solid var(--stroke); border-radius: calc(7 * var(--u)); box-shadow: 0 calc(3 * var(--u)) 0 0 var(--shadow); background: var(--panel-face); }
.wcm-slot { display: block; width: 100%; height: 100%; }
.wcm-crown { position: absolute; top: calc(-17 * var(--u)); inset-inline-start: calc(-13 * var(--u)); width: calc(28 * var(--u)); height: calc(28 * var(--u)); transform: rotate(-20deg); filter: drop-shadow(0 calc(1.5 * var(--u)) 0 var(--shadow)); }
[dir="rtl"] .wcm-crown { transform: rotate(20deg); }
.wcm-who { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: calc(2 * var(--u)); }
.wcm-nameline { display: flex; align-items: center; gap: calc(7 * var(--u)); min-width: 0; }
.wcm-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 900; font-size: calc(21 * var(--u)); line-height: 1.2; color: var(--text-primary); }
/* the leader is you (rank 1): a small tag, so the crown line and "You hold the crown" agree */
.wcm-you { flex: 0 0 auto; padding: calc(2 * var(--u)) calc(8 * var(--u)); border-radius: 999px; background: var(--accent1); color: var(--on-accent); border: calc(2 * var(--u)) solid var(--stroke); font-weight: 900; font-size: calc(11 * var(--u)); line-height: 1.25; text-transform: uppercase; letter-spacing: 0.06em; }
.wcm-country { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: calc(12.5 * var(--u)); line-height: 1.3; color: var(--text-secondary); }
.wcm-res { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: calc(2 * var(--u)); text-align: end; }
.wcm-score { font-weight: 900; font-size: calc(24 * var(--u)); line-height: 1.05; color: var(--text-primary); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.wcm-time { display: inline-flex; align-items: center; gap: calc(4 * var(--u)); font-weight: 800; font-size: calc(14 * var(--u)); color: var(--text-secondary); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.wcm-watch { display: inline-flex; width: calc(14 * var(--u)); height: calc(14 * var(--u)); }
.wcm-ltr { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
/* the goal strip: the result to beat (not played) / your rank + the gap (played) */
.wcm-goal { display: flex; align-items: center; gap: calc(12 * var(--u)); margin-top: calc(14 * var(--u)); min-height: calc(var(--gh) * var(--u)); box-sizing: border-box; padding: calc(9 * var(--u)) calc(12 * var(--u)); border: calc(2.5 * var(--u)) solid var(--stroke); border-radius: calc(16 * var(--u)); background: linear-gradient(to bottom, var(--panel-top), var(--panel-face)); }
.wcm-goal-ic { flex: 0 0 auto; display: inline-flex; width: calc(38 * var(--u)); height: calc(38 * var(--u)); }
.wcm-goal-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: calc(2 * var(--u)); }
.wcm-goal-k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 900; font-size: calc(11.5 * var(--u)); line-height: 1.25; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-secondary); }
.wcm-goal-v, .wcm-gap { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.wcm-goal-v { font-weight: 900; font-size: calc(17 * var(--u)); line-height: 1.15; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.wcm-goal-v-sm { font-size: calc(15.5 * var(--u)); }
.wcm-goal-v .lb-flag { margin-inline-end: calc(6 * var(--u)); margin-top: calc(-2 * var(--u)); }
html:is(.loc-font-arabic,.loc-font-devanagari,.loc-font-bengali) :is(.wcm-goal-v, .wcm-gap, .wcm-goal-k, .wcm-country) { line-height: 1.45; }
/* played today: the "me" look of the scores list (accent fill, on-accent ink) */
.wcm-goal.is-you { background: var(--accent1); }
.wcm-goal.is-you .wcm-goal-v { color: var(--on-accent); }
.wcm-goal.is-you .wcm-gap { white-space: normal; color: var(--on-accent-soft); text-transform: none; letter-spacing: 0; font-size: calc(13 * var(--u)); font-weight: 800; }
.wcm-rank { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: calc(50 * var(--u)); height: calc(46 * var(--u)); padding: 0 calc(6 * var(--u)); box-sizing: border-box; background: var(--face); border: calc(2.5 * var(--u)) solid var(--stroke); border-radius: calc(12 * var(--u)); box-shadow: 0 calc(3 * var(--u)) 0 0 var(--shadow); font-variant-numeric: tabular-nums; line-height: 1; }
.wcm-rank b { font-weight: 900; font-size: calc(19 * var(--u)); color: var(--text-primary); white-space: nowrap; }
.wcm-rank small { font-weight: 800; font-size: calc(10.5 * var(--u)); color: var(--text-secondary); margin-top: calc(3 * var(--u)); white-space: nowrap; }
.wcm-goal.is-top .wcm-rank { background: linear-gradient(to bottom, #FFE9A0, #F5C233 60%, #E8A41E); border-color: #8A5A10; }
.wcm-goal.is-top .wcm-rank :is(b, small) { color: #3A2606; }
/* footer: the real reset (midnight UK); local clock only, so it shows offline too */
.wcm-foot { display: flex; align-items: center; justify-content: center; gap: calc(6 * var(--u)); min-height: calc(18 * var(--u)); margin-top: calc(12 * var(--u)); font-weight: 800; font-size: calc(12.5 * var(--u)); line-height: 1.25; color: var(--text-secondary); font-variant-numeric: tabular-nums; text-align: center; }
.wcm-foot .wcm-ic { width: calc(16 * var(--u)); height: calc(16 * var(--u)); }
/* offline / error, with a 44px Try again */
.wcm-off { display: flex; align-items: center; gap: calc(12 * var(--u)); margin-top: calc(16 * var(--u)); }
.wcm-off-ic { flex: 0 0 auto; display: inline-flex; width: calc(44 * var(--u)); height: calc(44 * var(--u)); }
.wcm-off-txt { display: flex; flex-direction: column; gap: calc(3 * var(--u)); min-width: 0; }
.wcm-off-t { font-weight: 900; font-size: calc(16 * var(--u)); color: var(--text-primary); }
.wcm-off-m { font-weight: 700; font-size: calc(13 * var(--u)); line-height: 1.3; color: var(--text-secondary); }
.wcm-retry { align-self: center; margin-top: auto; min-height: 44px; min-width: calc(150 * var(--u)); padding: calc(8 * var(--u)) calc(22 * var(--u)); font: inherit; font-weight: 900; font-size: calc(14 * var(--u)); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-primary); background: linear-gradient(to bottom, var(--face-top), var(--face)); border: calc(2.5 * var(--u)) solid var(--stroke); border-radius: 999px; box-shadow: 0 calc(4 * var(--u)) 0 0 var(--shadow); cursor: pointer; }
.wcm-retry:active { transform: translateY(calc(3 * var(--u))); box-shadow: 0 calc(1 * var(--u)) 0 0 var(--shadow); }
/* skeleton (loading) */
.wcm-sk { display: block; border-radius: calc(6 * var(--u)); background: rgba(128, 128, 128, 0.14); background: linear-gradient(90deg, color-mix(in srgb, var(--text-primary) 9%, transparent) 0%, color-mix(in srgb, var(--text-primary) 16%, transparent) 50%, color-mix(in srgb, var(--text-primary) 9%, transparent) 100%); background-size: 200% 100%; animation: wcm-sk 1.4s ease-in-out infinite; }
.wcm-sk-count { display: inline-block; width: calc(120 * var(--u)); height: calc(12 * var(--u)); vertical-align: middle; }
.wcm-sk-flag { width: 100%; height: 100%; border-radius: calc(7 * var(--u)); }
.wcm-sk-l1 { width: 72%; height: calc(18 * var(--u)); }
.wcm-sk-l2 { width: 46%; height: calc(11 * var(--u)); margin-top: calc(4 * var(--u)); }
.wcm-sk-r1 { width: calc(62 * var(--u)); height: calc(20 * var(--u)); }
.wcm-sk-r2 { width: calc(42 * var(--u)); height: calc(12 * var(--u)); margin-top: calc(4 * var(--u)); }
.wcm-sk-ic { flex: 0 0 auto; width: calc(38 * var(--u)); height: calc(38 * var(--u)); border-radius: 50%; }
.wcm-goal.is-sk { background: transparent; border-color: color-mix(in srgb, var(--text-primary) 14%, transparent); }
@keyframes wcm-sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.wcm-in { animation: wcm-in 260ms ease-out both; }
@keyframes wcm-in { from { opacity: 0; } to { opacity: 1; } }
/* the one ornament: a slow light sweep across the crown, twice, then it rests */
.wcm-shine { animation: wcm-shine 2.4s ease-in-out 500ms 2 both; }
@keyframes wcm-shine { 0% { transform: skewX(-22deg) translateX(0); } 55%, 100% { transform: skewX(-22deg) translateX(34px); } }
@media (prefers-reduced-motion: reduce) {
  .wcm-sk, .wcm-in, .wcm-shine { animation: none; }
  .wcm-shine { opacity: 0; }
}
/* the primary button, played today without Pro: PLAY AGAIN + a PRO tag, and under it
   "(or wait 6h 12m)" to the next midnight UK. Fits the button's usual height. */
.wc-start.is-wait { flex-wrap: wrap; align-content: center; column-gap: calc(8 * var(--u)); row-gap: calc(1 * var(--u)); padding-top: calc(6 * var(--u)); padding-bottom: calc(12 * var(--u)); }
/* a button with the PRO tag beside its label (free tier v2: World Challenge practice, Times Table Master START) */
.tier-used { margin: calc(8 * var(--u)) 0 0; text-align: center; font-size: calc(13 * var(--u)); line-height: 1.35; color: var(--text-secondary); }
.tier-pro-btn { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; column-gap: calc(8 * var(--u)); row-gap: calc(2 * var(--u)); }
.wc-pro { flex: 0 0 auto; padding: calc(1 * var(--u)) calc(7 * var(--u)); border: calc(2 * var(--u)) solid #B8860B; border-radius: 999px; background: linear-gradient(to bottom, #FFE9A0, #F5C233); color: #3A2606; font-size: calc(11 * var(--u)); line-height: 1.3; letter-spacing: 0.08em; }
.wc-wait { flex: 0 0 100%; min-height: 1.25em; text-align: center; font-weight: 800; font-size: calc(13 * var(--u)); line-height: 1.25; letter-spacing: 0; text-transform: none; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
/* short screens (about 360 x 740): a smaller globe keeps the whole menu on one screen */
@media (max-height: 800px) {
  .wcm-title.tt-titlecard { padding-top: calc(14 * var(--u)); }
  .wcm-title .wc-globe { width: calc(76 * var(--u)); height: calc(76 * var(--u)); }
}

/* leaderboard table */
.lb-head { display: flex; align-items: center; gap: calc(8 * var(--u)); padding: 0 calc(14 * var(--u)) calc(8 * var(--u)); font-size: calc(11 * var(--u)); font-weight: 900; letter-spacing: 0.08em; color: var(--text-secondary); }
.lb-list { display: flex; flex-direction: column; gap: calc(8 * var(--u)); overflow-y: auto; }
.lb-row { display: flex; align-items: center; gap: calc(8 * var(--u)); padding: calc(12 * var(--u)) calc(14 * var(--u)); font-weight: 900; }
.lb-row.me { background: var(--accent1); }
.lb-row.me :is(.lb-name, .lb-correct) { color: var(--on-accent); }
.lb-row.me :is(.lb-rank, .lb-time) { color: var(--on-accent-soft); }
.lb-rank { width: calc(34 * var(--u)); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.lb-name { flex: 1; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* (the score and time columns are at least their old widths and grow with large text, never run into each other:
   "50/501:04" at 130% text; layout audit, 23 Nov 2026) */
.lb-correct { flex: none; min-width: calc(64 * var(--u)); white-space: nowrap; text-align: right; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.lb-time { flex: none; min-width: calc(56 * var(--u)); white-space: nowrap; text-align: right; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* ====================================================================
 * DESKTOP / wide layout (mouse + physical keyboard).
 * Mobile keeps the phone column; desktop opens up into a wider stage:
 * a multi-column menu, and a focused, roomier play area.
 * ==================================================================== */
/* On desktop the app stays a phone-shaped column (every screen is designed for
 * it; widening to a stage would only sprawl the menus/settings/dialogs), framed
 * and centred on a soft backdrop so it reads as intentional, plus pointer/hover
 * affordances. (Key hints are localized: desktop.css and the desktop dictionary.) */
@media (min-width: 760px) and (pointer: fine) {
  :root { --col: min(96vw, 480px, 56vh); }        /* a touch larger than mobile, still a column; height-fit on short windows */
  @supports (height: 1dvh) { :root { --col: min(96vw, 480px, 56dvh); } }
  body { display: flex; align-items: center; justify-content: center; }
  /* depth backdrop behind the centred column (theme-agnostic vignette) */
  body::before { content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background: radial-gradient(130% 100% at 50% 0%, rgba(255,255,255,0.06), rgba(0,0,0,0.22)); }
  .app {
    height: min(100%, calc(1.9 * var(--col)));   /* a portrait-proportioned card, not the full window */
    border-radius: calc(30 * var(--u));
    box-shadow: 0 calc(24 * var(--u)) calc(70 * var(--u)) rgba(0,0,0,0.45), 0 0 0 1px rgba(0,0,0,0.08);
  }
  @supports (height: 1dvh) { .app { height: min(100dvh, calc(1.9 * var(--col))); } }
  /* affordances */
  .menu-card, .mw-tile, .mw-btn, .theme-sw, .back-fab, .menu-fab, .pw-close, .pro-go, .pro-redeem { cursor: pointer; }
  .mw-tile:hover, .mw-btn:hover { filter: brightness(1.05); }
  .menu-card:hover { transform: translateY(calc(-2 * var(--u))); box-shadow: 0 calc(8 * var(--u)) 0 0 var(--shadow); }
}

/* Tablets / large foldables (touch, ≥700px): keep the portrait play column but
 * make it a roomier, framed card centred on a soft backdrop — and ALWAYS
 * height-fit (56dvh) so the full keypad shows without scrolling in any
 * orientation. The app becomes a portrait-proportioned card so a big tablet
 * doesn't stretch the question card into a near-empty box. */
@media (min-width: 700px) and (pointer: coarse) {
  :root { --col: min(96vw, 520px, 56vh); }
  @supports (height: 1dvh) { :root { --col: min(96vw, 520px, 56dvh); } }
  body { display: flex; align-items: center; justify-content: center; }
  body::before { content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background: radial-gradient(130% 100% at 50% 0%, rgba(255,255,255,0.06), rgba(0,0,0,0.22)); }
  .app {
    height: min(100%, calc(1.85 * var(--col)));
    border-radius: calc(30 * var(--u));
    box-shadow: 0 calc(20 * var(--u)) calc(60 * var(--u)) rgba(0,0,0,0.4), 0 0 0 1px rgba(0,0,0,0.08);
  }
  @supports (height: 1dvh) { .app { height: min(100dvh, calc(1.85 * var(--col))); } }
}

/* The app's UI size in its phone and tablet layouts (desktop spec 7.14, T-Content_Zoom).
 * Only ui/desktop/uiscale.js sets html[data-ui-scale]: in the Math Workout app, while a
 * mouse or trackpad is present, for a size other than 100%. A touch phone never gets it,
 * so none of this can reach one. The column follows --dt-scale and never outgrows the
 * window: the scrolling hubs up to its width, every other screen also within the 56dvh
 * height fit (a round never clips). Galaxy Run and Prime Raiders keep their columns
 * (aspect and score comparability, 7.3). Old WebViews without dvh keep 100%. The tablet layout
 * (html[data-tablet]: an Android tablet or an open foldable with a mouse, mw-v237) keeps its own
 * size from the window (styles/tablet.css --tb-u) and its filled games: these rules step aside. */
@supports (height: 1dvh) {
  :root[data-ui-scale]:not([data-desktop], [data-tablet]) { --col: min(100vw, 56dvh, calc(min(100vw, 460px, 56dvh) * var(--dt-scale, 1))); }
  :root[data-ui-scale]:not([data-desktop], [data-tablet]):is([data-screen="menu"], [data-screen="settings"], [data-screen="progress"], [data-screen="achievements"], [data-screen="academy"], [data-screen="wcboard"]) {
    --col: min(100vw, calc(min(100vw, 460px, 56dvh) * var(--dt-scale, 1)));
  }
  @media (min-width: 760px) and (pointer: fine) {
    :root[data-ui-scale]:not([data-desktop], [data-tablet]) { --col: min(96vw, 56dvh, calc(min(96vw, 480px, 56dvh) * var(--dt-scale, 1))); }
    :root[data-ui-scale]:not([data-desktop], [data-tablet]):is([data-screen="menu"], [data-screen="settings"], [data-screen="progress"], [data-screen="achievements"], [data-screen="academy"], [data-screen="wcboard"]) {
      --col: min(96vw, calc(min(96vw, 480px, 56dvh) * var(--dt-scale, 1)));
    }
  }
  @media (min-width: 700px) and (pointer: coarse) {
    :root[data-ui-scale]:not([data-desktop], [data-tablet]) { --col: min(96vw, 56dvh, calc(min(96vw, 520px, 56dvh) * var(--dt-scale, 1))); }
    :root[data-ui-scale]:not([data-desktop], [data-tablet]):is([data-screen="menu"], [data-screen="settings"], [data-screen="progress"], [data-screen="achievements"], [data-screen="academy"], [data-screen="wcboard"]) {
      --col: min(96vw, calc(min(96vw, 520px, 56dvh) * var(--dt-scale, 1)));
    }
  }
  :root[data-ui-scale]:not([data-desktop], [data-tablet]):is([data-screen="raiders"], [data-screen="game"][data-mode="galaxy"]) { --col: min(100vw, 460px, 56dvh); }
  @media (min-width: 760px) and (pointer: fine) { :root[data-ui-scale]:not([data-desktop], [data-tablet]):is([data-screen="raiders"], [data-screen="game"][data-mode="galaxy"]) { --col: min(96vw, 480px, 56dvh); } }
  @media (min-width: 700px) and (pointer: coarse) { :root[data-ui-scale]:not([data-desktop], [data-tablet]):is([data-screen="raiders"], [data-screen="game"][data-mode="galaxy"]) { --col: min(96vw, 520px, 56dvh); } }
}

/* ================================================================
 * Achievements (109-badge grid + detail dialog)
 * ================================================================ */
.ach-title { text-align: center; font-weight: 900; font-size: calc(30 * var(--u)); color: var(--text-primary); letter-spacing: 0.06em; margin: calc(6 * var(--u)) 0 calc(14 * var(--u)); }
.ach-progress-card { padding: calc(14 * var(--u)); margin-bottom: calc(16 * var(--u)); }
.ach-progress-text { text-align: center; font-weight: 900; font-size: calc(15 * var(--u)); color: var(--text-primary); font-variant-numeric: tabular-nums; }
.ach-progress-text b { color: var(--text-primary); }
.ach-bar { margin-top: calc(10 * var(--u)); height: calc(10 * var(--u)); border-radius: calc(5 * var(--u)); background: color-mix(in srgb, var(--text-primary) 12%, transparent); overflow: hidden; }
.ach-bar-fill { height: 100%; background: linear-gradient(to right, #E8A41E, #FFCF5A); border-radius: calc(5 * var(--u)); transition: width 0.4s; }
.ach-section { margin-bottom: calc(18 * var(--u)); }
.ach-head { display: flex; align-items: center; gap: calc(10 * var(--u)); margin-bottom: calc(10 * var(--u)); }
.ach-cat { flex: 1; font-weight: 900; font-size: calc(15 * var(--u)); color: var(--text-primary); letter-spacing: 0.03em; border-left: calc(4 * var(--u)) solid #E8A41E; padding-left: calc(8 * var(--u)); }
.ach-chip { font-weight: 900; font-size: calc(12 * var(--u)); color: var(--text-secondary); background: color-mix(in srgb, var(--text-primary) 10%, transparent); border-radius: calc(10 * var(--u)); padding: calc(3 * var(--u)) calc(9 * var(--u)); font-variant-numeric: tabular-nums; }
/* (minmax(0, 1fr) in every equal-column grid here: a bare 1fr is at least its widest item, so large text (Android's
   font size) pushed a column past the screen's edge and cut the third badge: layout audit, 23 Nov 2026) */
.ach-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(10 * var(--u)); }
.ach-badge { position: relative; aspect-ratio: 1 / 1; padding: calc(4 * var(--u)); background: none; border: none; cursor: pointer; }
.ach-badge img { width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 0.3s; }
.ach-badge img.loaded { opacity: 1; }
.ach-badge:active { transform: scale(0.94); }
.ach-badge.locked img { filter: grayscale(1); opacity: 0.34; }
.ach-lock { position: absolute; right: calc(8 * var(--u)); bottom: calc(8 * var(--u)); width: calc(22 * var(--u)); height: calc(22 * var(--u)); }
.ach-detail-ov { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: calc(24 * var(--u)); background: rgba(0,0,0,0.55); }
.ach-detail { width: 100%; max-width: calc(340 * var(--u)); display: flex; flex-direction: column; align-items: center; gap: calc(8 * var(--u)); padding: calc(22 * var(--u)); text-align: center; }
.ach-detail-badge { width: calc(150 * var(--u)); height: calc(150 * var(--u)); object-fit: contain; }
.ach-detail-badge.locked { filter: grayscale(1); opacity: 0.34; }
.ach-detail-tier { font-weight: 900; font-size: calc(13 * var(--u)); letter-spacing: 0.1em; }
.ach-detail-name { font-weight: 900; font-size: calc(22 * var(--u)); color: var(--text-primary); }
.ach-detail-desc { font-size: calc(13.5 * var(--u)); color: var(--text-secondary); line-height: 1.35; }
.ach-detail-status { margin-top: calc(6 * var(--u)); font-weight: 900; font-size: calc(12 * var(--u)); color: var(--text-secondary); letter-spacing: 0.08em; }
.ach-detail-hint { font-size: calc(13 * var(--u)); color: var(--text-primary); }
.ach-detail-actions { width: 100%; margin-top: calc(6 * var(--u)); }
.ach-close { width: 100%; margin-top: calc(6 * var(--u)); }

/* ACHIEVEMENT UNLOCKED popup (springy spin + sparkle burst) */
.au-ov { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: calc(24 * var(--u)); background: rgba(0,0,0,0.6); }
:root[data-kb] .au-ov { padding-bottom: calc(var(--kb-inset, 0px) + 12px); }   /* the iOS keyboard (lib/kbavoid.js) */
.au-card { width: 100%; max-width: calc(340 * var(--u)); display: flex; flex-direction: column; align-items: center; gap: calc(8 * var(--u)); padding: calc(24 * var(--u)); text-align: center; }
.au-header { font-weight: 900; font-size: calc(15 * var(--u)); letter-spacing: 0.14em; color: var(--text-primary); }
.au-badge-wrap { position: relative; width: calc(160 * var(--u)); height: calc(160 * var(--u)); display: flex; align-items: center; justify-content: center; margin: calc(6 * var(--u)) 0; }
.au-badge { width: 100%; height: 100%; object-fit: contain; animation: au-reveal 780ms cubic-bezier(.18,.9,.3,1) 60ms both; }
@keyframes au-reveal { from { transform: scale(0.3) rotate(0deg); opacity: 0; } to { transform: scale(1) rotate(720deg); opacity: 1; } }
.au-tier { font-weight: 900; font-size: calc(13 * var(--u)); letter-spacing: 0.1em; }
.au-name { font-weight: 900; font-size: calc(24 * var(--u)); color: var(--text-primary); line-height: 1.05; }
.au-desc { font-size: calc(13.5 * var(--u)); color: var(--text-secondary); line-height: 1.35; }
.au-actions { width: 100%; margin-top: calc(8 * var(--u)); display: flex; gap: calc(10 * var(--u)); }
/* equal-width twin buttons: min-width:0 defeats the flex content floor so the
   longer label ("AWESOME") can't out-grow "SHARE" */
.au-actions .mw-btn { flex: 1 1 0; min-width: 0; }
.au-spark { position: absolute; left: 50%; top: 50%; width: calc(8 * var(--u)); height: calc(8 * var(--u)); border-radius: 50%; pointer-events: none; animation: au-spark 700ms ease-out forwards; }
@keyframes au-spark { 0% { transform: translate(-50%,-50%) scale(0.4); opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1); opacity: 0; } }
/* several unlocks at once: ONE sheet (popup.js showSheet). Swipe the track, tap an
   arrow or a thumbnail to browse; only the first badge spins. */
.au-sheet { gap: calc(6 * var(--u)); padding: calc(20 * var(--u)) calc(18 * var(--u)) calc(12 * var(--u)); max-height: 100%; max-height: calc(100dvh - 32px); overflow-y: auto; }
.au-stage { position: relative; align-self: stretch; }
.au-track { display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.au-track::-webkit-scrollbar { display: none; }
.au-slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: center; scroll-snap-stop: always; display: flex; flex-direction: column; align-items: center; gap: calc(6 * var(--u)); padding: 0 calc(4 * var(--u)); box-sizing: border-box; }
.au-sheet .au-badge-wrap { width: calc(140 * var(--u)); height: calc(140 * var(--u)); }
.au-badge.au-still { animation: none; }
.au-nav { position: absolute; top: calc(76 * var(--u) - 22px); width: 44px; height: 44px; padding: 11px; border-radius: 50%; border: calc(2.5 * var(--u)) solid var(--stroke); background: var(--panel-face); color: var(--text-primary); display: flex; align-items: center; justify-content: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.au-nav svg { display: block; }
.au-nav:active { transform: scale(0.92); }
.au-nav:disabled { visibility: hidden; }
.au-prev { inset-inline-start: 0; }
.au-next { inset-inline-end: 0; }
.au-next svg, [dir="rtl"] .au-prev svg { transform: scaleX(-1); }
[dir="rtl"] .au-next svg { transform: none; }
.au-thumbs { display: flex; flex-wrap: wrap; justify-content: center; gap: calc(2 * var(--u)); }
.au-thumb { width: 44px; height: 44px; padding: 4px; border-radius: 50%; border: calc(2.5 * var(--u)) solid transparent; background: transparent; cursor: pointer; opacity: 0.55; transition: opacity .15s ease; -webkit-tap-highlight-color: transparent; }
.au-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.au-thumb.on { opacity: 1; border-color: var(--text-primary); }
.au-all { min-height: 44px; padding: 0 calc(14 * var(--u)); background: transparent; border: none; font: inherit; font-weight: 800; font-size: calc(14 * var(--u)); color: var(--text-primary); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ================================================================
 * Write-it Mode (handwriting answer panel)
 * ================================================================ */
.wi-panel { display: flex; flex-direction: column; gap: calc(10 * var(--u)); width: 100%; flex: 1.5; min-height: 0; }
.wi-stage { position: relative; width: 100%; flex: 1; min-height: calc(140 * var(--u)); }
.wi-canvas, .wi-demo { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: calc(16 * var(--u)); }
.wi-canvas { background: #fff; border: calc(3 * var(--u)) solid var(--stroke); touch-action: none; cursor: crosshair; }
.wi-demo { pointer-events: none; }
.wi-demo[hidden] { display: none; }
.wi-status { position: absolute; left: 0; right: 0; bottom: calc(6 * var(--u)); display: flex; align-items: center; justify-content: center; height: calc(24 * var(--u)); pointer-events: none; }
.wi-status-text { font-size: calc(13 * var(--u)); font-weight: 900; color: var(--text-secondary); }
.wi-wavy { width: calc(90 * var(--u)); height: calc(22 * var(--u)); }
.wi-wavy[hidden] { display: none; }
.wi-controls { display: flex; align-items: center; }
/* a white disc in every theme: fixed dark ink */
.wi-mute { position: absolute; top: calc(8 * var(--u)); right: calc(8 * var(--u)); z-index: 2; width: calc(48 * var(--u)); height: calc(48 * var(--u)); padding: calc(10 * var(--u)); border-radius: 50%; background: rgba(255,255,255,0.92); border: calc(2 * var(--u)) solid #2b2536; box-shadow: 0 calc(2 * var(--u)) calc(5 * var(--u)) rgba(0,0,0,0.12); color: #2b2536; }
.wi-mute.muted { color: #6f6a7b; }
.wi-mute svg { display: block; width: 100%; height: 100%; }
.wi-clear { flex: 1; width: 100%; }
.opt-sub { font-size: calc(12 * var(--u)); color: var(--text-secondary); margin-top: calc(2 * var(--u)); }

/* ================= first-run onboarding (intro) ================= */
/* (the step is centred by its auto margins, not align-items: with large text (Android's font size) or a short window a
   step taller than the screen starts at its top and the screen scrolls to the rest, with a fading edge; the last
   page's "Let's begin!" was cut off below it: layout audit, 23 Nov 2026. The screen is also a .screen, a COLUMN, so
   align-items: flex-start pins the step to the start edge: margin-inline auto centres it across a window wider than
   the step (an iPad, a foldable, a computer), 24 Nov 2026) */
.intro-screen { position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: center; overflow-x: hidden; overflow-y: auto; background: var(--bg-paint); padding: calc(22 * var(--u)); }
.intro-ops { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.intro-ops span { position: absolute; font-weight: 900; color: var(--accent1); opacity: .12; font-size: calc(120 * var(--u)); }
.intro-ops span:nth-child(1) { top: 6%; left: 8%; transform: rotate(-12deg); }
.intro-ops span:nth-child(2) { top: 22%; right: 6%; transform: rotate(10deg); }
.intro-ops span:nth-child(3) { bottom: 16%; left: 4%; transform: rotate(8deg); }
.intro-ops span:nth-child(4) { bottom: 8%; right: 12%; transform: rotate(-8deg); }
.intro-stage { position: relative; z-index: 1; width: 100%; max-width: calc(380 * var(--u)); margin: auto; }
.intro-mute { position: absolute; top: max(calc(14 * var(--u)), env(safe-area-inset-top)); right: calc(16 * var(--u)); z-index: 5; width: calc(44 * var(--u)); height: calc(44 * var(--u)); padding: calc(9 * var(--u)); border-radius: 50%; background: var(--face); border: calc(2 * var(--u)) solid var(--stroke); color: var(--text-primary); box-shadow: 0 calc(3 * var(--u)) calc(8 * var(--u)) rgba(0,0,0,0.12); }
.intro-mute.off { color: var(--text-secondary); }
.intro-mute svg { display: block; width: 100%; height: 100%; }
.intro-step { display: flex; flex-direction: column; align-items: center; text-align: center; gap: calc(14 * var(--u)); opacity: 0; transform: translateY(calc(16 * var(--u))); transition: opacity .42s ease, transform .42s ease; }
.intro-step.in { opacity: 1; transform: none; }
.intro-title { font-size: calc(46 * var(--u)); color: var(--text-primary); line-height: 1; }
.intro-sub { font-size: calc(18 * var(--u)); color: var(--text-secondary); line-height: 1.42; max-width: 32ch; }
.intro-textcard { width: 100%; padding: calc(22 * var(--u)) calc(22 * var(--u)) calc(24 * var(--u)); display: flex; flex-direction: column; align-items: center; gap: calc(10 * var(--u)); }
.intro-textcard .intro-sub { color: var(--text-primary); opacity: .85; max-width: none; }
.intro-welcome .intro-logo { width: calc(132 * var(--u)); height: calc(132 * var(--u)); border-radius: calc(30 * var(--u)); box-shadow: 0 calc(14 * var(--u)) calc(34 * var(--u)) rgba(0,0,0,.18); animation: introPop .6s cubic-bezier(.2,.8,.3,1.25) both; }
@keyframes introPop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
.intro-welcome .mw-btn, .intro-setup .mw-btn, .intro-welcomepage .mw-btn { margin-top: calc(8 * var(--u)); min-width: calc(190 * var(--u)); }
/* welcome pages (brain + Android copy) */
.intro-brain { position: relative; width: calc(122 * var(--u)); height: calc(99 * var(--u)); filter: drop-shadow(0 calc(8 * var(--u)) calc(16 * var(--u)) rgba(74,47,176,.28)); animation: brainFloat 4.6s ease-in-out infinite; }
/* Max narrates the intro pages from INSIDE the text card: a big avatar floating
   over the card's top-left corner (no box of his own). The heading is pushed to
   the right so it clears him. */
.intro-textcard-coach { position: relative; padding-top: calc(40 * var(--u)); }
.intro-textcard-coach .intro-wtitle { align-self: flex-end; text-align: right; max-width: 72%; }
.intro-maxlet {
  position: absolute; top: calc(-52 * var(--u)); left: calc(-14 * var(--u));
  width: calc(122 * var(--u)); height: calc(122 * var(--u));
  filter: drop-shadow(0 calc(5 * var(--u)) calc(12 * var(--u)) rgba(0,0,0,0.30));
}
.intro-maxlet .coach-avatar-svg { width: 100%; height: 100%; }
@keyframes brainFloat { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(calc(-8 * var(--u))) rotate(1deg); } }
.intro-wtitle { font-size: calc(34 * var(--u)); color: var(--text-primary); line-height: 1.05; }
.intro-pagedots { display: flex; gap: calc(7 * var(--u)); margin: calc(2 * var(--u)) 0; }
.intro-pagedots span { width: calc(8 * var(--u)); height: calc(8 * var(--u)); border-radius: 50%; background: var(--stroke); transition: background .25s, width .25s; }
.intro-pagedots span.on { width: calc(22 * var(--u)); border-radius: calc(4 * var(--u)); background: var(--accent1); }
/* question step */
.intro-progress { display: flex; gap: calc(8 * var(--u)); }
.intro-progress span { width: calc(9 * var(--u)); height: calc(9 * var(--u)); border-radius: 50%; background: var(--stroke); transition: background .25s, width .25s; }
.intro-progress span.on { width: calc(26 * var(--u)); border-radius: calc(5 * var(--u)); background: var(--accent1); }
.intro-q { position: relative; }
.intro-q .q-area, .intro-keypad { width: 100%; }
/* with a keyboard (the desktop layout, a key pressed, or main.js's keyboard signals): "Type
 * your answer on the keyboard" under the card, until a digit is typed (ui/intro.js); its
 * height is held from the start so the keypad never jumps when the words land */
.intro-kbdline { display: flex; align-items: center; justify-content: center; gap: calc(8 * var(--u)); min-height: calc(24 * var(--u)); margin: calc(-4 * var(--u)) 0 calc(-2 * var(--u));
  font-weight: 800; font-size: calc(15 * var(--u)); line-height: 1.3; color: var(--text-secondary); transition: opacity .2s ease; }
.intro-kbdline.gone { opacity: 0; }
.intro-kbd-ic { flex: 0 0 auto; width: calc(24 * var(--u)); height: calc(24 * var(--u)); color: var(--text-primary); }
@media (prefers-reduced-motion: reduce) { .intro-kbdline { transition: none; } }
.intro-keypad { margin-top: calc(2 * var(--u)); }
/* intro praise shout (ui/introshout.js): the hot-streak callout (.fx-callout: gold
   Bungee, dark outline; .fx-plain for other scripts) at about 1.5x its in-game size, ON
   the question card (never over the keypad), over gold rays, a shock ring and a sparkle
   burst, while the sum and answer fade back. --fx-fit (introshout.js) shrinks a long
   word; --tilt leans it with the reading direction. Starts .12s in, so the green answer
   reads first; the sum and answer fade out with the pop, leaving the card to the word. */
.intro-qcard { position: relative; }
.intro-qcard > :is(.q-text, .q-answer) { transition: opacity .15s ease .1s; }
.intro-qcard.intro-shouting > :is(.q-text, .q-answer) { opacity: 0; }
.intro-shout { position: absolute; inset: 0; z-index: 2; pointer-events: none; display: flex; align-items: center; justify-content: center; border-radius: inherit; --tilt: -5deg; }
[dir="rtl"] .intro-shout { --tilt: 5deg; }
.intro-shout-rays { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; opacity: 0; }
.intro-shout-rays::before, .intro-shout-rays::after { content: ''; position: absolute; left: 50%; top: 50%; border-radius: 50%; }
.intro-shout-rays::before { width: calc(560 * var(--u)); height: calc(560 * var(--u)); margin: calc(-280 * var(--u)) 0 0 calc(-280 * var(--u));
  background: radial-gradient(circle, rgba(255, 214, 90, .75) 0, rgba(255, 214, 90, 0) 30%), repeating-conic-gradient(rgba(255, 190, 40, .5) 0 6deg, rgba(255, 190, 40, 0) 6deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 12%, transparent 58%); mask: radial-gradient(circle, #000 12%, transparent 58%); }
.intro-shout-rays::after { width: calc(300 * var(--u)); height: calc(300 * var(--u)); margin: calc(-150 * var(--u)) 0 0 calc(-150 * var(--u)); border: calc(4 * var(--u)) solid #FFD24A; opacity: 0; }
.intro-shout-sparks { position: absolute; left: 50%; top: 50%; }
.intro-shout-sparks i { position: absolute; left: calc(-9 * var(--u)); top: calc(-9 * var(--u)); width: calc(18 * var(--u)); height: calc(18 * var(--u)); opacity: 0; filter: drop-shadow(0 0 calc(1 * var(--u)) #2A1B05); }
.intro-shout-sparks i::before { content: ''; position: absolute; inset: 0; background: #FFC21A; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); }
.intro-shout-sparks i:nth-child(3n+2)::before { background: #FF8A3D; }
.intro-shout-sparks i:nth-child(3n)::before { background: #FFFFFF; }
.intro-shout .intro-shout-word { position: relative; z-index: 1; opacity: 0; transform: rotate(var(--tilt)); font-size: calc(44 * var(--u) * var(--fx-fit, 1)); padding: calc(6 * var(--u)) calc(16 * var(--u)) calc(5 * var(--u));
  border-radius: calc(16 * var(--u)); background: var(--cel-warm); border: calc(3 * var(--u)) solid var(--stroke); box-shadow: 0 calc(5 * var(--u)) 0 0 var(--stroke); }
/* other scripts: a touch larger (no all-caps Bungee width to carry them) */
.intro-shout .intro-shout-word.fx-plain { font-size: calc(50 * var(--u) * var(--fx-fit, 1)); }
/* a long phrase on two balanced lines (introshout.js splits it): tighter leading */
.intro-shout .intro-shout-word.two { line-height: 1; }
.intro-shout .intro-shout-word.two.fx-plain { line-height: 1.15; }
.intro-shout .intro-shout-word.two > span { display: block; }
.intro-shout.go .intro-shout-word { animation: introShout 1s cubic-bezier(.2, .9, .3, 1) .12s both; }
@keyframes introShout {
  0% { opacity: 0; transform: scale(.3) rotate(calc(-3 * var(--tilt))); }
  15% { opacity: 1; transform: scale(1.2) rotate(var(--tilt)); }
  26% { transform: scale(.94) rotate(var(--tilt)); }
  36% { transform: scale(1) rotate(var(--tilt)); }
  82% { opacity: 1; transform: scale(1) rotate(var(--tilt)); }
  100% { opacity: 0; transform: scale(1.1) rotate(var(--tilt)); } }
.intro-shout.go .intro-shout-rays { animation: introShoutFade 1s ease-out .12s both; }
.intro-shout.go .intro-shout-rays::before { animation: introRays 1s cubic-bezier(.2, .8, .3, 1) .12s both; }
@keyframes introRays { 0% { transform: scale(.15) rotate(-40deg); } 30% { transform: scale(1) rotate(0deg); } 100% { transform: scale(1.06) rotate(18deg); } }
.intro-shout.go .intro-shout-rays::after { animation: introRing .5s ease-out .12s both; }
@keyframes introRing { 0% { opacity: .95; transform: scale(.15); } 100% { opacity: 0; transform: scale(1); } }
.intro-shout.go .intro-shout-sparks i { animation: introSpark .7s cubic-bezier(.15, .75, .35, 1) .16s both; }
@keyframes introSpark { 0% { opacity: 1; transform: translate(0, 0) scale(.3) rotate(0deg); } 70% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(var(--x) * var(--u)), calc(var(--y) * var(--u))) scale(1) rotate(90deg); } }
@keyframes introShoutFade { 0% { opacity: 0; } 14% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
/* Celebrations off / reduced motion: the word fades in and out in place over a still
   gold glow (no pop, rays, ring or sparkles), still large, tilted and clear */
.intro-shout.calm .intro-shout-sparks, .intro-shout.calm .intro-shout-rays::after { display: none; }
.intro-shout.calm .intro-shout-rays::before { background: radial-gradient(circle, rgba(255, 214, 90, .7) 0, rgba(255, 214, 90, 0) 36%); }
.intro-shout.calm.go .intro-shout-word { animation: introShoutFade 1s ease-out .12s both; }
.intro-shout.calm.go .intro-shout-rays::before { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .intro-shout-sparks, .intro-shout-rays::after { display: none; }
  .intro-shout-rays::before { background: radial-gradient(circle, rgba(255, 214, 90, .7) 0, rgba(255, 214, 90, 0) 36%); }
  .intro-shout.go .intro-shout-word { animation: introShoutFade 1s ease-out .12s both; }
  .intro-shout.go .intro-shout-rays::before { animation: none; }
}
/* setup step */
.intro-burst { animation: introPop .55s cubic-bezier(.2,.8,.3,1.25) both; }
.intro-card { width: 100%; padding: calc(16 * var(--u)); display: flex; flex-direction: column; gap: calc(12 * var(--u)); }
.intro-opt-row { display: flex; align-items: center; justify-content: space-between; gap: calc(12 * var(--u)); }
.intro-opt-label { display: flex; flex-direction: column; text-align: left; }
.intro-opt-label b { color: var(--text-primary); font-size: calc(16 * var(--u)); }
.intro-opt-label span { color: var(--text-secondary); font-size: calc(12.5 * var(--u)); }
.intro-install { width: 100%; }
.intro-ioshint { font-size: calc(13 * var(--u)); color: var(--text-secondary); line-height: 1.4; }
.intro-ioshint b { color: var(--text-primary); }

/* ============ logo tap — 16 random fun animations (Android parity) ============ */
.menu-title { transform-origin: center; will-change: transform; }
/* (reduced motion: a tap on the wordmark answers with a still fade instead of a moving animation; 22 Nov) */
@media (prefers-reduced-motion: reduce) { .menu-title[class*="logo-anim-"] { animation: la-calm .45s ease !important; } }
@keyframes la-calm { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.logo-anim-spin { animation: la-spin .8s ease; }
@keyframes la-spin { to { transform: rotate(360deg); } }
.logo-anim-zoom { animation: la-zoom .6s ease; }
@keyframes la-zoom { 0%,100% { transform: scale(1); } 50% { transform: scale(1.35); } }
.logo-anim-bounce { animation: la-bounce .9s; }
@keyframes la-bounce { 0%,20%,53%,80%,100% { transform: translateY(0); } 40%,43% { transform: translateY(-26px); } 70% { transform: translateY(-13px); } 90% { transform: translateY(-4px); } }
.logo-anim-wobble { animation: la-wobble .9s; }
@keyframes la-wobble { 0%,100% { transform: none; } 15% { transform: translateX(-18px) rotate(-5deg); } 30% { transform: translateX(14px) rotate(4deg); } 45% { transform: translateX(-10px) rotate(-3deg); } 60% { transform: translateX(7px) rotate(2deg); } 75% { transform: translateX(-4px) rotate(-1deg); } }
.logo-anim-shake { animation: la-shake .7s; }
@keyframes la-shake { 0%,100% { transform: translateX(0); } 10%,30%,50%,70%,90% { transform: translateX(-9px); } 20%,40%,60%,80% { transform: translateX(9px); } }
.logo-anim-flipx { animation: la-flipx .85s ease; }
@keyframes la-flipx { 0% { transform: perspective(500px) rotateY(0); } 100% { transform: perspective(500px) rotateY(360deg); } }
.logo-anim-flipy { animation: la-flipy .85s ease; }
@keyframes la-flipy { 0% { transform: perspective(500px) rotateX(0); } 100% { transform: perspective(500px) rotateX(360deg); } }
.logo-anim-tada { animation: la-tada 1s; }
@keyframes la-tada { 0% { transform: scale(1); } 10%,20% { transform: scale(.9) rotate(-3deg); } 30%,50%,70%,90% { transform: scale(1.1) rotate(3deg); } 40%,60%,80% { transform: scale(1.1) rotate(-3deg); } 100% { transform: scale(1) rotate(0); } }
.logo-anim-rubber { animation: la-rubber .9s; }
@keyframes la-rubber { 0% { transform: scale(1,1); } 30% { transform: scale(1.25,.75); } 40% { transform: scale(.75,1.25); } 50% { transform: scale(1.15,.85); } 65% { transform: scale(.95,1.05); } 75% { transform: scale(1.05,.95); } 100% { transform: scale(1,1); } }
.logo-anim-jello { animation: la-jello .9s; }
@keyframes la-jello { 0%,11%,100% { transform: none; } 22% { transform: skewX(-12deg) skewY(-12deg); } 33% { transform: skewX(6deg) skewY(6deg); } 44% { transform: skewX(-3deg) skewY(-3deg); } 55% { transform: skewX(1.5deg) skewY(1.5deg); } }
.logo-anim-heartbeat { animation: la-heart .9s ease; }
@keyframes la-heart { 0% { transform: scale(1); } 14% { transform: scale(1.22); } 28% { transform: scale(1); } 42% { transform: scale(1.22); } 70%,100% { transform: scale(1); } }
.logo-anim-swing { animation: la-swing .8s ease; transform-origin: top center; }
@keyframes la-swing { 20% { transform: rotate(13deg); } 40% { transform: rotate(-9deg); } 60% { transform: rotate(5deg); } 80% { transform: rotate(-3deg); } 100% { transform: rotate(0); } }
.logo-anim-squish { animation: la-squish .6s ease; }
@keyframes la-squish { 0%,100% { transform: scale(1,1); } 50% { transform: scale(1.28,.68); } }
.logo-anim-stretch { animation: la-stretch .6s ease; }
@keyframes la-stretch { 0%,100% { transform: scale(1,1); } 50% { transform: scale(.78,1.32); } }
.logo-anim-drop { animation: la-drop .8s cubic-bezier(.3,1.4,.5,1); }
@keyframes la-drop { 0% { transform: translateY(-32px); opacity: .55; } 60% { transform: translateY(7px); } 80% { transform: translateY(-3px); } 100% { transform: translateY(0); opacity: 1; } }
.logo-anim-tilt { animation: la-tilt .7s ease; }
@keyframes la-tilt { 0%,100% { transform: rotate(0); } 35% { transform: rotate(-8deg); } 70% { transform: rotate(5deg); } }

/* ---- share sheet (desktop fallback when Web Share API is unavailable) ---- */
.share-sheet { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: calc(20 * var(--u)); background: rgba(6,8,14,0.6); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.share-card { width: 100%; max-width: calc(340 * var(--u)); display: flex; flex-direction: column; gap: calc(12 * var(--u)); padding: calc(24 * var(--u)) calc(22 * var(--u)); text-align: center; }
.share-title { font-size: calc(22 * var(--u)); color: var(--text-primary); margin-bottom: calc(2 * var(--u)); }
/* icon-only share grid — logos read on their own, no labels */
.share-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: calc(12 * var(--u)); }
.share-tile { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: calc(9 * var(--u));
  background: color-mix(in srgb, var(--text-primary) 7%, transparent); border: none; border-radius: calc(16 * var(--u));
  cursor: pointer; transition: transform .1s ease, background .15s ease; -webkit-tap-highlight-color: transparent; }
.share-tile:hover { background: color-mix(in srgb, var(--text-primary) 12%, transparent); }
.share-tile:active { transform: scale(0.9); }
.share-ico { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.share-ico svg { width: 100%; height: 100%; display: block; }
.share-close { background: none; border: none; color: var(--text-secondary); font-weight: 700; font-size: calc(14 * var(--u)); padding: calc(8 * var(--u)); margin-top: calc(2 * var(--u)); }
/* WeChat scan-to-share QR */
.qr-box { width: calc(216 * var(--u)); height: calc(216 * var(--u)); margin: calc(4 * var(--u)) auto 0; background: #fff; border-radius: calc(10 * var(--u)); padding: calc(8 * var(--u)); box-shadow: 0 calc(4 * var(--u)) calc(14 * var(--u)) rgba(0,0,0,.2); }
.qr-box svg { display: block; }
.qr-hint { color: var(--text-secondary); font-size: calc(13 * var(--u)); font-weight: 700; margin-top: calc(2 * var(--u)); }
/* shared modal corner-X (added by lib/modal.js trapModal) — flips side in RTL */
.modal-x { position: absolute; top: calc(9 * var(--u)); inset-inline-end: calc(9 * var(--u)); z-index: 3;
  width: calc(30 * var(--u)); height: calc(30 * var(--u)); padding: calc(6 * var(--u)); border: none; cursor: pointer;
  background: color-mix(in srgb, var(--text-primary) 9%, transparent); border-radius: 50%; color: var(--text-secondary);
  -webkit-tap-highlight-color: transparent; transition: transform .1s ease, background .15s ease; }
.modal-x:hover { background: color-mix(in srgb, var(--text-primary) 16%, transparent); }
.modal-x:active { transform: scale(0.88); }
.modal-x svg { width: 100%; height: 100%; display: block; }
/* Offline download banner (lib/offline.js): flush and full width at the very top,
 * "Downloading offline files" + the real percentage + a progress line along the
 * bottom edge, then "Ready for offline play" for a moment. Theme tokens only, so it
 * follows every theme and brand. While it shows, html.dl-on pads the body down by
 * --dl-bar-h and shrinks the app column to match, so it never covers a screen
 * header (the banner also covers the safe-area inset, which every header already
 * pads for). html.dl-anim animates that move both ways. Below the modal overlays
 * (z 40+), so a dialog's scrim still dims it. */
:root { --dl-bar-h: clamp(42px, calc(46 * var(--u)), 50px); }
html.dl-on body { padding-top: var(--dl-bar-h); }
/* without dvh: 100% of the body, whose box (border-box) already leaves out the strip; the
 * dvh twins sit in @supports, as .app explains */
html.dl-on .app { height: 100%; }
@supports (height: 1dvh) { html.dl-on .app { height: calc(100dvh - var(--dl-bar-h)); } }
@media (min-width: 760px) and (pointer: fine) {
  html.dl-on .app { height: min(100%, calc(1.9 * var(--col))); }
  @supports (height: 1dvh) { html.dl-on .app { height: min(calc(100dvh - var(--dl-bar-h)), calc(1.9 * var(--col))); } }
}
@media (min-width: 700px) and (pointer: coarse) {
  html.dl-on .app { height: min(100%, calc(1.85 * var(--col))); }
  @supports (height: 1dvh) { html.dl-on .app { height: min(calc(100dvh - var(--dl-bar-h)), calc(1.85 * var(--col))); } }
}
html.dl-anim body { transition: padding-top .38s cubic-bezier(.22,.8,.24,1); }
html.dl-anim .app { transition: height .38s cubic-bezier(.22,.8,.24,1); }
#mw-dl-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 39; pointer-events: none;
  height: calc(var(--dl-bar-h) + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px);
  background: var(--accent1); color: var(--on-accent); border-bottom: 2px solid var(--stroke);
  transform: translateY(-100%); visibility: hidden;
  transition: transform .38s cubic-bezier(.22,.8,.24,1), visibility 0s linear .38s; }
#mw-dl-bar.on { transform: none; visibility: visible; transition: transform .38s cubic-bezier(.22,.8,.24,1), visibility 0s; }
#mw-dl-bar .dl-row { height: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px 4px;
  display: flex; align-items: center; justify-content: center; gap: 10px; }
#mw-dl-bar .dl-ic { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--on-accent); color: var(--accent1); }
#mw-dl-bar .dl-svg { grid-area: 1 / 1; width: 17px; height: 17px; fill: none; stroke: currentColor;
  stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
#mw-dl-bar .dl-arrow { animation: dlBob 1.1s ease-in-out infinite; }
#mw-dl-bar .dl-done { display: none; }
#mw-dl-bar.ready .dl-down { display: none; }
#mw-dl-bar.ready .dl-done { display: block; }
#mw-dl-bar.ready .dl-ic { animation: dlPop .45s cubic-bezier(.3,1.6,.5,1) both; }
#mw-dl-bar .dl-label { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: clamp(14px, calc(15 * var(--u)), 16px); font-weight: 800; line-height: 1.25; letter-spacing: .01em; }
#mw-dl-bar .dl-pct { flex: none; min-width: 3.4em; text-align: center; padding: 2px 8px; border-radius: 999px;
  font-size: clamp(13px, calc(14 * var(--u)), 15px); font-weight: 900; line-height: 1.25; font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--on-accent) 13%, transparent); }
#mw-dl-bar.ready .dl-pct, #mw-dl-bar.dl-tight .dl-pct { display: none; }
#mw-dl-bar.dl-tighter .dl-label { font-size: 13px; letter-spacing: 0; }
@media (max-width: 380px) { #mw-dl-bar .dl-row { padding-inline: 12px; gap: 8px; } }
#mw-dl-bar .dl-track { position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: color-mix(in srgb, var(--on-accent) 16%, transparent); overflow: hidden; }
#mw-dl-bar .dl-fill { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; width: 3%;
  background: linear-gradient(90deg, var(--on-accent) 0%, var(--on-accent) 35%, color-mix(in srgb, var(--on-accent) 45%, var(--accent1)) 50%, var(--on-accent) 65%, var(--on-accent) 100%);
  background-size: 220% 100%; animation: dlFlow 1.15s linear infinite; transition: width .35s ease; }
[dir="rtl"] #mw-dl-bar .dl-fill { animation-direction: reverse; }
#mw-dl-bar.ready .dl-fill { animation: none; background: var(--on-accent); }
@keyframes dlFlow { from { background-position: 220% 0; } to { background-position: 0 0; } }
@keyframes dlBob { 0%, 100% { transform: translateY(-1.5px); } 50% { transform: translateY(1.5px); } }
@keyframes dlPop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  html.dl-anim body, html.dl-anim .app, #mw-dl-bar, #mw-dl-bar.on, #mw-dl-bar .dl-fill { transition: none; }
  #mw-dl-bar .dl-arrow, #mw-dl-bar .dl-fill, #mw-dl-bar.ready .dl-ic { animation: none; }
}

/* "Thinking" loader overlay: shown while a slow async step runs (e.g. switching
   language fetches a locale module). Theme-neutral scrim + soft blur. */
.thinking-ov { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center;
  justify-content: center; background: rgba(10,20,40,.10); backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px); opacity: 0; transition: opacity .18s ease; }
.thinking-ov.in { opacity: 1; }
.thinking-brain { width: calc(120 * var(--u)); height: calc(120 * var(--u)); }

/* Inline brand loader: a smaller copy for in-place loading states (leaderboard lists,
 * etc.), centred in its container in place of "Loading...". The padding also leaves
 * room for the mark's glow, which reaches 6% outside its box. */
.brain-inline { display: flex; align-items: center; justify-content: center;
  padding: calc(28 * var(--u)) 0; }
.brain-inline .ld { width: calc(72 * var(--u)); height: calc(72 * var(--u)); }

/* Operator Morph: the brand busy mark (busy overlay, inline loader, first-load splash).
 * One chunky operator on an icon-style tile turns + into x, closes into -, grows two
 * dots into a divide sign and joins them back into +, one 2 s loop with even holds.
 * The glyph is --text-primary (with a darker underside, like the app icon's 3D
 * operators), the tile is --face, the soft glow is --accent1 shaped like the tile,
 * so it follows every theme. Sized purely by its square wrapper (all %), animates
 * transform and opacity only, no color-mix(), no inset shorthand (old WebViews and
 * iOS Safari). Markup lives in ui/brainloader.js (BRAIN) and the #splash in
 * index.html: keep the two copies identical. */
.ld-morph { position: relative; width: 100%; height: 100%; isolation: isolate; }
.ld-morph::before, .ld-morph .ld-t::before { content: ""; position: absolute; }
.ld-morph::before { top: -6%; right: -6%; bottom: -6%; left: -6%; background: var(--accent1); opacity: .4;
  animation: ldmorphG 2s ease-in-out infinite alternate;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cfilter id='f' x='-.5' y='-.5' width='2' height='2'%3E%3CfeGaussianBlur stdDeviation='4'/%3E%3C/filter%3E%3Crect x='10.5' y='10.5' width='79' height='79' rx='23' filter='url(%23f)'/%3E%3C/svg%3E");
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cfilter id='f' x='-.5' y='-.5' width='2' height='2'%3E%3CfeGaussianBlur stdDeviation='4'/%3E%3C/filter%3E%3Crect x='10.5' y='10.5' width='79' height='79' rx='23' filter='url(%23f)'/%3E%3C/svg%3E"); }
.ld-morph .ld-t { position: absolute; top: 8%; right: 8%; bottom: 8%; left: 8%; border-radius: 28%;
  background: linear-gradient(#ffffff1f, #0000000a) var(--face, #fff);
  box-shadow: inset 0 0 0 1px #80808038, 0 1px 2px #0000001a; }
.ld-morph .ld-t::before { top: 64%; right: 6%; bottom: -12%; left: 6%; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, #0000004d, #0000); }
.ld-morph b { position: absolute; top: 0; right: 0; bottom: 0; left: 0; transform: translateY(-1.2%); }
.ld-morph .ld-x { transform: translateY(1.4%); }   /* the darker underside layer */
.ld-morph b * { position: absolute; top: 43.25%; left: 27%; width: 46%; height: 13.5%; border-radius: 999px;
  background: linear-gradient(#ffffff1c, #ffffff1c) var(--text-primary, #222);
  animation: ldmorphA 2s cubic-bezier(.34, 1.32, .64, 1) infinite; }
.ld-morph .ld-x * { background: linear-gradient(#00000070, #00000070) var(--text-primary, #222); }
.ld-morph i + i { transform: rotate(90deg); animation-name: ldmorphB; }
.ld-morph u { top: 22.3%; left: 43.25%; width: 13.5%; transform: scale(0); animation-name: ldmorphD;
  animation-timing-function: cubic-bezier(.25, 1.6, .5, 1); }
.ld-morph u + u { top: 64.2%; }
.ld-morph .ld-x u { transform-origin: 50% 30.7%; }
@keyframes ldmorphA { 0%, 15% { transform: rotate(0); } 25%, 40% { transform: rotate(45deg); } 50%, to { transform: rotate(0); } }
@keyframes ldmorphB { 0%, 15% { transform: rotate(90deg) scale(1); } 25%, 40% { transform: rotate(135deg) scale(1); }
  50% { transform: rotate(180deg) scale(1); } 53% { transform: rotate(180deg) scale(0); }
  56%, 92% { transform: rotate(270deg) scale(0); } to { transform: rotate(270deg) scale(1); } }
@keyframes ldmorphD { 0%, 65% { transform: scale(0); } 75% { transform: scale(1); }
  90% { transform: scale(1); animation-timing-function: ease-in; } 93%, to { transform: scale(0); } }
@keyframes ldmorphG { to { opacity: .8; } }
@media (prefers-reduced-motion: reduce) {
  /* a still +: no turning, no popping. Only the glow keeps breathing (opacity, no movement);
     the tile and glyph stay fully opaque so the mark never looks disabled. */
  .ld-morph b i, .ld-morph u { animation: none; }
}
/* Windows contrast themes would repaint every part as Canvas and hide the mark: keep its colours */
@media (forced-colors: active) { .ld-morph { forced-color-adjust: none; } }
/* the Galaxy Top Pilots panel is a fixed navy space panel: give its loader space colours
   instead of the theme face (a white tile on navy otherwise) */
.gm-lb-rows .ld-morph { --face: #16264a; --text-primary: #eaf6ff; --accent1: #4fc3f7; }

/* Progress / Mastery screen — spaced-repetition "facts mastered" map */
.mastery-screen { display: flex; flex-direction: column; height: 100%; }
.m-title { font-size: calc(26 * var(--u)); color: var(--text-primary); flex: 1; text-align: center; }
.m-spacer { width: calc(44 * var(--u)); }
.m-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: calc(8 * var(--u)) calc(12 * var(--u)) calc(22 * var(--u)); display: flex; flex-direction: column; gap: calc(14 * var(--u)); }
.m-card { padding: calc(14 * var(--u)); }
.m-sub { font-weight: 900; font-size: calc(20 * var(--u)); color: var(--text-primary); margin-bottom: calc(3 * var(--u)); }
.m-count { color: var(--text-secondary); font-weight: 800; margin-bottom: calc(12 * var(--u)); }
.m-grid { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: calc(2 * var(--u)); width: 100%; }
.m-cell { aspect-ratio: 1 / 1; border-radius: calc(4 * var(--u)); }
.m-cell.m-hd { background: transparent !important; display: flex; align-items: center; justify-content: center; font-size: calc(11 * var(--u)); font-weight: 800; color: var(--text-secondary); }
.m-legend { display: flex; gap: calc(14 * var(--u)); margin-top: calc(12 * var(--u)); flex-wrap: wrap; font-size: calc(13 * var(--u)); color: var(--text-secondary); font-weight: 700; }
.m-legend i { display: inline-block; width: calc(14 * var(--u)); height: calc(14 * var(--u)); border-radius: 4px; margin-right: calc(5 * var(--u)); vertical-align: -2px; }
.m-ops { display: flex; flex-direction: column; gap: calc(10 * var(--u)); }
.m-op { display: flex; align-items: center; gap: calc(10 * var(--u)); }
.m-op-sym { width: calc(28 * var(--u)); font-size: calc(22 * var(--u)); font-weight: 900; color: var(--text-primary); text-align: center; }
.m-op-bar { flex: 1; height: calc(16 * var(--u)); border-radius: calc(8 * var(--u)); background: var(--panel-face); overflow: hidden; }
.m-op-fill { height: 100%; background: linear-gradient(90deg, #FFB74D, #66BB6A); border-radius: calc(8 * var(--u)); }
.m-op-num { width: calc(34 * var(--u)); text-align: right; font-weight: 900; color: var(--text-primary); }
.m-empty { text-align: center; color: var(--text-secondary); font-weight: 700; padding: calc(16 * var(--u)); }

/* results-screen mastery celebration + Progress review CTA */
.score-mastery { text-align: center; display: flex; flex-direction: column; gap: calc(4 * var(--u)); margin-top: calc(4 * var(--u)); }
.sm-line { font-weight: 800; font-size: calc(16 * var(--u)); }
.sm-master { color: #1A8F3C; }
.sm-strong { color: var(--text-secondary); }
.sm-adapt { color: var(--text-primary); }
.sm-adapt::before { content: '✦ '; }
.m-review { width: 100%; margin-bottom: calc(2 * var(--u)); }
/* Trouble Spots card — weak skill families with a "See how" that opens the explainer */
.m-trouble-row { display: flex; align-items: center; justify-content: space-between; gap: calc(10 * var(--u)); padding: calc(8 * var(--u)) 0; border-top: 1px solid color-mix(in srgb, var(--text-secondary) 16%, transparent); }
.m-trouble-row:first-of-type { border-top: none; }
.m-trouble-name { font-weight: 800; font-size: calc(16 * var(--u)); color: var(--text-primary); }
.m-showhow { min-width: 0; padding: calc(7 * var(--u)) calc(14 * var(--u)); font-size: calc(13 * var(--u)); }
.m-trophy { width: 100%; margin-top: calc(2 * var(--u)); display: inline-flex; align-items: center; justify-content: center; gap: calc(9 * var(--u)); }
.m-trophy-ico { flex: 0 0 auto; color: var(--accent1); }

/* Math Adapt AI™ card — interactive per-mode difficulty (Progress + Settings) */
.adapt-ai { margin-bottom: calc(16 * var(--u)); }
.m-scroll .adapt-ai { margin-bottom: 0; }   /* m-scroll provides the gap in Progress */
.adapt-ai-head { display: flex; align-items: center; justify-content: space-between; gap: calc(8 * var(--u)); margin-bottom: calc(6 * var(--u)); }
.adapt-ai-name { font-weight: 900; font-size: calc(20 * var(--u)); color: var(--text-primary); letter-spacing: -0.01em; }
.adapt-ai-tm { font-size: calc(10 * var(--u)); vertical-align: super; opacity: 0.65; margin-left: 1px; }
.adapt-ai-chip { display: inline-flex; align-items: center; gap: calc(5 * var(--u)); flex: 0 0 auto; font-weight: 900; font-size: calc(11 * var(--u)); letter-spacing: 0.14em; color: #fff; background: linear-gradient(135deg, #6E50F5, #2470D6); padding: calc(3 * var(--u)) calc(9 * var(--u)); border-radius: 999px; box-shadow: 0 calc(2 * var(--u)) calc(8 * var(--u)) rgba(90, 70, 255, 0.34); }
.adapt-ai-dot { width: calc(6 * var(--u)); height: calc(6 * var(--u)); border-radius: 50%; background: #fff; animation: aiDot 1.4s ease-in-out infinite; }
@keyframes aiDot { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.adapt-ai-blurb { font-size: calc(13.5 * var(--u)); color: var(--text-secondary); line-height: 1.45; margin-bottom: calc(10 * var(--u)); }
/* "you can tap the bars" hint — a faint accent chip so the override is discoverable */
.adapt-ai-hint { display: inline-flex; align-items: center; gap: calc(6 * var(--u)); margin-bottom: calc(12 * var(--u)); padding: calc(5 * var(--u)) calc(11 * var(--u)); border-radius: 999px; background: color-mix(in srgb, var(--accent1) 32%, transparent); font-size: calc(12.5 * var(--u)); font-weight: 700; line-height: 1.3; color: var(--text-primary); }
.adapt-ai-tap { flex: 0 0 auto; }
.adapt-ai-row { display: flex; align-items: center; justify-content: space-between; gap: calc(10 * var(--u)); padding: calc(8 * var(--u)) 0; border-top: 1px solid color-mix(in srgb, var(--text-secondary) 16%, transparent); }
.adapt-ai-row:first-of-type { border-top: none; }
.adapt-ai-mode { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; font-size: calc(15 * var(--u)); color: var(--text-primary); }
.adapt-ai-ctl { flex: 0 0 auto; display: flex; align-items: center; gap: calc(9 * var(--u)); }
.adapt-ai-lvl { font-weight: 900; font-size: calc(11 * var(--u)); letter-spacing: 0.04em; text-transform: uppercase; padding: calc(3 * var(--u)) calc(9 * var(--u)); border-radius: 999px; color: #1c1408; white-space: nowrap; min-width: calc(56 * var(--u)); text-align: center; }
.adapt-ai-lvl.d1 { background: #BFE6C5; } .adapt-ai-lvl.d2 { background: #FFE08A; } .adapt-ai-lvl.d3 { background: #FFC078; } .adapt-ai-lvl.d4 { background: #F4A0A0; }
.adapt-ai-meter { display: flex; align-items: flex-end; gap: calc(3 * var(--u)); padding: 0 calc(5 * var(--u)); border-radius: calc(9 * var(--u)); background: color-mix(in srgb, var(--text-secondary) 9%, transparent); }
.adapt-ai-bar { -webkit-appearance: none; appearance: none; background: none; border: none; padding: calc(5 * var(--u)) calc(2 * var(--u)); display: flex; align-items: flex-end; cursor: pointer; }
.adapt-ai-bar .bar { display: block; width: calc(7 * var(--u)); border-radius: calc(3 * var(--u)); background: color-mix(in srgb, var(--text-secondary) 28%, transparent); transition: background .15s ease; }
.adapt-ai-bar .bar.h1 { height: calc(9 * var(--u)); } .adapt-ai-bar .bar.h2 { height: calc(14 * var(--u)); } .adapt-ai-bar .bar.h3 { height: calc(19 * var(--u)); } .adapt-ai-bar .bar.h4 { height: calc(24 * var(--u)); }
.adapt-ai-bar .bar.on.d1 { background: #5BBE73; } .adapt-ai-bar .bar.on.d2 { background: #E8B23A; } .adapt-ai-bar .bar.on.d3 { background: #E8902E; } .adapt-ai-bar .bar.on.d4 { background: #D85A5A; }
.adapt-ai-progress { width: 100%; margin-top: calc(10 * var(--u)); background: none; border: none; color: var(--text-primary); opacity: 0.8; font-weight: 800; font-size: calc(13.5 * var(--u)); text-align: right; text-decoration: underline; cursor: pointer; padding: calc(6 * var(--u)) 0 0; }

/* Score screen: heart-rate-MONITOR trajectory of recent pace (per mode) */
.traj-panel { margin-top: calc(8 * var(--u)); border-radius: calc(14 * var(--u)); background: #0A1119; padding: calc(7 * var(--u)) calc(10 * var(--u)) calc(7 * var(--u)); border: 1px solid rgba(255, 255, 255, 0.07); box-shadow: inset 0 0 calc(28 * var(--u)) rgba(0, 0, 0, 0.55); }
.traj-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: calc(4 * var(--u)); }
.traj-title { display: flex; align-items: center; gap: calc(6 * var(--u)); font-weight: 900; font-size: calc(11 * var(--u)); letter-spacing: 0.09em; text-transform: uppercase; color: #C9D6E2; }
.traj-led { width: calc(7 * var(--u)); height: calc(7 * var(--u)); border-radius: 50%; background: #C9D6E2; animation: trajLed 1.1s ease-in-out infinite; }
.traj-runs { font-weight: 800; font-size: calc(11 * var(--u)); color: #8394A4; font-variant-numeric: tabular-nums; }
.traj-canvas { display: block; width: 100%; height: calc(56 * var(--u)); border-radius: calc(7 * var(--u)); }
.traj-cap { margin-top: calc(4 * var(--u)); font-weight: 800; font-size: calc(12 * var(--u)); line-height: 1.25; text-align: center; color: #C9D6E2; }
.traj-up .traj-led { background: #33F2A0; box-shadow: 0 0 calc(9 * var(--u)) #33F2A0; }
.traj-down .traj-led { background: #FF6B79; box-shadow: 0 0 calc(9 * var(--u)) #FF6B79; }
.traj-flat .traj-led { background: #FFC36B; box-shadow: 0 0 calc(9 * var(--u)) #FFC36B; }
.traj-up .traj-cap { color: #33F2A0; }
.traj-down .traj-cap { color: #FF6B79; }
.traj-flat .traj-cap { color: #FFC36B; }
@keyframes trajLed { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Progress: mastery-level card + tappable table rows */
.m-levelcard { padding-bottom: calc(16 * var(--u)); }
.m-lvl-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: calc(8 * var(--u)); }
.m-lvl { font-weight: 900; font-size: calc(20 * var(--u)); color: var(--text-primary); }
.m-lvl-n { font-weight: 800; color: var(--text-secondary); font-size: calc(14 * var(--u)); }
.m-lvl-bar { height: calc(16 * var(--u)); border-radius: calc(8 * var(--u)); background: var(--panel-face); overflow: hidden; }
.m-lvl-fill { height: 100%; border-radius: calc(8 * var(--u)); background: linear-gradient(90deg, #FFB74D, #66BB6A); transition: width .4s ease; }
.m-tap { text-align: center; color: var(--text-secondary); font-size: calc(12 * var(--u)); margin-top: calc(10 * var(--u)); }
.m-cell.m-row { cursor: pointer; transition: color .12s; }
.m-cell.m-row:active { color: var(--accent1); transform: scale(1.18); }

/* first-visit Gains explainer (Max) */
.mi-overlay { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: calc(24 * var(--u)); background: rgba(0,0,0,0.6); opacity: 0; transition: opacity .2s ease; }
.mi-overlay.in { opacity: 1; }
.mi-card { width: 100%; max-width: calc(360 * var(--u)); display: flex; flex-direction: column; align-items: center; gap: calc(8 * var(--u)); padding: calc(24 * var(--u)); text-align: center; transform: translateY(calc(14 * var(--u))) scale(.97); transition: transform .25s ease; }
.mi-overlay.in .mi-card { transform: none; }
.mi-avatar { width: calc(96 * var(--u)); height: calc(96 * var(--u)); }
.mi-avatar svg { width: 100%; height: 100%; display: block; }
.mi-title { font-size: calc(24 * var(--u)); color: var(--text-primary); }
.mi-name { font-weight: 900; color: var(--accent1); font-size: calc(15 * var(--u)); margin-top: calc(-4 * var(--u)); }
.mi-lines { display: flex; flex-direction: column; gap: calc(11 * var(--u)); text-align: left; margin: calc(8 * var(--u)) 0 calc(4 * var(--u)); }
.mi-line { font-size: calc(15 * var(--u)); color: var(--text-primary); font-weight: 600; line-height: 1.4; }
.mi-dots { display: inline-flex; gap: 3px; margin-right: calc(6 * var(--u)); vertical-align: -1px; }
.mi-dots i { width: calc(12 * var(--u)); height: calc(12 * var(--u)); border-radius: 3px; display: inline-block; }
.mi-ok { width: 100%; margin-top: calc(8 * var(--u)); }
.m-levelcard, .m-opcard { position: relative; cursor: pointer; }
.m-help { position: absolute; top: calc(10 * var(--u)); inset-inline-end: calc(12 * var(--u)); width: calc(22 * var(--u)); height: calc(22 * var(--u)); border-radius: 50%; background: var(--panel-face); color: var(--text-secondary); font-weight: 900; font-size: calc(13 * var(--u)); display: flex; align-items: center; justify-content: center; border: calc(2 * var(--u)) solid var(--stroke); }
.m-levelcard .m-lvl-n { padding-inline-end: calc(38 * var(--u)); }
.rd-hudrow .rd-help { align-self: center; margin: 0; }   /* the briefing "?" (Prime Raiders how-to) */

/* ---- Max's per-mode intro (coachintro.js) ---- */
.ci-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(8,10,20,0.7); backdrop-filter: blur(calc(3 * var(--u))); opacity: 0; transition: opacity .2s ease; padding: calc(20 * var(--u)); }
.ci-overlay.in { opacity: 1; }
.ci-card { padding: calc(22 * var(--u)); display: flex; flex-direction: column; align-items: center; gap: calc(8 * var(--u)); text-align: center; max-width: calc(380 * var(--u)); }
.ci-ava { width: calc(78 * var(--u)); height: calc(78 * var(--u)); }
/* Max blinks — the shades band thins to a line and back (his "eyes" closing).
   .max-blink toggled on any avatar container (intro card, score verdict, …). */
.max-eyes { transform-box: fill-box; transform-origin: center; }
.max-blink .max-eyes { animation: maxEyesBlink 0.2s ease; }
@keyframes maxEyesBlink { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(0.1); } }
.ci-name { font-weight: 900; font-size: calc(12 * var(--u)); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-secondary); margin-top: calc(-2 * var(--u)); }
.ci-speak { font-weight: 800; font-size: calc(20 * var(--u)); line-height: 1.34; color: var(--text-primary); min-height: calc(26 * var(--u)); }
.ci-science { font-size: calc(13.5 * var(--u)); line-height: 1.34; color: var(--text-primary); background: color-mix(in srgb, var(--accent1) 22%, var(--face)); border: calc(1.5 * var(--u)) solid color-mix(in srgb, var(--accent1) 45%, transparent); border-radius: calc(12 * var(--u)); padding: calc(9 * var(--u)) calc(12 * var(--u)); }
.ci-sci-tag { font-weight: 900; color: color-mix(in srgb, var(--accent1) 38%, var(--text-primary)); text-transform: uppercase; font-size: calc(11.5 * var(--u)); letter-spacing: 0.05em; }
.ci-go { margin-top: calc(4 * var(--u)); min-width: calc(180 * var(--u)); }
/* the announcement's secondary action ("Maybe later") */
.ci-later { min-height: 44px; padding: 0 calc(14 * var(--u)); margin-top: calc(-4 * var(--u)); background: transparent; border: none; font: inherit; font-weight: 800; font-size: calc(14 * var(--u)); color: var(--text-primary); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
/* (the reminder ask's own styles: styles/remask.css, lazy) */
/* "?" that replays a mode's briefing (coachintro.js mountBriefingHelp): the top
   corner opposite the back button on a mode menu or the countdown; in the Galaxy
   map header it sits next to the speaker (.brief-q-dark). */
.brief-q { position: absolute; top: max(calc(14 * var(--u)), env(safe-area-inset-top)); inset-inline-end: calc(14 * var(--u)); z-index: 6; width: calc(44 * var(--u)); height: calc(44 * var(--u)); min-width: 44px; min-height: 44px; padding: 0; border: none; background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.brief-q-dot { width: calc(32 * var(--u)); height: calc(32 * var(--u)); border-radius: 50%; border: calc(2.5 * var(--u)) solid var(--stroke); background: var(--panel-face); color: var(--text-primary); font-weight: 900; font-size: calc(17 * var(--u)); line-height: 1; display: flex; align-items: center; justify-content: center; }
.brief-q:active .brief-q-dot { transform: scale(0.92); }
.brief-q.brief-q-dark { position: static; flex: 0 0 auto; align-self: flex-start; margin: calc(-3 * var(--u)) calc(-3 * var(--u)) 0; }
.brief-q-dark .brief-q-dot { width: calc(38 * var(--u)); height: calc(38 * var(--u)); background: rgba(13,23,40,0.72); border: calc(2 * var(--u)) solid #2a3a5c; color: #cfe3ff; font-size: calc(18 * var(--u)); }

/* Animated "how to solve" explainer (ui/explainer.js) — reuses the .ci card look. */
.ex-overlay { position: fixed; inset: 0; z-index: 55; display: flex; align-items: center; justify-content: center; background: rgba(8,10,20,0.72); backdrop-filter: blur(calc(3 * var(--u))); opacity: 0; transition: opacity .2s ease; padding: calc(18 * var(--u)); }
.ex-overlay.in { opacity: 1; }
.ex-card { padding: calc(16 * var(--u)) calc(16 * var(--u)) calc(20 * var(--u)); display: flex; flex-direction: column; align-items: center; gap: calc(6 * var(--u)); text-align: center; width: 100%; max-width: calc(400 * var(--u)); }
/* The original question — always visible so the player knows what they're solving. */
.ex-question { font-weight: 900; font-size: calc(26 * var(--u)); color: var(--text-primary); letter-spacing: 0.01em; margin-bottom: calc(2 * var(--u)); font-variant-numeric: tabular-nums; }
.ex-stage { position: relative; width: 100%; height: calc(196 * var(--u)); background: var(--panel-face); border-radius: calc(18 * var(--u)); overflow: hidden; box-shadow: inset 0 0 0 calc(2 * var(--u)) rgba(0,0,0,0.06); }
.ex-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.ex-ava { width: calc(70 * var(--u)); height: calc(70 * var(--u)); margin-top: calc(6 * var(--u)); }
.ex-name { font-weight: 900; font-size: calc(11 * var(--u)); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-secondary); margin-top: calc(-2 * var(--u)); }
.ex-speak { font-weight: 800; font-size: calc(19 * var(--u)); line-height: 1.32; color: var(--text-primary); min-height: calc(50 * var(--u)); display: flex; align-items: center; justify-content: center; padding: 0 calc(6 * var(--u)); }
.ex-controls { display: flex; align-items: center; justify-content: space-between; gap: calc(10 * var(--u)); margin-top: calc(6 * var(--u)); width: 100%; }
.ex-controls .ex-next { min-width: calc(116 * var(--u)); }
.ex-nav { width: calc(46 * var(--u)); height: calc(46 * var(--u)); flex: 0 0 auto; border-radius: 50%; border: none; background: var(--panel-face); color: var(--text-primary); padding: calc(11 * var(--u)); cursor: pointer; box-shadow: 0 calc(2 * var(--u)) 0 0 var(--shadow); }
.ex-nav:active { transform: translateY(calc(2 * var(--u))); box-shadow: none; }
[dir="rtl"] .ex-nav svg { transform: scaleX(-1); }   /* the explainer's Back chevron points the reading way */
.ex-dots { display: flex; gap: calc(7 * var(--u)); flex: 1 1 auto; justify-content: center; }
.ex-dot { width: calc(8 * var(--u)); height: calc(8 * var(--u)); border-radius: 50%; background: color-mix(in srgb, var(--text-secondary) 32%, transparent); transition: background .2s, transform .2s; }
.ex-dot.on { background: var(--accent1); transform: scale(1.25); }
.ex-replaylink { background: none; border: none; color: var(--text-secondary); font-weight: 800; font-size: calc(13 * var(--u)); text-decoration: underline; padding: calc(8 * var(--u)); margin-top: calc(2 * var(--u)); cursor: pointer; }
.ex-replaylink[hidden] { display: none; }
/* sparkle at the answer */
.ex-spk-host { position: absolute; width: 0; height: 0; pointer-events: none; }
.ex-spk { position: absolute; left: 0; top: 0; width: calc(8 * var(--u)); height: calc(8 * var(--u)); border-radius: 50%; transform: translate(-50%,-50%); animation: ex-spark .8s ease-out forwards; }
@keyframes ex-spark { 0% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2); } }

/* "See how →" / Skip — matching themed buttons, centred, on a 3rd-strike miss. */
.kp-actions { display: flex; gap: calc(10 * var(--u)); justify-content: center; align-items: center; flex-wrap: wrap; }
.kp-seehow, .kp-skip { padding: calc(9 * var(--u)) calc(18 * var(--u)); font-size: calc(14 * var(--u)); min-width: calc(112 * var(--u)); }

/* Offline banner — a calm, persistent top bar shown whenever the device reports
 * no connection (and on a request timeout while seemingly online). Amber, not red
 * (it's a state, not an error); slides down under the safe-area inset; the pulsing
 * dot reads as "still trying". pointer-events:none so it never blocks taps. */
/* (the persistent .net-banner was removed — offline is a first-class state now;
   main.js shows a brief one-time toast instead, and online-only features gate
   themselves contextually.) */

/* Welcome card — one-time "welcome to the new Math Workout" on the migrated app. */
.welcome-ov { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center;
  padding: calc(24 * var(--u)); background: rgba(8,12,24,.55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); opacity: 0; transition: opacity .22s ease; }
.welcome-ov.in { opacity: 1; }
.welcome-card { max-width: calc(380 * var(--u)); width: 100%; text-align: center;
  padding: calc(26 * var(--u)) calc(22 * var(--u)) calc(24 * var(--u));
  transform: translateY(calc(12 * var(--u))) scale(.97); transition: transform .25s ease; }
.welcome-ov.in .welcome-card { transform: none; }
.welcome-coach { width: calc(104 * var(--u)); height: calc(104 * var(--u)); margin: 0 auto calc(4 * var(--u)); }
.welcome-logo { font-weight: 900; font-size: calc(26 * var(--u)); letter-spacing: .04em; margin-bottom: calc(10 * var(--u)); }
.welcome-title { font-weight: 900; font-size: calc(20 * var(--u)); color: var(--text-primary); margin-bottom: calc(8 * var(--u)); }
.welcome-body { font-size: calc(14.5 * var(--u)); line-height: 1.4; color: var(--text-secondary); margin-bottom: calc(18 * var(--u)); }
.welcome-go { min-width: calc(160 * var(--u)); }

/* Self-serve "get my Pro code" recovery dialog (Settings → Pro card) */
.recover-ov { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center;
  background: rgba(10,20,40,.45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); padding: calc(20 * var(--u)); }
.recover-card { max-width: calc(380 * var(--u)); width: 100%; text-align: center; padding: calc(24 * var(--u)) calc(22 * var(--u)); }
.recover-title { font-weight: 900; font-size: calc(20 * var(--u)); color: var(--text-primary); margin-bottom: calc(8 * var(--u)); }
.recover-body { font-size: calc(14 * var(--u)); line-height: 1.45; color: var(--text-secondary); margin-bottom: calc(14 * var(--u)); }
.recover-email { width: 100%; box-sizing: border-box; padding: calc(12 * var(--u)) calc(14 * var(--u)); font-size: calc(15 * var(--u));
  border: 2px solid color-mix(in srgb, var(--text-secondary) 35%, transparent); border-radius: calc(12 * var(--u));
  background: #fff; color: #15223d; margin-bottom: calc(12 * var(--u)); text-align: center; }
.recover-send { width: 100%; }
.recover-msg { min-height: calc(18 * var(--u)); margin-top: calc(10 * var(--u)); font-size: calc(13.5 * var(--u)); font-weight: 800; }
.recover-msg.ok { color: #2E9E5B; }
.recover-msg.err { color: #d23b3b; }
.recover-hint { margin-top: calc(14 * var(--u)); font-size: calc(12.5 * var(--u)); color: var(--text-secondary); opacity: .85; line-height: 1.4; }

/* ================================================================
 * Techniques Academy: the small boot-time surfaces (the Academy's own screens are
 * styled by styles/academy-screens.css + academy-components.css, loaded lazily).
 * Logical properties only, so Arabic / Urdu mirror the chrome but never the math.
 * ================================================================ */
/* Progress: "Your methods" card (one mini glyph chip per method, with state rings) */
.m-academy .m-sub { margin-bottom: calc(10 * var(--u)); }
/* 6 columns while a 44px chip (the tap target) fits its column plus the gap; fewer on a
 * narrower card (320px phones: 5), so a chip never overlaps its neighbour. The column floor
 * is the larger of 44px minus one gap and a sixth of the row (0.5px under it, so rounding
 * never drops to 5 columns early) */
.m-ac-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(calc(44px - 8 * var(--u)), calc((100% - 5 * 8 * var(--u)) / 6 - 0.5px)), 1fr)); gap: calc(8 * var(--u)); list-style: none; margin: 0; padding: 0; }
.m-ac-li { display: flex; min-width: 0; }
.m-ac-li > .m-ac-chip { width: 100%; }
/* stars as dots under the glyph: the stage is never shown by ring colour alone (8.2) */
.m-ac-stars { position: absolute; inset-block-end: calc(-5 * var(--u)); inset-inline: 0; display: flex; justify-content: center; gap: calc(2 * var(--u)); pointer-events: none; }
.m-ac-stars > span { width: calc(7 * var(--u)); height: calc(7 * var(--u)); border-radius: 50%; background: #F5C233; border: calc(1.5 * var(--u)) solid var(--stroke); }
.m-ac-chip { position: relative; aspect-ratio: 1 / 1; min-width: 44px; min-height: 44px; padding: calc(4 * var(--u)); border-radius: 50%;
  background: var(--panel-face); border: calc(3 * var(--u)) dashed color-mix(in srgb, var(--text-secondary) 55%, transparent);
  display: flex; align-items: center; justify-content: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.m-ac-chip:active { transform: scale(0.94); }
.m-ac-chip:focus-visible { outline: 3px solid var(--text-primary); outline-offset: 2px; }
.m-ac-chip.st-started { border-style: solid; border-color: color-mix(in srgb, var(--text-secondary) 60%, transparent); }
.m-ac-chip.st-learned, .m-ac-chip.st-passed { border-style: solid; border-color: var(--accent1); }
.m-ac-chip.st-mastered { border-style: solid; border-color: var(--good-green); }
.m-ac-chip.st-gold { border-style: solid; border-color: #F5C233; box-shadow: 0 0 0 calc(2 * var(--u)) #B8860B; }
.m-ac-chip.st-rusty { border-style: solid; border-color: #B7791F; filter: saturate(0.45); }
.m-ac-glyph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.m-ac-glyph svg { width: 100%; height: 100%; display: block; }
.m-ac-ph { font-weight: 900; font-size: calc(16 * var(--u)); color: var(--text-secondary); direction: ltr; unicode-bidi: isolate; }
.m-ac-pro { position: absolute; inset-block-start: calc(-3 * var(--u)); inset-inline-end: calc(-3 * var(--u)); width: calc(11 * var(--u)); height: calc(11 * var(--u));
  border-radius: 50%; background: #F5C233; border: calc(2 * var(--u)) solid var(--stroke); }
.m-ac-next { margin-top: calc(12 * var(--u)); padding-top: calc(10 * var(--u)); border-top: 1px solid color-mix(in srgb, var(--text-secondary) 16%, transparent); }
.m-ac-next-t { font-weight: 900; font-size: calc(16 * var(--u)); color: var(--text-primary); }
.m-ac-ev { margin-top: calc(4 * var(--u)); font-size: calc(13.5 * var(--u)); line-height: 1.4; color: var(--text-secondary); }
.m-ac-learn { width: 100%; margin-top: calc(10 * var(--u)); min-height: calc(56 * var(--u)); }
/* keypad score screen: the method a See how "Learn this method" queued mid-round */
.kp-learn { width: 100%; margin-top: calc(10 * var(--u)); min-height: max(44px, calc(52 * var(--u))); }
/* Trouble Spots: See how + Learn the method side by side (wrap on narrow phones) */
.m-trouble-btns { display: inline-flex; flex-wrap: wrap; gap: calc(6 * var(--u)); justify-content: flex-end; }
/* with a "Learn the method" button the skill name takes its own line and the two
 * buttons share the row below at a compact height (QA: stacked oversized buttons) */
.m-trouble-row { flex-wrap: wrap; }
.m-trouble-row:has(.m-learn) .m-trouble-name { flex-basis: 100%; }
.m-trouble-row:has(.m-learn) .m-trouble-btns { flex: 1 1 100%; flex-wrap: nowrap; }
.m-trouble-row:has(.m-learn) .m-trouble-btns .mw-btn { flex: 1 1 0; min-height: max(44px, calc(48 * var(--u))); padding: calc(4 * var(--u)) calc(10 * var(--u)) calc(9 * var(--u)); }
.m-learn { background: var(--face); }
/* any LTR-isolated math inside boot-time Academy text (evidence lines) */
.ta-math { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
/* score-screen method suggestion (Phase 2): the autopilot card's look */
.coach-tech .coach-line { font-size: calc(15 * var(--u)); }
/* delayed cue chip (Phase 2) inside .q-hint of a folded item */
.ta-cue { display: inline-flex; align-items: center; gap: calc(6 * var(--u)); font-weight: 800; font-size: calc(13 * var(--u)); color: var(--text-primary);
  background: color-mix(in srgb, var(--accent1) 40%, var(--face)); border: calc(2 * var(--u)) solid var(--stroke); border-radius: 999px; padding: calc(3 * var(--u)) calc(10 * var(--u)); }
@media (prefers-reduced-motion: reduce) { .m-ac-chip:active { transform: none; } }

/* Korean breaks lines between words (spaces), not inside a word: without keep-all Chrome
 * splits 측정/해요 mid-word (QA). overflow-wrap still rescues a single over-long word. */
html:lang(ko) { word-break: keep-all; overflow-wrap: anywhere; }
/* German compounds ("Multiplikationstabellen") and long Turkish / Indonesian words can be
 * wider than a card, a button or a 2-column tile on a 360 px phone. Needs <html lang>,
 * which i18n.applyLocale() sets.
 * RUNNING TEXT (descriptions, card sub-lines, coach lines, hints, prose) may hyphenate a
 * long word at a real syllable break (words of 10+ letters, 4+ letters on each side, so
 * short words never split) and, as a last resort, wrap a word that still cannot fit
 * instead of letting it run out of its box. */
html:is(:lang(de), :lang(tr), :lang(id)) { overflow-wrap: anywhere; }
html:is(:lang(de), :lang(tr), :lang(id)) :where(p, li, dd, [class*="desc"], [class*="sub"], [class*="note"], [class*="blurb"], [class*="advice"], [class*="body"],
  [class*="text"], [class*="line"], [class*="hint"], [class*="msg"], [class*="tip"], [class*="copy"], [class*="bubble"], [class*="caption"], [class*="detail"], [class*="why"]) {
  -webkit-hyphens: auto; hyphens: auto; hyphenate-limit-chars: 10 4 4; }
/* LABELS never hyphenate, in any language: buttons, chips, pills, tabs, titles (display
 * faces), keypad keys, names, counts, short labels. An all-caps tracked label split as
 * "WEITERMA-CHEN" (the Method Lab Continue button in German) reads as two broken words.
 * In de / tr / id a label wraps only at its spaces and sizes to its longest word (no
 * mid-word wrap); only a single word wider than the whole line may still wrap (last resort). */
html :is(button, [role="button"], input, select, label, h1, h2, h3, h4, .mw-btn, .mw-tile, .mw-outline, .mw-outline-2, .mw-outline-4,
  [class*="btn"], [class*="chip"], [class*="pill"], [class*="tab"], [class*="title"], [class*="label"], [class*="badge"], [class*="tag"], [class*="key"],
  [class*="name"], [class*="tier"], [class*="count"], [class*="rank"], [class*="seg"], [class*="head"], [class*="choice"]),
html :is(button, [role="button"], label, h1, h2, h3, h4, .mw-btn, .mw-tile, .mw-outline, .mw-outline-2, .mw-outline-4,
  [class*="btn"], [class*="chip"], [class*="pill"], [class*="tab"], [class*="title"], [class*="label"], [class*="badge"], [class*="tag"], [class*="key"],
  [class*="name"], [class*="tier"], [class*="count"], [class*="rank"], [class*="seg"], [class*="head"], [class*="choice"]) * { -webkit-hyphens: manual; hyphens: manual; }
html:is(:lang(de), :lang(tr), :lang(id)) :is(button, [role="button"], label, h1, h2, h3, h4, .mw-btn, .mw-tile, .mw-outline, .mw-outline-2, .mw-outline-4,
  [class*="btn"], [class*="chip"], [class*="pill"], [class*="tab"], [class*="title"], [class*="label"], [class*="badge"], [class*="tag"], [class*="key"],
  [class*="name"], [class*="tier"], [class*="count"], [class*="rank"], [class*="seg"], [class*="choice"]),
html:is(:lang(de), :lang(tr), :lang(id)) :is(button, [role="button"], label, .mw-btn, .mw-tile, [class*="btn"], [class*="chip"], [class*="pill"]) * { overflow-wrap: break-word; }
/* Method Lab action row ([back] [Replay] [Continue]): the default 24u side padding pushed
 * the unbroken "WEITERMACHEN" onto a row of its own at 360 px; trimmed, the row stays one line. */
html:is(:lang(de), :lang(tr), :lang(id)) .ta-actions > .mw-btn { padding-left: calc(12 * var(--u)); padding-right: calc(12 * var(--u)); letter-spacing: 0.03em; }
/* Turkish and German capitals carry marks above the cap height and below the baseline
 * (İ Ö Ü Ğ, Ş Ç; Ä Ö Ü): at the outlined titles' ~1.0 line height a second line's marks ran
 * into the first ("BEYİN / ÖĞÜTÜCÜ") and the cedilla of "YAŞIN" landed on the I below it,
 * reading as "HESAPLANİYOR". Give two-line capitals room for their marks. */
html:is(:lang(tr), :lang(de)) :is(.tt-titlecard .mw-outline, .wc-suspense-title, .count-mode, .ta-res-title, .intro-title, .intro-wtitle) { line-height: 1.14; }
/* A long mode name ("Kendimi Zeki Hissediyorum") in a Math Adapt AI row was cut to
 * "Hissediyor..." by the one-line ellipsis: let it take a second line instead. */
html:is(:lang(de), :lang(tr), :lang(id)) .adapt-ai-mode { white-space: normal; text-overflow: clip; line-height: 1.2; }
/* Half-width buttons leave ~86 px for the label on a 360 px phone, so under the
 * wrap-anywhere rule above a short Indonesian word broke mid-word ("BAGIKA / N" in the
 * achievement popup, "LINGKARA / N" in the Brain Age shape question). Trim their side
 * padding (and the shape choices' tracking) so a 9-letter label sits on one line. */
html:is(:lang(de), :lang(tr), :lang(id)) :is(.au-actions .mw-btn, .ba-choice) { padding-left: calc(6 * var(--u)); padding-right: calc(6 * var(--u)); }
html:is(:lang(de), :lang(tr), :lang(id)) .ba-choice { letter-spacing: 0.02em; }
/* A centred screen title runs under the back button once it is wider than ~250 px
 * ("HEUTIGE ERGEBNISSE" put the chevron on its H): keep the title clear of the button,
 * with slightly tighter tracking, and let a still-longer one take a second line. */
html:is(:lang(de), :lang(tr), :lang(id)) .opt-title { padding-left: calc(40 * var(--u)); padding-right: calc(40 * var(--u)); letter-spacing: 0.04em; line-height: 1.12; }

/* ---- hot-streak celebrations (ui/fx.js; Settings > Celebrations) ----------------- */
.fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.q-answer.fx-pop { animation: fxPop 210ms cubic-bezier(.2, 1.6, .4, 1); }
@keyframes fxPop { 0% { transform: scale(1); } 45% { transform: scale(1.28); } 100% { transform: scale(1); } }
/* the card's own chunky shadow (.mw-card) stays put under the gold glow */
.q-area.fx-glow { animation: fxGlow 460ms ease-out; }
@keyframes fxGlow { 0% { box-shadow: 0 calc(5 * var(--u)) 0 0 var(--shadow), 0 0 0 0 rgba(255, 210, 74, 0); }
  30% { box-shadow: 0 calc(5 * var(--u)) 0 0 var(--shadow), 0 0 calc(22 * var(--u)) calc(6 * var(--u)) rgba(255, 210, 74, 0.75); }
  100% { box-shadow: 0 calc(5 * var(--u)) 0 0 var(--shadow), 0 0 0 0 rgba(255, 210, 74, 0); } }
.fx-combo { flex: 0 0 auto; padding: calc(2 * var(--u)) calc(9 * var(--u)); border-radius: 999px; border: calc(2 * var(--u)) solid var(--stroke);
  background: linear-gradient(to bottom, #FFE9A0, #F5C233); color: #3A2606; font-weight: 900; font-size: calc(15 * var(--u)); line-height: 1.3;
  font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; white-space: nowrap; box-shadow: 0 calc(2 * var(--u)) 0 0 #8A5A10; }
.fx-combo[hidden] { display: none; }
.fx-combo.hot { background: linear-gradient(to bottom, #FFB37A, #FF6B3D); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,0.35); box-shadow: 0 calc(2 * var(--u)) 0 0 #9A2E10; }
.fx-combo.bump { animation: fxBump 260ms cubic-bezier(.2, 1.8, .4, 1); }
@keyframes fxBump { 0% { transform: scale(1); } 40% { transform: scale(1.35) rotate(-6deg); } 100% { transform: scale(1); } }
.fx-combo.fx-combo-out { animation: fxOut 240ms ease-in forwards; }
@keyframes fxOut { to { opacity: 0; transform: scale(0.6); } }
/* score screens: "BEST STREAK" + the same chip, one line under the result (the chip is
 * aria-hidden: a screen reader hears the plain number in .fx-sr, not "times 20") */
.score-streak { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: calc(10 * var(--u)); }
.score-streak .fx-combo { font-size: calc(18 * var(--u)); }
/* the keypad score screen's stat rows under the final time (BEST TIME, BEST STREAK and, with the rating, MATH XP; owner,
 * 20 Nov 2026: "line up these pills a bit more neatly"): one two column block centred as a whole in the card. Every
 * label ends on one line (the gutter; mirrored in RTL), every pill starts on one line, one row height, one pill height,
 * one gap, the label and the pill's number on one baseline; an absent row leaves no gap. Each row is a subgrid of the
 * block; without subgrid (Chrome before 117) each row is two equal columns: the gutter is then the block's centre line. */
.score-rows { display: grid; grid-template-columns: auto auto; justify-content: center; column-gap: calc(12 * var(--u)); row-gap: calc(2 * var(--u)); max-width: 100%; }
.score-rows:empty { display: none; }
.score-rows > :is(.score-streak, .score-skill, .wc-rank) { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; gap: normal; align-items: baseline; align-items: last baseline;
  align-content: center; justify-content: normal; min-height: 44px; max-width: none; margin: 0; padding: 0; text-align: start; }
/* the labels a step under the stat headings (15 / .07em): the longest (pt, id, ru) then fit beside a three digit Math XP
 * and its change in one line; a label that still cannot wraps to two balanced lines, its last line on the pill's line */
.score-rows > :is(.score-streak, .score-skill, .wc-rank) > .score-stat-label { justify-self: end; min-width: 0; font-size: calc(15 * var(--u)); letter-spacing: .07em;
  text-align: end; overflow-wrap: normal; text-wrap: balance; }
html:is(.loc-font-devanagari,.loc-font-bengali,.loc-font-arabic) .score-rows .score-stat-label { letter-spacing: 0; }
.score-rows > :is(.score-streak, .score-skill, .wc-rank) > :is(.fx-combo, .sr-pv, .wc-rank-pv) { justify-self: start; }
/* the pills: one height and at least the width of a three digit Math XP pill (the streak pill no longer looks stubby; a
 * longer time keeps its natural width); inline blocks, so the pill's baseline is its number's (the icons sit on the
 * digits' middle) */
.score-rows :is(.fx-combo, .sr-chip) { display: inline-block; box-sizing: border-box; height: calc(32 * var(--u)); min-width: 4.5em; padding: 0 calc(10 * var(--u));
  border-width: calc(2 * var(--u)); font-size: calc(18 * var(--u)); line-height: calc(28 * var(--u)); text-align: center; vertical-align: baseline; }
.score-rows :is(.fx-combo.score-time, .sr-chip) { padding-inline: calc(8 * var(--u)) calc(11 * var(--u)); }
.score-rows .score-time::before { display: inline-block; vertical-align: -0.1em; margin-inline-end: calc(5 * var(--u)); }
@supports not (grid-template-columns: subgrid) {
  .score-rows { grid-template-columns: auto; }
  .score-rows > :is(.score-streak, .score-skill, .wc-rank) { grid-column: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: calc(12 * var(--u)); }
}
.fx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: -1px; }
/* the score labels' letter-spacing splits the joining headstroke of Devanagari and
 * Bengali (and Arabic joins): none for those scripts */
html:is(.loc-font-devanagari,.loc-font-bengali,.loc-font-arabic) .score-stat-label { letter-spacing: 0; }
@font-face { font-family: 'Bungee'; font-style: normal; font-weight: 400; font-display: swap; src: url('../../assets/fonts/bungee.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; }
/* the Turkish and German letters the Latin file lacks (Ğğ İ Şş ẞ): a 1.5 KB cut of
 * Bungee's own Latin Extended subset, fetched only when a callout uses one */
@font-face { font-family: 'Bungee'; font-style: normal; font-weight: 400; font-display: swap; src: url('../../assets/fonts/bungee-ext.woff2') format('woff2');
  unicode-range: U+011E-011F, U+0130, U+015E-015F, U+1E9E; }
/* the arcade callout: on the calculator screen (left/width/top set by fx.js from the
 * card), chunky Bungee, solid fill + thick outline + hard drop shadow: readable at a
 * glance. --fx-fit (fx.js) shrinks a word that is wider than the card. */
.fx-callout { position: absolute; z-index: 5; pointer-events: none; text-align: center; white-space: nowrap; opacity: 0; transform: translateY(-50%);
  font-family: 'Bungee', 'Roboto', system-ui, sans-serif; font-weight: 400; font-size: calc(32 * var(--u) * var(--fx-fit, 1)); line-height: 1.05; letter-spacing: 0.01em;
  text-transform: uppercase; color: var(--cel-ink); padding: 0 calc(8 * var(--u)); }
/* the word on its plaque (an intro shout-out is its own plaque: below) */
.fx-callout:not(.intro-shout-word) > span { display: inline-block; padding: calc(5 * var(--u)) calc(14 * var(--u)) calc(4 * var(--u)); border-radius: calc(14 * var(--u));
  background: var(--cel-warm); border: calc(2.5 * var(--u)) solid var(--stroke); box-shadow: 0 calc(4 * var(--u)) 0 0 var(--stroke); }
.fx-callout.tier3 { font-size: calc(36 * var(--u) * var(--fx-fit, 1)); }
.fx-callout.tier3 > span { background: var(--cel-hot); }
.fx-callout.fx-cool > span { background: var(--cel-cool); }
/* not Latin (Cyrillic, CJK, Indic, Arabic): the language's own bold face (the loc-font-*
 * stack on <html> reaches it through inheritance), the same plaque. */
.fx-callout.fx-plain { font-family: inherit; font-weight: 900; letter-spacing: 0; text-transform: none; line-height: 1.3; }
/* Cyrillic has capitals: keep the arcade all-caps (and for a Turkish / German /
 * Indonesian callout that ever falls back here: the face covers their capitals) */
.fx-callout.fx-plain:is(:lang(ru), :lang(tr), :lang(de), :lang(id)) { text-transform: uppercase; }
/* a full-width "！" carries an empty right half that pushes the centred word left:
 * set it half-width ('halt'; PingFang SC has no 'halt', only 'hwid', which is safe
 * for Chinese but would also halve Japanese kana) */
.fx-callout.fx-plain:lang(ja) { font-feature-settings: 'halt'; }
.fx-callout.fx-plain:lang(zh) { font-feature-settings: 'halt', 'hwid'; }
.fx-callout.go { animation: fxCallout 760ms cubic-bezier(.2, .9, .3, 1) forwards; }
@keyframes fxCallout {
  0% { opacity: 0; transform: translateY(-50%) scale(0.4) rotate(-3deg); }
  16% { opacity: 1; transform: translateY(-50%) scale(1.16) rotate(-3deg); }
  28% { transform: translateY(-50%) scale(1) rotate(-3deg); }
  74% { opacity: 1; transform: translateY(-50%) scale(1) rotate(-3deg); }
  100% { opacity: 0; transform: translateY(-50%) scale(1.08) rotate(-3deg); } }
.mw-tile.fx-key-hot { animation: fxKeyHot 240ms ease-out; }
.mw-tile.fx-key-blaze { animation: fxKeyBlaze 260ms ease-out; }
/* an outline ring, so the key's own pressed-down shadow is untouched */
@keyframes fxKeyHot { 0% { outline: calc(3 * var(--u)) solid rgba(255, 210, 74, 0.95); outline-offset: 0; } 100% { outline: calc(3 * var(--u)) solid rgba(255, 210, 74, 0); outline-offset: calc(9 * var(--u)); } }
@keyframes fxKeyBlaze { 0% { outline: calc(4 * var(--u)) solid rgba(255, 106, 54, 0.95); outline-offset: 0; } 100% { outline: calc(4 * var(--u)) solid rgba(255, 138, 61, 0); outline-offset: calc(13 * var(--u)); } }
/* reduced motion: fx.js already skips the key sparks, the pop and the glow; the chip
 * appears without its bump and the callout simply fades in and out in place */
@media (prefers-reduced-motion: reduce) {
  .mw-tile.fx-key-hot, .mw-tile.fx-key-blaze, .q-area.fx-glow, .fx-combo.bump { animation: none; }
  .fx-combo.fx-combo-out { animation: fxOutFade 240ms ease-in forwards; }
  @keyframes fxOutFade { to { opacity: 0; } }
  .fx-callout.go { animation: fxFade 760ms ease-out forwards; }
  @keyframes fxFade { 0% { opacity: 0; transform: translateY(-50%); } 18% { opacity: 1; transform: translateY(-50%); } 75% { opacity: 1; transform: translateY(-50%); } 100% { opacity: 0; transform: translateY(-50%); } }
}

/* ---- one-time keyboard tip (ui/kbdtip.js): the coach card + a hand-built keyboard whose
 * working keys (number row, Backspace; arrows and Space once Prime Raiders is open) are lit
 * and press in turn */
.kbd-card { gap: calc(6 * var(--u)); }
.kbd-svg { display: block; width: 100%; max-width: calc(300 * var(--u)); height: auto; margin: calc(4 * var(--u)) auto calc(2 * var(--u)); direction: ltr; overflow: visible; }
.kbd-svg .kb-body { fill: var(--panel-face); stroke: var(--stroke); stroke-width: 2.5; }
.kbd-svg .kb-k { fill: var(--face); stroke: var(--stroke); stroke-width: 1.3; }
.kbd-svg .kb-sh { fill: var(--stroke); opacity: 0.45; }
.kbd-svg .kb-hot .kb-k { fill: var(--accent1); }
.kbd-svg .kb-l { fill: var(--on-accent); font-family: inherit; font-size: 11px; font-weight: 800; text-anchor: middle; }
.kbd-svg .kb-g { fill: none; stroke: var(--on-accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kbd-svg .kb-f { fill: var(--on-accent); }
/* light themes: a pastel accent is about as light as the key face (1.1 to 1.6:1), so the
 * plain keys step back (no face of their own, a faint outline and shadow) while the lit
 * keys keep a bold outline and their full shadow (outline vs outline about 7:1) */
:root:not([data-tone="dark"]) .kbd-svg .kb-k { fill: var(--panel-face); stroke-opacity: 0.32; stroke-width: 1; }
:root:not([data-tone="dark"]) .kbd-svg .kb-sh { opacity: 0.12; }
:root:not([data-tone="dark"]) .kbd-svg .kb-sh-hot { opacity: 0.45; }
:root:not([data-tone="dark"]) .kbd-svg .kb-hot .kb-k { fill: var(--accent1); stroke-opacity: 1; stroke-width: 1.6; }
.kbd-svg .kb-hot { animation: kbdPress 3.2s ease-in-out infinite; }
@keyframes kbdPress { 0%, 8%, 100% { transform: none; } 4% { transform: translateY(2px); } }
.kbd-b { margin: 0; font-size: calc(15 * var(--u)); line-height: 1.4; color: var(--text-primary); text-wrap: pretty; }
@media (prefers-reduced-motion: reduce) { .kbd-svg .kb-hot { animation: none; } }

/* ==== Pro platinum (owner, 21 Nov 2026: "anytime we talk about pro to feel platinum and super premium - maybe even the
   modals when they show"). ONE material, drawn in CSS only: a brushed platinum fill (soft vertical bands of light and
   shadow, cool silver with faint champagne and pale blue), a spun-metal conic fill for round marks, a bevel (light top
   edge, darker lip), the lettering for the PRO word, a one-time sheen. Graphite ink on the metal (at least 4.5 to 1 on
   its darkest band). Light themes give the metal a darker lip; dark ones (data-tone dark) a soft glow. Tones on QA
   hosts and /try/ only (?plat=b | c, lib/home2flag.js): A cool brushed (shipped), B champagne, C chrome. Each Pro
   surface carries --plat: 1 (tools/tests/academy/pro_platinum.test.mjs). Old engines: a plain fill and ink first. */
:root {
  --plat-ink: #1E2329; --plat-rim: #7A828C; --plat-lip: #5B636D; --plat-glow: 0 0 0 transparent; --plat-solid: #CDD2D8;
  --plat-brush: linear-gradient(90deg, #A6ADB6 0%, #DCE0E5 7%, #F5F6F4 13%, #BEC4CB 21%, #E4EAF0 29%, #ADB4BD 37%, #EEF1F4 45%,
    #F6F1E6 52%, #C4CAD1 60%, #DDE6EE 69%, #B3BAC3 77%, #EDEFF0 86%, #A9B0B9 100%);
  --plat-shade: linear-gradient(180deg, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 46%, rgba(40, 46, 54, .14) 100%);
  --plat-spin: conic-gradient(from 15deg, #DADFE5, #F5F1E6 12%, #B9C0C8 25%, #E2EBF4 37%, #C8CDD3 50%, #F3EEE2 62%, #B6BEC7 75%, #E0E9F2 87%, #DADFE5);
  --plat-letters: linear-gradient(100deg, #FDFDFC 0%, #B9C0C8 16%, #F4F1E8 30%, #8E969F 44%, #E6EEF5 56%, #A3ABB4 70%, #F6F7F7 84%, #B1B8C0 100%);
  --plat-edge: #2E343B;
  --plat-bg: var(--plat-shade), var(--plat-brush);
  --plat-bevel: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1.5px 0 rgba(60, 66, 74, .3);
}
:root[data-tone="dark"], :root[data-theme="dark"] { --plat-rim: #C9D0D8; --plat-lip: #1C2026; --plat-glow: 0 0 calc(10 * var(--u)) rgba(205, 222, 240, .42); --plat-edge: #14171B; }
/* (owner, 22 Nov, on Neon: the PRO lettering read as plain grey on a dark card): on a dark theme the lettering is brighter
   chrome with a soft light halo instead of the dark drop shadow the light themes use */
:root[data-tone="dark"], :root[data-theme="dark"] {
  --plat-letters: linear-gradient(100deg, #FFFFFF 0%, #B9C2CC 14%, #FFFFFF 28%, #929CA8 44%, #F5F9FD 56%, #ABB5C0 70%, #FFFFFF 84%, #B6BFC9 100%); }
:root:is([data-tone="dark"], [data-theme="dark"]):not([data-plat]) :is(.pro-metal, .pw-pro, .menu-tier.pro:not(.h2-pro-t)) {
  filter: drop-shadow(0 0 .6px var(--plat-edge)) drop-shadow(0 0 calc(3 * var(--u)) rgba(214, 228, 242, .45)); }
:root[data-plat="b"] { --plat-solid: #D6CDBF; --plat-rim: #8C7F6C; --plat-lip: #625746;
  --plat-brush: linear-gradient(90deg, #B4AA9C 0%, #E6DFD3 7%, #FAF6EE 13%, #CBC1B2 21%, #EFE8DC 29%, #B9AFA0 37%, #F5EFE5 45%,
    #FBF4E6 52%, #D0C6B7 60%, #EAE3D8 69%, #BFB4A5 77%, #F3EEE6 86%, #B3A999 100%);
  --plat-spin: conic-gradient(from 15deg, #E2DACC, #FAF4E7 12%, #C6BBAB 25%, #EEE6D8 37%, #D3C9BA 50%, #F8F0E1 62%, #C2B7A6 75%, #ECE4D6 87%, #E2DACC);
  --plat-letters: linear-gradient(100deg, #FFFCF6 0%, #C9BDAA 16%, #F7EEDD 30%, #9C8F7B 44%, #F1E8DA 56%, #B2A691 70%, #FBF7F0 84%, #C0B4A1 100%); }
:root[data-plat="c"] { --plat-solid: #D4D9DF; --plat-rim: #545C66; --plat-lip: #3A4049;
  --plat-brush: linear-gradient(90deg, #8E97A1 0%, #FFFFFF 8%, #A7B0BA 16%, #EEF2F6 24%, #8F98A2 33%, #FFFFFF 42%, #B9C1CA 50%,
    #F8FAFC 58%, #939CA6 67%, #E9EEF3 76%, #FFFFFF 85%, #9AA3AD 100%);
  --plat-spin: conic-gradient(from 15deg, #FFFFFF, #9AA3AD 12%, #F3F6F9 25%, #8E97A1 37%, #FFFFFF 50%, #A3ACB6 62%, #EEF2F6 75%, #939CA6 87%, #FFFFFF);
  --plat-letters: linear-gradient(100deg, #FFFFFF 0%, #7E8792 18%, #FFFFFF 34%, #6A737E 48%, #F2F5F8 60%, #858E99 74%, #FFFFFF 88%, #8E97A1 100%); }
/* the plate: Pro tags, chips and the buttons that open Pro. Doubled :root: beats the lazy mode sheets that load later. */
:root:root :is(.plat, .cr-pro, .mm-pro, .run-pro, .run-go .run-pro, .run-again .run-pro, .ta-pro-chip, .wc-pro, .lv-pro-tag, .dt-mi-pro,
    .hop-proline em, .gm-world-meta.pro, .pw-go, .pro-go, .lv-pro, .gm-pro-btn, .bl-end-pro-btn, .hop-go[data-act="pro-hint"], .yap-close) {
  --plat: 1; background: var(--plat-solid); background-image: var(--plat-bg); border-color: var(--plat-rim); color: var(--plat-ink);
  -webkit-text-fill-color: var(--plat-ink); text-shadow: 0 1px 0 rgba(255, 255, 255, .55); box-shadow: var(--plat-bevel), 0 calc(2 * var(--u)) 0 0 var(--plat-lip), var(--plat-glow); }
:root:root :is(.pw-go, .pro-go, .lv-pro, .gm-pro-btn, .bl-end-pro-btn, .hop-go[data-act="pro-hint"], .yap-close) { box-shadow: var(--plat-bevel), 0 calc(6 * var(--u)) 0 0 var(--plat-lip), var(--plat-glow); }
:root:root :is(.pw-go, .pro-go, .lv-pro, .gm-pro-btn, .bl-end-pro-btn, .hop-go[data-act="pro-hint"], .yap-close):active { box-shadow: var(--plat-bevel), 0 calc(1 * var(--u)) 0 0 var(--plat-lip); }
/* (the calm desktop layout paints every gold button with its own rule, desktop2.css: the Pro ones stay platinum) */
:root[data-desktop-v2] :is(.pw-go, .pro-go, .lv-pro, .gm-pro-btn, .bl-end-pro-btn, .hop-go[data-act="pro-hint"], .yap-close).mw-btn { background: var(--plat-solid); background-image: var(--plat-bg); box-shadow: var(--plat-bevel), 0 4px 0 var(--plat-lip), var(--plat-glow); }
/* round marks: spun metal */
:root:root :is(.plat-disc, .theme-lock, .m-ac-pro) { --plat: 1; background: var(--plat-solid); background-image: var(--plat-spin); border-color: var(--plat-rim); color: var(--plat-ink);
  box-shadow: var(--plat-bevel), 0 0 0 calc(1 * var(--u)) var(--plat-rim), var(--plat-glow); }
.lv-meter span.pro:not(.on) { --plat: 1; background: var(--plat-solid); background-image: var(--plat-brush); opacity: .6; }
/* the PRO lettering (the player's status, the Pro sheet's title word, "You are Pro") */
.pro-metal, .pw-pro, .menu-tier.pro:not(.h2-pro-t) { --plat: 1; display: inline-block; font-weight: 900; letter-spacing: .08em; line-height: 1; color: #8A939D; vertical-align: baseline;
  filter: drop-shadow(0 0 .6px var(--plat-edge)) drop-shadow(0 0 .6px var(--plat-edge)) drop-shadow(0 calc(1.2 * var(--u)) calc(.6 * var(--u)) rgba(15, 18, 22, .35)); }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .pro-metal, .pw-pro, .menu-tier.pro:not(.h2-pro-t) { color: transparent; -webkit-text-fill-color: transparent;
    background-image: linear-gradient(100deg, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, .95) 50%, rgba(255, 255, 255, 0) 62%), var(--plat-letters);
    background-size: 300% 100%, 100% 100%; background-repeat: no-repeat; background-position: 130% 0, 0 0;
    -webkit-background-clip: text; background-clip: text; animation: platShine 1.3s ease-in-out .35s 1 both; }
}
@keyframes platShine { from { background-position: 130% 0, 0 0; } to { background-position: -30% 0, 0 0; } }
/* the Pro cards' frame: the card keeps its face; its rim turns platinum, with a darker lip or a glow, and one soft glint */
:root:root :is(.plat-frame, .pw3 .pw-card, .yap, .ty-card) { --plat: 1; border-color: var(--plat-rim); background: var(--card-paint, none) padding-box, linear-gradient(to bottom, var(--face-top) 0%, var(--face) 50%, var(--face) 100%) padding-box, var(--plat-brush) border-box;
  box-shadow: 0 calc(5 * var(--u)) 0 0 var(--plat-lip), var(--plat-glow); }
:is(.plat-frame, .pw3 .pw-card, .yap, .ty-card)::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 3; opacity: 0;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .5) 46%, rgba(235, 242, 250, .2) 52%, rgba(255, 255, 255, 0) 64%);
  animation: platGlint 1.1s ease-out .25s 1 both; }
@keyframes platGlint { 0% { opacity: 0; } 35% { opacity: 1; } 100% { opacity: 0; } }
/* the Pro sheet: the plain price on a light platinum plate in graphite (the sale and the one-time offer keep their own
   colours); the title's PRO in the lettering */
:root:root .pw3 .pw-card.pw-plain:not(.pw-sale-on) .pw-deal { --plat: 1; background: var(--plat-solid); background-image: linear-gradient(rgba(255, 255, 255, .5), rgba(255, 255, 255, .5)), var(--plat-bg);
  border: calc(2 * var(--u)) solid var(--plat-rim); box-shadow: var(--plat-bevel), 0 calc(3 * var(--u)) 0 0 var(--plat-lip), var(--plat-glow); }
:root:root .pw3 .pw-card.pw-plain:not(.pw-sale-on) .pw-now { color: var(--plat-ink); }
.pw-title .pw-pro { letter-spacing: inherit; }
:root:root .yap-i { --plat: 1; border-radius: 50%; padding: 3px; box-sizing: border-box; background: var(--plat-solid); background-image: var(--plat-spin); color: var(--plat-ink); box-shadow: var(--plat-bevel), 0 0 0 1px var(--plat-rim); }
@media (prefers-reduced-motion: reduce) { .pro-metal, .pw-pro, .menu-tier.pro:not(.h2-pro-t), :is(.plat-frame, .pw3 .pw-card, .yap, .ty-card)::after { animation: none !important; display: none; } .pro-metal, .pw-pro, .menu-tier.pro:not(.h2-pro-t) { display: inline-block; } }
/* the PRO mark beside a Pro player's name on the leaderboards (ui/promark.js; owner, 21 Nov 2026): the platinum pill with
   the hat and the PRO word; a 48 px tap area outside the layout (the row keeps its height); after the name while it fits,
   else (pb-tight) the small hat alone on the corner of the row's flag, so no name is ever cut more than without it */
.pb-has { display: inline-flex; align-items: center; max-width: 100%; min-width: 0; vertical-align: bottom; }
.pb-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-mark { --plat: 1; position: relative; flex: none; display: inline-flex; align-items: center; gap: calc(2.5 * var(--u)); box-sizing: border-box;
  height: calc(17 * var(--u)); margin: 0; margin-inline-start: calc(6 * var(--u)); padding: 0 calc(5.5 * var(--u)) 0 calc(4 * var(--u));
  border: calc(1 * var(--u)) solid #7A828C; border-radius: 999px; background: #CDD2D8; color: #1E2329; -webkit-text-fill-color: #1E2329;
  border-color: var(--plat-rim); background-image: var(--plat-bg); color: var(--plat-ink); -webkit-text-fill-color: var(--plat-ink);
  box-shadow: var(--plat-bevel), 0 calc(1 * var(--u)) 0 0 var(--plat-lip), var(--plat-glow);
  font: 900 calc(9.5 * var(--u)) / 1 Roboto, system-ui, sans-serif; letter-spacing: .07em; text-shadow: 0 1px 0 rgba(255, 255, 255, .55);
  vertical-align: middle; cursor: pointer; -webkit-tap-highlight-color: transparent; -webkit-appearance: none; appearance: none; }
.pb-mark::after { content: ''; position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; transform: translate(-50%, -50%); }
.pb-mark .pb-ico { width: calc(13 * var(--u)); height: calc(13 * var(--u)); flex: none; }
.pb-mark .pb-word { font: inherit; letter-spacing: inherit; }
.pb-mark:active { transform: translateY(calc(1 * var(--u))); box-shadow: var(--plat-bevel); }
.pb-mark.pb-dark { box-shadow: var(--plat-bevel), 0 0 calc(6 * var(--u)) rgba(205, 222, 240, .5); }
.pb-rel { position: relative; }
.pb-mark.pb-tight { position: absolute; z-index: 2; margin: 0; padding: 0; justify-content: center; width: calc(16 * var(--u)); height: calc(16 * var(--u)); border-radius: 50%;
  background-image: var(--plat-spin); }
.pb-mark.pb-tight .pb-word { display: none; }
.pb-mark.pb-tight .pb-ico { width: calc(11.5 * var(--u)); height: calc(11.5 * var(--u)); }
.pb-mark.pb-tight:active { transform: none; }
/* (pb-small: a row with no flag whose name cannot keep the full mark beside it, ui/promark.js fit: the same round hat) */
.pb-mark.pb-disc, .pb-mark.pb-small { justify-content: center; width: calc(17 * var(--u)); padding: 0; border-radius: 50%; background-image: var(--plat-spin); margin-inline-start: calc(4 * var(--u)); }
.pb-mark.pb-disc .pb-word, .pb-mark.pb-small .pb-word { display: none; }
.pb-mark.pb-disc .pb-ico, .pb-mark.pb-small .pb-ico { width: calc(12 * var(--u)); height: calc(12 * var(--u)); }
/* (a tight mark is placed in px from the flag by fit(); the right to left row mirrors it there) */

/* ================================================================
 * Layout audit (23 Nov 2026): fixes to lazy stylesheets kept here, so a quiet release changes fewer files (each wins by
 * a more specific selector, or !important where the other side cannot be outranked)
 * ================================================================ */
/* You are Pro: list rows sized to their words (a row shrank to its item's min-height inside the scrolling list and the
   words ran out of their pills at large text) */
.yap .yap-list { grid-auto-rows: min-content; }
/* the Math XP sheet (skill.css, lazy, overflow-y auto): its close X sits 9 px from the sheet's edge, so the 48 px tap ring
   grows inwards only, to the start side (mirrored in Arabic and Urdu); it ran 5 px past the edge at 320 px and the sheet
   scrolled sideways (skill_rating 5, skill_modes 5) */
:root .sr-sheet .modal-x::after { inset-inline-start: min(0px, calc(100% - 48px)); inset-inline-end: 0; }
/* Mental Math Master: a level name too wide for its tile (VERY HARD on a foldable, SEHR SCHWER) takes two lines at its space */
.mm-level .mm-lv-name { white-space: normal; overflow-wrap: normal; text-wrap: balance; }
/* the home wordmark steps down to fit its row (ui/home2/home.js fitMark sets --h2-mk; large text cut it to WORKOU) */
:root .h2 .menu-header.h2-banner .menu-title { font-size: calc(40 * var(--u) * var(--h2-mk, 1)); }
/* desktop: the celebration canvas stays over the round (desktop2.css made it relative: every round scrolled a screen
   height and the sparks drew below the card) */
:root[data-desktop-v2] .d2-stage > .fx-canvas { position: absolute !important; z-index: 4 !important; }

/* Titles (.mw-outline, .mw-outline-2, .mw-outline-4: screen, menu, hub and result titles, sheets, the countdown): a clean
   heavy solid title in the app's text face (Roboto 900) and ink, no outline (owner, 23 Nov 2026: "the font used here for
   'your progress' is not legible"). Chromium paints -webkit-text-stroke over the letters, centred on their outline
   (paint-order does not reach HTML text), so the dark 3 u stroke on dark letters filled the counters of e, o, g and a and
   blurred every title, worst on a small column with large text. The colour titles (Brain Age's tier, the Mental Math and
   Brain Cruncher result headings) take the ink too: without the stroke a pale accent did not read on its card. Game
   display lettering keeps its look: Galaxy Run and Prime Raiders (light lettering on space, their own boards), Math Run's
   own lettering, the MATH HOP flying letters and the home wordmark (.menu-title). */
:is(.mw-outline, .mw-outline-2, .mw-outline-4):not(:is(.blaster-screen, .galaxymap-screen, .gm-lb-overlay, .rd-board) *) { -webkit-text-stroke-width: 0; paint-order: normal; }
:root :is(.ba-tier-name, .mm-res-title, .bc-result-title).mw-outline { color: var(--text-primary); text-shadow: none; }
/* the wordmark keeps its outline UNDER the letters (paint-order: stroke fill, Chrome 123+, Safari, Firefox): the system
   fonts (Android's Roboto, Apple's San Francisco) are variable fonts whose glyphs keep overlapping contours, and a stroke
   painted over the letters drew every inner contour as a dark slice through M, A, T, H, W, R and K, near-black on the
   dark themes' near-white letters (owner, 26 Nov 2026: "Math workout text is coming out weird on dark themes"; live
   from mw-v235, web, Android and iOS). wordmark_outline.test.mjs */
:root .menu-title.mw-outline { -webkit-text-stroke-width: calc(3 * var(--u)); paint-order: stroke fill; }

/* Settings rows and links (48 px targets): a row with one switch toggles on a tap anywhere (main.js); the switch's own hit
   area is 48 px tall; the text links (Have a code, Restore, Lost your Pro, Keep it safe) are 48 px tall */
.opt-row:has(> .mw-switch:only-of-type) { cursor: pointer; }
.mw-switch::before { content: ''; position: absolute; inset: min(0px, (100% - 48px) / 2); }
:root .opt-link { display: flex; align-items: center; justify-content: center; min-height: 48px; padding-block: calc(2 * var(--u)); margin-top: calc(2 * var(--u)); }

/* Android's font size (main.js sets html[data-fs] when the WebView inflates text and text-size-adjust can hold it back):
   body text follows the player's setting; the fixed pieces (keypads, tiles, HUDs, countdowns, score pills, the Pro
   sheet's price strip) grow at most to 115% so nothing in them clips. The Pro sheet's price strip is compact there and in
   short windows: the struck price over the price beside the countdown, the button; the saving line goes (the struck price
   carries it). */
:root[data-fs] :is(.keypad, .blaster-keypad, .rd-gate-pad, .ba-grid, .tt-grid, .bc-levels, .ai-row, .game-top, .blaster-hud, .rd-hudrow,
  .hop-hud, .run-hud, .run-bar, .count-digit, .score-rows, .kp-score, .cr-res-stats, .wlb-grid, .tt-titlecard, .menu-header, .pw3 .pw-buy, .pw-burst,
  .cr-levels, .mm-levels, .q-area, .mc-title) {
  -webkit-text-size-adjust: 115%; text-size-adjust: 115%; }
:root[data-fs] .pw3 .pw-card.pw-offering .pw-deal-foot { display: none; }
:root[data-fs] .pw3 .pw-card.pw-offering .pw-now { font-size: calc(34 * var(--u)); }
:root[data-fs] .pw3 .pw-card.pw-offering .pw-tv { font-size: calc(18 * var(--u)); }
@media (max-height: 620px) { .pw3 .pw-card.pw-offering .pw-deal-foot { display: none; } }
/* a board's title keeps clear of its close X with large text (Top Pilots, Top Runners; German ran under it) */
:root[data-fs] .gx-lb .gm-lb-title { padding-inline: calc(40 * var(--u)); }
/* the Pro sheet's downloads line keeps clear of the close X on one line (Russian ran 5 px under it): a step smaller, as French */
:lang(ru) .pw3 .pw-dl-t { font-size: calc(12.5 * var(--u)); }
/* the sale's burst: a long word (RABATT, DESCUENTO, RÉDUCTION, DESCONTO, İNDİRİM, СКИДКА, DISKON) never breaks inside */
:root :is(:lang(de), :lang(es), :lang(fr), :lang(pt), :lang(tr), :lang(ru), :lang(id)) .pw-burst-t { max-width: 92%; font-size: calc(9 * var(--u)); letter-spacing: -0.02em; overflow-wrap: normal; }
:root :is(:lang(de), :lang(es), :lang(fr), :lang(pt), :lang(tr), :lang(ru), :lang(id)) .pw3 .pw-burst { width: calc(68 * var(--u)); height: calc(68 * var(--u)); margin-top: calc(-34 * var(--u)); }

/* Tablets and foldables (touch, 580 px wide and up (lib/device.js TABLET_SHORT: an open Galaxy Z Fold 7 at a larger
   display size is 598 px wide, the widest phones about 540 at their smallest); never a phone, never the desktop layout). The scrolling hubs (home,
   Settings, Progress, Trophy Room, Method Lab, the boards, the Workout Log, the mode menus) open into a wider sheet with
   full-size controls (1u = 1 dp or more; a 615 x 605 foldable gave them a 339 px column and 36 px buttons), their cards in
   two or more columns where they fit. A round keeps its height-fitted column (its keypad on screen without scrolling;
   every small control has a 48 px hit ring), up to 560 px. Galaxy Run and Prime Raiders keep their columns (their play
   area, the scores' fairness). Window size only, so folding, unfolding and rotating restyle the same screen in place. The iPad's own
   tablet layout (html[data-tablet], feature/ios-shell, lib/tablet.js) replaces all of this where it is switched on. */
@media (min-width: 580px) and (pointer: coarse) {
  :root:not([data-desktop], [data-tablet]) { --col: min(96vw, 560px, 56vh); }
  :root:not([data-desktop], [data-tablet]):is([data-screen="raiders"], [data-screen="game"][data-mode="galaxy"]) { --col: min(100vw, 460px, 56vh); }
  :root:not([data-desktop], [data-tablet]):is([data-screen="menu"], [data-screen="settings"], [data-screen="progress"], [data-screen="achievements"], [data-screen="academy"],
    [data-screen="wcboard"], [data-screen="worklog"], [data-screen="tables"], [data-screen="world"], [data-screen="mmm"], [data-screen="cruncher"]) {
    --col: min(94vw, 780px); --u: clamp(1px, 56vh / 411, 1.15px); }
  @supports (height: 1dvh) {
    :root:not([data-desktop], [data-tablet]) { --col: min(96vw, 560px, 56dvh); }
    :root:not([data-desktop], [data-tablet]):is([data-screen="raiders"], [data-screen="game"][data-mode="galaxy"]) { --col: min(100vw, 460px, 56dvh); }
    :root:not([data-desktop], [data-tablet]):is([data-screen="menu"], [data-screen="settings"], [data-screen="progress"], [data-screen="achievements"], [data-screen="academy"],
    [data-screen="wcboard"], [data-screen="worklog"], [data-screen="tables"], [data-screen="world"], [data-screen="mmm"], [data-screen="cruncher"]) { --u: clamp(1px, 56dvh / 411, 1.15px); }
  }
  /* Settings: its cards in two balanced columns where two of 300 dp fit (as on a computer); Trophy Room: more badges a row */
  :root:not([data-desktop], [data-tablet])[data-screen="settings"] .screen-scroll { display: block; padding-bottom: calc(18 * var(--u)); }
  :root:not([data-desktop], [data-tablet])[data-screen="settings"] .set-cols { display: block; columns: calc(300 * var(--u)) 2; column-gap: calc(18 * var(--u)); }
  :root:not([data-desktop], [data-tablet])[data-screen="settings"] .set-cols > * { break-inside: avoid; display: block; }
  :root:not([data-desktop], [data-tablet])[data-screen="achievements"] .ach-grid { grid-template-columns: repeat(auto-fill, minmax(calc(118 * var(--u)), 1fr)); }
}
@media (min-width: 700px) and (pointer: coarse) {
  :root:not([data-desktop], [data-tablet]):is([data-screen="raiders"], [data-screen="game"][data-mode="galaxy"]) { --col: min(96vw, 520px, 56vh); }
  @supports (height: 1dvh) { :root:not([data-desktop], [data-tablet]):is([data-screen="raiders"], [data-screen="game"][data-mode="galaxy"]) { --col: min(96vw, 520px, 56dvh); } }
}
/* 48 px targets on every touch layout (layout audit round 2): buttons and tiles never under 48 px tall (a short window's
   height-fitted column scaled some to 43 to 45 px: Brain Age's number grid, START FROM ADDITRON, a lesson's Next) and
   Settings' theme swatches in its two tablet columns. The score screen's rows stay 44 px (46 apart): 48 made the World
   Challenge result scroll at 360 x 640 in the long languages (it fits one screen since mw-v234). */
:where(:root:not([data-desktop])) :where(button.mw-btn, button.mw-tile) { min-height: 48px; }   /* (no weight: a bigger min-height of its own wins) */
:root:not([data-desktop]) :is(.au-all, .ta-watch-extra > button, .lang-opt) { min-height: 48px; }
:root:not([data-desktop]) .ta-compact .ta-actions > .mw-btn { min-height: max(48px, calc(52 * var(--u))); }
@media (max-height: 700px) { :root:not([data-desktop]) .gm-launch { min-height: max(48px, calc(54 * var(--u))); } }
.m-ac-chip { min-width: 48px; min-height: 48px; }
:root .theme-more::after { inset: min(calc(-6 * var(--u)), calc((100% - 48px) / 2)); }
@media (min-width: 580px) and (pointer: coarse) { :root:not([data-desktop], [data-tablet])[data-screen="settings"] .theme-sw { flex-basis: max(48px, calc((100% - 5 * var(--gap)) / 5.5)); } }
/* a lesson's worked example with large text on a short window: the question stays in its card (centred while it fits,
   from the top and scrolling when it does not; it was cut by the card's top edge) */
:root .ta-qcard.ta-watch-card { justify-content: safe center; overflow-y: auto; }
