/* Gringo Minute — design system (00-CONTEXTO.md §7). Every color/spacing/radius/font used by any
   component must come from a token below — no hexadecimal literal belongs in a .razor file.

   The palette is defined twice: once on :root (light) and once under a dark block guarded by
   prefers-color-scheme. Only the *values* change between the two — never the token names, and
   never which token a component reaches for. A component that picks a different variable in dark
   mode is a component that will drift out of sync with the next palette change. */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    color-scheme: light dark;

    --navy: #16205c;
    --navy-hover: #202c74;
    --red: #c0261f;
    --paper: #faf8f3;
    --paper-2: #f3f0e8;
    --surface: #ffffff;
    --surface-2: #fbfaf6;
    --ink: #33342e;
    --muted: #6b6a63;
    --muted-2: #8a887f;
    --faint: #a3a196;
    --border: #e6e0d2;
    --border-2: #d8d3c7;

    --success: #1f7a44;
    --success-bg: #eaf5ee;
    --success-border: #b6ddc4;

    --warning: #e08a1e;
    --warning-bg: #fff5e6;
    --warning-border: #f0d9ac;
    /* §7's --warning (#e08a1e) measures ~2.5:1 as small text on --warning-bg/--paper — short of
       WCAG AA's 4.5:1 (found by an axe-core pass, item 11). This is the same hue, darkened for the
       few places that render it as actual text rather than a background/border/icon fill. */
    --warning-text: #8a5a12;

    --danger: #c0261f;
    --danger-bg: #fbeceb;
    --danger-border: #eec3c0;

    --info: #1d5fa8;
    --info-bg: #eaf1fa;
    --info-border: #bcd3ec;

    --lilac: #7048c0;
    --navy-soft: #9fb0e8;
    --navy-soft-2: #c6cdec;

    --on-accent: #ffffff;

    --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;

    --radius: 10px;
    --radius-sm: 9px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;

    --shadow-card: 0 1px 2px rgba(22, 32, 92, 0.06), 0 1px 1px rgba(22, 32, 92, 0.04);
    --shadow-raised: 0 6px 20px -8px rgba(22, 32, 92, 0.22), 0 2px 6px -2px rgba(22, 32, 92, 0.10);
    --shadow-overlay: 0 24px 60px -12px rgba(15, 20, 45, 0.35);

    --type-framework: var(--navy);
    --type-vocab: var(--lilac);
    --type-speaking: #1f7a44;
    --type-game: #c0261f;
    --type-grammar: #16205c;
    --type-book: #6b4b2a;
    --type-test: #8a887f;

    /* Categorical series for charts. Ordered so any two adjacent entries stay distinguishable in
       grayscale and for the common colour-vision deficiencies — a bar chart is read by position
       first and hue second, so hue must never be the only thing separating two neighbours. */
    --chart-1: #16205c;
    --chart-2: #1f7a44;
    --chart-3: #c0261f;
    --chart-4: #7048c0;
    --chart-5: #e08a1e;
    --chart-6: #1d5fa8;
    --chart-grid: var(--border);
    --chart-track: var(--paper-2);
}

@media (prefers-color-scheme: dark) {
    :root {
        --navy: #7c92e8;
        --navy-hover: #93a6ee;
        --red: #f0736a;
        --paper: #14161c;
        --paper-2: #1c1f27;
        --surface: #1a1d25;
        --surface-2: #21252e;
        --ink: #e8e6e0;
        --muted: #a9a69d;
        --muted-2: #918e86;
        --faint: #6f6c66;
        --border: #2c303a;
        --border-2: #3a3f4b;

        --success: #58c98a;
        --success-bg: #16281f;
        --success-border: #2c5540;

        --warning: #e8a850;
        --warning-bg: #2a2216;
        --warning-border: #55442a;
        --warning-text: #e8b268;

        --danger: #f0736a;
        --danger-bg: #2c1a19;
        --danger-border: #593330;

        --info: #6fa8e8;
        --info-bg: #172431;
        --info-border: #2e4761;

        --lilac: #b193ef;
        --navy-soft: #6274c0;
        --navy-soft-2: #8f9ede;

        --on-accent: #0f1119;

        --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.5), 0 1px 1px rgba(0, 0, 0, 0.35);
        --shadow-raised: 0 6px 20px -8px rgba(0, 0, 0, 0.65), 0 2px 6px -2px rgba(0, 0, 0, 0.45);
        --shadow-overlay: 0 24px 60px -12px rgba(0, 0, 0, 0.8);

        --type-framework: #8fa2ee;
        --type-vocab: #b193ef;
        --type-speaking: #58c98a;
        --type-game: #f0736a;
        --type-grammar: #8fa2ee;
        --type-book: #c9a077;
        --type-test: #a9a69d;

        --chart-1: #7c92e8;
        --chart-2: #58c98a;
        --chart-3: #f0736a;
        --chart-4: #b193ef;
        --chart-5: #e8a850;
        --chart-6: #6fa8e8;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    font-family: var(--font-sans);
    color: var(--navy);
    margin: 0 0 var(--space-3);
    line-height: 1.25;
    letter-spacing: -0.015em;
}

