/* Feuille de style de MathBrain.

   Elle vivait dans un <style> de base.html, donc 66 Ko renvoyes a chaque
   page et jamais mis en cache. En fichier statique, le navigateur ne la
   telecharge qu'une fois pour toute la visite. */

:root {
    --bg: #f4f7fb;
    --bg-soft: #eef6ff;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-strong: #ffffff;
    --surface-play: linear-gradient(180deg, #fffef8 0%, #fff6e9 100%);
    --line: #d9e2ec;
    --line-strong: #c6d3e1;
    --text: #14213d;
    --muted: #5c677d;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #e8f0ff;
    --accent: #f59e0b;
    --accent-soft: #fff2d8;
    --success-soft: #e7f8ef;
    --danger-soft: #ffe8e6;
    --special: #7c3aed;
    --shadow: 0 24px 60px rgba(20, 33, 61, 0.10);
    --shadow-soft: 0 14px 32px rgba(20, 33, 61, 0.08);
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    font-family: "Avenir Next", "Nunito", "Trebuchet MS", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(96, 165, 250, 0.18), transparent 32%),
        radial-gradient(circle at top right, rgba(245, 158, 11, 0.12), transparent 26%),
        linear-gradient(180deg, #f9fbff 0%, #eef4fb 100%);
}

a { color: inherit; text-decoration: none; }

.shell {
    width: min(1080px, calc(100% - 28px));
    margin: 0 auto;
    padding: 28px 0 56px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
    padding: 12px 14px;
    border: 1px solid rgba(217, 226, 236, 0.9);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-soft);
    flex-wrap: nowrap;
    overflow: hidden;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-weight: 800;
    letter-spacing: -0.02em;
    flex: 0 0 auto;
}

.brand-logo {
    display: block;
    height: 52px;
    width: auto;
    max-width: min(300px, 38vw);
}

.topbar-links {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 auto;
    min-width: 0;
}

.topbar-links form {
    margin: 0;
    flex: 0 0 auto;
}

.topbar-meta {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
}

.topbar-context {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 0 1 280px;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
}

.active-child-form {
    margin: 0;
    min-width: 0;
    flex: 0 1 auto;
}

.active-child-chip {
    display: inline-grid;
    align-items: center;
    grid-template-columns: auto minmax(0, auto) minmax(110px, 1fr);
    gap: 8px;
    min-height: 36px;
    padding: 4px 10px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    min-width: 0;
    width: auto;
    max-width: 100%;
}

.active-child-chip::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    flex: 0 0 auto;
}

.active-child-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.active-child-label {
    font-size: 0.76rem;
    line-height: 1;
    color: var(--muted);
    font-weight: 800;
    white-space: nowrap;
}

.active-child-name {
    font-size: 0.9rem;
    line-height: 1;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.active-child-select {
    min-height: 44px;
    border-radius: 12px;
    border: 0;
    padding: 0 20px 0 0;
    background: transparent;
    font: inherit;
    color: var(--text);
    box-shadow: none;
    width: auto;
    min-width: 0;
    font-weight: 700;
    font-size: 0.9rem;
    justify-self: end;
}

.topbar .button,
.topbar button {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 14px;
    white-space: nowrap;
    font-size: 0.94rem;
}

.card {
    background: var(--surface);
    border: 1px solid rgba(217, 226, 236, 0.95);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}

.stack { display: grid; gap: 14px; }

.grid {
    display: grid;
    gap: 20px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

h1, h2, h3, p { margin: 0; }

h1, h2, h3 {
    letter-spacing: -0.03em;
}

h1 {
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    line-height: 1;
}

h2 {
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    line-height: 1.1;
}

h3 {
    font-size: 1.15rem;
    line-height: 1.2;
}

p.muted { color: var(--muted); }

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.20);
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.button:hover,
button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(37, 99, 235, 0.22);
}

.button.secondary {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    border-color: var(--line);
    box-shadow: none;
}

.button.support-button,
.support-button {
    background: linear-gradient(135deg, #ffdd8f 0%, #f59e0b 100%);
    color: #4a2b00;
    border-color: rgba(245, 158, 11, 0.28);
    box-shadow: 0 10px 18px rgba(245, 158, 11, 0.20);
}

.field {
    display: grid;
    gap: 8px;
}

label {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--muted);
}

