/*
 * themes.css: the 12 ThemeStore palettes (Classic, Dark, 10 colours), the 10 pattern
 * themes + the chunky component recipes, lifted from the TV port (which ports
 * res/values/styles.xml + bg_game_*.xml).
 *
 * Sizing: everything is Android dp numbers × var(--u). app.css sets --u
 * responsively (a phone-width play column that scales to the viewport).
 *
 * The signature look: NO blur shadows — a hard "shadow lip" (box-shadow:
 * 0 5u 0 0) under a gradient face with a dark stroke; keys/buttons add a
 * translucent white gloss bar; press = the face physically drops onto the lip.
 */

/* --u lives OUTSIDE the theme blocks so a page override keeps winning even
   once a theme picker sets data-theme. app.css provides the responsive value. */
:root { --u: 1px; --ps: var(--u); }

:root,
:root[data-theme="classic"] {
  --accent1: #BFE6C5;
  --accent2: #F4B7C0;
  --face: #FFFFFF;
  --face-top: #ECECEC;
  --panel-face: #FAFAFA;
  --panel-top: #E4E4E4;
  --text-primary: #222222;
  /* #4D4D4D keeps secondary text at 4.5:1 or better on every light theme's bg, card
     top band and panels (the old #666 fell to 3.2:1 on Rose / Periwinkle tops) */
  --text-secondary: #4D4D4D;
  --stroke: #2A2A2A;
  --shadow: #2A2A2A;
  --bg: #EAEAEA;
  --answer-ink: #512DA8;
  --stat-red: #E53935;
  --good-green: #1A8F3C;
  /* text ON an accent-filled surface (selected option, chip, current row): the pastel
     accents are light on every theme, so this stays dark everywhere (Dark included) */
  --on-accent: #222222;
  --on-accent-soft: #4D4D4D;   /* secondary text on an accent surface (rank, time) */
  --streak-green: #136B2D;     /* "Last played" line on the home header card */
  --hint-ink: #707070;         /* the grey "?" in an empty answer field (large text, 3:1+) */
  /* the app background paint (pattern themes add layers over --bg) and the scroll layer */
  --bg-paint: var(--bg);
  --scroll-bg: var(--bg);
}