h1 { font-size: clamp(26px, 4.2vw, 34px); font-weight: 700; }
h2 { font-size: clamp(19px, 2.8vw, 22px); font-weight: 600; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0 0 var(--space-3); }

a { color: var(--navy); text-underline-offset: 3px; }

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: var(--space-6) 0;
}

.gm-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    /* --muted-2 (#8a887f) is §7's own "rótulos" token, but at the 11px uppercase weight these
       labels actually render at, it measures ~3.4:1 against --paper/#fff — short of WCAG AA's
       4.5:1 for normal text (found by an axe-core pass, item 11 of the phase spec). --muted is the
       same "secondary text" role, just dark enough to clear AA; --muted-2 stays defined for any
       future non-text (e.g. icon/border) use where contrast rules don't apply the same way. */
    color: var(--muted);
}

.gm-numeric {
    font-family: var(--font-mono);
    /* Digits must not jitter as a value ticks — every table of numbers here is read by comparing
       columns, and proportional digits break that alignment. */
    font-variant-numeric: tabular-nums;
}

/* ---------- Shell ---------- */
.gm-app-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: var(--space-6) var(--space-5) var(--space-7);
}

.gm-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-5);
    background: var(--navy);
    color: #fff;
    box-shadow: var(--shadow-raised);
}

.gm-topbar a {
    color: var(--navy-soft-2);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    transition: background-color 120ms ease, color 120ms ease;
}

.gm-topbar a:hover, .gm-topbar a:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

/* Dark mode flips --navy to a light blue, which would put light text on a light bar. The topbar
   keeps its own fixed dark ground in both themes instead — it is the one surface whose identity is
   the brand colour rather than the page background. */
@media (prefers-color-scheme: dark) {
    .gm-topbar {
        background: #171b26;
        border-bottom: 1px solid var(--border);
    }
}

.gm-topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 18px;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.gm-topbar-brand:hover, .gm-topbar-brand:focus-visible { background: none; color: #fff; }

.gm-topbar-brand__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(140deg, var(--red), #e8542c);
    font-size: 15px;
}

.gm-topbar-nav {
    display: flex;
    gap: var(--space-1);
    align-items: center;
}

/* The hamburger only exists below the mobile breakpoint; hiding it here (rather than showing it
   there) keeps it out of the tab order on desktop without a second aria-hidden to maintain. */
.gm-topbar-toggle { display: none; }

/* Visually hidden but still announced by screen readers and targetable by FocusOnNavigate — used
   for a page's <h1> while a loading/error state hasn't reached the point of having a real,
   contentful title yet (axe-core's "page-has-heading-one" must still pass in every state). */
.sr-only-heading, .gm-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visibility — never suppressed, required by item 11 of the phase spec. */
:focus-visible {
    outline: 3px solid var(--navy);
    outline-offset: 2px;
}

@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;
    }
}

/* ---------- Layout helpers ---------- */
.gm-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.gm-page-header h1 { margin-bottom: var(--space-1); }

.gm-section { margin-top: var(--space-7); }
.gm-section > h2 { margin-bottom: var(--space-4); }

.gm-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.gm-section-head h2 { margin-bottom: 0; }

.gm-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
}

.gm-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-4);
}

.gm-stack > * + * { margin-top: var(--space-4); }

/* ---------- GmButton ---------- */
.gm-button {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 15px;
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-5);
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    /* Every interactive control clears the 44px pointer-target guideline on touch, without the
       page having to remember to add padding case by case. */
    min-height: 44px;
    transition: background-color 120ms ease, border-color 120ms ease, transform 60ms ease, box-shadow 120ms ease;
}