input {
    width: 100%;
    min-height: 50px;
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    font: inherit;
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Bare <select> elements in forms fell back to the browser default:
   19px tall, grey system border, nothing like the text fields beside
   them. They get the same box as `input`; the two selects that carry
   their own class keep their own look through class specificity. */
select {
    width: 100%;
    min-height: 50px;
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    font: inherit;
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

select:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

input:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

/* Site-wide keyboard focus ring. :focus-visible only, so a mouse click
   never draws it; components that need a different ring override it. */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
summary:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(15, 97, 196, 0.95);
    outline-offset: 3px;
}

/* The year's programme: one compact row per week, folded by term so a
   parent sees the term they are in rather than twenty-eight rows. */
.programme-term {
    border-top: 1px solid var(--line);
    padding-top: 8px;
}

.programme-term > summary {
    cursor: pointer;
    font-weight: 700;
    padding: 8px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.programme-week-list {
    display: grid;
    gap: 6px;
    padding-bottom: 8px;
}

.programme-week {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 6px 10px;
    border-radius: 12px;
    background: var(--surface-strong);
}

.programme-week.is-current {
    background: var(--accent-soft);
}

.programme-week.is-off .programme-week-label {
    opacity: 0.55;
}

.programme-week-number {
    white-space: nowrap;
}

.programme-week-number {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
    color: var(--muted, #5c677d);
    min-width: 68px;
}

.programme-week-label {
    flex: 1 1 auto;
    min-width: 0;
}

.programme-week .button {
    flex: 0 0 auto;
}

/* One tap per number-fact table. Wraps so all seventeen fit a phone
   without a scroll, and every button keeps the 44px touch target. */
.fact-family-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fact-family-grid form {
    margin: 0;
}

.fact-family-button {
    min-width: 64px;
    padding: 0 14px;
    font-variant-numeric: tabular-nums;
}

ul.messages {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    display: grid;
    gap: 10px;
}

ul.messages li {
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--accent-soft);
    border: 1px solid #f4d7a0;
    box-shadow: var(--shadow-soft);
}

ul.messages li.success {
    background: var(--success-soft);
    border-color: #aad9bc;
    color: #17592b;
}

ul.messages li.error {
    background: var(--danger-soft);
    border-color: #f4b6af;
    color: #912b1d;
}

ul.messages li.info {
    background: var(--primary-soft);
    border-color: #bdd0ff;
    color: #24508b;
}

.child-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.child-card {
    padding: 20px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    box-shadow: var(--shadow-soft);
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.child-card:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow);
}

.active-player-card {
    border-color: rgba(37, 99, 235, 0.40);
    background: linear-gradient(180deg, #f9fbff 0%, #eef4ff 100%);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.child-card-button {
    width: 100%;
    text-align: left;
    display: block;
    color: var(--text);
    background: var(--surface-strong);
    border: 1px solid var(--line);
}

.child-card-button:hover {
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
    border-color: rgba(37, 99, 235, 0.22);
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
}

/* Visually hidden, but it is still a real focusable radio. Without an
   explicit box it inherited `width: 100%` and the padding from the
   global `input` rule; with no positioned ancestor that resolved
   against the viewport and pushed the whole setup page 168px wide,
   giving every phone a horizontal scrollbar. */
.choice-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    min-width: 0;
    height: 1px;
    min-height: 0;
    padding: 0;
    margin: 0;
    border: 0;
}

.choice-card {
    display: block;
    width: 100%;
    min-height: 122px;
    padding: 18px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.choice-card.special {
    background: linear-gradient(180deg, #faf5ff 0%, #f1e9ff 100%);
    border-color: rgba(124, 58, 237, 0.25);
}

.choice-card[data-recommended="true"] {
    border-color: rgba(16, 185, 129, 0.32);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.10);
}

.choice-card strong {
    display: block;
    margin-bottom: 6px;
    font-size: 1.08rem;
}

.choice-card .meta {
    display: block;
}

.choice-card:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow);
}

.choice-input:checked + .choice-card {
    border-color: rgba(37, 99, 235, 0.42);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
}

/* The radio itself is invisible, so its own focus ring would be too.
   Move the indicator onto the card the child actually sees. */
.choice-input:focus-visible + .choice-card {
    outline: 3px solid rgba(15, 97, 196, 0.95);
    outline-offset: 3px;
}

.avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8f0ff 0%, #fff2d8 100%);
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.meta {
    color: var(--muted);
    font-size: 0.95rem;
}

.hero {
    display: grid;
    gap: 12px;
    margin-bottom: 22px;
}

.hero.card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(245, 249, 255, 0.96) 100%);
}

.hero h1 {
    max-width: 23ch;
}

.play-shell {
    display: grid;
    gap: 22px;
    max-width: 980px;
    margin: 0 auto;
}

.play-shell .card {
    background: var(--surface-play);
}

.setup-shell {
    max-width: 1180px;
}

.setup-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
    gap: 22px;
    align-items: start;
}

.setup-main {
    min-width: 0;
}

.setup-sidebar {
    min-width: 0;
}

.setup-summary {
    position: sticky;
    top: 92px;
}

.remote-code-entry-card,
.remote-join-entry-card {
    border-color: rgba(16, 185, 129, 0.20);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(236, 253, 245, 0.86) 58%, rgba(232, 240, 255, 0.86) 100%);
    box-shadow: 0 16px 34px rgba(20, 33, 61, 0.08);
}

.setup-floating-submit {
    display: none;
}

.setup-section-header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.setup-section-header h2,
.setup-section-header h3,
.setup-subsection h3 {
    margin: 0;
}

.setup-step {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: linear-gradient(135deg, #e8f0ff 0%, #fff2d8 100%);
    border: 1px solid rgba(37, 99, 235, 0.16);
    font-weight: 800;
    color: var(--text);
}

.setup-subsection {
    display: grid;
    gap: 12px;
}

.choice-grid-compact {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.choice-grid-dense {
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 10px;
}

.choice-grid-dense .choice-card {
    min-height: 92px;
    padding: 14px 12px;
}

.choice-grid-dense .choice-card strong {
    font-size: 0.97rem;
}

.choice-card-person {
    min-height: 112px;
}

.summary-list {
    display: grid;
    gap: 12px;
    margin: 0;
}

.summary-list div {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
}

.summary-list dt {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.summary-list dd {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.play-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
}

.play-header-main {
    display: grid;
    gap: 6px;
}

.score-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 126px;
    min-height: 72px;
    padding: 12px 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #fff0cc 100%);
    border: 1px solid #f0d48d;
    text-align: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.score-pill strong {
    display: block;
    font-size: 1.75rem;
    line-height: 1;
}

/* Score and BrainCoins side by side, the same box to the pixel. "BrainCoins"
   is a longer word than "Score", so leaving each to its own min-width made
   one a few pixels wider than the other — visible, because they touch. The
   timed variant keeps the room its countdown needs. */
.play-header-figures {
    --figure-width: 136px;
    display: flex;
    align-items: stretch;
    gap: 0.6rem;
    flex-wrap: wrap;
    flex: none;
}
.play-header-figures.is-timed { --figure-width: 148px; }
.play-header-figures > .score-pill {
    flex: 0 0 var(--figure-width);
    width: var(--figure-width);
    min-width: var(--figure-width);
    max-width: var(--figure-width);
}

.coin-pill {
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, var(--accent-soft) 100%);
    border-color: #f0d48d;
    cursor: default;
}
.coin-pill:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.coin-pill strong {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}
.coin-pill-icon { width: 1.5rem; height: 1.5rem; color: var(--accent); flex: none; }

/* The week, as a hairline rather than a sentence. */
.coin-pill-week {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 9px;
    height: 3px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.25);
    overflow: hidden;
}
.coin-pill-week span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
}