:root[data-theme="pink"]       { --accent1:#FFB7C5; --accent2:#FFD8A8; --face:#FFE3EE; --face-top:#F5C8D8; --panel-face:#FCD7E5; --panel-top:#F0BFD0; --bg:#F8E0EA; }
:root[data-theme="mint"]       { --accent1:#A8E6C0; --accent2:#B8E0F0; --face:#E2F7EA; --face-top:#BDE6CC; --panel-face:#D5EFE0; --panel-top:#B0DEC0; --bg:#DDF1E5; }
:root[data-theme="lavender"]   { --accent1:#D5C4F0; --accent2:#FFCCEA; --face:#EFE5FB; --face-top:#D5C4F0; --panel-face:#E5D9F4; --panel-top:#CBB8E8; --bg:#E6DEF2; }
:root[data-theme="peach"]      { --accent1:#FFCBA4; --accent2:#FFE6B5; --face:#FFEBD9; --face-top:#F8CFAA; --panel-face:#FCE0CC; --panel-top:#F2C39E; --bg:#FAE5D6; }
:root[data-theme="lemon"]      { --accent1:#FFEC8B; --accent2:#FFD3A5; --face:#FFF8D9; --face-top:#F5E68F; --panel-face:#FCF1CB; --panel-top:#EDDB81; --bg:#FBF3D0; }
:root[data-theme="sky"]        { --accent1:#A8D2EE; --accent2:#D5C4F0; --face:#E0F0FB; --face-top:#A8D2EE; --panel-face:#D2E6F5; --panel-top:#9DC8E5; --bg:#D6E9F7; }
:root[data-theme="rose"]       { --accent1:#F0B8B8; --accent2:#FFD9C0; --face:#FCE0E0; --face-top:#F0B8B8; --panel-face:#F4D2D2; --panel-top:#E6ABAB; --bg:#F2D8D8; }
:root[data-theme="sage"]       { --accent1:#BFD4B0; --accent2:#E5E2A8; --face:#E5F0DC; --face-top:#BFD4B0; --panel-face:#D8E5CE; --panel-top:#B2C7A2; --bg:#DDE7D5; }
:root[data-theme="periwinkle"] { --accent1:#B8BFEC; --accent2:#FFB7DE; --face:#E5E8FB; --face-top:#B8BFEC; --panel-face:#D8DCF4; --panel-top:#ABB2E2; --bg:#DDE0F4; }
:root[data-theme="coral"]      { --accent1:#F6BBA0; --accent2:#FFE4B5; --face:#FFE3D5; --face-top:#F6BBA0; --panel-face:#FCD6C5; --panel-top:#EDAD90; --bg:#FBDED1; }
:root[data-theme="dark"] {
  --accent1:#5BC8A8; --accent2:#E66B7C;
  --face:#262A33; --face-top:#181B22;
  --panel-face:#1E222B; --panel-top:#13161D;
  --text-primary:#F0F0F0; --text-secondary:#9C9CA8;
  --stroke:#000000; --shadow:#000000;
  --bg:#0F1115;
  /* the purple typed answer was 1.57:1 on the Dark face; a light violet keeps the hue */
  --answer-ink:#B39DFF;
  --on-accent:#0F1115; --on-accent-soft:#1F3A33;
  --streak-green:#4ADE80;
  --hint-ink:#8A8A8A;
}

/* ---------------------------------------------------------- pattern themes
 * Ten textured themes (Pro, like the colour themes). Each is a full token set plus:
 *   --bg-paint   the app background (pattern layers over --bg), painted once on .app
 *                and the full-cover overlays; never on the scrolling layer
 *   --scroll-bg  transparent, so scrolled content passes over the static pattern
 *   --card-paint an optional faint layer on .mw-card faces
 * Patterns are sized in --ps (1dp on screen; the Settings swatch shrinks it) and are
 * plain CSS gradients or small inline SVG tiles: static, cheap, no animation.
 * The same blocks style a [data-swatch] picker tile, so the swatch shows the real thing.
 * Dark-family themes (chalk, blueprint, stars, neon) also set html[data-tone="dark"]. */

/* Graph paper: teal ruled grid, blue-pen answers */
:root[data-theme="graph"], [data-swatch="graph"] {
  --accent1:#9ED9D4; --accent2:#F6B3A6;
  --face:#FFFFFF; --face-top:#E3EDEC; --panel-face:#F6FAF9; --panel-top:#DCE8E6;
  --text-primary:#1E2B2F; --text-secondary:#44535A; --stroke:#26353A; --shadow:#26353A;
  --bg:#EDF3F1; --answer-ink:#2648B0; --stat-red:#D32F2F; --good-green:#1A7F38;
  --on-accent:#1E2B2F; --on-accent-soft:#3A494E; --streak-green:#136B2D; --hint-ink:#68777C;
  --bg-paint:
    linear-gradient(to right, rgba(60,140,160,.22) 1px, transparent 1px) 0 0 / calc(70 * var(--ps)) calc(70 * var(--ps)),
    linear-gradient(to bottom, rgba(60,140,160,.22) 1px, transparent 1px) 0 0 / calc(70 * var(--ps)) calc(70 * var(--ps)),
    linear-gradient(to right, rgba(60,140,160,.11) 1px, transparent 1px) 0 0 / calc(14 * var(--ps)) calc(14 * var(--ps)),
    linear-gradient(to bottom, rgba(60,140,160,.11) 1px, transparent 1px) 0 0 / calc(14 * var(--ps)) calc(14 * var(--ps)),
    var(--bg);
  --card-paint:
    linear-gradient(to right, rgba(60,140,160,.07) 1px, transparent 1px) 0 0 / calc(14 * var(--ps)) calc(14 * var(--ps)),
    linear-gradient(to bottom, rgba(60,140,160,.07) 1px, transparent 1px) 0 0 / calc(14 * var(--ps)) calc(14 * var(--ps));
  --scroll-bg: transparent;
}

/* Chalkboard (dark): slate green, faint chalk sums and dust, chalk-yellow answers */
:root[data-theme="chalk"], [data-swatch="chalk"] {
  --accent1:#F2DF86; --accent2:#F2A7B5;
  --face:#2F473C; --face-top:#253B31; --panel-face:#2A4237; --panel-top:#1F3329;
  --text-primary:#F6F3EA; --text-secondary:#BED0C5; --stroke:#0E1914; --shadow:#0E1914;
  --bg:#22352C; --answer-ink:#FFE48A; --stat-red:#FF9A8F; --good-green:#86E8A0;
  --on-accent:#17231D; --on-accent-soft:#3B4433; --streak-green:#93E9A6; --hint-ink:#93A99D;
  --bg-paint:
    radial-gradient(60% 40% at 18% 12%, rgba(255,255,255,.05), transparent 70%) no-repeat,
    radial-gradient(70% 45% at 88% 78%, rgba(255,255,255,.045), transparent 70%) no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cg stroke='%23fff' fill='none' stroke-linecap='round' stroke-linejoin='round' stroke-opacity='.09' stroke-width='2.2'%3E%3Cpath d='M34 30v16M26 38h16'/%3E%3Cpath d='M146 34h14M146 41h14'/%3E%3Cpath d='M96 112l11 11M107 112l-11 11'/%3E%3Cpath d='M168 150h14'/%3E%3Ccircle cx='175' cy='144' r='.9' fill='%23fff' stroke='none' fill-opacity='.12'/%3E%3Ccircle cx='175' cy='156' r='.9' fill='%23fff' stroke='none' fill-opacity='.12'/%3E%3Cpath d='M40 150h11l-7 15'/%3E%3Cpath d='M120 168c8-3 13 4 4 8c9 1 8 11-3 9'/%3E%3Cpath d='M66 70c9-6 22-5 27 3c4 8-7 15-17 13c-9-2-15-9-10-16'/%3E%3Cpath d='M150 92l5 6l11-13'/%3E%3C/g%3E%3Cg stroke='%23fff' fill='none' stroke-linecap='round' stroke-opacity='.025' stroke-width='16'%3E%3Cpath d='M8 196c40-22 90-26 140-14'/%3E%3Cpath d='M120 14c26 10 54 8 74-6'/%3E%3C/g%3E%3Cg fill='%23fff' fill-opacity='.16'%3E%3Ccircle cx='50.9' cy='177.7' r='1'/%3E%3Ccircle cx='180.3' cy='15.3' r='1.2'/%3E%3Ccircle cx='73.9' cy='16' r='0.6'/%3E%3Ccircle cx='191' cy='188.9' r='0.9'/%3E%3Ccircle cx='90.9' cy='109' r='1'/%3E%3Ccircle cx='152.2' cy='152.6' r='0.8'/%3E%3Ccircle cx='95.1' cy='166.2' r='0.8'/%3E%3Ccircle cx='96.5' cy='23.3' r='1.1'/%3E%3Ccircle cx='162.8' cy='73.3' r='0.6'/%3E%3Ccircle cx='190.6' cy='28.9' r='0.9'/%3E%3Ccircle cx='91.8' cy='26.3' r='0.6'/%3E%3Ccircle cx='122.9' cy='151.3' r='0.6'/%3E%3Ccircle cx='119.8' cy='180.2' r='0.7'/%3E%3Ccircle cx='117' cy='72.3' r='0.8'/%3E%3Ccircle cx='102.3' cy='139.8' r='0.7'/%3E%3Ccircle cx='35.7' cy='170.3' r='1'/%3E%3C/g%3E%3C/svg%3E") 0 0 / calc(200 * var(--ps)) calc(200 * var(--ps)),
    var(--bg);
  --card-paint: radial-gradient(80% 60% at 15% 0%, rgba(255,255,255,.035), transparent 70%) no-repeat;
  --scroll-bg: transparent;
}

/* Polka dots: cream with offset coral and sky dots */
:root[data-theme="polka"], [data-swatch="polka"] {
  --accent1:#FFAAA5; --accent2:#9FD6F0;
  --face:#FFFFFF; --face-top:#FBE6D2; --panel-face:#FFF8F0; --panel-top:#F3DCC6;
  --text-primary:#2A2220; --text-secondary:#57493F; --stroke:#2E2522; --shadow:#2E2522;
  --bg:#FFF2E3; --answer-ink:#5B2DA8; --stat-red:#D32F2F; --good-green:#1A7F38;
  --on-accent:#2A2220; --on-accent-soft:#4E403A; --streak-green:#136B2D; --hint-ink:#76695F;
  --bg-paint:
    radial-gradient(circle at center, rgba(240,115,105,.24) calc(3.6 * var(--ps)), transparent calc(4.1 * var(--ps))) 0 0 / calc(30 * var(--ps)) calc(30 * var(--ps)),
    radial-gradient(circle at center, rgba(70,160,215,.20) calc(3.6 * var(--ps)), transparent calc(4.1 * var(--ps))) calc(15 * var(--ps)) calc(15 * var(--ps)) / calc(30 * var(--ps)) calc(30 * var(--ps)),
    var(--bg);
  --scroll-bg: transparent;
}

/* Blueprint (dark): drafting blue with a white grid */
:root[data-theme="blueprint"], [data-swatch="blueprint"] {
  --accent1:#93D9FF; --accent2:#FFD27A;
  --face:#215290; --face-top:#1B4880; --panel-face:#1F4E89; --panel-top:#184277;
  --text-primary:#FFFFFF; --text-secondary:#DAE8F9; --stroke:#0A2546; --shadow:#0A2546;
  --bg:#1A4782; --answer-ink:#FFE08A; --stat-red:#FFB3AB; --good-green:#8CF2B4;
  --on-accent:#0A2546; --on-accent-soft:#1D4470; --streak-green:#8CF2B4; --hint-ink:#A9C4E6;
  --bg-paint:
    linear-gradient(to right, rgba(255,255,255,.14) 1px, transparent 1px) 0 0 / calc(70 * var(--ps)) calc(70 * var(--ps)),
    linear-gradient(to bottom, rgba(255,255,255,.14) 1px, transparent 1px) 0 0 / calc(70 * var(--ps)) calc(70 * var(--ps)),
    linear-gradient(to right, rgba(255,255,255,.065) 1px, transparent 1px) 0 0 / calc(14 * var(--ps)) calc(14 * var(--ps)),
    linear-gradient(to bottom, rgba(255,255,255,.065) 1px, transparent 1px) 0 0 / calc(14 * var(--ps)) calc(14 * var(--ps)),
    var(--bg);
  --card-paint:
    linear-gradient(to right, rgba(255,255,255,.04) 1px, transparent 1px) 0 0 / calc(14 * var(--ps)) calc(14 * var(--ps)),
    linear-gradient(to bottom, rgba(255,255,255,.04) 1px, transparent 1px) 0 0 / calc(14 * var(--ps)) calc(14 * var(--ps));
  --scroll-bg: transparent;
}

/* Candy stripes: pink and mint diagonal stripes */
:root[data-theme="candy"], [data-swatch="candy"] {
  --accent1:#FFA3C4; --accent2:#9FE3CB;
  --face:#FFFFFF; --face-top:#FFDDE8; --panel-face:#FFF6F9; --panel-top:#F7D2DF;
  --text-primary:#2B2026; --text-secondary:#5A4650; --stroke:#2F2429; --shadow:#2F2429;
  --bg:#FFF1F5; --answer-ink:#6A1FA0; --stat-red:#D32F2F; --good-green:#1A7F38;
  --on-accent:#2B2026; --on-accent-soft:#4F3C45; --streak-green:#136B2D; --hint-ink:#7A6670;
  --bg-paint:
    repeating-linear-gradient(135deg, rgba(255,128,170,.17) 0 calc(13 * var(--ps)), transparent calc(13 * var(--ps)) calc(20 * var(--ps)), rgba(80,200,165,.16) calc(20 * var(--ps)) calc(23 * var(--ps)), transparent calc(23 * var(--ps)) calc(30 * var(--ps))),
    var(--bg);
  --scroll-bg: transparent;
}

/* Starfield (dark): deep space, two star tiles and soft nebula glows */
:root[data-theme="stars"], [data-swatch="stars"] {
  --accent1:#A3B5FF; --accent2:#FFB77A;
  --face:#1B2349; --face-top:#141B3B; --panel-face:#182046; --panel-top:#111839;
  --text-primary:#F3F5FF; --text-secondary:#B3BCE3; --stroke:#04060F; --shadow:#04060F;
  --bg:#0B1130; --answer-ink:#FFD98A; --stat-red:#FF9494; --good-green:#74F0A6;
  --on-accent:#0B1130; --on-accent-soft:#2A3568; --streak-green:#74F0A6; --hint-ink:#8C96C2;
  --bg-paint:
    radial-gradient(90% 55% at 88% 6%, rgba(150,110,255,.22), transparent 70%) no-repeat,
    radial-gradient(80% 50% at 8% 94%, rgba(60,150,255,.16), transparent 70%) no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 270 270'%3E%3Ccircle cx='70.8' cy='238.9' r='1.6' fill='%23fff' fill-opacity='0.8'/%3E%3Ccircle cx='188.7' cy='85.6' r='1.7' fill='%23fff' fill-opacity='0.6'/%3E%3Ccircle cx='74.2' cy='70.9' r='1.8' fill='%23fff' fill-opacity='0.8'/%3E%3Ccircle cx='247.5' cy='131.9' r='1.5' fill='%23fff' fill-opacity='0.6'/%3E%3Ccircle cx='45.9' cy='199.1' r='1.1' fill='%23fff' fill-opacity='0.7'/%3E%3Ccircle cx='151.9' cy='227.4' r='1.7' fill='%23fff' fill-opacity='0.7'/%3E%3Ccircle cx='113.9' cy='27.8' r='1.4' fill='%23fff' fill-opacity='0.9'/%3E%3Cpath d='M60 195Q60 200 65 200Q60 200 60 205Q60 200 55 200Q60 200 60 195Z' fill='%23fff' fill-opacity='0.75'/%3E%3Cpath d='M210 66Q210 70 214 70Q210 70 210 74Q210 70 206 70Q210 70 210 66Z' fill='%23fff' fill-opacity='0.6'/%3E%3C/svg%3E") calc(40 * var(--ps)) calc(10 * var(--ps)) / calc(270 * var(--ps)) calc(270 * var(--ps)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 150'%3E%3Ccircle cx='37.6' cy='42.8' r='0.7' fill='%23fff' fill-opacity='0.4'/%3E%3Ccircle cx='106' cy='124.9' r='0.5' fill='%23fff' fill-opacity='0.7'/%3E%3Ccircle cx='17.9' cy='33.8' r='1' fill='%23fff' fill-opacity='0.5'/%3E%3Ccircle cx='54.7' cy='54.1' r='0.8' fill='%23cfe0ff' fill-opacity='0.6'/%3E%3Ccircle cx='59.5' cy='72' r='1' fill='%23ffe9b8' fill-opacity='0.5'/%3E%3Ccircle cx='21.3' cy='108.5' r='1' fill='%23fff' fill-opacity='0.4'/%3E%3Ccircle cx='46.7' cy='21.1' r='0.9' fill='%23fff' fill-opacity='0.4'/%3E%3Ccircle cx='55.1' cy='136.1' r='1.1' fill='%23fff' fill-opacity='0.7'/%3E%3Ccircle cx='142.3' cy='9.8' r='0.7' fill='%23cfe0ff' fill-opacity='0.7'/%3E%3Ccircle cx='7.6' cy='33.9' r='1.1' fill='%23ffe9b8' fill-opacity='0.4'/%3E%3Ccircle cx='43.7' cy='128.5' r='1' fill='%23fff' fill-opacity='0.8'/%3E%3Ccircle cx='107.5' cy='25.3' r='0.8' fill='%23fff' fill-opacity='0.6'/%3E%3Ccircle cx='85.2' cy='62.4' r='0.6' fill='%23fff' fill-opacity='0.6'/%3E%3Ccircle cx='68.6' cy='9.8' r='1' fill='%23cfe0ff' fill-opacity='0.4'/%3E%3Ccircle cx='8.1' cy='102.7' r='0.8' fill='%23ffe9b8' fill-opacity='0.6'/%3E%3Ccircle cx='43.3' cy='146.3' r='0.6' fill='%23fff' fill-opacity='0.4'/%3E%3Ccircle cx='8.8' cy='77.3' r='0.7' fill='%23fff' fill-opacity='0.5'/%3E%3Ccircle cx='108.4' cy='76.7' r='0.6' fill='%23fff' fill-opacity='0.6'/%3E%3Ccircle cx='31.1' cy='92.1' r='0.7' fill='%23cfe0ff' fill-opacity='0.4'/%3E%3Ccircle cx='12.8' cy='103.5' r='1.2' fill='%23ffe9b8' fill-opacity='0.4'/%3E%3C/svg%3E") 0 0 / calc(150 * var(--ps)) calc(150 * var(--ps)),
    var(--bg);
  --scroll-bg: transparent;
}

/* Honeycomb: honey cream with amber hexagons */
:root[data-theme="honey"], [data-swatch="honey"] {
  --accent1:#FFCB52; --accent2:#F7A57A;
  --face:#FFFBEE; --face-top:#FAE3A8; --panel-face:#FFF6DD; --panel-top:#F1D795;
  --text-primary:#2B2310; --text-secondary:#584A27; --stroke:#30270F; --shadow:#30270F;
  --bg:#FFF1CF; --answer-ink:#5A2C9E; --stat-red:#C62828; --good-green:#1A7F38;
  --on-accent:#2B2310; --on-accent-soft:#4D401E; --streak-green:#136B2D; --hint-ink:#7A6A45;
  --bg-paint: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27.7 48'%3E%3Cpath d='M0 -16L13.9 -8L13.9 8L0 16L-13.9 8L-13.9 -8ZM27.7 -16L41.6 -8L41.6 8L27.7 16L13.9 8L13.9 -8ZM13.9 8L27.7 16L27.7 32L13.9 40L0 32L0 16ZM0 32L13.9 40L13.9 56L0 64L-13.9 56L-13.9 40ZM27.7 32L41.6 40L41.6 56L27.7 64L13.9 56L13.9 40Z' fill='none' stroke='%23C98A12' stroke-opacity='.30' stroke-width='1.3'/%3E%3C/svg%3E") 0 0 / calc(34.64 * var(--ps)) calc(60 * var(--ps)), var(--bg);
  --scroll-bg: transparent;
}

/* Neon grid (dark arcade): magenta and cyan grid over a glowing horizon */
:root[data-theme="neon"], [data-swatch="neon"] {
  --accent1:#3CE8DA; --accent2:#FF5FDB;
  --face:#221238; --face-top:#1A0D2C; --panel-face:#1E1033; --panel-top:#150A26;
  --text-primary:#FCF2FF; --text-secondary:#CDB9E6; --stroke:#05010A; --shadow:#05010A;
  --bg:#130A22; --answer-ink:#62F4E8; --stat-red:#FF86B4; --good-green:#62F4A2;
  --on-accent:#130A22; --on-accent-soft:#2D1F47; --streak-green:#62F4A2; --hint-ink:#9D88BA;
  --bg-paint:
    radial-gradient(120% 40% at 50% 100%, rgba(255,70,205,.26), transparent 72%) no-repeat,
    radial-gradient(100% 30% at 50% 0%, rgba(50,220,255,.12), transparent 72%) no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 160' preserveAspectRatio='xMidYMax slice'%3E%3Cg fill='none' stroke='%23FF4FD8' stroke-opacity='.30' stroke-width='1.4'%3E%3Cpath d='M152 0L-360 160'/%3E%3Cpath d='M158 0L-290 160'/%3E%3Cpath d='M164 0L-220 160'/%3E%3Cpath d='M170 0L-150 160'/%3E%3Cpath d='M176 0L-80 160'/%3E%3Cpath d='M182 0L-10 160'/%3E%3Cpath d='M188 0L60 160'/%3E%3Cpath d='M194 0L130 160'/%3E%3Cpath d='M200 0L200 160'/%3E%3Cpath d='M206 0L270 160'/%3E%3Cpath d='M212 0L340 160'/%3E%3Cpath d='M218 0L410 160'/%3E%3Cpath d='M224 0L480 160'/%3E%3Cpath d='M230 0L550 160'/%3E%3Cpath d='M236 0L620 160'/%3E%3Cpath d='M242 0L690 160'/%3E%3Cpath d='M248 0L760 160'/%3E%3Cpath d='M-400 8H800'/%3E%3Cpath d='M-400 20H800'/%3E%3Cpath d='M-400 36H800'/%3E%3Cpath d='M-400 56H800'/%3E%3Cpath d='M-400 82H800'/%3E%3Cpath d='M-400 114H800'/%3E%3Cpath d='M-400 154H800'/%3E%3C/g%3E%3C/svg%3E") 50% 100% / 100% 34% no-repeat,
    linear-gradient(to right, rgba(255,90,215,.12) 1px, transparent 1px) 0 0 / calc(32 * var(--ps)) calc(32 * var(--ps)),
    linear-gradient(to bottom, rgba(70,225,255,.10) 1px, transparent 1px) 0 0 / calc(32 * var(--ps)) calc(32 * var(--ps)),
    var(--bg);
  --scroll-bg: transparent;
}

/* Terrazzo: warm stone flecked with coloured chips */
:root[data-theme="terrazzo"], [data-swatch="terrazzo"] {
  --accent1:#F0B5A0; --accent2:#A9D1B8;
  --face:#FFFDFA; --face-top:#EDE4DA; --panel-face:#FAF6F1; --panel-top:#E4D9CD;
  --text-primary:#2B2724; --text-secondary:#544D47; --stroke:#2D2926; --shadow:#2D2926;
  --bg:#F3EEE8; --answer-ink:#4E2AA0; --stat-red:#C62828; --good-green:#1A7F38;
  --on-accent:#2B2724; --on-accent-soft:#4C4540; --streak-green:#136B2D; --hint-ink:#756D66;
  --bg-paint: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpath d='M141.2 50.3L143.5 51.3L144.1 54.6L143.8 56L140.2 54.7L139.7 51.4Z' fill='%238DB596' fill-opacity='0.5'/%3E%3Cpath d='M24 181L30.7 184.9L27.1 192.2L21.3 192.3L19.2 184.7Z' fill='%23E2B15E' fill-opacity='0.5'/%3E%3Cpath d='M45.1 174.4L51.5 165.4L57.5 170.9L54.9 175.7Z' fill='%235B6378' fill-opacity='0.4'/%3E%3Cpath d='M64.1 30.1L58 30.5L55.7 26.3L62.5 22L65.8 26.4Z' fill='%23E8A5A0' fill-opacity='0.5'/%3E%3Cpath d='M113.7 177.1L112.1 177.9L109.4 177.1L110.6 174.5L112.4 173L113.8 174Z' fill='%23D9826A' fill-opacity='0.6'/%3E%3Cpath d='M191.4 59.4L188.6 64.3L184.7 60.8L187.7 58.1Z' fill='%238DB596' fill-opacity='0.6'/%3E%3Cpath d='M72.7 76.9L69 73L69.9 70.5L75.2 70.9L74.9 74.8Z' fill='%23E2B15E' fill-opacity='0.5'/%3E%3Cpath d='M120.8 82.6L119.3 81.1L119.1 77.6L123.4 79Z' fill='%235B6378' fill-opacity='0.5'/%3E%3Cpath d='M62.8 48.4L62.3 54L54.5 57.4L52.2 49.1Z' fill='%23E8A5A0' fill-opacity='0.4'/%3E%3Cpath d='M154.4 186.8L153.2 187.5L151 186.7L152.3 184.6L153.2 183L155.3 185.5Z' fill='%23D9826A' fill-opacity='0.4'/%3E%3Cpath d='M81.5 142.7L84.8 141.3L86.5 147.6L84 151.4L82.7 150.4L79.7 144.3Z' fill='%238DB596' fill-opacity='0.6'/%3E%3Cpath d='M125.8 62.4L126.2 64.9L124.2 66.4L120.5 64.9L122 62.4L123.3 62.2Z' fill='%23E2B15E' fill-opacity='0.5'/%3E%3Cpath d='M128.5 138.1L131.1 135.1L136 138.4L132.4 141.1Z' fill='%235B6378' fill-opacity='0.5'/%3E%3Cpath d='M181 158.8L186.1 165.1L179.9 168.1L176.5 164.6Z' fill='%23E8A5A0' fill-opacity='0.5'/%3E%3Cpath d='M53.8 127.7L55.8 117.6L60.1 119.5L63.7 120L62.6 127.6L56.7 131Z' fill='%23D9826A' fill-opacity='0.4'/%3E%3Cpath d='M16.2 33.5L12.3 28.8L17.9 25.5L19.8 30.1Z' fill='%238DB596' fill-opacity='0.6'/%3E%3Cpath d='M26.7 58.4L25.2 60.6L21.2 59.5L21.1 57.8L25.6 55.8Z' fill='%23E2B15E' fill-opacity='0.6'/%3E%3Cpath d='M158.6 173.7L152.5 174.3L153.7 168.1L157.5 170.1Z' fill='%235B6378' fill-opacity='0.6'/%3E%3Cpath d='M175.9 92.2L169.5 94.5L168.5 89.5L174.6 88.2Z' fill='%23E8A5A0' fill-opacity='0.5'/%3E%3Cpath d='M192.7 110.7L190.8 114.4L187.2 113.8L189.4 110.5Z' fill='%23D9826A' fill-opacity='0.5'/%3E%3Cpath d='M168.1 154.6L161.4 158.7L152.2 153.5L158.2 147.9Z' fill='%238DB596' fill-opacity='0.6'/%3E%3Cpath d='M111.5 69.5L109.8 75.7L103.2 77.4L100.4 69.9L103.6 66.7Z' fill='%23E2B15E' fill-opacity='0.5'/%3E%3Cpath d='M102.1 134.1L103 131.9L106.4 131.1L106.7 134.4L104.3 136.5Z' fill='%235B6378' fill-opacity='0.4'/%3E%3Cpath d='M169.4 73.2L171.6 66.1L175.3 69.5L173.3 75.1Z' fill='%23E8A5A0' fill-opacity='0.6'/%3E%3Cpath d='M119.8 185.1L122.2 190.2L120.8 194.5L117.8 194.3L114.7 189.9L115 186.6Z' fill='%23D9826A' fill-opacity='0.6'/%3E%3Cpath d='M5.8 82.9L3.2 74.8L9.5 70.8L16.5 78.4L13.8 82.4Z' fill='%238DB596' fill-opacity='0.5'/%3E%3Cpath d='M97.3 188.8L102.3 187.5L102.4 190.6L98.1 193.3Z' fill='%23E2B15E' fill-opacity='0.5'/%3E%3Cpath d='M153 104.7L153.2 105.7L150.3 106.3L148.5 104L149 103.2L151.9 102.1Z' fill='%235B6378' fill-opacity='0.5'/%3E%3Cpath d='M188.3 126.8L191.8 131L190.2 133.5L182.8 134.8L183.1 129.4Z' fill='%23E8A5A0' fill-opacity='0.5'/%3E%3Cpath d='M144.7 91.3L144.3 85.5L151.1 83.8L154.2 87.3L148.5 91.5Z' fill='%23D9826A' fill-opacity='0.6'/%3E%3Ccircle cx='107.6' cy='102' r='1.2' fill='%23D9826A' fill-opacity='.45'/%3E%3Ccircle cx='6.9' cy='83.4' r='1' fill='%238DB596' fill-opacity='.45'/%3E%3Ccircle cx='131.7' cy='20.2' r='1' fill='%23E2B15E' fill-opacity='.45'/%3E%3Ccircle cx='75.6' cy='163' r='0.7' fill='%235B6378' fill-opacity='.45'/%3E%3Ccircle cx='145.6' cy='122.5' r='1.2' fill='%23E8A5A0' fill-opacity='.45'/%3E%3Ccircle cx='23.6' cy='124.9' r='0.7' fill='%23D9826A' fill-opacity='.45'/%3E%3Ccircle cx='189.3' cy='67.9' r='0.8' fill='%238DB596' fill-opacity='.45'/%3E%3Ccircle cx='132.2' cy='121.5' r='0.7' fill='%23E2B15E' fill-opacity='.45'/%3E%3Ccircle cx='167.1' cy='139' r='0.6' fill='%235B6378' fill-opacity='.45'/%3E%3Ccircle cx='189.1' cy='111.5' r='1.3' fill='%23E8A5A0' fill-opacity='.45'/%3E%3Ccircle cx='93.2' cy='183' r='1.2' fill='%23D9826A' fill-opacity='.45'/%3E%3Ccircle cx='103.7' cy='146.3' r='1.1' fill='%238DB596' fill-opacity='.45'/%3E%3Ccircle cx='150.9' cy='19' r='1' fill='%23E2B15E' fill-opacity='.45'/%3E%3Ccircle cx='49.4' cy='101.5' r='0.6' fill='%235B6378' fill-opacity='.45'/%3E%3Ccircle cx='48.6' cy='75.8' r='0.7' fill='%23E8A5A0' fill-opacity='.45'/%3E%3Ccircle cx='72.9' cy='134.3' r='1.2' fill='%23D9826A' fill-opacity='.45'/%3E%3C/svg%3E") 0 0 / calc(200 * var(--ps)) calc(200 * var(--ps)), var(--bg);
  --scroll-bg: transparent;
}

/* Waves: sea foam with soft rolling lines */
:root[data-theme="waves"], [data-swatch="waves"] {
  --accent1:#8FD3E8; --accent2:#FFD7A0;
  --face:#F8FDFF; --face-top:#CFE9F1; --panel-face:#EEF8FB; --panel-top:#C3E1EA;
  --text-primary:#12303A; --text-secondary:#3B5862; --stroke:#163540; --shadow:#163540;
  --bg:#E1F1F6; --answer-ink:#3A2CA8; --stat-red:#C62828; --good-green:#1A7F38;
  --on-accent:#12303A; --on-accent-soft:#33505A; --streak-green:#136B2D; --hint-ink:#5E7880;
  --bg-paint:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 20'%3E%3Cpath d='M0 10C10 3 20 3 30 10S50 17 60 10' fill='none' stroke='%232A86A8' stroke-opacity='0.22' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") 0 0 / calc(60 * var(--ps)) calc(20 * var(--ps)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 20'%3E%3Cpath d='M0 10C10 3 20 3 30 10S50 17 60 10' fill='none' stroke='%232A86A8' stroke-opacity='0.11' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E") calc(30 * var(--ps)) calc(10 * var(--ps)) / calc(60 * var(--ps)) calc(20 * var(--ps)),
    var(--bg);
  --scroll-bg: transparent;
}

/* ------------------------------------------------------------ foundations */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Roboto', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

.mw-black { font-weight: 900; }

/* One keyboard / switch-access focus ring for the whole app: the theme's primary text
 * colour (dark on light themes, light on Dark) always contrasts with the surface around
 * the control, where an accent ring measured 1.07 to 1.48:1. The Galaxy screens are
 * always dark space, so the ring is white there (themed cards on them keep the default). */
:focus-visible { outline: 3px solid var(--text-primary); outline-offset: 2px; }
.blaster-screen :focus-visible, .galaxymap-screen :focus-visible { outline-color: #FFFFFF; }
.blaster-screen .mw-card :focus-visible, .galaxymap-screen .mw-card :focus-visible { outline-color: var(--text-primary); }

/* celebration lettering (owner, 21 Nov 2026: "The yellow text with the black border looks cheap", "Doesn't fit the app"):
 * never yellow / gold letters with a dark outline, ring or glow. White lettering on a solid shaped plaque with depth (the
 * app's chunky border and drop), the plaque's colour carrying the moment: warm (a streak), hot (a big streak), cool (the
 * fastest answer); elsewhere plain ink. Guard: tools/tests/academy/no_yellow_text.test.mjs */
:root { --cel-warm: linear-gradient(to bottom, #FF9446, #F26A1C 58%, #D9540D); --cel-hot: linear-gradient(to bottom, #FF6F5A, #E8412C 58%, #C42E1B);
  --cel-cool: linear-gradient(to bottom, #6F98FF, #3D6BF0 58%, #2A50C9); --cel-ink: #FFFFFF; }
.mw-outline   { font-weight: 900; paint-order: stroke fill; -webkit-text-stroke: calc(3 * var(--u)) var(--stroke); }
.mw-outline-2 { font-weight: 900; paint-order: stroke fill; -webkit-text-stroke: calc(2 * var(--u)) var(--stroke); }
.mw-outline-4 { font-weight: 900; paint-order: stroke fill; -webkit-text-stroke: calc(4 * var(--u)) var(--stroke); }

.mw-label {
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

/* ------------------------------------------------------------------ card */
.mw-card {
  background: var(--card-paint, none), linear-gradient(to bottom, var(--face-top) 0%, var(--face) 50%, var(--face) 100%);
  border: calc(3 * var(--u)) solid var(--stroke);
  border-radius: calc(24 * var(--u));
  box-shadow: 0 calc(5 * var(--u)) 0 0 var(--shadow);
}

.mw-panel {
  background: linear-gradient(to bottom, var(--panel-top) 0%, var(--panel-face) 100%);
  border: calc(4 * var(--u)) solid var(--stroke);
  border-radius: calc(20 * var(--u));
}

/* ----------------------------------------------------- keypad tile (keys) */
.mw-tile {
  position: relative;
  background: linear-gradient(to bottom, var(--face-top) 0%, var(--face) 50%, var(--face) 100%);
  border: calc(3 * var(--u)) solid var(--stroke);
  border-radius: calc(16 * var(--u));
  box-shadow: 0 calc(5 * var(--u)) 0 0 var(--shadow);
  color: var(--text-primary);
  font-weight: 900;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  transition: transform 90ms ease-out, box-shadow 90ms ease-out;
  touch-action: manipulation;
}
.mw-tile::before {
  content: '';
  position: absolute;
  left: calc(8 * var(--u)); right: calc(8 * var(--u));
  top: calc(6 * var(--u)); bottom: calc(30 * var(--u));
  border-radius: calc(10 * var(--u));
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.5));
  pointer-events: none;
}
.mw-tile:active, .mw-tile.pressed {
  transform: translateY(calc(5 * var(--u)));
  box-shadow: 0 calc(2 * var(--u)) 0 0 var(--shadow);
  transition-duration: 50ms;
}
.mw-tile:active::before, .mw-tile.pressed::before { opacity: 0; }
/* Same fix as .mw-btn below: the gloss band paints BEHIND the digit (isolated stacking
 * context + z-index -1). Painted over it, the band washed a keypad "5" from 15.9:1 to
 * 3.2:1 on Classic (and greyed out Times Table tile labels). On Dark the band is softer
 * so light digits keep their contrast; :where() keeps this at plain .mw-tile::before
 * weight, so .selected / :active / .ai-tile / blaster rules still set their own opacity. */
.mw-tile { isolation: isolate; }
.mw-tile::before { z-index: -1; }
:where(:root[data-tone="dark"]) .mw-tile::before { opacity: 0.35; }

/* --------------------------------------------------------- button (pills) */
.mw-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to bottom, var(--face-top) 0%, var(--face) 50%, var(--face) 100%);
  border: calc(3 * var(--u)) solid var(--stroke);
  border-radius: calc(36 * var(--u));
  box-shadow: 0 calc(6 * var(--u)) 0 0 var(--shadow);
  color: var(--text-primary);
  font-family: inherit;
  font-weight: 900;
  font-size: calc(20 * var(--u));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-height: calc(76 * var(--u));
  padding: calc(8 * var(--u)) calc(24 * var(--u)) calc(16 * var(--u));
  cursor: pointer;
  transition: transform 90ms ease-out, box-shadow 90ms ease-out;
  touch-action: manipulation;
}
.mw-btn::before {
  content: '';
  position: absolute;
  left: calc(14 * var(--u)); right: calc(14 * var(--u));
  top: calc(10 * var(--u)); bottom: calc(48 * var(--u));
  border-radius: calc(22 * var(--u));
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.5));
  pointer-events: none;
}
.mw-btn:active, .mw-btn.pressed {
  transform: translateY(calc(6 * var(--u)));
  box-shadow: 0 calc(2 * var(--u)) 0 0 var(--shadow);
  transition-duration: 50ms;
}
.mw-btn:active::before, .mw-btn.pressed::before { opacity: 0; }
/* The gloss paints BEHIND the label (isolated stacking context + z-index -1), so a
 * label that wraps to 2 lines (long translations) is never washed out by the band.
 * On dark-family themes (data-tone="dark": Dark and the dark patterns), a plain
 * (light-text) button gets a softer band so the text keeps contrast. */
.mw-btn { isolation: isolate; }
.mw-btn::before { z-index: -1; }
:root[data-tone="dark"] .mw-btn:not(.accent):not(.gold)::before { opacity: 0.35; }
:root[data-tone="dark"] .mw-btn:not(.accent):not(.gold):active::before,
:root[data-tone="dark"] .mw-btn:not(.accent):not(.gold).pressed::before { opacity: 0; }
.mw-btn.gold { background: linear-gradient(to bottom, #FFE9A0, #F5C233 55%, #E8A41E); border-color: #B8860B; box-shadow: 0 calc(6 * var(--u)) 0 0 #8A5A10; color: #3A2606; }
/* thematic CTA — the theme accent hue, chunky highlight/stroke/shadow derived from --accent1 */
.mw-btn.accent {
  background: linear-gradient(to bottom, color-mix(in srgb, var(--accent1) 76%, white) 0%, var(--accent1) 55%, color-mix(in srgb, var(--accent1) 86%, black) 100%);
  border-color: color-mix(in srgb, var(--accent1) 55%, black 45%);
  box-shadow: 0 calc(6 * var(--u)) 0 0 color-mix(in srgb, var(--accent1) 45%, black 55%);
  color: color-mix(in srgb, var(--accent1) 22%, black 78%);
}
.mw-btn.accent:active, .mw-btn.accent.pressed { box-shadow: 0 calc(2 * var(--u)) 0 0 color-mix(in srgb, var(--accent1) 45%, black 55%); }

/* ------------------------------------------------------------ progress bar */
.mw-progress {
  height: calc(16 * var(--u));
  background: rgba(0, 0, 0, 0.2);
  border: calc(2 * var(--u)) solid var(--stroke);
  border-radius: calc(10 * var(--u));
  overflow: hidden;
}
.mw-progress .mw-progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(to bottom, var(--face-top), var(--face));
  border-right: calc(2 * var(--u)) solid var(--stroke);
  border-radius: calc(8 * var(--u));
  transition: width 250ms ease-out;
}

/* ------------------------------------------------------- shared animations */
@keyframes mw-shake {
  0%, 100% { transform: translateX(0); }
  8.3% { transform: translateX(calc(-10 * var(--u))); }
  25%  { transform: translateX(calc(10 * var(--u))); }
  41.6%{ transform: translateX(calc(-10 * var(--u))); }
  58.3%{ transform: translateX(calc(10 * var(--u))); }
  75%  { transform: translateX(calc(-10 * var(--u))); }
  91.6%{ transform: translateX(calc(10 * var(--u))); }
}
.shake { animation: mw-shake 300ms linear; }

@keyframes mw-pop-fade {
  0%   { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.2); opacity: 0; }
}
.pop-fade { animation: mw-pop-fade 800ms ease-in-out forwards; }
.pop-fade-once { animation: mw-pop-fade 800ms ease-in-out; }

@keyframes mw-slide-in {
  0%   { transform: translateY(-50%); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
.slide-in { animation: mw-slide-in 300ms cubic-bezier(0, 0, 0.2, 1); }

.fade-out { opacity: 0; transition: opacity 100ms ease-in; }

@keyframes mw-pop {
  0% { transform: scale(0.5); } 70% { transform: scale(1.15); } 100% { transform: scale(1); }
}
.pop { animation: mw-pop 500ms ease-out; }