.gm-button:active:not(:disabled) { transform: translateY(1px); }

.gm-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gm-button--primary {
    background: var(--navy);
    color: var(--on-accent);
    box-shadow: var(--shadow-card);
}

.gm-button--primary:hover:not(:disabled) { background: var(--navy-hover); box-shadow: var(--shadow-raised); }

.gm-button--secondary {
    background: var(--surface);
    color: var(--navy);
    border-color: var(--border-2);
}

.gm-button--secondary:hover:not(:disabled) { background: var(--paper-2); border-color: var(--navy-soft); }

.gm-button--danger {
    background: var(--danger);
    color: #fff;
}

.gm-button--block { width: 100%; }

/* ---------- GmCard ---------- */
.gm-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--space-5);
}

.gm-card--flush { padding: 0; overflow: hidden; }

.gm-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.gm-card__head h2, .gm-card__head h3 { margin-bottom: 0; }

/* The one hero surface on the student home — deliberately the only gradient in the system, so it
   reads as "this is today's thing" rather than as decoration. */
.gm-hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    color: #fff;
    background: linear-gradient(135deg, #16205c 0%, #2b3a94 55%, #4a3d9c 100%);
    box-shadow: var(--shadow-raised);
}

.gm-hero::after {
    content: "";
    position: absolute;
    inset: auto -60px -120px auto;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.16), transparent 68%);
    pointer-events: none;
}

.gm-hero h2, .gm-hero h1 { color: #fff; }
.gm-hero .gm-meta { color: var(--navy-soft-2); }
.gm-hero__title { font-size: clamp(22px, 3.6vw, 30px); margin-bottom: var(--space-3); }

.gm-hero__actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-5);
}

.gm-hero .gm-button--primary {
    background: #fff;
    color: #16205c;
}

.gm-hero .gm-button--primary:hover:not(:disabled) { background: var(--navy-soft-2); }

.gm-hero .gm-button--secondary {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.gm-hero .gm-button--secondary:hover:not(:disabled) { background: rgba(255, 255, 255, 0.2); }

/* ---------- GmTypeBadge / pills ---------- */
.gm-type-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid currentColor;
    background: color-mix(in srgb, currentColor 8%, transparent);
    white-space: nowrap;
}

.gm-type-badge--framework { color: var(--type-framework); }
.gm-type-badge--vocab { color: var(--type-vocab); }
.gm-type-badge--speaking { color: var(--type-speaking); }
.gm-type-badge--game { color: var(--type-game); }
.gm-type-badge--grammar { color: var(--type-grammar); }
.gm-type-badge--book { color: var(--type-book); }
.gm-type-badge--test { color: var(--type-test); }

.gm-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 3px 10px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid transparent;
}

.gm-pill--success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.gm-pill--warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); }
.gm-pill--danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.gm-pill--info { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }
.gm-pill--neutral { background: var(--paper-2); border-color: var(--border-2); color: var(--muted); }

/* ---------- GmStreakBadge ---------- */
.gm-streak-badge {
    display: inline-flex;
    align-items: baseline;
    gap: var(--space-2);
    font-family: var(--font-mono);
    padding: var(--space-2) var(--space-4);
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.gm-streak-badge__current {
    font-size: 20px;
    font-weight: 600;
    color: var(--red);
}

.gm-streak-badge__label {
    font-size: 11px;
    /* See the note on .gm-meta: --muted-2 is §7's label token but misses AA at this size. */
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.gm-streak-badge--at-risk .gm-streak-badge__current { color: var(--warning-text); }

.gm-hero .gm-streak-badge {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
}

.gm-hero .gm-streak-badge__current { color: #fff; }
.gm-hero .gm-streak-badge__label { color: var(--navy-soft-2); }

/* ---------- GmProgressBar ---------- */
.gm-progress-bar {
    height: 10px;
    border-radius: 999px;
    background: var(--chart-track);
    overflow: hidden;
}

.gm-progress-bar__fill {
    height: 100%;
    background: var(--navy);
    border-radius: 999px;
    transition: width 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.gm-hero .gm-progress-bar { background: rgba(255, 255, 255, 0.22); }
.gm-hero .gm-progress-bar__fill { background: #fff; }

/* ---------- GmExampleBlock ---------- */
.gm-example-block {
    border-left: 3px solid var(--navy-soft);
    background: var(--paper-2);
    padding: var(--space-4);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--ink);
}

.gm-example-block__label {
    font-family: var(--font-mono);
    font-style: normal;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin-bottom: var(--space-2);
}

/* ---------- GmAside ---------- */
.gm-aside {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--muted);
    background: var(--paper-2);
    border: 1px dashed var(--border-2);
}

.gm-aside--tip {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    color: var(--ink);
    font-weight: 500;
}

.gm-aside--tip .gm-aside__badge {
    color: var(--warning-text);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-right: var(--space-2);
}

/* Resultado de uma acao de escrita (salvou, falhou), no fluxo da pagina. Herdam a borda solida
   do --tip de proposito: um aviso tracejado le como nota de rodape, e estes precisam ser lidos. */
.gm-aside--danger {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--ink);
}

.gm-aside--success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--ink);
}