/* Everything else behind a hover or a tap: the pill is focusable, so touch
   reaches the same detail without the layout ever changing size. */
.coin-pill-tip {
    position: absolute;
    top: calc(100% + 0.45rem);
    right: 0;
    z-index: 20;
    width: max-content;
    max-width: min(20rem, 80vw);
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface-strong);
    box-shadow: var(--shadow-soft);
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--muted);
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.25rem);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.coin-pill:hover .coin-pill-tip,
.coin-pill:focus .coin-pill-tip,
.coin-pill:focus-within .coin-pill-tip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.coin-pill-tip p { margin: 0 0 0.35rem; }
.coin-pill-tip p:last-child { margin-bottom: 0; }
.coin-pill-tip-lead { color: var(--text); font-weight: 600; }
.coin-pill-tip ul { margin: 0 0 0.35rem; padding-left: 1.1rem; }

.timer-shell {
    min-width: 148px;
    background: linear-gradient(135deg, #fff7e6 0%, #ffe2b6 100%);
    border-color: #f3c56f;
}

.timer-shell strong {
    font-size: 2rem;
}

.timer-shell-warning {
    background: linear-gradient(135deg, #ffe3df 0%, #ffd0ca 100%);
    border-color: #f3aa9f;
    color: #912b1d;
    box-shadow: 0 0 0 5px rgba(225, 29, 72, 0.10);
}

.timer-shell-finished {
    background: linear-gradient(135deg, #f3e8ff 0%, #ede9fe 100%);
    border-color: rgba(124, 58, 237, 0.22);
    color: #5b21b6;
}

.question-card {
    text-align: center;
    padding: 36px 28px;
}

.question-card h2 {
    font-size: clamp(1.6rem, 4vw, 2.3rem);
}

.round-banner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    font-size: 0.96rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    border: 1px solid transparent;
    box-shadow: var(--shadow-soft);
    animation: roundPulse 2.8s ease-in-out infinite;
}

.round-theme-classic {
    background: linear-gradient(135deg, #eef4ff 0%, #ffffff 100%);
    border-color: rgba(37, 99, 235, 0.16);
    color: var(--primary-dark);
}

.round-theme-warmup {
    background: linear-gradient(135deg, #e8f0ff 0%, #fffaf0 100%);
    border-color: rgba(37, 99, 235, 0.14);
    color: var(--primary-dark);
}

.round-theme-speed {
    background: linear-gradient(135deg, #fff0cf 0%, #ffe1b8 100%);
    border-color: rgba(245, 158, 11, 0.18);
    color: #9a5a00;
}

.round-theme-challenge {
    background: linear-gradient(135deg, #ffe8df 0%, #fff4ef 100%);
    border-color: rgba(249, 115, 22, 0.18);
    color: #b45309;
}

.round-theme-finale {
    background: linear-gradient(135deg, #f3e8ff 0%, #ede9fe 100%);
    border-color: rgba(124, 58, 237, 0.18);
    color: #6d28d9;
}

.round-panel {
    position: relative;
    overflow: hidden;
}

.round-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.18) 45%, transparent 100%);
    transform: translateX(-100%);
    animation: roundSweep 3.6s ease-in-out infinite;
}

.question-text {
    font-size: clamp(2.1rem, 5vw, 3.35rem);
    line-height: 1.08;
    font-weight: 800;
    margin: 10px 0 0;
    letter-spacing: -0.04em;
}

.timer-question-card {
    transition: border-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.timer-ended-panel {
    border-color: rgba(124, 58, 237, 0.20);
    box-shadow: 0 0 0 5px rgba(124, 58, 237, 0.08);
    opacity: 0.88;
}

.answer-panel {
    max-width: 560px;
    margin: 0 auto;
    width: 100%;
}

.solo-progress-track {
    width: min(340px, 100%);
    height: 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.18);
    overflow: hidden;
    margin-top: 4px;
}

.solo-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #22c55e 0%, #2563eb 100%);
    transition: width 220ms ease;
}

.answer-input-large {
    min-height: 74px;
    padding: 14px 18px;
    font-size: 2rem;
    text-align: center;
    border-radius: 18px;
    font-weight: 800;
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease, background 120ms ease;
}

.answer-input-large:focus,
.answer-input-live {
    border-color: rgba(37, 99, 235, 0.38);
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.12);
    transform: scale(1.01);
}

.submit-button-large {
    width: 100%;
    min-height: 62px;
    font-size: 1.08rem;
    border-radius: 18px;
}

.submit-button-large:disabled,
.button:disabled,
button:disabled {
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.78;
}

.support-text {
    text-align: center;
    color: var(--muted);
    font-size: 0.96rem;
}

/* ── Question figure (SVG geometry) ─────────────────── */
.question-figure {
    display: flex;
    justify-content: center;
    margin: 0.5rem 0 1rem;
}
.question-figure-svg {
    max-width: 260px;
    width: 100%;
    height: auto;
    color: var(--text);
}

/* ── Data table (statistics questions) ──────────────── */
.question-data-table {
    overflow-x: auto;
    margin: 0.5rem 0 1rem;
}
.question-data-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}
.question-data-table th,
.question-data-table td {
    border: 1px solid rgba(20, 26, 40, 0.14);
    padding: 0.45rem 0.75rem;
    text-align: center;
}
.question-data-table th {
    background: rgba(37, 99, 235, 0.07);
    font-weight: 700;
}

/* ── Fraction answer input ───────────────────────────── */
.fraction-input {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}
.fraction-numerator,
.fraction-denominator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
    max-width: 200px;
}
.fraction-bar {
    width: 100%;
    max-width: 200px;
    height: 3px;
    background: var(--text);
    border-radius: 2px;
    margin: 0.1rem 0;
}

