  /* ── Trikker house style ──────────────────────────────────────────────
     Source of truth: https://www.trikker.be/brandbook (cached tokens:
     docs/odoo/brandbook-website.md, "De merktokens"). Fonts are self-hosted
     (CSP font-src 'self'); both families are SIL OFL, see fonts/OFL-*.txt.
     Radley only ships Regular + Italic: never give it a weight above 400. */
  @font-face {
    font-family: 'Radley'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('../fonts/radley-400-normal-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
  }
  @font-face {
    font-family: 'Radley'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('../fonts/radley-400-normal-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  }
  @font-face {
    font-family: 'Radley'; font-style: italic; font-weight: 400; font-display: swap;
    src: url('../fonts/radley-400-italic-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
  }
  @font-face {
    font-family: 'Radley'; font-style: italic; font-weight: 400; font-display: swap;
    src: url('../fonts/radley-400-italic-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  }
  @font-face {
    font-family: 'Carlito'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('../fonts/carlito-400-normal-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
  }
  @font-face {
    font-family: 'Carlito'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('../fonts/carlito-400-normal-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  }
  @font-face {
    font-family: 'Carlito'; font-style: italic; font-weight: 400; font-display: swap;
    src: url('../fonts/carlito-400-italic-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
  }
  @font-face {
    font-family: 'Carlito'; font-style: italic; font-weight: 400; font-display: swap;
    src: url('../fonts/carlito-400-italic-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  }
  @font-face {
    font-family: 'Carlito'; font-style: normal; font-weight: 700; font-display: swap;
    src: url('../fonts/carlito-700-normal-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
  }
  @font-face {
    font-family: 'Carlito'; font-style: normal; font-weight: 700; font-display: swap;
    src: url('../fonts/carlito-700-normal-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  }
  :root {
    /* Brand palette */
    --coral: #FA7049;          /* primary, key moments only (~10%) */
    --signal-orange: #F6804E;  /* reserved for in-product actions */
    --bronze: #C09668;         /* accent */
    --cream: #FAF4EA;          /* background */
    --white: #FFFFFF;          /* background */
    --charcoal: #413837;       /* text and dark surfaces */
    --on-brand: #2A2320;       /* text ON coral / bronze / signal orange */
    /* Derived tints (same hues, for states and contrast-safe text) */
    --coral-ink: #A84A2E;      /* coral-hued text on light: 5.7:1 on white */
    --coral-tint: #FEEDE6;
    --cream-deep: #F3EADB;
    --bronze-tint: #F6EBDD;
    --charcoal-light: #574A48;
    /* Semantic roles (old names kept: JS reads --navy, --accent, ...) */
    --navy: var(--charcoal);
    --navy-light: var(--charcoal-light);
    --accent: var(--coral);
    --accent-hover: #FB8A69;
    --accent-ink: var(--coral-ink);
    --bg: var(--cream);
    --card: var(--white);
    --surface-hover: var(--cream-deep);
    --text: var(--charcoal);
    --text-muted: #6B5F5C;     /* 5.6:1 on cream, 6.2:1 on white */
    --border: #E2D7C8;
    --error: #B3261E;          /* 6.5:1 on white */
    --error-tint: #FBEAE8;
    --success: #2E7A4B;        /* 5.2:1 on white */
    --focus-ring: var(--charcoal);
    --font-heading: 'Radley', Georgia, 'Times New Roman', serif;
    --font-body: 'Carlito', Calibri, Arial, sans-serif;
    --home-w: 420px;
    /* Typography scale (Carlito is Calibri-metric: a touch larger than before) */
    --fs-2xs: 0.7rem;
    --fs-xs: 0.8rem;
    --fs-sm: 0.9rem;
    --fs-base: 1rem;
    --fs-md: 1.05rem;
    --fs-lg: 1.2rem;
    --fs-xl: 1.35rem;
    --fs-2xl: 1.75rem;
    --fs-3xl: 2.1rem;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  body, button, input, select, textarea {
    font-family: var(--font-body);
  }
  body {
    background: var(--bg);
    color: var(--text);
    font-size: var(--fs-base);
    min-height: 100vh;
    overflow: hidden;
    line-height: 1.4;
  }
  .screen {
    display: none; width: 100vw; height: 100vh;
    flex-direction: column; align-items: center; justify-content: center;
    animation: fadeIn 0.3s ease;
  }
  .screen.active { display: flex; }
  .screen:not(.active) { content-visibility: hidden; }
  .screen.has-tabs { padding-bottom: 64px !important; }
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* ── Bottom Tab Bar ── */
  .tab-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 60px; background: var(--card);
    border-top: 1px solid var(--border);
    display: none; justify-content: space-around; align-items: center;
    z-index: 100; padding: 0 0.5rem;
    box-shadow: 0 -2px 10px rgba(65,56,55,0.06);
  }
  .tab-bar.visible { display: flex; }
  .tab-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 2px; background: none; border: none; color: var(--text-muted);
    font-size: var(--fs-xs); cursor: pointer;
    padding: 0.4rem 0; min-height: 52px; justify-content: center; transition: color 0.2s; position: relative;
  }
  .tab-btn .tab-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
  .tab-btn .tab-icon svg { width: 24px; height: 24px; fill: var(--text-muted); transition: fill 0.2s; }
  .tab-btn.active .tab-icon svg { fill: var(--accent); }
  .tab-btn.active { color: var(--accent-ink); }
  /* Active tab: coral indicator on the top edge (a real border, so it is
     also what the visual brand check reads) */
  .tab-btn { border-top: 3px solid transparent; align-self: stretch; }
  .tab-btn.active { border-top-color: var(--accent); }

  /* ── Unified Button System ── */
  .btn, .btn-play, .btn-ok, .btn-secondary {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.4rem; padding: 0.7rem 1.5rem; font-size: var(--fs-base);
    font-weight: 700; border-radius: 8px;
    cursor: pointer; transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s; border: none;
    min-height: 44px; text-decoration: none;
  }
  .btn-primary, .btn-play, .btn-ok {
    background: var(--accent); color: var(--on-brand);
    box-shadow: 0 2px 8px rgba(250,112,73,0.2);
  }
  .btn-primary:hover, .btn-play:hover, .btn-ok:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(250,112,73,0.3); }
  .btn-outline, .btn-secondary {
    background: var(--card); color: var(--text); border: 1px solid var(--border);
  }
  .btn-outline:hover, .btn-secondary:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--coral-tint); }
  .btn-ghost {
    background: none; color: var(--text-muted); border: none; padding: 0.5rem 1rem;
  }
  .btn-ghost:hover { color: var(--accent-ink); }
  .btn-full { width: 100%; }
  .btn-sm { padding: 0.45rem 1rem; font-size: var(--fs-sm); min-height: 36px; }
  .btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; width: 100%; margin-top: 0.3rem; }

  /* ── Screen Header (non-game) ── */
  .screen-header {
    width: 100%; max-width: 550px; display: flex; align-items: center;
    padding: 0 0.5rem; margin-bottom: 0.5rem;
  }
  .screen-header h2 {
    flex: 1; text-align: center; font-size: var(--fs-2xl); color: var(--charcoal);
    line-height: 1.2;
  }
  .btn-back {
    background: none; border: none; color: var(--text-muted); font-size: var(--fs-xl);
    cursor: pointer; padding: 0.3rem; min-width: 44px; min-height: 44px; border-radius: 8px; transition: color 0.2s; line-height: 1;
  }
  .btn-back:hover { color: var(--accent-ink); }
  .header-spacer { width: 44px; }

  /* Home: news from the blog as a compact link (not a heavy dark bar) */
  .home-banner {
    display: flex; align-items: center; gap: 0.6rem;
    width: 100%; min-height: 44px; padding: 0.5rem 0.9rem;
    background: var(--card); color: var(--charcoal);
    border: 1px solid var(--border); border-left: 3px solid var(--bronze);
    border-radius: 10px; text-decoration: none; font-size: var(--fs-sm);
    transition: background-color 0.2s, border-color 0.2s; cursor: pointer;
  }
  .home-banner:hover { background: var(--bronze-tint); border-color: var(--bronze); }
  .hb-label { flex-shrink: 0; font-size: var(--fs-xs); font-weight: 700; color: var(--coral-ink); }
  .hb-text {
    flex: 1; min-width: 0; overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  }
  .hb-arrow { flex-shrink: 0; color: var(--coral-ink); font-size: var(--fs-lg); line-height: 1; }

  /* Home / Landing */
  #screen-home { padding: 1.5rem 1rem 1rem; justify-content: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .home-wrap {
    width: 100%; max-width: var(--home-w);
    display: flex; flex-direction: column; gap: 0.9rem;
  }
  .home-top { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
  .home-day { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
  .home-day-text { min-width: 0; }
  .daily-eyebrow { font-size: var(--fs-sm); font-weight: 700; color: var(--coral-ink); margin: 0; }
  .home-date { font-size: 1.7rem; line-height: 1.15; color: var(--charcoal); margin: 0.1rem 0 0; }
  .home-date .num { font-family: 'Carlito', Calibri, Arial, sans-serif; font-weight: 400; font-variant-numeric: lining-nums; }
  /* Compact player chip next to the daily header */
  .home-welcome-card {
    flex: 0 1 auto; min-width: 0; max-width: 55%; background: var(--card);
    border: 1px solid var(--border); border-radius: 999px;
    padding: 0.3rem 0.8rem 0.3rem 0.3rem; display: flex; align-items: center; gap: 0.55rem;
    cursor: pointer; transition: box-shadow 0.2s, border-color 0.2s; min-height: 44px;
  }
  .home-welcome-card:hover { box-shadow: 0 2px 12px rgba(65,56,55,0.08); border-color: var(--bronze); }
  .home-welcome-card .hw-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--navy); color: var(--cream);
    display: flex; align-items: center; justify-content: center;
    font-size: var(--fs-md); font-weight: bold; flex-shrink: 0;
  }
  .home-welcome-card .hw-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
  .home-welcome-card .hw-name { font-weight: 700; color: var(--navy); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .home-welcome-card .hw-meta { font-size: var(--fs-xs); color: var(--text-muted); }
  .home-welcome-card .hw-medals { display: flex; gap: 0.3rem; flex-shrink: 0; align-items: center; }
  .home-welcome-card .hw-medal { display: flex; align-items: center; font-size: var(--fs-2xs); color: var(--text-muted); }
  .home-welcome-card .hw-medal span:not(.hw-medal-icon) { display: none; }
  .home-welcome-card .hw-medal-icon { font-size: 1.15rem; }
  .home-welcome-card .hw-streak { display: none; } /* the today card shows the streak */
  .home-section-label {
    font-size: var(--fs-xl); font-style: italic; color: var(--charcoal);
    margin: 0.4rem 0 0; width: 100%;
  }

  /* Today: your day, your streak, the next game */
  .today-card {
    width: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 16px;
    padding: 1rem 1.1rem; display: grid; grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "progress streak" "action action" "notes notes";
    column-gap: 1rem; box-shadow: 0 1px 3px rgba(65,56,55,0.05);
  }
  .today-progress { grid-area: progress; min-width: 0; }
  .today-streak { grid-area: streak; text-align: right; }
  .today-action { grid-area: action; margin-top: 0.9rem; }
  .today-notes { grid-area: notes; }
  .today-kicker {
    font-family: var(--font-heading); font-style: italic; font-weight: 400;
    font-size: var(--fs-md); color: var(--text-muted); margin: 0 0 0.2rem; line-height: 1.2;
  }
  .today-count-row { margin: 0; display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; }
  .today-streak .today-count-row { justify-content: flex-end; }
  /* Counters in Carlito: Radley's old-style 1 reads as an I */
  .today-count, .today-streak-val {
    font-family: var(--font-body); font-weight: 700; font-size: 2.1rem; line-height: 1;
    color: var(--charcoal); font-variant-numeric: tabular-nums; white-space: nowrap;
  }
  .today-count-lbl { font-size: var(--fs-sm); color: var(--text-muted); }
  .today-fire { font-size: 1.35rem; line-height: 1; align-self: center; }
  .today-fire.is-zero { filter: grayscale(1); opacity: 0.45; }
  .today-dots { display: flex; gap: 5px; margin-top: 0.65rem; }
  .today-dot { flex: 1; max-width: 34px; height: 6px; border-radius: 99px; background: var(--border); }
  .today-dot.on { background: var(--accent); }
  .today-cta { width: 100%; min-height: 52px; justify-content: space-between; padding: 0.7rem 1.1rem; font-size: var(--fs-md); text-align: left; }
  .today-cta-game { font-weight: 400; white-space: nowrap; }
  .today-cta-game::after { content: '\00a0\2192'; }
  .today-done {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
    column-gap: 0.75rem; background: var(--bronze-tint); border-radius: 12px; padding: 0.7rem 0.9rem;
  }
  .today-done-title { font-family: var(--font-heading); font-size: var(--fs-lg); color: var(--charcoal); margin: 0; grid-column: 1; }
  .today-done-sub { font-size: var(--fs-sm); color: var(--charcoal-light); margin: 0; grid-column: 1; }
  .today-done .btn { grid-column: 2; grid-row: 1 / span 2; }
  .today-notes > p { margin: 0.6rem 0 0; }
  .home-input-row {
    display: flex; gap: 0.5rem; align-items: stretch;
  }
  .home-input-row input {
    flex: 1; padding: 0.6rem 0.8rem; font-size: var(--fs-base);
    border: 1px solid var(--border); border-radius: 6px;
    min-width: 0; background: var(--card); color: var(--text);
  }
  .home-input-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(250,112,73,0.2); }
  .home-input-row input.error { border-color: var(--error); box-shadow: 0 0 0 3px rgba(179,38,30,0.1); }
  .btn-play { width: 100%; }
  .home-register-hint {
    font-size: var(--fs-xs); color: var(--text-muted); text-align: center;
    line-height: 1.4;
  }
  .home-register-hint b { color: var(--accent-ink); }

  /* Details */
  #screen-details { padding: 2rem; }
  .details-form {
    width: 100%; max-width: 460px;
    display: flex; flex-direction: column; gap: 0.6rem;
  }
  .details-form label { font-size: var(--fs-md); color: var(--text-muted); margin-top: 0.4rem; }
  .details-form input[type="text"],
  .details-form input[type="email"],
  .details-form input[type="tel"] {
    padding: 0.7rem 0.9rem; font-size: var(--fs-md);
    border: 2px solid var(--border); background: var(--card);
    color: var(--text);
    border-radius: 4px; transition: border-color 0.2s;
  }
  .details-form input:focus { border-color: var(--accent); }
  .details-form input.error { border-color: var(--error); background: var(--error-tint); }
  .radio-group { display: flex; gap: 2rem; margin-top: 0.3rem; }
  .radio-group label {
    display: flex; align-items: center; gap: 0.5rem; cursor: pointer;
    font-size: var(--fs-md); color: var(--text); margin-top: 0;
  }
  .radio-group input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; }
  .disclaimer {
    font-size: var(--fs-sm); color: var(--text-muted);
    text-align: center; margin-top: 1.2rem; line-height: 1.4;
  }

  /* Countdown */
  #screen-countdown { flex-direction: column; gap: 0.5rem; }
  .countdown-title {
    font-size: clamp(1.4rem, 3vw, 2rem);
    color: var(--text-muted); font-style: italic;
  }
  .countdown-number {
    font-size: clamp(5rem, 15vw, 10rem);
    color: var(--charcoal); line-height: 1;
  }

  /* Game Screen */
  #screen-game { padding: 0; justify-content: flex-start; }
  .game-header {
    width: 100%; display: flex; justify-content: space-between;
    align-items: center; padding: 0.5rem 1rem;
    background: var(--navy); color: var(--cream); z-index: 10;
    flex-wrap: wrap; gap: 0.3rem;
  }
  .game-title-label { font-family: var(--font-heading); font-style: italic; font-size: var(--fs-md); color: rgba(250,244,234,0.85); letter-spacing: 0.02em; width: 100%; text-align: center; order: -1; }
  .game-timer {
    font-size: clamp(1.25rem, 2.5vw, 1.5rem); /* >= 18.66px bold: large text */
    font-variant-numeric: tabular-nums; color: var(--coral); font-weight: bold; /* 4.05:1 on charcoal, large bold text */
  }
  .game-timer.paused { opacity: 0.5; }
  .game-instructions { font-size: clamp(var(--fs-xs), 1.5vw, var(--fs-sm)); color: rgba(250,244,234,0.85); }
  .game-progress { font-size: clamp(var(--fs-sm), 1.5vw, var(--fs-md)); color: rgba(250,244,234,0.9); }
  .btn-back-game {
    background: rgba(250,244,234,0.15); border: 1px solid rgba(250,244,234,0.3);
    color: var(--cream); padding: 0.3rem 0.7rem; font-size: var(--fs-sm);
    cursor: pointer; border-radius: 6px; min-height: 44px; min-width: 44px;
    transition: background-color 0.2s; white-space: nowrap;
  }
  .btn-back-game:hover { background: rgba(250,244,234,0.25); }
  .btn-stop-game { padding: 0.3rem 0.5rem; background: rgba(179,38,30,0.55); border-color: rgba(250,244,234,0.35); }
  .btn-stop-game:hover { background: rgba(179,38,30,0.8); }

  .game-area {
    flex: 1; width: 100%;
    display: flex; gap: 0; position: relative;
    overflow: hidden;
  }
  .game-panel {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; padding: 0.3rem;
    min-width: 0;
  }
  .panel-label {
    font-size: clamp(0.65rem, 1.2vw, 0.85rem);
    color: var(--text-muted); margin-bottom: 0.2rem;
    font-weight: 700;
  }
  .game-divider { width: 1px; background: var(--border); align-self: stretch; }
  canvas {
    background: var(--card);
    border: 1px solid var(--border);
    cursor: crosshair;
    max-width: 100%;
  }

  /* Palette — sidebar on desktop, bottom bar on mobile */
  .palette {
    display: flex; flex-direction: column;
    gap: 4px; padding: 6px;
    background: var(--card);
    border-left: 1px solid var(--border);
    overflow-y: auto; overflow-x: hidden;
    width: 80px; min-width: 80px;
    align-items: center;
  }
  .pal-btn {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    width: 66px; height: 56px;
    border: 2px solid var(--border);
    background: var(--card); color: var(--text);
    cursor: pointer;
    border-radius: 6px; transition: all 0.15s;
    padding: 3px; gap: 1px; flex-shrink: 0;
  }
  .pal-btn:hover { border-color: var(--bronze); background: var(--surface-hover); }
  .pal-btn.active { border-color: var(--accent); background: var(--coral-tint); box-shadow: 0 0 0 2px rgba(250,112,73,0.25); }
  .pal-btn .pal-sym { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; color: var(--navy); }
  .pal-btn .pal-sym svg { width: 100%; height: 100%; }
  .pal-btn .pal-lbl { font-size: var(--fs-2xs); color: var(--text-muted); white-space: nowrap; }
  .pal-btn .pal-cnt { font-size: var(--fs-2xs); color: var(--accent-ink); font-weight: bold; }

  /* Score */
  #screen-score { padding: 1.5rem; gap: 0.8rem; overflow-y: auto; justify-content: flex-start; padding-top: 1rem; }
  #screen-quiz-result { padding: 1.5rem; gap: 0.8rem; overflow-y: auto; justify-content: flex-start; padding-top: 1rem; }
  .score-title { font-size: var(--fs-xl); color: var(--text-muted); font-style: italic; }
  .score-value {
    font-size: clamp(var(--fs-2xl), 5vw, var(--fs-3xl)); color: var(--charcoal);
    animation: scoreReveal 0.6s ease;
  }
  @keyframes scoreReveal {
    0% { opacity: 0; transform: scale(0.5); }
    60% { transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
  }

  /* Stats Tab Screen */
  #screen-stats { padding: 1.5rem; gap: 0.8rem; overflow-y: auto; justify-content: flex-start; padding-top: 1rem; }
  .stats-card {
    width: 100%; max-width: 420px; background: var(--card);
    border: 1px solid var(--border); border-radius: 12px;
    padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: 0.5rem;
  }
  .stats-card h3 { font-size: var(--fs-lg); font-style: italic; color: var(--charcoal); margin: 0; }
  .stats-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.4rem 0; border-bottom: 1px solid var(--cream-deep);
  }
  .stats-row:last-child { border-bottom: none; }
  .stats-label { font-size: var(--fs-base); color: var(--text); }
  .stats-val { font-size: var(--fs-base); font-weight: 600; color: var(--navy); }
  .stats-streak-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem;
  }
  .stats-streak-grid--2col { grid-template-columns: repeat(2, 1fr); }
  .stats-streak-grid--4col { grid-template-columns: repeat(4, 1fr); margin-top: 0.5rem; }
  .stats-streak-item {
    text-align: center; padding: 0.6rem;
    background: var(--bg); border-radius: 8px;
  }
  .stats-streak-item .ss-val { font-size: var(--fs-2xl); font-weight: 700; color: var(--navy); }
  .stats-streak-item .ss-lbl { font-size: var(--fs-xs); color: var(--text-muted); }

  /* Profile Tab Screen */
  #screen-profile { padding: 1.5rem; gap: 0.8rem; overflow-y: auto; justify-content: flex-start; padding-top: 1rem; }
  .profile-card {
    width: 100%; max-width: 480px; background: var(--card);
    border: 1px solid var(--border); border-radius: 12px;
    padding: 1.2rem; display: flex; flex-direction: column; gap: 0.8rem;
  }
  .profile-card + .profile-card { margin-top: 0.8rem; }
  .profile-card h3 { font-size: var(--fs-xl); font-style: italic; color: var(--charcoal); }
  #profile-guest-section, #profile-account-section { width: 100%; max-width: 480px; }
  .profile-avatar-row {
    display: flex; align-items: center; gap: 1rem;
  }
  .profile-avatar {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--navy); color: var(--cream);
    display: flex; align-items: center; justify-content: center;
    font-size: var(--fs-2xl); font-weight: bold; flex-shrink: 0;
  }
  .profile-info { display: flex; flex-direction: column; }
  .profile-info .p-name { font-weight: 600; font-size: var(--fs-lg); color: var(--navy); }
  .profile-info .p-detail { font-size: var(--fs-sm); color: var(--text-muted); }
  .profile-lang-row {
    display: flex; align-items: center; gap: 0.5rem;
  }
  .avatar-picker-label { font-size: var(--fs-sm); font-weight: 700; color: var(--text-muted); }
  .avatar-symbol-grid { display: flex; gap: 0.3rem; flex-wrap: wrap; }
  .avatar-sym-btn {
    width: 40px; height: 40px; border-radius: 8px; border: 2px solid var(--border);
    background: var(--card); cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; color: var(--navy); transition: all 0.15s;
  }
  .avatar-sym-btn:hover { border-color: var(--bronze); }
  .avatar-sym-btn.selected { border-color: var(--accent); background: rgba(250,112,73,0.1); }
  .avatar-sym-btn .sym-svg { width: 22px; height: 22px; }
  .avatar-sym-btn--letter { font-weight: bold; font-size: 1.2rem; }
  .avatar-color-grid { display: flex; gap: 0.3rem; flex-wrap: wrap; }
  .avatar-color-btn {
    width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent;
    cursor: pointer; transition: all 0.15s;
  }
  .avatar-color-btn:hover { transform: scale(1.15); }
  .avatar-color-btn.selected { border-color: var(--charcoal); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--charcoal); }
  .avatar-preview {
    width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: 1.5rem; color: var(--cream); font-weight: bold; flex-shrink: 0;
  }
  .avatar-preview .sym-svg { width: 26px; height: 26px; color: var(--cream); }
  .profile-lang-row label { font-size: var(--fs-sm); color: var(--text-muted); }
  .profile-lang-row select {
    padding: 0.4rem 0.8rem; font-size: var(--fs-base);
    border: 1px solid var(--border); border-radius: 6px;
    background: var(--card); color: var(--text);
    cursor: pointer; flex: 1; min-height: 44px;
  }
  .profile-actions { display: flex; flex-direction: column; gap: 0.5rem; }
  .profile-guest-msg {
    text-align: center; color: var(--text-muted); font-size: var(--fs-base);
    padding: 1rem 0;
  }
  .top10-title { font-size: var(--fs-xl); color: var(--text-muted); font-style: italic; margin-top: 0.5rem; }
  .top10-list { width: 100%; max-width: 550px; }
  .top10-row { display: flex; padding: 0.4rem 0.8rem; font-size: var(--fs-base); align-items: center; }
  .top10-row:nth-child(even) { background: rgba(65,56,55,0.04); }
  .top10-row.highlight { background: var(--coral-tint); color: var(--accent-ink); font-weight: bold; }
  .top10-rank { width: 36px; text-align: center; }
  .top10-name { flex: 1; }
  .top10-score { width: 140px; text-align: right; }

  /* Daily badge */
  .daily-badge {
    background: var(--card); border: 1px solid var(--bronze);
    color: var(--charcoal); padding: 0.3rem 1rem;
    border-radius: 999px; font-size: var(--fs-sm);
    margin-bottom: 1.2rem; letter-spacing: 0.02em;
    text-align: center; line-height: 1.4;
  }
  .daily-badge .daily-date {
    display: block; font-weight: 700;
  }
  /* Language switch: NL / FR / EN (home header on phone/tablet, sidebar on desktop) */
  .lang-seg {
    display: inline-flex; gap: 2px; padding: 2px; flex-shrink: 0;
    background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  }
  .lang-btn {
    min-width: 44px; min-height: 44px; padding: 0 0.6rem; border-radius: 999px;
    border: none; background: transparent; cursor: pointer;
    font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.03em; color: var(--text-muted);
    transition: background-color 0.15s, color 0.15s;
  }
  .lang-btn:hover { color: var(--charcoal); background: var(--cream-deep); }
  .lang-btn.active { background: var(--charcoal); color: var(--cream); }
  /* Engagement notes inside the today card: quiet, no pulsing */
  .streak-warning, .achievement-nudge {
    background: var(--bronze-tint); color: var(--charcoal); padding: 0.45rem 0.75rem;
    border-radius: 8px; font-size: var(--fs-sm); line-height: 1.35;
  }
  .streak-warning { font-weight: 700; }
  .time-urgency { font-size: var(--fs-sm); color: var(--coral-ink); font-weight: 700; }

  /* Leaderboard / Rankings */
  #screen-rankings { padding: 1.5rem; gap: 0.8rem; overflow-y: auto; justify-content: flex-start; padding-top: 1rem; }
  #screen-leaderboard { padding: 1.5rem; gap: 0.8rem; }
  .lb-tabs {
    display: flex; gap: 0; border-bottom: 2px solid var(--border);
    width: 100%; max-width: 550px;
  }
  .lb-tab {
    flex: 1; background: none; border: none; color: var(--text-muted);
    font-size: var(--fs-base); font-weight: 700; padding: 0.6rem 0.8rem; cursor: pointer;
    min-height: 44px;
    transition: color 0.2s, border-color 0.2s; border-bottom: 2px solid transparent; margin-bottom: -2px;
  }
  .lb-tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }
  .lb-tab:hover { color: var(--text); }
  .rank-game-select {
    width: 100%; padding: 0.5rem 0.8rem; font-size: var(--fs-base);
    border: 2px solid var(--border); border-radius: 8px; background: var(--card);
    color: var(--charcoal); font-weight: 700; cursor: pointer; min-height: 44px;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23413837' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.8rem center;
  }
  .rank-game-select:focus { border-color: var(--accent); }
  .lb-list { width: 100%; max-width: 550px; max-height: 50vh; overflow-y: auto; }
  .lb-row { display: flex; padding: 0.4rem 0.8rem; font-size: var(--fs-base); align-items: center; gap: 0.5rem; }
  .lb-row:nth-child(even) { background: rgba(65,56,55,0.04); }
  .lb-row.highlight { background: var(--coral-tint); color: var(--accent-ink); font-weight: bold; }
  .lb-rank { width: 36px; text-align: center; }
  .lb-name { flex: 1; }
  .lb-score { width: 130px; text-align: right; }
  .lb-date { width: 80px; text-align: right; color: var(--text-muted); font-size: var(--fs-sm); }
  .lb-empty {
    text-align: center; color: var(--text-muted); padding: 2.5rem 1rem; font-style: italic;
    font-size: var(--fs-sm); line-height: 1.6;
  }
  .lb-empty::before {
    content: '\1F3C6'; display: block; font-size: 2rem; font-style: normal; margin-bottom: 0.5rem; opacity: 0.3;
  }

  /* Streak & Gamification */
  .streak-badge {
    display: inline-flex; align-items: center; gap: 0.4rem;
    background: var(--accent);
    color: var(--on-brand); padding: 0.3rem 1rem; border-radius: 999px;
    font-size: var(--fs-sm); font-weight: 700;
    animation: pulseGlow 2s ease-in-out infinite;
  }
  .streak-badge.hidden { display: none; }
  @keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(250,112,73,0.3); }
    50% { box-shadow: 0 0 12px 4px rgba(250,112,73,0.15); }
  }
  .xp-bar-wrap {
    width: 100%; max-width: 550px; height: 8px;
    background: var(--border); border-radius: 99px; overflow: hidden;
    margin: 0.3rem 0;
  }
  .xp-bar {
    height: 100%; width: 0; background: var(--accent);
    border-radius: 99px; transition: width 1s ease;
  }
  .xp-label { font-size: var(--fs-xs); color: var(--text-muted); }
  .achievements {
    display: flex; flex-direction: column; gap: 0.5rem;
    max-width: 550px; margin: 0.3rem 0; width: 100%;
  }
  .ach-group {
    background: var(--card); border: 1px solid var(--border); border-radius: 10px;
    padding: 0.5rem 0.7rem;
  }
  .ach-group-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.3rem; cursor: pointer; user-select: none; }
  .ach-group-header .ach-toggle { font-size: var(--fs-xs); color: var(--text-muted); transition: transform 0.2s; display: inline-block; }
  .ach-group.collapsed .ach-group-header .ach-toggle { transform: rotate(-90deg); }
  .ach-group.collapsed .ach-group-items { display: none; }
  .ach-group.collapsed .ach-group-header { margin-bottom: 0; }
  .ach-group-title {
    font-size: var(--fs-sm); font-weight: 700; color: var(--charcoal);
  }
  .ach-group-count { font-size: var(--fs-2xs); color: var(--text-muted); }
  .ach-group-items { display: flex; flex-direction: column; gap: 0.25rem; }
  .achievement {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.2rem 0; font-size: var(--fs-xs); color: var(--text-muted);
    position: relative;
  }
  .achievement.earned { color: var(--navy); }
  .achievement.earned .ach-icon { color: var(--accent-ink); }
  .achievement.tier-bronze .ach-icon { color: var(--bronze); }
  .achievement.tier-silver .ach-icon { color: #8a9bae; }
  .achievement.tier-gold .ach-icon { color: #C9A227; }
  .achievement.tier-platinum .ach-icon { color: #b0c4de; background: linear-gradient(135deg, #7ec8e3, #b0c4de, #e0e0e0); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
  .achievement.tier-special .ach-icon { color: var(--accent-ink); }
  .achievement.hidden-ach { opacity: 0.55; }
  .achievement .ach-icon { font-size: var(--fs-md); width: 1.5em; text-align: center; flex-shrink: 0; }
  .achievement .ach-name { flex: 1; }
  .achievement .ach-check { color: var(--accent-ink); font-size: var(--fs-xs); flex-shrink: 0; }
  .achievement .ach-tip {
    display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
    background: var(--navy); color: var(--cream); font-size: var(--fs-xs);
    padding: 0.3rem 0.6rem; border-radius: 6px; white-space: nowrap;
    z-index: 10; margin-bottom: 4px; pointer-events: none;
  }
  .achievement .ach-tip::after {
    content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    border: 4px solid transparent; border-top-color: var(--navy);
  }
  .achievement:hover .ach-tip, .achievement:active .ach-tip { display: block; }
  /* Toast notification */
  .toast {
    position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px);
    background: var(--navy); color: var(--cream); padding: 0.8rem 1.5rem;
    border-radius: 10px; font-size: var(--fs-base); z-index: 1000;
    opacity: 0; transition: all 0.4s ease; pointer-events: none;
    box-shadow: 0 4px 20px rgba(65,56,55,0.3);
  }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
  /* Confetti canvas */
  #confetti-canvas {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 999;
    display: none;
  }
  #confetti-canvas.active { display: block; }
  /* Points animation */
  .points-popup {
    position: fixed; top: 40%; left: 50%; transform: translate(-50%, -50%);
    font-family: var(--font-heading); font-size: 2.5rem; color: var(--accent-ink);
    z-index: 998; pointer-events: none;
    animation: pointsFloat 1.5s ease forwards;
  }
  @keyframes pointsFloat {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
    30% { opacity: 1; transform: translate(-50%, -70%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -120%) scale(0.8); }
  }
  /* Quiz combo indicator */
  .quiz-combo {
    text-align: center; font-size: var(--fs-sm); color: var(--accent-ink);
    font-weight: 600; min-height: 1.2em;
  }
  /* Odoo sync indicator */
  .sync-status {
    font-size: var(--fs-xs); color: var(--text-muted);
    display: flex; align-items: center; gap: 0.3rem;
  }
  .sync-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--success); display: inline-block;
  }
  .sync-dot.error { background: var(--error); }
  .sync-dot.pending { background: var(--accent); animation: blink 1s infinite; }
  @keyframes blink { 50% { opacity: 0.3; } }

  /* Pause Screen */
  .pause-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: 16px; padding: 2.5rem; text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 1rem;
    max-width: 380px; width: 90%;
    box-shadow: 0 8px 30px rgba(65,56,55,0.12);
  }
  .pause-icon { font-size: 3rem; }
  .pause-card h2 { font-size: var(--fs-2xl); color: var(--charcoal); margin: 0; }
  .pause-timer { font-size: var(--fs-lg); color: var(--text-muted); font-variant-numeric: tabular-nums; }
  .pause-buttons { display: flex; flex-direction: column; gap: 0.7rem; width: 100%; margin-top: 0.5rem; }
  .pause-buttons .btn, .pause-buttons .btn-play, .pause-buttons .btn-secondary { width: 100%; }

  /* Home game cards: icon, title, one-line description, status, best time */
  .home-games {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; width: 100%;
  }
  .home-game-btn {
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    padding: 0.7rem 0.75rem; cursor: pointer; color: var(--text); text-align: left;
    display: grid; grid-template-columns: auto minmax(0, 1fr); align-content: start;
    grid-template-areas: "icon title" "desc desc" "status status" "meta meta";
    column-gap: 0.55rem; min-width: 0;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  }
  .home-game-btn:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(65,56,55,0.1); }
  .home-game-btn .hg-text { display: contents; }
  .home-game-btn .hg-icon {
    grid-area: icon; width: 32px; height: 32px; border-radius: 8px; background: var(--coral-tint);
    display: flex; align-items: center; justify-content: center;
  }
  .home-game-btn .hg-icon svg { width: 20px; height: 20px; fill: var(--accent); }
  .home-game-btn .hg-title {
    grid-area: title; align-self: center; min-width: 0;
    font-size: var(--fs-md); font-weight: 700; color: var(--charcoal);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .home-game-btn .hg-desc {
    grid-area: desc; margin-top: 0.35rem; font-size: var(--fs-xs); line-height: 1.3; color: var(--text-muted);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .home-game-btn .hg-status {
    grid-area: status; justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
    margin-top: 0.45rem; padding: 0.1rem 0.55rem;
    border-radius: 999px; font-size: var(--fs-xs); font-weight: 700; white-space: nowrap;
    background: var(--cream-deep); color: var(--charcoal);
  }
  .home-game-btn .hg-status.is-played { background: #E3F0E7; color: #24613C; }
  .home-game-btn .hg-status.is-progress { background: var(--coral-tint); color: var(--coral-ink); }
  .home-game-btn .hg-meta { grid-area: meta; margin-top: 0.3rem; font-size: var(--fs-xs); color: var(--text-muted); }
  .home-game-btn .hg-meta:empty { display: none; }
  .home-game-btn.played { background: var(--white); }
  /* Mobile active press states */
  .home-game-btn:active { transform: scale(0.97); border-color: var(--accent); }
  .btn:active, .btn-play:active, .btn-ok:active { transform: scale(0.97); }
  .tab-btn:active { opacity: 0.7; }

  /* Game Choose Screen */
  #screen-choose { gap: 1.5rem; padding: 2rem; justify-content: flex-start; padding-top: 1rem; }
  .game-cards { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
  .game-card {
    width: 260px; background: var(--card);
    border: 2px solid var(--border); border-radius: 10px;
    padding: 1.8rem 1.5rem; text-align: center;
    cursor: pointer; transition: all 0.2s;
    display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  }
  .game-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 4px 12px rgba(65,56,55,0.1); }
  .game-card .card-icon { font-size: 2.8rem; display: flex; align-items: center; justify-content: center; }
  .game-card .card-icon svg { width: 42px; height: 42px; fill: var(--accent); }
  .game-card .card-title { font-family: var(--font-heading); font-size: var(--fs-xl); color: var(--charcoal); }
  .game-card .card-desc { font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.4; }

  /* Quiz Screen */
  #screen-quiz { padding: 1.5rem; gap: 1rem; }
  .quiz-header {
    width: 100%; display: flex; justify-content: space-between;
    align-items: center; padding: 0.7rem 1.2rem;
    background: var(--navy); color: var(--cream); border-radius: 8px;
    max-width: 700px; flex-wrap: wrap; gap: 0.2rem;
  }
  .quiz-progress { font-size: var(--fs-md); font-weight: bold; }
  .quiz-timer { font-size: var(--fs-lg); font-weight: bold; color: var(--coral); font-variant-numeric: tabular-nums; }
  .quiz-card {
    width: 100%; max-width: 700px; background: var(--card);
    border: 1px solid var(--border); border-radius: 10px;
    padding: 2rem; display: flex; flex-direction: column; gap: 1.2rem;
  }
  .quiz-question {
    font-size: clamp(1rem, 2.5vw, 1.25rem); color: var(--navy);
    line-height: 1.5; font-weight: 400;
  }
  .quiz-answers { display: flex; flex-direction: column; gap: 0.6rem; }
  .quiz-answer {
    padding: 0.9rem 1.2rem; border: 2px solid var(--border);
    border-radius: 8px; background: var(--card); cursor: pointer;
    font-size: var(--fs-md); text-align: left;
    color: var(--text); transition: all 0.15s; line-height: 1.4;
  }
  .quiz-answer:hover { border-color: var(--bronze); background: var(--surface-hover); }
  .quiz-answer.selected { border-color: var(--accent); background: var(--coral-tint); }
  .quiz-answer.correct { border-color: var(--success); background: #E6F2EA; }
  .quiz-answer.wrong { border-color: var(--error); background: var(--error-tint); }
  .quiz-answer[disabled] { cursor: default; opacity: 0.85; }
  .quiz-answer[disabled]:hover { background: inherit; border-color: inherit; }
  .quiz-explain {
    font-size: var(--fs-base); color: var(--text-muted); line-height: 1.5;
    padding: 0.8rem; background: var(--cream); border-radius: 6px;
    display: none;
  }
  .quiz-explain.visible { display: block; }
  .quiz-next-row { display: flex; justify-content: flex-end; }
  .quiz-next {
    background: var(--accent); color: var(--on-brand); border: none; font-weight: 700;
    padding: 0.7rem 2rem; font-size: var(--fs-md); cursor: pointer; min-height: 44px;
    border-radius: 6px; transition: all 0.2s;
    display: none;
  }
  .quiz-next.visible { display: inline-block; }
  .quiz-next:hover { background: var(--accent-hover); }

  /* Quiz Result Screen */
  #screen-quiz-result { padding: 2rem; gap: 1rem; }
  .quiz-result-icon { font-size: 4rem; animation: resultPop 0.5s ease; }
  @keyframes resultPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); opacity: 1; }
  }
  .quiz-result-text {
    font-size: clamp(1.4rem, 3vw, 1.9rem); color: var(--charcoal); text-align: center;
  }
  .quiz-result-detail {
    font-size: var(--fs-md); color: var(--text-muted); text-align: center; line-height: 1.5;
  }
  /* Puzzle result screen */
  #screen-puzzle-result { padding: 1.5rem; gap: 0.6rem; overflow-y: auto; justify-content: flex-start; padding-top: 1.5rem; }

  /* Shared Puzzle Styles */
  #screen-puzzle { padding: 0; justify-content: flex-start; }
  .puzzle-container {
    width: 100%; max-width: 420px; display: flex; flex-direction: column;
    align-items: center; gap: 0.8rem; padding: 0.8rem; flex: 1;
    overflow: visible;
  }
  .puzzle-grid {
    display: grid; gap: 1px; background: var(--navy); border: 2px solid var(--navy);
    border-radius: 6px; width: calc(100% - 24px); max-width: 348px;
    position: relative; margin: 12px auto;
    overflow: visible;
  }
  .puzzle-grid::before {
    content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Ctext x='30' y='35' text-anchor='middle' font-size='24' fill='%23413837'%3E⊗%3C/text%3E%3C/svg%3E");
  }
  .puzzle-cell {
    background: var(--card); display: flex; align-items: center; justify-content: center;
    font-size: var(--fs-xl); cursor: pointer; transition: background 0.12s;
    user-select: none; position: relative; z-index: auto; min-height: 0;
    aspect-ratio: 1; box-sizing: border-box;
    overflow: visible;
  }
  .puzzle-cell:hover { background: var(--surface-hover); }
  .puzzle-cell:hover .sym-svg { color: var(--accent-ink); }
  .puzzle-cell.selected { background: rgba(250,112,73,0.18); box-shadow: inset 0 0 0 2px var(--accent); }
  .puzzle-cell.selected .sym-svg { color: var(--accent-ink); }
  .puzzle-cell.fixed { color: var(--navy); font-weight: bold; cursor: default; }
  .puzzle-cell.fixed:hover { background: var(--surface-hover); }
  .puzzle-cell.fixed:hover .sym-svg { color: var(--navy); }
  .puzzle-cell.memory-card .sym-svg { width: 100%; height: 100%; }
  .puzzle-cell.error { box-shadow: inset 0 0 0 2px var(--error); background: rgba(179,38,30,0.2); }
  .puzzle-cell.error .sym-svg { color: var(--error); }
  .puzzle-cell.error.error-other .sym-svg { color: var(--cream); }
  .puzzle-cell.correct { animation: correctFlash 1.2s ease; }
  @keyframes correctFlash { 0%,30% { background: rgba(46,122,75,0.25) !important; } 100% { } }
  .puzzle-toolbar {
    display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: center;
    width: 100%; max-width: 360px;
  }
  .puzzle-tool-btn {
    min-width: 44px; min-height: 44px; padding: 0.4rem 0.7rem;
    background: var(--card); border: 2px solid var(--border); border-radius: 8px;
    font-size: var(--fs-lg); cursor: pointer; transition: all 0.15s;
    display: flex; align-items: center; justify-content: center;
    color: var(--charcoal); font-weight: 700;
  }
  .puzzle-tool-btn:hover { border-color: var(--bronze); background: var(--surface-hover); }
  .puzzle-tool-btn.active { border-color: var(--accent); background: var(--coral-tint); color: var(--accent-ink); }
  .puzzle-tool-btn.erase { font-size: var(--fs-sm); }
  .puzzle-tool-btn.erase-red { font-size: var(--fs-sm); border-color: var(--error); color: var(--error); }
  .puzzle-tool-btn.erase-red:hover { background: rgba(179,38,30,0.08); }
  /* Queens region colors: warm pastels, still eight clearly distinct hues */
  .region-0 { background: #FFD3BF; } .region-1 { background: #BFD9F0; }
  .region-2 { background: #DCC3E6; } .region-3 { background: #BFE0C4; }
  .region-4 { background: #F5C1CF; } .region-5 { background: #F7E3A1; }
  .region-6 { background: #B5E2DF; } .region-7 { background: #E3CBAA; }
  .puzzle-cell.queen-placed { color: var(--on-brand); font-weight: bold; font-size: var(--fs-xl); line-height: 1; overflow: hidden; }
  .puzzle-cell .sym-svg { width: 60%; height: 60%; max-width: 28px; max-height: 28px; }
  .puzzle-cell.fixed .sym-svg { color: var(--navy); }
  .puzzle-cell.queen-placed .sym-svg { color: var(--on-brand); }
  .puzzle-tool-btn .sym-svg { width: 22px; height: 22px; }
  .btn-hint { min-width: 80px; }
  .btn-hint:disabled { opacity: 0.5; cursor: not-allowed; }
  /* Tango clue markers */
  .tango-clue {
    position: absolute; font-size: 11px; color: var(--charcoal);
    background: var(--card); border-radius: 50%; width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; z-index: 10; border: 1.5px solid var(--navy);
    line-height: 1; pointer-events: none;
    font-family: var(--font-body);
    text-align: center; padding: 0; box-sizing: border-box;
    overflow: visible;
  }
  .tango-clue.clue-eq { font-size: 12px; }
  .tango-clue.clue-x { font-size: 12px; }
  .tango-clue.right { right: -9px; top: 50%; transform: translateY(-50%); }
  .tango-clue.bottom { bottom: -9px; left: 50%; transform: translateX(-50%); }
  .tango-clue.clue-error { color: var(--cream); background: var(--error); border-color: var(--error); }
  /* Zip path */
  .puzzle-cell.zip-path { background: rgba(250,112,73,0.08); }
  .puzzle-cell.zip-path::after {
    content: ''; position: absolute; width: 10px; height: 10px;
    border-radius: 50%; background: var(--accent); opacity: 0.35;
  }
  .puzzle-cell.zip-num { font-weight: bold; color: var(--navy); font-size: var(--fs-md); z-index: 2; }
  .puzzle-cell.zip-num.zip-path { background: var(--accent); color: var(--on-brand); }
  .puzzle-cell.zip-num.zip-path::after { display: none; }
  .puzzle-cell.zip-head { box-shadow: inset 0 0 0 2px var(--accent); background: rgba(250,112,73,0.1); }
  .puzzle-cell.zip-head::after { opacity: 0.6; width: 14px; height: 14px; }
  .zip-line-overlay { position: absolute; inset: 0; z-index: 1; pointer-events: none; }

  /* Trikker Logo */
  .trikker-logo { display: flex; align-items: center; gap: 0.5rem; }
  .trikker-logo svg { height: 44px; width: auto; display: block; }
  .trikker-logo-games {
    font-size: clamp(1.8rem, 4vw, 2.6rem); font-style: italic; color: var(--charcoal);
    line-height: 1;
  }
  .home-subtitle {
    font-family: var(--font-heading); font-size: var(--fs-md); color: var(--text-muted); font-style: italic;
    margin: 0.25rem 0 0;
  }

  /* Post-game actions */
  .postgame-section {
    width: 100%; max-width: 550px; margin-top: 0.5rem;
    display: flex; flex-direction: column; gap: 0.6rem; align-items: center;
  }
  .postgame-next {
    width: 100%; background: var(--card); border: 2px solid var(--border);
    border-radius: 10px; padding: 1rem 1.2rem; cursor: pointer;
    display: flex; align-items: center; gap: 1rem;
    transition: all 0.2s; text-align: left;
    color: var(--text);
  }
  .postgame-next:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 3px 10px rgba(65,56,55,0.08); }
  .postgame-next .pg-icon { font-size: var(--fs-3xl); flex-shrink: 0; }
  .postgame-next .pg-info { display: flex; flex-direction: column; }
  .postgame-next .pg-title { font-weight: 700; color: var(--charcoal); font-size: var(--fs-md); }
  .postgame-next .pg-desc { font-size: var(--fs-sm); color: var(--text-muted); }
  .postgame-links {
    display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; width: 100%;
  }

  /* Guest nudge card */
  .guest-nudge {
    width: 100%; max-width: 550px;
    background: var(--card);
    border: 2px solid var(--accent);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    margin-bottom: 0.8rem;
    text-align: center;
    animation: nudge-fade-in 0.5s ease-out;
  }
  .guest-nudge-icon { font-size: 1.6rem; margin-bottom: 0.3rem; }
  .guest-nudge-msg {
    font-size: var(--fs-sm); color: var(--text);
    margin: 0 0 0.7rem 0; line-height: 1.4;
  }
  .guest-nudge-actions {
    display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap;
  }
  .guest-nudge-actions .btn-sm {
    padding: 0.4rem 1.2rem; font-size: var(--fs-sm);
  }
  @keyframes nudge-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .near-miss-nudge {
    width: 100%; max-width: 550px; text-align: center;
    font-size: var(--fs-sm); color: var(--accent-ink);
    font-weight: 600; padding: 0.5rem 0; margin-bottom: 0.3rem;
    animation: nudge-fade-in 0.5s ease-out;
  }

  .reset-hint {
    width: 100%; text-align: center;
    font-size: var(--fs-xs); color: var(--text-muted);
    padding: 0.2rem 0;
  }

  /* Share buttons */
  .share-row {
    display: flex; gap: 0.5rem; align-items: center; justify-content: center;
    margin-top: 0.3rem;
  }
  .share-row span { font-size: var(--fs-sm); color: var(--text-muted); }
  .share-btn {
    width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--card); cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; font-size: 1rem; color: var(--navy);
  }
  .share-btn:hover, .share-btn:active { border-color: var(--accent); color: var(--accent-ink); transform: scale(1.1); }
  .share-btn svg { width: 18px; height: 18px; fill: currentColor; }

  /* Registration panel (used in profile tab) */
  .home-expand-toggle {
    background: none; border: none; color: var(--accent-ink);
    font-size: var(--fs-sm); cursor: pointer; min-height: 44px;
    padding: 0.3rem 0; text-decoration: underline;
  }
  .home-expand-toggle:hover { color: var(--accent-hover); }
  .home-register-panel {
    width: 100%; max-width: 420px; background: var(--card);
    border: 1px solid var(--border); border-radius: 10px;
    padding: 1.2rem; display: none; flex-direction: column; gap: 0.7rem;
  }
  .home-register-panel.open { display: flex; }
  .home-register-panel h3 { font-size: var(--fs-xl); font-style: italic; color: var(--charcoal); margin: 0; }

  /* Mobile: floating reference thumbnail */
  .ref-thumb {
    display: none; position: absolute; top: 96px; right: 8px; /* below the two-row game header (~85px) */
    z-index: 40; cursor: pointer;
    border: 2px solid var(--accent); border-radius: 8px;
    background: var(--card); box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    overflow: hidden; transition: transform 0.15s;
  }
  .ref-thumb:active { transform: scale(0.95); }
  .ref-thumb canvas { display: block; width: 100px; height: 80px; }
  .ref-thumb-label {
    display: block; text-align: center; font-size: var(--fs-2xs);
    color: var(--accent-ink); font-weight: 600; padding: 2px 0;
    background: rgba(250,112,73,0.08);
  }
  /* Mobile: full-screen reference overlay */
  .ref-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 200; background: rgba(42,35,32,0.94);
    flex-direction: column; align-items: center; justify-content: center;
    padding: 1rem; cursor: pointer;
  }
  .ref-overlay.open { display: flex; }
  .ref-overlay-header {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; max-width: 500px; padding: 0.5rem 0.2rem; color: var(--cream);
  }
  .ref-overlay-header span { font-size: var(--fs-md); font-weight: 600; }
  .ref-overlay-close {
    background: none; border: none; color: var(--cream); font-size: 2rem;
    cursor: pointer; padding: 0.2rem 0.5rem; line-height: 1;
  }
  .ref-overlay canvas {
    max-width: calc(100% - 1rem); max-height: 75vh; background: var(--card);
    border-radius: 8px;
  }

  /* Responsive */
  @media (max-width: 900px) {
    .game-area { flex-wrap: wrap; }
    .game-panel { min-width: 45%; }
    .palette {
      flex-direction: row; flex-wrap: wrap;
      width: 100%; min-width: unset;
      border-left: none; border-top: 1px solid var(--border);
      justify-content: center;
      max-height: 110px; overflow-y: auto;
    }
    .pal-btn { width: 58px; height: 48px; }
  }
  @media (max-width: 768px) {
    .game-header { padding: 0.4rem 0.6rem; }
    .details-form { max-width: 100%; }
    .game-cards { flex-direction: column; align-items: center; }
    .game-card { width: 100%; max-width: 320px; }

    /* Schema game: mobile layout */
    .game-area { flex-wrap: nowrap; flex-direction: column; overflow: hidden; }
    .game-divider { display: none; }
    .game-panel { min-width: 100%; width: 100%; flex: 1; overflow: hidden; min-height: 0; }
    .game-panel.mobile-hidden { display: none; }
    .game-panel canvas { max-width: 100%; }
    .panel-label { display: none; }
    .ref-thumb { display: block; }
    #screen-game { position: relative; }

    /* Palette: fixed bottom strip on mobile */
    .palette {
      flex-direction: row; flex-wrap: nowrap;
      width: 100%; min-width: unset;
      border-left: none; border-top: 1px solid var(--border);
      justify-content: flex-start;
      max-height: none; overflow-x: auto; overflow-y: hidden;
      padding: 6px 40px 6px 6px; gap: 4px;
      padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
      flex-shrink: 0;
      position: fixed; bottom: 0; left: 0; right: 0;
      z-index: 50;
      background: var(--card);
      box-shadow: 0 -2px 8px rgba(65,56,55,0.12);
      /* Scroll affordance: snap to whole buttons and fade the trailing edge,
         so a half-visible symbol reads as "more to the right". */
      scroll-snap-type: x proximity; scroll-padding-inline: 6px;
      scrollbar-width: thin; scrollbar-color: var(--bronze) transparent;
      -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent);
      mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent);
    }
    .palette .pal-btn { scroll-snap-align: start; }
    .game-area {
      padding-bottom: 68px; /* space for fixed palette */
    }
    .pal-btn {
      width: 54px; height: 52px; flex-shrink: 0;
      min-width: 54px;
    }
    .pal-btn .pal-sym { width: 22px; height: 22px; }
    .pal-btn .pal-lbl { font-size: 0.65rem; }

    /* Quiz: tighter on mobile — use full screen */
    #screen-quiz { padding: 0.8rem; gap: 0.6rem; justify-content: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .quiz-header { padding: 0.5rem 0.8rem; border-radius: 0; max-width: 100%; }
    .quiz-card { padding: 0.8rem; gap: 0.6rem; }
    .quiz-question { font-size: 0.95rem; }
    .quiz-answer { padding: 0.6rem 0.8rem; font-size: var(--fs-base); min-height: 44px; }
    .quiz-explain { padding: 0.6rem; font-size: var(--fs-sm); }
    .quiz-next { padding: 0.6rem 1.5rem; }
    /* Home: compact header, logo + language switch on one row */
    #screen-home { padding: 1rem 1rem 0.75rem; }
    .home-wrap { gap: 0.75rem; }
    .trikker-logo svg { height: 32px; }
    .trikker-logo-games { font-size: clamp(1.4rem, 6vw, 1.75rem); }
    .daily-badge { margin-bottom: 0.25rem; padding: 0.2rem 0.8rem; font-size: var(--fs-xs); }
    .home-date { font-size: 1.5rem; }
    .home-subtitle { font-size: var(--fs-sm); }
    /* Player chip: just the avatar on a phone (name and level are in the profile) */
    .home-welcome-card { padding: 2px; border-radius: 50%; min-height: 0; flex-shrink: 0; }
    .home-welcome-card .hw-info, .home-welcome-card .hw-medals { display: none; }
    .home-games { gap: 0.5rem; }
    /* Today card: no kickers, the labels next to the numbers say it */
    .today-card { padding: 0.85rem 1rem; }
    .today-kicker { display: none; }
    .today-count, .today-streak-val { font-size: 1.8rem; }
    .today-action { margin-top: 0.75rem; }
    .hb-text { -webkit-line-clamp: 1; }
    .home-section-label { font-size: var(--fs-lg); margin-top: 0.2rem; }
    /* Score/result screens: fullscreen scroll */
    #screen-score, #screen-quiz-result, #screen-puzzle-result { padding: 1rem; padding-top: 0.8rem; gap: 0.6rem; -webkit-overflow-scrolling: touch; }
    .score-title { font-size: var(--fs-lg); }
    .postgame-next { padding: 0.7rem 0.8rem; }
    /* Stats screen tighter */
    #screen-stats { padding: 1rem; padding-top: 0.8rem; gap: 0.6rem; }
    .stats-card { padding: 0.8rem; }
  }
  @media (max-width: 360px) {
    .home-welcome-card .hw-meta { display: none; }
    .home-game-btn .hg-desc { -webkit-line-clamp: 3; }
  }

  /* ── CSP-safe utility classes (replaces inline style="...") ─────────── */
  /* Visibility: marker for initial hidden state. Replaced by JS at boot
     with an inline display:none (via CSSOM, not a style attribute) so the
     existing `.style.display = ''/'none'` toggle pattern keeps working. */
  .is-hidden { display: none; }
  .is-svg-sprite { position: absolute; }
  /* Layout widths */
  .u-mw-420 { max-width: 420px; }
  .u-mw-480 { max-width: 480px; }
  .u-mw-550 { max-width: 550px; }
  .u-mw-full { max-width: 100%; }
  .u-w-full { width: 100%; }
  /* Flex utilities */
  .u-flex { display: flex; }
  .u-flex-row { display: flex; align-items: center; }
  .u-flex-col { display: flex; flex-direction: column; }
  .u-flex-center { display: flex; align-items: center; justify-content: center; }
  .u-flex-center-v { display: flex; align-items: center; }
  .u-justify-center { justify-content: center; }
  .u-justify-between { justify-content: space-between; }
  .u-justify-start { justify-content: flex-start; }
  .u-items-center { align-items: center; }
  .u-gap-03 { gap: 0.3rem; }
  .u-gap-05 { gap: 0.5rem; }
  .u-gap-06 { gap: 0.6rem; }
  .u-gap-08 { gap: 0.8rem; }
  /* Margin utilities */
  .u-m-0 { margin: 0; }
  .u-mt-02 { margin-top: 0.2rem; }
  .u-mt-03 { margin-top: 0.3rem; }
  .u-mt-04 { margin-top: 0.4rem; }
  .u-mt-05 { margin-top: 0.5rem; }
  .u-mt-08 { margin-top: 0.8rem; }
  .u-my-03 { margin-top: 0.3rem; margin-bottom: 0.3rem; }
  .u-mb-03 { margin-bottom: 0.3rem; }
  .u-mb-05 { margin-bottom: 0.5rem; }
  .u-mb-08 { margin-bottom: 0.8rem; }
  .u-ml-auto { margin-left: auto; }
  .u-mr-2px { margin-right: 2px; }
  /* Text utilities */
  .u-text-center { text-align: center; }
  .u-text-muted { color: var(--text-muted); }
  .u-text-error { color: var(--error); }
  .u-text-accent { color: var(--accent-ink); }
  .u-white { color: var(--cream); }
  .u-nowrap { white-space: nowrap; }
  .u-font-bold { font-weight: bold; }
  .u-font-semi { font-weight: 600; }
  /* Font size utilities */
  .u-fs-2xs { font-size: var(--fs-2xs); }
  .u-fs-xs  { font-size: var(--fs-xs); }
  .u-fs-sm  { font-size: var(--fs-sm); }
  .u-fs-base { font-size: var(--fs-base); }
  .u-fs-emoji { font-size: 1.5rem; }
  .u-fs-icon-xl { font-size: 2.5rem; }
  .u-fs-em-xs { font-size: 0.75em; }
  .u-fs-em-sm { font-size: 0.8em; }
  /* Cursor / border */
  .u-pointer { cursor: pointer; }
  .u-border-none { border-bottom: none; }
  /* Line height */
  .u-lh-14 { line-height: 1.4; }
  /* Helpers for specific patterns */
  .u-flex-1-160 { flex: 1; max-width: 160px; }
  .u-w-auto { width: auto; }
  .u-w-60 { width: 60px; }
  .u-accent-color { accent-color: var(--accent); }
  /* Screen-reader-only / honeypot */
  .u-honeypot {
    position: absolute; left: -9999px; opacity: 0;
    height: 0; overflow: hidden;
  }
  /* Profile label (non-card row) */
  .u-lang-label {
    font-size: var(--fs-base); font-weight: 700;
    color: var(--charcoal); margin: 0;
  }
  .u-radio-row {
    display: flex; align-items: center;
    gap: 0.3rem; cursor: pointer; margin: 0;
  }
  .u-trikker-row {
    display: flex; align-items: center;
    gap: 0.6rem; font-size: 0.9rem; color: var(--text-muted);
  }
  /* CRM opt-in: checkbox + real <label for>, label is the >= 44px tap target */
  .u-consent-row {
    display: flex; align-items: flex-start; gap: 0.6rem;
    margin: 0.4rem 0; text-align: left;
  }
  .u-consent-check {
    flex: 0 0 auto; width: 22px; height: 22px; margin: 11px 0 0;
    accent-color: var(--accent); cursor: pointer;
  }
  .u-consent-row label {
    flex: 1; min-height: 44px; padding: 0.6rem 0; margin: 0;
    font-size: 0.9rem; line-height: 1.4; color: var(--text-muted); cursor: pointer;
  }
  /* Privacy link under the consent checkbox: a real button styled as a link */
  .u-privacy-link {
    align-self: flex-start; background: none; border: none; padding: 0.4rem 0;
    min-height: 44px; margin: -0.7rem 0 0; text-align: left; cursor: pointer;
    font: inherit; font-size: 0.9rem; color: var(--accent-ink);
    text-decoration: underline; text-underline-offset: 2px;
  }
  .u-privacy-link:hover { color: var(--charcoal); }
  /* Privacy screen */
  #screen-privacy { padding: 1rem 1.5rem 2rem; gap: 0.8rem; overflow-y: auto; justify-content: flex-start; }
  .privacy-body {
    width: 100%; max-width: 550px; display: flex; flex-direction: column; gap: 1rem;
    text-align: left; color: var(--charcoal); line-height: 1.5;
  }
  .privacy-intro { font-size: var(--fs-base); color: var(--text-muted); }
  .privacy-section {
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: 0.5rem;
  }
  .privacy-section h3 { font-size: var(--fs-lg); font-style: italic; color: var(--charcoal); }
  .privacy-section p { font-size: 0.95rem; }
  /* Inline mailto link: padding widens the tap target to 44px without moving the text */
  .privacy-section a {
    color: var(--accent-ink); text-underline-offset: 2px;
    display: inline-block; padding: 13px 0; margin: -13px 0;
  }
  .privacy-policy-link { align-self: center; text-align: center; text-decoration: none; }
  .u-verify-row {
    display: flex; flex-direction: column; gap: 0.5rem;
    margin-top: 0.6rem; text-align: left;
  }
  .u-lang-inline-label {
    font-size: 0.9rem; color: var(--text-muted); margin: 0;
  }
  .u-select-inline {
    padding: 0.4rem 0.6rem; border: 1px solid var(--border);
    border-radius: 6px; font-size: var(--fs-base); min-height: 44px;
    background: var(--card); color: var(--charcoal);
  }
  .u-captcha-row {
    display: flex; align-items: center; gap: 0.5rem;
  }
  .u-captcha-input { width: 60px; text-align: center; }
  .u-auth-error {
    color: var(--error); font-size: var(--fs-sm);
  }
  .u-puzzle-help {
    font-size: var(--fs-xs); color: var(--text-muted);
    text-align: center; max-width: 360px;
    line-height: 1.4; margin-top: 0.2rem;
  }
  /* Shared small avatar circles used in JS-rendered lists */
  .u-avatar-circle {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--navy); color: var(--cream);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: bold; flex-shrink: 0;
  }
  /* Scalable avatar circle - size set via CSS variables */
  .u-avatar-scalable {
    border-radius: 50%; color: var(--cream);
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; flex-shrink: 0;
    width: var(--av-size, 44px); height: var(--av-size, 44px);
    font-size: var(--av-fs, 1rem);
    background: var(--av-bg, var(--navy));
  }
  .u-avatar-scalable svg.sym-svg {
    width: var(--av-sym-size, 24px); height: var(--av-sym-size, 24px);
  }
  /* Queens/memory inline symbol wrapper */
  .u-sym-inline {
    display: inline-block; width: 1.2em; height: 1.2em; vertical-align: middle;
  }
  .u-sym-cell {
    width: 90%; height: 90%;
    display: flex; align-items: center; justify-content: center;
  }
  /* Puzzle toolbar help text */
  .u-toolbar-help {
    color: var(--text-muted); font-size: var(--fs-sm); text-align: center;
  }
  /* Zip undo/reset row */
  .u-zip-tools { display: flex; gap: 0.5rem; justify-content: center; }
  /* Postgame XP header */
  .u-xp-header {
    text-align: center; font-weight: 600; color: var(--accent-ink);
    margin-bottom: 0.3rem; font-size: var(--fs-sm);
  }
  /* Postgame combo row */
  .u-combo-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 0.8rem; gap: 0.5rem;
  }
  /* Postgame hint info */
  .u-hint-info { font-size: 0.75em; color: var(--text-muted); }
  .u-hint-info-big { font-size: 0.75em; color: var(--text-muted); margin-left: auto; white-space: nowrap; }
  /* Achievement group header count */
  .u-ach-group-count { display: flex; align-items: center; gap: 0.3rem; }
  /* Leaderboard XP subscript */
  .u-xp-sub { font-size: 0.75em; color: var(--text-muted); }
  /* Leaderboard flag */
  .u-lb-flag { font-size: 0.8em; margin-right: 2px; }
  /* Memory card back */
  .u-memory-back { color: var(--cream); font-size: 1.5rem; }
  /* Percentile labels (schema/quiz/puzzle result screens) */
  .u-pctl-label {
    font-size: var(--fs-sm); color: var(--accent-ink);
    font-weight: 600; margin: 0.3rem 0;
  }
  .u-pctl-label--md { margin: 0.4rem 0; }
  /* Hint cooldown label */
  .u-hint-label {
    font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px;
  }
  /* Lights-out playable cell (set via className, CSP-safe) */
  .u-lightsout-cell {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; cursor: pointer; border-radius: 6px;
    border: 2px solid var(--border); transition: all 0.15s;
  }
  /* Lights-out review cell (non-interactive) */
  .u-lightsout-review {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; border-radius: 6px; border: 2px solid var(--border);
  }
  /* Memory playable cell */
  .u-memory-cell {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    cursor: pointer; border-radius: 8px;
    border: 2px solid var(--border); transition: all 0.3s; min-height: 60px;
  }
  /* Memory review cell (completed) */
  .u-memory-review {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    border-radius: 8px; border: 2px solid var(--success);
    background: #DCEFE2; min-height: 60px;
  }

  /* ── House style: headings in Radley (Regular/Italic only) ─────────── */
  h1, h2, h3,
  .screen-header h2, .stats-card h3, .profile-card h3, .home-register-panel h3,
  .pause-card h2, .score-title, .score-value, .top10-title, .countdown-title,
  .countdown-number, .quiz-result-text, .trikker-logo-games, .game-card .card-title {
    font-family: var(--font-heading);
    font-weight: 400;           /* Radley has no bold: never synthesise one */
    font-synthesis: none;
    font-variant: normal;
    text-transform: none;
  }
  h4 { font-weight: 700; }

  /* ── Keyboard focus: always visible, never colour-only ─────────────── */
  :focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
  }
  .game-header :focus-visible, .quiz-header :focus-visible,
  .ref-overlay :focus-visible, .toast :focus-visible {
    outline-color: var(--cream);
  }
  input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline-offset: 0; border-color: var(--charcoal);
  }

  /* ── Rankings, stats, profile: shared building blocks ──────────────── */
  .rank-layout { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 0.8rem; align-items: center; }
  .rank-controls { width: 100%; display: flex; flex-direction: column; align-items: center; }
  .rank-layout .lb-list { order: 2; }
  .rank-me {
    order: 3; width: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    padding: 0.9rem 1.1rem; display: flex; flex-direction: column; gap: 0.35rem;
  }
  .rank-me:empty { display: none; }
  .rank-me-title { font-size: var(--fs-lg); font-style: italic; color: var(--charcoal); margin: 0; }
  .rank-me-game { font-weight: 700; color: var(--charcoal); margin: 0; }
  .rank-me-row { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); display: flex; align-items: baseline; gap: 0.4rem; }
  .rank-me-big { font-family: var(--font-body); font-weight: 700; font-size: var(--fs-2xl); color: var(--charcoal); line-height: 1.1; font-variant-numeric: tabular-nums; }
  .rank-me-none, .rank-me-best { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
  .rank-me-play { align-self: flex-start; min-height: 44px; }
  .stats-layout { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 0.8rem; }
  .profile-cols, .profile-col, .profile-col-intro, .profile-col-forms { display: flex; flex-direction: column; }
  .profile-col, #profile-account-section.profile-cols { gap: 0.8rem; }
  .profile-col > .profile-card + .profile-card { margin-top: 0; }
  .profile-col .home-register-panel { max-width: none; }

  /* ── Desktop sidebar (hidden below 1024px) ────────────────────────── */
  .side-nav { display: none; }
  .side-brand { display: flex; align-items: center; gap: 0.45rem; padding: 0 0.6rem 1.75rem; }
  .side-logo { height: 34px; width: auto; display: block; }
  .side-logo-games {
    font-family: var(--font-heading); font-style: italic; font-weight: 400; font-synthesis: none;
    font-size: 1.65rem; color: var(--charcoal); line-height: 1;
  }
  .side-links { display: flex; flex-direction: column; gap: 0.25rem; }
  .side-nav-btn {
    position: relative; display: flex; align-items: center; gap: 0.8rem; width: 100%;
    min-height: 48px; padding: 0.6rem 0.9rem; border: none; border-radius: 10px;
    background: none; color: var(--charcoal-light); cursor: pointer; text-align: left;
    font-size: var(--fs-md); font-weight: 700; transition: background-color 0.15s, color 0.15s;
  }
  .side-nav-btn:hover { background: var(--cream); color: var(--charcoal); }
  .side-nav-btn.active { background: var(--coral-tint); color: var(--coral-ink); }
  .side-nav-btn.active::before {
    content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
    border-radius: 3px; background: var(--accent);
  }
  .side-icon { width: 22px; height: 22px; display: flex; flex-shrink: 0; }
  .side-icon svg { width: 22px; height: 22px; fill: currentColor; }
  .side-nav-btn.active .side-icon svg { fill: var(--accent); }
  .side-lang {
    margin-top: auto; padding: 1rem 0.6rem 0; border-top: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 0.5rem;
  }
  .side-lang-label { font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); }
  .side-lang .lang-seg { display: flex; }
  .side-lang .lang-btn { flex: 1; }

  /* ── Tablet and up (769px+): wider home, today card in one row ─────── */
  @media (min-width: 769px) {
    :root { --home-w: 720px; }
    #screen-home { padding: 2rem 2rem 1.5rem; }
    .home-wrap { gap: 1.1rem; }
    .home-date { font-size: 2.1rem; }
    .today-card {
      grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.9fr) minmax(0, 1.35fr);
      grid-template-areas: "progress streak action" "notes notes notes";
      align-items: center; column-gap: 1.5rem; padding: 1.25rem 1.5rem;
    }
    .today-streak { text-align: left; border-left: 1px solid var(--border); padding-left: 1.5rem; }
    .today-streak .today-count-row { justify-content: flex-start; }
    .today-action { margin-top: 0; }
    .today-done { grid-template-columns: minmax(0, 1fr); row-gap: 0.4rem; }
    .today-done .btn { grid-column: 1; grid-row: auto; justify-self: start; }
    .home-games { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
    .home-game-btn {
      padding: 1rem; grid-template-areas: "icon status" "title title" "desc desc" "meta meta";
    }
    .home-game-btn .hg-icon { width: 40px; height: 40px; border-radius: 10px; }
    .home-game-btn .hg-icon svg { width: 24px; height: 24px; }
    .home-game-btn .hg-status { justify-self: end; align-self: start; margin-top: 0; }
    .home-game-btn .hg-title { margin-top: 0.7rem; font-size: var(--fs-lg); }
    .home-game-btn .hg-desc { font-size: var(--fs-sm); }
    .home-game-btn .hg-meta { margin-top: 0.5rem; }
    .stats-layout {
      max-width: 900px; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
      grid-template-areas: "streaks ach" "xp ach"; grid-template-rows: auto 1fr; gap: 1rem; align-items: start;
    }
    .stats-layout .stats-card { max-width: none; }
    .stats-card--streaks { grid-area: streaks; }
    .stats-card--xp { grid-area: xp; }
    .stats-card--ach { grid-area: ach; }
  }

  /* Narrower today card (tablet, small laptop): game name under the button label */
  @media (min-width: 769px) and (max-width: 1279px) {
    .today-cta { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0.1rem; }
    .today-cta-game { font-size: var(--fs-sm); }
  }

  /* ── Desktop (1024px+): sidebar, content uses the width ───────────── */
  @media (min-width: 1024px) {
    :root { --side-w: 248px; --home-w: 1040px; --content-w: 1100px; }
    .tab-bar, .tab-bar.visible { display: none; }
    .side-nav.visible {
      display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0;
      width: var(--side-w); padding: 1.75rem 1rem 1.25rem; z-index: 100;
      background: var(--card); border-right: 1px solid var(--border);
    }
    .screen.has-tabs { margin-left: var(--side-w); width: calc(100vw - var(--side-w)); padding-bottom: 2rem !important; }

    /* Home: the sidebar carries logo + language */
    #screen-home { padding: 2.5rem 3rem 2rem; }
    .home-top { display: none; }
    .home-wrap { gap: 1.25rem; }
    .home-date { font-size: 2.6rem; }
    .home-welcome-card { max-width: 45%; padding: 0.4rem 1rem 0.4rem 0.4rem; }
    .home-welcome-card .hw-name { font-size: var(--fs-md); }
    .today-card { padding: 1.5rem 1.75rem; column-gap: 2rem; }
    .today-streak { padding-left: 2rem; }
    .today-count, .today-streak-val { font-size: 2.6rem; }
    .home-games { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
    .home-games[data-count="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .home-game-btn { padding: 1.1rem 1.15rem; min-height: 168px; }

    /* Rankings, stats, profile: page title left, content up to --content-w */
    #screen-rankings, #screen-stats, #screen-profile { padding: 2rem 2.5rem; }
    #screen-rankings > .screen-header, #screen-stats > .screen-header, #screen-profile > .screen-header {
      max-width: var(--content-w); padding: 0; margin-bottom: 0.75rem;
    }
    #screen-rankings > .screen-header h2, #screen-stats > .screen-header h2, #screen-profile > .screen-header h2 { text-align: left; font-size: var(--fs-3xl); }
    #screen-rankings > .screen-header .header-spacer, #screen-stats > .screen-header .header-spacer, #screen-profile > .screen-header .header-spacer { display: none; }
    .stats-layout { max-width: var(--content-w); gap: 1.25rem; }
    .rank-layout {
      max-width: var(--content-w); display: grid; grid-template-columns: 340px minmax(0, 1fr);
      grid-template-areas: "controls list" "me list"; gap: 1.25rem 2rem; align-items: start;
    }
    .rank-controls { grid-area: controls; align-items: stretch; }
    .rank-controls .u-mw-420 { max-width: none; }
    .rank-controls .daily-badge { align-self: flex-start; }
    .rank-me { grid-area: me; }
    .rank-layout .lb-list {
      grid-area: list; max-width: none; max-height: calc(100vh - 9rem);
      background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 0.5rem;
    }
    #profile-guest-section, #profile-account-section { max-width: var(--content-w); }
    .profile-cols {
      display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
      gap: 1.5rem 2rem; align-items: start;
    }
    .profile-col-intro { padding-top: 0.5rem; }
    .profile-col-intro .profile-guest-msg {
      text-align: left; padding: 0 0 1rem; font-family: var(--font-heading); font-style: italic;
      font-size: var(--fs-xl); color: var(--charcoal); line-height: 1.35;
    }
    .profile-col-intro .u-justify-center { justify-content: flex-start; }
    #screen-profile > .profile-card { max-width: var(--content-w); }

    /* Puzzles: board in the centre, side panel with timer, controls, tools, hint, help */
    #screen-puzzle.active {
      display: grid; padding: 2rem;
      grid-template-columns: minmax(0, 1fr) minmax(0, 560px) 300px minmax(0, 1fr);
      grid-template-rows: auto auto auto 1fr; column-gap: 2.5rem; row-gap: 1rem; align-content: center;
    }
    #screen-puzzle .puzzle-container { display: contents; }
    #screen-puzzle .puzzle-grid {
      grid-column: 2; grid-row: 1 / -1; align-self: start; margin: 0 auto;
      width: 100%; max-width: min(540px, calc(100vh - 6rem));
    }
    #screen-puzzle .puzzle-cell .sym-svg { max-width: 40px; max-height: 40px; }
    #screen-puzzle .puzzle-toolbar { grid-column: 3; grid-row: 2; justify-content: flex-start; max-width: none; }
    #screen-puzzle .puzzle-hint-row { grid-column: 3; grid-row: 3; justify-content: flex-start; margin-top: 0; }
    #screen-puzzle .puzzle-help { grid-column: 3; grid-row: 4; align-self: start; text-align: left; font-size: var(--fs-sm); margin: 0; }
    #screen-puzzle .game-header, #screen-quiz .quiz-header {
      grid-column: 3; grid-row: 1; align-self: start;
      display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; padding: 1.25rem; border-radius: 14px;
    }
    #screen-puzzle .game-title-label, #screen-quiz .game-title-label { grid-column: 1 / -1; grid-row: 1; text-align: left; font-size: var(--fs-xl); }
    #screen-puzzle .game-timer, #screen-quiz .quiz-timer { grid-column: 1; grid-row: 2; font-size: 2.4rem; line-height: 1; }
    #screen-puzzle .game-progress, #screen-quiz .quiz-progress { grid-column: 2; grid-row: 2; justify-self: end; align-self: end; }
    #screen-puzzle .btn-back-game:not(.btn-stop-game), #screen-quiz .btn-back-game:not(.btn-stop-game) { grid-column: 1; grid-row: 3; }
    #screen-puzzle .btn-stop-game, #screen-quiz .btn-stop-game { grid-column: 2; grid-row: 3; }

    /* Quiz: question card in the centre, the same side panel on the right */
    #screen-quiz.active {
      display: grid; padding: 2rem; grid-template-columns: minmax(0, 700px) 280px;
      justify-content: center; align-content: center; column-gap: 2rem;
    }
    #screen-quiz .quiz-header { grid-column: 2; max-width: none; }
    #screen-quiz .quiz-card { grid-column: 1; grid-row: 1; }

    /* Schema: two diagrams already fill the width; one slim header row */
    #screen-game .game-header { flex-wrap: nowrap; gap: 1rem; padding: 0.55rem 1.5rem; }
    #screen-game .game-title-label { width: auto; order: 0; flex: 1; text-align: left; font-size: var(--fs-lg); }
    #screen-game .game-progress { order: 1; }
    #screen-game .game-timer { order: 2; min-width: 4ch; text-align: right; }
    #screen-game #btn-pause-schema { order: 3; }
    #screen-game #btn-stop-schema { order: 4; }
  }

  /* ── Reduced motion: no pulsing, popping or confetti ───────────────── */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
    #confetti-canvas, #confetti-canvas.active { display: none !important; }
    .points-popup { display: none; }
    .home-game-btn:hover, .game-card:hover, .postgame-next:hover,
    .btn-primary:hover, .btn-play:hover, .btn-ok:hover { transform: none; }
  }

  /* Recovery codes block (profile) */
  .u-recovery-codes {
    font-family: ui-monospace, Consolas, 'Courier New', monospace;
    background: var(--cream); border: 1px solid var(--border); border-radius: 8px;
    padding: 0.8rem; font-size: var(--fs-base); line-height: 1.6;
    white-space: pre-wrap; color: var(--charcoal);
  }