/* ---------- GmChallengeCard ---------- */
.gm-challenge-card {
    background: linear-gradient(135deg, #16205c, #2b3a94);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

.gm-challenge-card__label {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--navy-soft-2);
    margin-bottom: var(--space-2);
}

.gm-challenge-card__text {
    font-size: 18px;
    margin-bottom: var(--space-3);
}

.gm-challenge-card__bonus {
    color: var(--navy-soft-2);
    font-size: 14px;
    margin-bottom: var(--space-3);
}

.gm-challenge-card label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 14px;
    color: var(--navy-soft-2);
    margin-bottom: var(--space-4);
}

/* ---------- GmFeedback ---------- */
.gm-feedback {
    border-radius: var(--radius);
    padding: var(--space-4);
    border: 1px solid var(--border);
}

.gm-feedback--correct {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success);
}

.gm-feedback--incorrect {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
}

.gm-feedback__title {
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.gm-feedback__explanation {
    color: var(--ink);
    font-weight: 400;
}

/* ---------- GmCalendarGrid ---------- */
/* Visual hierarchy is mandatory: Today > Completed > Pending > Available > Locked. */
.gm-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--space-2);
}

.gm-calendar-grid--dense {
    grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    gap: 4px;
}

.gm-calendar-cell {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-family: var(--font-mono);
    font-size: 13px;
    cursor: pointer;
    padding: 2px;
    transition: transform 100ms ease, box-shadow 120ms ease;
}

.gm-calendar-cell:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-card);
}

.gm-calendar-cell:disabled { cursor: default; }

.gm-calendar-grid--dense .gm-calendar-cell { font-size: 10px; border-radius: 5px; }

.gm-calendar-cell--locked {
    background: var(--paper-2);
    /* --faint (§7's "texto terciário") measures ~1.5:1 here — nowhere near AA. --muted keeps the
       cell visually the least prominent of the states (light, low-saturation background) while its
       day number stays readable. */
    color: var(--muted);
    border-color: var(--border);
}

/* A future day that is simply open. Quieter than pending — it is not a debt, so it must not
   borrow the amber that means "you are behind". */
.gm-calendar-cell--available {
    background: var(--surface);
    border-color: var(--border-2);
    color: var(--muted);
}

.gm-calendar-cell--pending {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--warning-text);
    font-weight: 600;
}

.gm-calendar-cell--completed {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success);
    font-weight: 600;
}

.gm-calendar-cell--today {
    background: var(--navy);
    border-color: var(--navy);
    color: var(--on-accent);
    font-weight: 700;
    box-shadow: 0 0 0 3px var(--navy-soft-2);
}

.gm-calendar-cell__dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.7;
}

.gm-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.gm-legend__item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 13px;
    color: var(--muted);
}

.gm-legend__swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid var(--border-2);
    flex: none;
}

/* ---------- GmEmptyState / GmSkeleton ---------- */
.gm-empty-state {
    text-align: center;
    padding: var(--space-7) var(--space-4);
    color: var(--muted);
    border: 1px dashed var(--border-2);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
}

.gm-empty-state__action { margin-top: var(--space-4); }

.gm-error-state {
    text-align: center;
    padding: var(--space-6) var(--space-4);
    color: var(--danger);
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    border-radius: var(--radius);
}

.gm-offline-banner {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    color: var(--ink);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    font-size: 14px;
}