.time-input {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.time-input-field {
    flex: 1 1 8rem;
    min-width: 0;
}

.time-separator {
    font-size: 1.4rem;
    font-weight: 900;
    line-height: 2.7rem;
    padding-top: 1.65rem;
}

.choice-answer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr));
    gap: 0.75rem;
}

.choice-answer-button {
    border: 1px solid rgba(20, 26, 40, 0.14);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 252, 0.96));
    color: var(--text);
    font: inherit;
    font-weight: 800;
    min-height: 3.5rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.choice-input-card {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.55rem;
    text-align: left;
    box-sizing: border-box;
}

.choice-input-card input[type="radio"],
.choice-input-card input[type="checkbox"] {
    accent-color: var(--primary);
    width: 1.15rem;
    height: 1.15rem;
    min-width: 1.15rem;
    min-height: 1.15rem;
    flex: 0 0 1.15rem;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

.choice-input-card .choice-option,
.choice-input-card span {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
}

.radio-label-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    min-width: 0;
}

.radio-label-row input[type="radio"] {
    flex: 0 0 auto;
    width: auto;
    min-height: auto;
    margin: 0;
}

.radio-label-row strong,
.radio-label-row span {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.choice-input-card.is-selected {
    border-color: rgba(15, 97, 196, 0.55);
    box-shadow: 0 14px 30px rgba(15, 97, 196, 0.12);
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.98), rgba(219, 234, 254, 0.88));
}

.choice-answer-button:hover,
.choice-answer-button:focus-visible {
    border-color: rgba(15, 97, 196, 0.42);
    box-shadow: 0 14px 30px rgba(15, 97, 196, 0.12);
    transform: translateY(-1px);
}

.choice-answer-button:focus-visible {
    outline: 3px solid rgba(15, 97, 196, 0.95);
    outline-offset: 3px;
}

.choice-and-number-grid .choice-answer-button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    text-align: left;
}

.answer-with-unit {
    display: flex;
    align-items: stretch;
    max-width: 16rem;
}

.answer-component .grid.two {
    align-items: start;
}

.coordinate-input,
.multi-answer-grid {
    width: 100%;
}

.answer-with-unit input {
    border-radius: 0.85rem 0 0 0.85rem;
}

.answer-unit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3rem;
    border: 1px solid rgba(20, 26, 40, 0.14);
    border-left: 0;
    border-radius: 0 0.85rem 0.85rem 0;
    background: rgba(244, 247, 252, 0.96);
    font-weight: 800;
    color: var(--muted);
}

.gameplay-live-feedback {
    position: relative;
    overflow: hidden;
    gap: 10px;
    padding: 16px 18px;
    transition: transform 140ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.gameplay-live-feedback-correct {
    border: 1px solid rgba(34, 197, 94, 0.28);
    background: linear-gradient(135deg, rgba(240, 253, 244, 0.98) 0%, rgba(220, 252, 231, 0.92) 100%);
    box-shadow: 0 18px 34px rgba(22, 163, 74, 0.10);
}

.gameplay-live-feedback-incorrect,
.gameplay-live-feedback-static {
    border: 1px solid rgba(239, 68, 68, 0.24);
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.98) 0%, rgba(254, 226, 226, 0.92) 100%);
    box-shadow: 0 18px 34px rgba(185, 28, 28, 0.08);
}

.feedback-title-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.feedback-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.1rem;
    color: #fff;
}

.gameplay-live-feedback-correct .feedback-icon {
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
    animation: popIn 220ms ease;
}

.gameplay-live-feedback-incorrect .feedback-icon,
.gameplay-live-feedback-static .feedback-icon {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}

.gameplay-live-feedback-incorrect,
.gameplay-live-feedback-static {
    animation: shakeX 220ms ease;
}

.feedback-review {
    display: grid;
    gap: 8px;
    padding: 10px 0 0;
}

.feedback-value-wrong {
    color: #b42318;
    font-weight: 800;
}

.feedback-value-correct {
    color: #027a48;
    font-weight: 800;
}

.points-burst {
    position: absolute;
    right: 18px;
    top: 16px;
    color: #0f766e;
    font-weight: 900;
    animation: floatUp 900ms ease forwards;
}

@keyframes popIn {
    0% {
        transform: scale(0.72);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shakeX {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    50% {
        transform: translateX(5px);
    }
    75% {
        transform: translateX(-3px);
    }
}

@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.88);
    }
    20% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(-22px) scale(1.04);
    }
}

.card-title-row,
.inline-actions,
.chip-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.card-title-row {
    justify-content: space-between;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.12);
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 700;
}

.status-chip.special {
    background: rgba(124, 58, 237, 0.10);
    border-color: rgba(124, 58, 237, 0.16);
}

.status-chip.danger {
    background: rgba(220, 38, 38, 0.10);
    border-color: rgba(220, 38, 38, 0.16);
}

.adaptive-panel {
    gap: 10px;
    padding: 18px 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(238, 244, 255, 0.94) 100%);
    border-color: rgba(37, 99, 235, 0.16);
    box-shadow: var(--shadow-soft);
}

.adaptive-debug {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    padding-top: 6px;
    color: var(--muted);
    font-size: 0.9rem;
}

.adaptive-debug strong {
    color: var(--text);
}