.gm-skeleton {
    background: linear-gradient(90deg, var(--paper-2) 25%, var(--border) 37%, var(--paper-2) 63%);
    background-size: 400% 100%;
    animation: gm-skeleton-shimmer 1.4s ease infinite;
    border-radius: var(--radius-sm);
}

@keyframes gm-skeleton-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .gm-skeleton { animation: none; background: var(--paper-2); }
}

/* ---------- Exercises ---------- */
.gm-exercise-card { max-width: 680px; margin: 0 auto; }

.gm-exercise-prompt {
    font-size: clamp(18px, 2.6vw, 20px);
    font-weight: 600;
    color: var(--ink);
    margin-bottom: var(--space-5);
}

.gm-exercise-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.gm-option-button {
    width: 100%;
    text-align: left;
    padding: var(--space-4);
    border-radius: var(--radius);
    border: 2px solid var(--border-2);
    background: var(--surface);
    color: var(--ink);
    font-size: 16px;
    font-family: var(--font-sans);
    cursor: pointer;
    min-height: 52px;
    transition: border-color 120ms ease, background-color 120ms ease;
}

.gm-option-button:hover:not(:disabled) { border-color: var(--navy-soft); }
.gm-option-button--selected { border-color: var(--navy); background: var(--paper-2); }
.gm-option-button--correct { border-color: var(--success); background: var(--success-bg); }
.gm-option-button--incorrect { border-color: var(--danger); background: var(--danger-bg); }

.gm-text-input, .gm-textarea, select.gm-text-input {
    width: 100%;
    font-family: var(--font-sans);
    /* 16px exactly: anything smaller makes iOS Safari zoom the whole page on focus. */
    font-size: 16px;
    padding: var(--space-3);
    border: 2px solid var(--border-2);
    border-radius: var(--radius);
    color: var(--ink);
    background: var(--surface);
    min-height: 44px;
}

.gm-text-input:focus, .gm-textarea:focus { border-color: var(--navy); }

.gm-textarea { min-height: 100px; resize: vertical; }

.gm-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

.gm-reorder-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.gm-reorder-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 2px solid var(--border-2);
    border-radius: var(--radius);
    background: var(--surface);
}

.gm-reorder-item__controls { display: flex; gap: var(--space-1); }
.gm-reorder-item__controls button {
    background: var(--paper-2);
    border: 1px solid var(--border-2);
    border-radius: 6px;
    color: var(--ink);
    width: 40px;
    height: 40px;
    cursor: pointer;
}

.gm-match-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
}

.gm-match-item {
    width: 100%;
    text-align: left;
    padding: var(--space-3);
    border: 2px solid var(--border-2);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    margin-bottom: var(--space-2);
    cursor: pointer;
    min-height: 44px;
}

.gm-match-item--selected { border-color: var(--navy); background: var(--paper-2); }
.gm-match-item--linked { border-color: var(--success); background: var(--success-bg); }

/* ---------- Result ---------- */
.gm-score-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-6);
}

/* The ring is drawn with a conic gradient masked into a donut rather than as an SVG, so the fill
   fraction is a single custom property the markup sets inline. --gm-ring-color says which of pass
   or fail this is; the geometry never changes. */
.gm-score-ring {
    --gm-ring-value: 0;
    --gm-ring-color: var(--navy);
    position: relative;
    flex: none;
    width: 148px;
    height: 148px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background:
        radial-gradient(closest-side, var(--surface) 78%, transparent 79% 100%),
        conic-gradient(var(--gm-ring-color) calc(var(--gm-ring-value) * 1%), var(--chart-track) 0);
}

.gm-score-ring__value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 34px;
    font-weight: 700;
    color: var(--gm-ring-color);
    line-height: 1;
}

.gm-score-ring__label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: var(--space-1);
}

.gm-answer-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.gm-answer-list__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: var(--radius);
    background: var(--surface);
}

.gm-answer-list__item--correct { border-left-color: var(--success); }
.gm-answer-list__item--incorrect { border-left-color: var(--danger); }

.gm-answer-list__index {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
    min-width: 24px;
}

/* ---------- Content blocks ---------- */
.gm-block { margin-bottom: var(--space-4); }

.gm-figure {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4);
    background: var(--paper-2);
}

.gm-figure img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }

.gm-figure__caption {
    font-style: italic;
    color: var(--muted);
    margin-top: var(--space-2);
}

.gm-table {
    width: 100%;
    border-collapse: collapse;
}

.gm-table th, .gm-table td {
    border: 1px solid var(--border);
    padding: var(--space-2) var(--space-3);
    text-align: left;
}

.gm-table th {
    background: var(--paper-2);
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
}

/* ---------- Login ---------- */
.gm-login-shell {
    max-width: 420px;
    margin: var(--space-7) auto;
    padding: 0 var(--space-4);
}

/* ---------- Admin ---------- */
.gm-table-scroll {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    /* Momentum scrolling plus a hint that there is more to the right than the viewport shows. */
    -webkit-overflow-scrolling: touch;
}

.gm-admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    font-size: 14px;
}

.gm-admin-table th, .gm-admin-table td {
    border-bottom: 1px solid var(--border);
    padding: var(--space-3) var(--space-4);
    text-align: left;
    white-space: nowrap;
}

.gm-admin-table tbody tr:last-child td { border-bottom: 0; }

.gm-admin-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
}

.gm-admin-table td.gm-numeric, .gm-admin-table th.gm-numeric { text-align: right; }

.gm-admin-table tbody tr.gm-row-link { cursor: pointer; }
.gm-admin-table tbody tr.gm-row-link:hover { background: var(--surface-2); }
.gm-admin-table tbody tr.gm-row-link:focus-within { background: var(--surface-2); }

.gm-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: var(--space-4);
}

.gm-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.gm-stat-card__value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: clamp(24px, 3.2vw, 30px);
    font-weight: 700;
    color: var(--navy);
    line-height: 1.15;
}

.gm-stat-card__label {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
}

.gm-stat-card__hint {
    font-size: 12px;
    color: var(--muted);
}

.gm-stat-card--success .gm-stat-card__value { color: var(--success); }
.gm-stat-card--warning .gm-stat-card__value { color: var(--warning-text); }
.gm-stat-card--danger .gm-stat-card__value { color: var(--danger); }

.gm-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: flex-end;
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.gm-filters .gm-field { flex: 1 1 180px; }

.gm-tabs {
    display: flex;
    gap: var(--space-1);
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-5);
}

.gm-tab {
    appearance: none;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    min-height: 44px;
}

.gm-tab:hover { color: var(--ink); }

.gm-tab--active {
    color: var(--navy);
    border-bottom-color: var(--navy);
}

.gm-identity {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.gm-avatar {
    flex: none;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--navy);
    color: var(--on-accent);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 0.02em;
}

.gm-definition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: var(--space-4);
}

.gm-definition-grid dt {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin-bottom: var(--space-1);
}

.gm-definition-grid dd {
    margin: 0;
    font-size: 15px;
    color: var(--ink);
}

/* ---------- Charts ---------- */
.gm-chart {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.gm-chart__canvas {
    width: 100%;
    height: auto;
    overflow: visible;
}

.gm-chart__grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.gm-chart__axis-label { fill: var(--muted); font-family: var(--font-mono); font-size: 10px; }
.gm-chart__value-label { fill: var(--muted); font-family: var(--font-mono); font-size: 10px; }
.gm-chart__bar { transition: opacity 120ms ease; }
.gm-chart__bar:hover { opacity: 0.82; }
.gm-chart__line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.gm-chart__point { stroke: var(--surface); stroke-width: 2; }
.gm-chart__area { opacity: 0.14; }

.gm-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.gm-chart-legend__item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 13px;
    color: var(--muted);
}

.gm-chart-legend__swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex: none;
}

/* A horizontal "bar in a row" list — used where the categories have long labels that a rotated
   x-axis would mangle (exercise kinds, band names). */
.gm-bar-rows {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin: 0;
}

.gm-bar-row {
    display: grid;
    grid-template-columns: minmax(90px, 150px) 1fr auto;
    align-items: center;
    gap: var(--space-3);
}

.gm-bar-row__label {
    font-size: 13px;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gm-bar-row__track {
    display: block;
    height: 12px;
    border-radius: 999px;
    background: var(--chart-track);
    overflow: hidden;
}

/* display:block is load-bearing, not tidiness: both of these are <span>s, and width/height do
   nothing on an inline box — the fill would paint an empty track at every value. */
.gm-bar-row__fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--chart-1);
    transition: width 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.gm-bar-row__value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    color: var(--muted);
    min-width: 56px;
    text-align: right;
}