@media (max-width: 940px) {
    .dashboard-progress-layout {
        grid-template-columns: 1fr;
    }

    .dashboard-insights-grid {
        grid-template-columns: 1fr;
    }

    .active-child-form {
        width: 100%;
    }

    .active-child-chip {
        grid-template-columns: auto minmax(0, 1fr);
        width: 100%;
    }

    .active-child-copy {
        grid-column: 2;
    }

    .active-child-select {
        grid-column: 1 / -1;
        justify-self: stretch;
        width: 100%;
    }

    .setup-layout {
        grid-template-columns: 1fr;
    }

    .setup-summary {
        position: static;
    }
}

.result-hero {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(239, 246, 255, 0.98) 100%);
    border-color: rgba(37, 99, 235, 0.14);
}

.winner-card {
    border-color: rgba(37, 99, 235, 0.32);
    background: linear-gradient(180deg, #ffffff 0%, #eef5ff 100%);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

.badge-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.10);
    border: 1px solid rgba(245, 158, 11, 0.18);
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 700;
}

.badge-pill.trophy {
    background: linear-gradient(135deg, #fff3c8 0%, #ffe2a8 100%);
    border-color: rgba(245, 158, 11, 0.28);
}

.badge-pill.spark {
    background: linear-gradient(135deg, #eef4ff 0%, #fff0cf 100%);
    border-color: rgba(37, 99, 235, 0.18);
}

.badge-pill.play {
    background: linear-gradient(135deg, #e7f7ec 0%, #dff7eb 100%);
    border-color: rgba(22, 163, 74, 0.18);
}

.badge-pill.special {
    background: linear-gradient(135deg, #f3e8ff 0%, #ede9fe 100%);
    border-color: rgba(124, 58, 237, 0.18);
}

.badge-icon {
    font-size: 1rem;
    line-height: 1;
}

.celebration-card {
    padding: 18px 20px;
    border-radius: 22px;
    border: 1px solid rgba(245, 158, 11, 0.18);
    background: linear-gradient(180deg, #fffdf6 0%, #fff3da 100%);
    box-shadow: var(--shadow-soft);
}

.celebration-stars {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 1.15rem;
}

.celebration-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 18px;
}

.dashboard-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1.12fr) minmax(320px, 1fr);
}

.stat-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stat-card {
    padding: 18px 20px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(243, 248, 255, 0.98) 100%);
    box-shadow: var(--shadow-soft);
}

.stat-card .eyebrow {
    display: block;
    margin-bottom: 8px;
}

.stat-value {
    font-size: clamp(1.9rem, 4vw, 2.5rem);
    line-height: 1;
    letter-spacing: -0.04em;
    font-weight: 800;
    margin-bottom: 6px;
}

.activity-list {
    display: grid;
    gap: 12px;
}

.activity-item {
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-soft);
}

.activity-item strong {
    display: block;
    margin-bottom: 4px;
}

.feature-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.feature-card {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-soft);
}

.feature-card strong {
    display: block;
    margin-bottom: 6px;
    font-size: 1rem;
}

.helper-panel {
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid rgba(37, 99, 235, 0.14);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(232, 240, 255, 0.7) 100%);
    box-shadow: var(--shadow-soft);
}

.dashboard-shell {
    align-items: start;
}

.dashboard-column {
    gap: 16px;
}

.dashboard-child-focused {
    grid-template-columns: minmax(0, 1.22fr) minmax(280px, 0.88fr);
}

.dashboard-child-focused .dashboard-primary-column {
    order: 1;
}

.dashboard-child-focused .dashboard-family-column {
    order: 2;
}

.dashboard-hero {
    gap: 10px;
    margin-bottom: 16px;
    padding: 20px 22px;
}

.dashboard-child-hero {
    gap: 12px;
    padding: 16px 18px;
}

.dashboard-child-hero-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
}

.dashboard-child-hero-main {
    display: grid;
    gap: 8px;
}

.dashboard-child-hero-title-row {
    display: grid;
    gap: 8px;
}

.dashboard-child-hero-title-row h1 {
    margin: 0;
}

.dashboard-child-hero-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dashboard-child-hero-actions form {
    margin: 0;
}

.dashboard-hero-focused {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(232, 240, 255, 0.95) 55%, rgba(222, 245, 236, 0.85) 100%);
}

.dashboard-card {
    gap: 12px;
    padding: 18px 20px;
}

.compact-card {
    padding: 16px 18px;
}

.compact-stack {
    gap: 10px;
}

.dashboard-top-grid,
.dashboard-bottom-grid {
    gap: 16px;
}

.dashboard-bottom-grid .dashboard-card:first-child {
    order: 1;
}

.dashboard-bottom-grid .dashboard-card:last-child {
    order: 2;
}

.dashboard-stat-grid {
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
}

.dashboard-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-family-rail {
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.dashboard-family-rail .dashboard-stat-card {
    padding: 12px 14px;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: none;
}

.dashboard-family-card {
    background: rgba(255, 255, 255, 0.84);
}

.dashboard-stat-card {
    padding: 14px 16px;
}

.dashboard-stat-card .stat-value {
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    margin-bottom: 4px;
}

.family-dashboard-shell {
    align-items: stretch;
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
}

.family-dashboard-family-column,
.family-dashboard-primary-column {
    align-content: start;
}

.family-dashboard-stats {
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;
}

.family-dashboard-stat {
    display: grid;
    align-content: start;
    gap: 6px;
    height: 100%;
    padding: 16px 18px;
}

.family-dashboard-stat .eyebrow {
    margin-bottom: 0;
}

.family-dashboard-stat .stat-value {
    font-size: clamp(2rem, 3vw, 2.5rem);
    margin-bottom: 0;
}

.family-dashboard-stat-copy {
    max-width: 24ch;
    line-height: 1.35;
}

.family-dashboard-activity {
    height: 100%;
    align-content: start;
}

.dashboard-child-grid {
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 12px;
}

.dashboard-child-card {
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 16px;
}

.dashboard-child-card-active {
    transform: translateY(-1px);
}

.dashboard-child-card-secondary {
    opacity: 0.74;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: none;
}

.dashboard-child-card-secondary:hover {
    opacity: 0.92;
}

.dashboard-child-focus-card {
    gap: 14px;
    padding: 20px 22px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(240, 247, 255, 0.98) 60%, rgba(231, 245, 238, 0.9) 100%);
}

.dashboard-child-focus-card h2 {
    margin: 4px 0 0;
}

.dashboard-overview-card {
    border-color: rgba(37, 99, 235, 0.14);
}

.dashboard-child-card .avatar {
    margin-bottom: 4px;
}

.dashboard-metric-card {
    padding: 14px 16px;
    box-shadow: none;
}

.dashboard-skill-groups {
    gap: 14px;
}

.dashboard-skill-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.dashboard-activity-item {
    padding: 14px 16px;
}

.child-tabs-card {
    padding-top: 10px;
    padding-bottom: 10px;
}

.child-tabs-row {
    gap: 8px;
    flex-wrap: wrap;
}

.child-tab-link {
    min-height: 44px;
    padding: 0 14px;
}

.dashboard-chip-row-tight {
    gap: 8px;
}

.dashboard-support {
    text-align: left;
    font-size: 0.93rem;
}

.progress-chart-shell {
    display: grid;
    gap: 12px;
}

.progress-chart-toolbar {
    display: flex;
    gap: 14px;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
}

.progress-chart-controls {
    display: grid;
    gap: 6px;
}

.progress-filter-group {
    gap: 8px;
}

.progress-filter-button {
    min-height: 44px;
    padding: 0 12px;
}

.progress-chart-summary {
    display: grid;
    gap: 3px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.92);
    border: 1px solid rgba(217, 226, 236, 0.9);
}

.progress-chart-summary strong {
    font-size: 1.35rem;
    line-height: 1;
}

.progress-chart-frame {
    min-height: 260px;
    padding: 10px 0 4px;
}

.progress-chart-svg {
    width: 100%;
    height: 260px;
    overflow: visible;
}

.progress-chart-grid line {
    stroke: rgba(148, 163, 184, 0.2);
    stroke-width: 1;
}

.progress-chart-area {
    fill: rgba(37, 99, 235, 0.12);
    stroke: none;
}

.progress-chart-line {
    fill: none;
    stroke: var(--primary);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.progress-chart-svg circle {
    fill: #fff;
    stroke: var(--primary-dark);
    stroke-width: 3;
    outline: none;
    transition: r 0.16s ease, fill 0.16s ease, stroke-width 0.16s ease;
}

.progress-chart-svg circle:hover,
.progress-chart-svg circle:focus {
    fill: var(--primary);
    r: 8;
    stroke-width: 4;
}

.progress-chart-value-labels line {
    stroke: rgba(37, 99, 235, 0.24);
    stroke-width: 1.5;
}

.progress-chart-value-labels line.is-latest {
    stroke: rgba(37, 99, 235, 0.5);
}

.progress-chart-value-labels rect {
    fill: rgba(255, 255, 255, 0.94);
    stroke: rgba(37, 99, 235, 0.22);
    stroke-width: 1;
    filter: drop-shadow(0 8px 14px rgba(15, 23, 42, 0.1));
}

.progress-chart-value-labels rect.is-latest {
    fill: var(--primary);
    stroke: var(--primary-dark);
}

.progress-chart-value-labels text {
    fill: var(--primary-dark);
    font-size: 0.76rem;
    font-weight: 800;
    pointer-events: none;
}

.progress-chart-value-labels text.is-latest {
    fill: #fff;
}

.progress-chart-value-marker line {
    stroke: rgba(15, 23, 42, 0.22);
    stroke-dasharray: 4 4;
    stroke-width: 1.5;
}

.progress-chart-value-marker rect {
    fill: rgba(15, 23, 42, 0.92);
    filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.18));
}

.progress-chart-value-marker text {
    fill: #fff;
    font-size: 12px;
    font-weight: 800;
    text-anchor: middle;
}

.progress-chart-axis {
    color: var(--muted);
}

.progress-chart-axis line {
    stroke: rgba(100, 116, 139, 0.42);
    stroke-width: 1;
}

.progress-chart-axis text {
    fill: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.progress-chart-range {
    text-align: right;
    line-height: 1.3;
}

.dashboard-progress-layout {
    grid-template-columns: minmax(0, 1.18fr) minmax(280px, 0.82fr);
}

.dashboard-progress-hero-card {
    gap: 14px;
}

.dashboard-progress-kpi-card {
    gap: 8px;
}

.dashboard-kpi-note {
    margin: -4px 0 0;
}

.dashboard-kpi-summary {
    color: var(--ink);
    font-size: 0.96rem;
    font-weight: 800;
    margin: 0;
}

.dashboard-kpi-trend-row {
    margin-top: auto;
}

.dashboard-trend-row {
    display: grid;
    gap: 6px;
}

.dashboard-skill-progress-list {
    gap: 12px;
}

.dashboard-skill-progress-item {
    gap: 12px;
}

.dashboard-progress-bar {
    height: 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.10);
    overflow: hidden;
}

.dashboard-progress-bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.96) 0%, rgba(59, 130, 246, 0.84) 100%);
}

.dashboard-progress-bar-fill.is-strong {
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.92) 0%, rgba(168, 85, 247, 0.82) 100%);
}

.dashboard-progress-bar-fill.is-needs-work {
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.92) 0%, rgba(249, 115, 22, 0.84) 100%);
}

.dashboard-insights-stack {
    gap: 16px;
}

.dashboard-insights-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}

.dashboard-insight-item,
.dashboard-signal-item {
    padding: 14px 16px;
}

.dashboard-insights-action-card {
    border-color: rgba(37, 99, 235, 0.16);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(238, 244, 255, 0.92) 100%);
}