/* ---------- Modal (locked day) ---------- */
.gm-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 45, 0.5);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    z-index: 50;
}

.gm-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-overlay);
    padding: var(--space-5);
    max-width: 380px;
    width: 100%;
    text-align: center;
}

.gm-modal__icon { font-size: 32px; margin-bottom: var(--space-3); }

/* ---------- Blazor's own unhandled-error banner ---------- */
/* Hidden by default; blazor.webassembly.js toggles this to visible on an uncaught JS/.NET error —
   display:none also keeps it out of axe-core's "content must be in a landmark" scan while inactive. */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--danger-bg);
    border-top: 1px solid var(--danger-border);
    color: var(--ink);
    padding: var(--space-3) var(--space-4);
}

#blazor-error-ui .reload {
    color: var(--navy);
    text-decoration: underline;
    margin-left: var(--space-2);
    cursor: pointer;
}

#blazor-error-ui .dismiss {
    float: right;
    cursor: pointer;
}

/* ---------- Responsive (item 12) ---------- */
@media (max-width: 900px) {
    .gm-calendar-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
    .gm-match-columns { gap: var(--space-3); }
    .gm-app-shell { padding: var(--space-5) var(--space-4) var(--space-7); }
    .gm-score-hero { gap: var(--space-4); }
}

@media (max-width: 640px) {
    .gm-app-shell { padding: var(--space-4) var(--space-3) var(--space-7); }

    .gm-topbar { padding: var(--space-3); }

    /* The nav collapses behind the hamburger; .gm-topbar-nav--open is toggled by MainLayout. */
    .gm-topbar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: var(--radius-sm);
        border: 1px solid rgba(255, 255, 255, 0.3);
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
        font-size: 18px;
        cursor: pointer;
    }

    .gm-topbar-nav {
        display: none;
        position: absolute;
        top: 100%;
        right: var(--space-3);
        left: var(--space-3);
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-1);
        padding: var(--space-2);
        border-radius: var(--radius-lg);
        background: #171b26;
        border: 1px solid rgba(255, 255, 255, 0.14);
        box-shadow: var(--shadow-overlay);
    }

    .gm-topbar-nav--open { display: flex; }
    .gm-topbar-nav a { padding: var(--space-3); font-size: 13px; }

    .gm-hero { padding: var(--space-5); border-radius: var(--radius-lg); }
    .gm-hero__actions .gm-button { flex: 1 1 100%; }

    .gm-stat-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-3); }
    .gm-stat-card { padding: var(--space-3) var(--space-4); }

    .gm-match-columns { grid-template-columns: 1fr; }

    .gm-calendar-grid { gap: 5px; }
    .gm-calendar-cell { font-size: 11px; gap: 1px; }

    .gm-bar-row { grid-template-columns: 1fr auto; row-gap: var(--space-1); }
    .gm-bar-row__label { grid-column: 1 / -1; }

    .gm-score-hero { flex-direction: column; align-items: stretch; text-align: center; }
    .gm-score-ring { margin: 0 auto; }

    .gm-filters { padding: var(--space-3); }

    /* Wide admin tables stop being tables below this width and become one card per row: a
       horizontal scrollbar on a phone hides the columns that matter most (the ones on the right).
       Each cell carries its own header via data-label. */
    .gm-admin-table--cards, .gm-admin-table--cards tbody, .gm-admin-table--cards tr, .gm-admin-table--cards td {
        display: block;
        width: 100%;
    }

    .gm-admin-table--cards thead { display: none; }

    .gm-admin-table--cards tbody tr {
        border: 1px solid var(--border);
        border-radius: var(--radius);
        margin-bottom: var(--space-3);
        padding: var(--space-2);
        background: var(--surface);
    }

    .gm-admin-table--cards td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: var(--space-4);
        border-bottom: 0;
        padding: var(--space-2) var(--space-3);
        white-space: normal;
        text-align: right;
    }

    .gm-admin-table--cards td::before {
        content: attr(data-label);
        font-family: var(--font-mono);
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 1px;
        color: var(--muted);
        text-align: left;
        flex: none;
    }

    .gm-table-scroll:has(.gm-admin-table--cards) { border: 0; background: none; }
}