.site-footer {
    margin-top: 26px;
    padding: 16px 18px;
    border: 1px solid rgba(217, 226, 236, 0.9);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-soft);
}

.footer-links {
    display: flex;
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
}

.footer-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid rgba(217, 226, 236, 0.9);
}

.footer-link {
    color: var(--muted);
    font-weight: 700;
    font-size: 0.95rem;
    transition: color 120ms ease;
}

.footer-link:hover {
    color: var(--text);
}

.footer-language-form {
    margin: 0;
}

.footer-language-select {
    width: auto;
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid var(--line);
    padding: 0 8px;
    background: rgba(255,255,255,0.75);
    font: inherit;
    font-size: 0.92rem;
    color: var(--text);
    box-shadow: none;
}

.footer-brand {
    display: grid;
    gap: 2px;
}

.footer-brand strong {
    font-size: 0.98rem;
}

.footer-brand .meta {
    font-size: 0.9rem;
}

.footer-meta-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.footer-support-link {
    color: var(--muted);
    font-weight: 700;
    font-size: 0.95rem;
    transition: color 120ms ease;
}

.footer-support-link:hover {
    color: var(--text);
}

.share-panel {
    display: grid;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(20, 33, 61, 0.10);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 12px 28px rgba(20, 33, 61, 0.05);
}

.share-panel summary {
    list-style: none;
}

.share-panel summary::-webkit-details-marker {
    display: none;
}

.share-panel-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
}

.share-panel-copy {
    display: grid;
    gap: 4px;
}

.share-panel-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(20, 33, 61, 0.10);
    background: rgba(255, 255, 255, 0.92);
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 800;
    white-space: nowrap;
}

.share-action-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.share-action-button {
    min-height: 44px;
    justify-content: center;
    padding: 0 10px;
    font-size: 0.9rem;
}

.share-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.09);
    color: var(--primary-dark);
    overflow: hidden;
}

.share-action-icon-image {
    display: block;
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.share-inline-stack {
    display: grid;
    gap: 12px;
}

.share-inline-stack.compact {
    gap: 10px;
}

.observer-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 251, 255, 0.98) 100%);
}

.observer-question {
    font-size: 1.1rem;
    line-height: 1.35;
    font-weight: 700;
    margin: 8px 0 0;
    letter-spacing: -0.02em;
}

.chat-panel {
    gap: 12px;
}

.chat-message-list {
    max-height: 240px;
    overflow-y: auto;
    display: grid;
    gap: 8px;
    padding-right: 4px;
}

.chat-message {
    display: grid;
    gap: 3px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.9);
    animation: chatPopIn 180ms ease;
    transform-origin: bottom center;
}

.chat-message.mine {
    background: linear-gradient(135deg, #edf4ff 0%, #e3eeff 100%);
    border-color: rgba(37, 99, 235, 0.18);
}

.chat-message.theirs {
    background: rgba(255, 255, 255, 0.96);
}

.chat-message.reaction {
    display: inline-grid;
    justify-self: start;
    min-width: 74px;
    text-align: center;
    background: linear-gradient(135deg, #fff7e5 0%, #fff1cf 100%);
    border-color: rgba(245, 158, 11, 0.26);
}

.chat-message.reaction span {
    font-size: 1.35rem;
    line-height: 1.1;
}

.chat-message.is-new {
    animation: chatPopIn 180ms ease, chatGlow 2200ms ease;
}

.chat-message strong {
    font-size: 0.9rem;
}

.chat-message span {
    font-size: 0.96rem;
}

.chat-message small {
    color: var(--muted);
    font-size: 0.78rem;
}

.chat-preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}

.chat-reaction-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chat-reaction-row form {
    margin: 0;
}

.chat-reaction-button {
    min-width: 48px;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 1.2rem;
    line-height: 1;
}

.chat-preset-grid form {
    margin: 0;
}

.chat-preset-button {
    width: 100%;
    min-height: 44px;
    font-weight: 700;
}

.section-separator {
    margin-top: 22px;
}

@keyframes roundPulse {
    0%, 100% {
        transform: translateY(0);
        box-shadow: var(--shadow-soft);
    }
    50% {
        transform: translateY(-1px);
        box-shadow: var(--shadow);
    }
}

@keyframes chatPopIn {
    0% {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes chatGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.18);
    }
    20% {
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.14);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

@keyframes roundSweep {
    0% {
        transform: translateX(-100%);
    }
    60%,
    100% {
        transform: translateX(120%);
    }
}

.code-input {
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.22em;
    font-size: 1.6rem;
    font-weight: 800;
}

.code-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 82px;
    padding: 0 24px;
    border-radius: 24px;
    background: linear-gradient(135deg, #ffffff 0%, #eef4ff 100%);
    border: 1px solid rgba(37, 99, 235, 0.16);
    color: var(--primary-dark);
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 800;
    letter-spacing: 0.2em;
    box-shadow: var(--shadow-soft);
}

.eyebrow {
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    font-weight: 800;
}

.errorlist {
    margin: 0;
    padding-left: 18px;
    color: #a23524;
}

@media (max-width: 760px) {
    .grid.two {
        grid-template-columns: 1fr;
    }

    .dashboard-grid,
    .dashboard-top-grid,
    .dashboard-bottom-grid,
    .dashboard-skill-list {
        grid-template-columns: 1fr;
    }

    .family-dashboard-stats {
        grid-template-columns: 1fr;
    }

    .dashboard-child-focused .dashboard-primary-column,
    .dashboard-child-focused .dashboard-family-column {
        order: initial;
    }

    .play-header {
        align-items: stretch;
        flex-direction: column;
    }

    .card-title-row,
    .inline-actions,
    .footer-links,
    .footer-meta,
    .footer-meta-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    /* The child tabs are short labels, not actions: stacking the six of
       them cost 300px of a phone screen and pushed the page's real
       content below the fold. They wrap instead. */
    .child-tabs-row {
        flex-direction: row;
        align-items: center;
    }

    .setup-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .setup-sidebar {
        display: none;
    }

    .setup-main {
        padding-bottom: 96px;
    }

    .setup-main > .submit-button-large[data-setup-submit] {
        display: none;
    }

    .setup-floating-submit {
        position: fixed;
        left: 14px;
        right: 14px;
        bottom: 14px;
        z-index: 30;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 56px;
        border: 0;
        border-radius: 18px;
        background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
        color: #fff;
        font-size: 1rem;
        font-weight: 800;
        box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
    }

    .setup-floating-submit:disabled {
        opacity: 0.55;
        box-shadow: none;
    }

    .dashboard-hero {
        padding: 18px;
    }

    .dashboard-child-hero {
        padding: 16px;
    }

    .dashboard-child-hero-row {
        grid-template-columns: 1fr;
    }

    .dashboard-child-hero-actions {
        justify-content: flex-start;
    }

    .dashboard-column {
        gap: 14px;
    }

    .dashboard-kpi-grid {
        grid-template-columns: 1fr;
    }

    .progress-chart-toolbar {
        flex-direction: column;
    }

    .topbar {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        overflow: visible;
        padding: 12px;
    }

    .topbar-meta {
        justify-content: center;
        width: 100%;
    }

    .brand {
        justify-content: center;
        width: 100%;
    }

    .brand-logo {
        height: 40px;
        max-width: min(220px, 62vw);
    }

    .topbar-nav {
        width: 100%;
        min-width: 0;
    }

    /* The row used to scroll sideways with the scrollbar hidden, which
       left Support and Logout unreachable on a 375px screen. Wrapping
       keeps every link visible and costs one extra row at most. */
    .topbar-links {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 8px;
    }

    .topbar .button,
    .topbar button {
        min-height: 44px;
        padding: 0 12px;
        border-radius: 12px;
        font-size: 0.83rem;
        flex: 0 0 auto;
        box-shadow: none;
    }

    .topbar .button.secondary,
    .topbar .support-button,
    .topbar button {
        white-space: nowrap;
    }
}

/* Honeypot. Taken out of the layout entirely rather than display:none, which
   some bots detect and skip; anyone using a keyboard or a screen reader never
   reaches it because the field is tabindex=-1 inside an aria-hidden wrapper. */
.antispam-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* The sibling-product card. Warm border so it reads as an invitation rather
   than as another statistic panel. */
.lingobrain-card { border-left: 3px solid #7c3aed; }
.lingobrain-note { font-size: 0.88rem; }

/* ---------------------------------------------------------------- BrainCoins
   The page a parent reads to decide about money, so the numbers lead and the
   controls follow. Icons carry the meaning of each figure at a glance; they
   are decorative to a screen reader, which reads the label instead. */

.bc-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.bc-icon {
    width: 1.35em;
    height: 1.35em;
    flex: none;
    color: var(--accent);
    vertical-align: -0.28em;
}

.bc-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.bc-title .bc-icon { width: 1.25em; height: 1.25em; }

/* The one number the parent came for. */
.bc-hero {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    flex-wrap: wrap;
    padding: 1.1rem 1.2rem;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-soft) 0%, var(--surface-strong) 78%);
    border: 1px solid var(--line);
}
.bc-hero-coin { width: 3.2rem; height: 3.2rem; color: var(--accent); flex: none; }
.bc-hero-figure { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.bc-hero-number {
    font-size: clamp(2rem, 6vw, 2.6rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}
.bc-hero-unit { font-size: 0.92rem; color: var(--muted); }
.bc-hero-worth {
    margin-left: auto;
    text-align: right;
    font-weight: 700;
    font-size: 1.15rem;
}
.bc-hero-worth small { display: block; font-weight: 500; font-size: 0.8rem; color: var(--muted); }

/* Secondary figures: small, equal, scannable. */
.bc-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: 0.7rem;
    margin: 0;
}
.bc-tile {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-strong);
}
.bc-tile dt { font-size: 0.78rem; color: var(--muted); line-height: 1.25; }
.bc-tile dd { margin: 0.15rem 0 0; font-weight: 700; font-size: 1.1rem; }
.bc-tile dd span { font-weight: 500; font-size: 0.8rem; color: var(--muted); }

/* Weekly ceiling: a bar says "how much is left" faster than "18 of 75". */
.bc-meter { display: flex; flex-direction: column; gap: 0.35rem; }
.bc-meter-track {
    height: 0.55rem;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
}
.bc-meter-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent) 0%, #fbbf24 100%);
    transition: width 0.4s ease;
}
.bc-meter-full .bc-meter-fill { background: linear-gradient(90deg, #10b981 0%, #34d399 100%); }
.bc-meter-label { font-size: 0.82rem; color: var(--muted); }

.bc-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--line);
    color: var(--muted);
}
.bc-status-on { background: var(--success-soft); color: #047857; }
.bc-status-paused { background: var(--accent-soft); color: #92400e; }

/* The PIN panel. Deliberately quiet when unlocked: it is a state, not a task. */
.bc-lock {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    padding: 0.75rem 0.9rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
}
.bc-lock-text { flex: 1 1 14rem; font-size: 0.88rem; color: var(--muted); }
.bc-lock-text strong { color: var(--text); }
.bc-lock-closed { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.bc-lock-form { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }
.bc-lock-form input[type="password"] {
    width: 7rem;
    letter-spacing: 0.3em;
    text-align: center;
}

/* A row of history entries reads better with the amount pinned left. */
.bc-row { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.bc-amount {
    font-weight: 700;
    color: var(--accent);
    min-width: 2.6rem;
}

@media (prefers-color-scheme: dark) {
    .bc-tile, .bc-hero { background: var(--surface); }
    .bc-status-on { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; }
    .bc-status-paused { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
}
