/* Shared shell for Errata's newer pages (class.html, exam.html): the same tokens and components as lesson.html,
   kept in one file so those pages don't each carry a copy. Loaded after fonts.css and brand-colour-tokens.css. */
:root {
  --text-soft: #475569;
  --line: #E2E8F0;
  --tile-bg: #FFFFFF;
  --hover: rgba(30, 41, 59, .07);
  --btn-bg: var(--color-primary); --btn-bg-hover: var(--color-primary-dark); --btn-fg: #fff;
  --glow-a: rgba(67, 56, 202, .10); --glow-b: rgba(34, 211, 238, .12);
  --good: #0F766E; --good-bg: rgba(13, 148, 136, .12); --good-line: #0D9488;
  --bad: #BE123C; --bad-bg: rgba(244, 63, 94, .10); --bad-line: #F43F5E;
  --warn: #B45309; --warn-bg: rgba(245, 158, 11, .14);
  --accent-ink: var(--color-primary);

  --font-display: "Sentient", "Satoshi", serif;
  --font-body: "Satoshi", "Geist", sans-serif;
  --font-ui: "Geist", "Satoshi", sans-serif;

  --step--1: .8rem; --step-0: 1rem; --step-1: 1.25rem; --step-2: 1.5625rem; --step-3: 1.953rem;
  --step-4: 2.441rem; --step-5: 3.052rem; --step-6: 3.815rem;
  --lh-body: 1.6; --lh-ui: 1.5; --lh-head: 1.2; --lh-display: 1.05;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --orb: 76px;
}
[data-theme="dark"] {
  --text-soft: #CBD5E1;
  --line: #334155;
  --tile-bg: #1E293B;
  --hover: rgba(248, 250, 252, .09);
  --btn-bg: var(--color-accent); --btn-bg-hover: #67E8F9; --btn-fg: #0F172A;
  --glow-a: rgba(99, 102, 241, .22); --glow-b: rgba(34, 211, 238, .10);
  --good: #5EEAD4; --good-bg: rgba(45, 212, 191, .14); --good-line: #2DD4BF;
  --bad: #FDA4AF; --bad-bg: rgba(244, 63, 94, .16); --bad-line: #FB7185;
  --warn: #FCD34D; --warn-bg: rgba(245, 158, 11, .16);
  --accent-ink: var(--color-accent);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100dvh; background: var(--color-canvas); color: var(--color-text); font-family: var(--font-body); font-size: var(--step-0); line-height: var(--lh-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, .btn, .exit, .chip, .kicker, .meta, label, select, .stat span, kbd { font-family: var(--font-ui); }
svg { display: block; flex: none; }
:focus-visible { outline: 3px solid var(--color-primary-light); outline-offset: 3px; border-radius: 12px; }
[data-theme="dark"] :focus-visible { outline-color: var(--color-accent); }
[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app {
  min-height: 100dvh; display: flex; flex-direction: column;
  background:
    radial-gradient(ellipse 55% 45% at 50% 0%, var(--glow-a), transparent 70%),
    radial-gradient(ellipse 40% 35% at 85% 60%, var(--glow-b), transparent 70%);
  background-attachment: fixed;
}
.top { min-height: 68px; padding: 8px clamp(16px, 3vw, 32px); display: flex; align-items: center; gap: 12px; flex: none; flex-wrap: wrap; }
.logo { font-family: var(--font-display); font-weight: 700; font-size: var(--step-2); letter-spacing: -.01em; line-height: 1; margin-right: auto; }
.logo sup { color: var(--accent-ink); font-size: .6em; margin-left: .06em; vertical-align: top; position: relative; top: -.1em; }
.exit { min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; border: 0; background: transparent; border-radius: 22px; font-weight: 500; color: var(--text-soft); transition: background-color .2s; }
.exit:hover { background: var(--hover); }
.nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px; }
.exit[aria-current="page"] { color: var(--color-text); font-weight: 600; background: var(--hover); }

.stage { flex: 1; display: flex; flex-direction: column; padding: 8px 16px 64px; }
.view { width: min(760px, 100%); margin: 0 auto; display: flex; flex-direction: column; align-items: stretch; }
.view.center { margin: auto; align-items: center; text-align: center; }
.view.enter > * { animation: rise .6s var(--ease-out) both; }
.view.enter > *:nth-child(2) { animation-delay: .05s; } .view.enter > *:nth-child(3) { animation-delay: .1s; }
.view.enter > *:nth-child(4) { animation-delay: .15s; } .view.enter > *:nth-child(n+5) { animation-delay: .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.kicker { font-size: var(--step--1); line-height: var(--lh-ui); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); margin: 0 0 10px; }
.big { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; line-height: var(--lh-head); text-wrap: balance; }
.big.xl { font-size: clamp(var(--step-4), 7vw, var(--step-6)); line-height: var(--lh-display); }
.big.lg { font-size: clamp(var(--step-3), 4.6vw, var(--step-5)); }
.big.md { font-size: clamp(var(--step-1), 3vw, var(--step-2)); }
.lede { margin-top: 10px; font-size: var(--step-1); line-height: var(--lh-ui); color: var(--text-soft); text-wrap: balance; }
.soft { color: var(--text-soft); }
.small { font-size: var(--step--1); line-height: var(--lh-ui); }
.actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.center .actions { justify-content: center; }
.section { margin-top: 40px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; }

.btn { min-height: 48px; padding: 0 24px; border-radius: 26px; border: 0; font-weight: 600; font-size: var(--step-0); background: var(--btn-bg); color: var(--btn-fg); display: inline-flex; align-items: center; justify-content: center; gap: 10px; white-space: nowrap; transition: background-color .2s, transform .25s var(--ease-out), opacity .2s; }
.btn:hover:not(:disabled) { background: var(--btn-bg-hover); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.btn.quiet { background: transparent; color: var(--color-text); border: 1.5px solid var(--line); }
.btn.quiet:hover:not(:disabled) { background: var(--hover); }
.btn.sm { min-height: 40px; padding: 0 16px; font-size: var(--step--1); }
.btn.danger { background: transparent; color: var(--bad); border: 1.5px solid var(--bad-line); }
.btn.danger:hover:not(:disabled) { background: var(--bad-bg); }

.card { background: var(--tile-bg); border: 1.5px solid var(--line); border-radius: 24px; padding: clamp(16px, 3vw, 24px); box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 14px 28px -18px rgba(15, 23, 42, .22); }
.card h3 { font-family: var(--font-display); font-weight: 600; font-size: var(--step-1); line-height: var(--lh-head); letter-spacing: -.005em; overflow-wrap: anywhere; }
a.card, button.card { display: block; width: 100%; text-align: left; transition: transform .3s var(--ease-out), border-color .2s; }
a.card:hover, button.card:hover { transform: translateY(-2px); border-color: var(--color-primary-light); }
.chip { display: inline-flex; align-items: center; padding: 3px 12px; border-radius: 999px; font-size: var(--step--1); font-weight: 600; line-height: var(--lh-ui); background: color-mix(in srgb, var(--color-secondary) 16%, transparent); color: var(--color-secondary); white-space: nowrap; }
[data-theme="dark"] .chip { color: #C4B5FD; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.plain { background: var(--hover); color: var(--text-soft); }
.note { padding: 12px 16px; border-radius: 16px; background: var(--hover); font-size: var(--step-0); line-height: var(--lh-ui); }
.note.bad { background: var(--bad-bg); color: var(--bad); }

/* Percentage bar */
.meter { display: flex; align-items: center; gap: 12px; }
.meter-track { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter-fill { height: 100%; width: 0; border-radius: inherit; background: var(--gradient-ai-pulse); transition: width .7s var(--ease-out); }
.meter-pct { flex: none; min-width: 4ch; text-align: right; font-family: var(--font-ui); font-size: var(--step--1); font-weight: 600; line-height: var(--lh-ui); color: var(--text-soft); font-variant-numeric: tabular-nums; }

/* Text field + select */
.field { width: 100%; min-height: 48px; padding: 0 18px; border-radius: 24px; border: 1.5px solid var(--line); background: var(--tile-bg); outline: 0; transition: border-color .2s; }
.field:focus { border-color: var(--color-primary-light); }
[data-theme="dark"] .field:focus { border-color: var(--color-accent); }
select.field { padding-right: 12px; }
textarea.field { padding: 12px 18px; border-radius: 18px; min-height: 120px; resize: vertical; line-height: var(--lh-body); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row > .field { flex: 1 1 200px; width: auto; }

/* Orb */
.orb { position: relative; width: var(--orb); height: var(--orb); margin-bottom: 20px; flex: none; }
.orb-core { position: absolute; inset: 14px; border-radius: 50%; background: var(--gradient-ai-pulse); box-shadow: 0 10px 30px -8px rgba(67, 56, 202, .55); display: grid; place-items: center; color: #fff; animation: breathe 4.2s ease-in-out infinite; }
.orb-core svg { width: 26px; height: 26px; opacity: 0; transform: scale(.4); transition: opacity .3s, transform .5s var(--ease-out); }
.orb[data-state="done"] .orb-core svg.i-done, .orb[data-state="error"] .orb-core svg.i-error { opacity: 1; transform: none; }
.orb[data-state="done"] .orb-core { background: var(--color-growth); box-shadow: 0 10px 30px -8px rgba(13, 148, 136, .6); animation: none; }
.orb[data-state="error"] .orb-core { background: var(--color-error); box-shadow: 0 10px 30px -8px rgba(244, 63, 94, .55); animation: none; }
@keyframes breathe { 50% { transform: scale(1.07); } }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); opacity: 0; transition: opacity .3s; }
.ring circle { fill: none; stroke-width: 4; }
.ring .track { stroke: var(--line); }
.ring .bar { stroke: var(--color-primary-light); stroke-linecap: round; stroke-dasharray: 226.2; stroke-dashoffset: 160; }
[data-theme="dark"] .ring .bar { stroke: var(--color-accent); }
.orb[data-state="working"] .ring { opacity: 1; animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(270deg); } }

.stat-row { display: flex; flex-wrap: wrap; gap: 12px; }
.stat { padding: 14px 20px; border-radius: 20px; background: var(--tile-bg); border: 1.5px solid var(--line); min-width: 130px; text-align: left; }
.stat b { display: block; font-family: var(--font-display); font-size: var(--step-3); line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span { font-size: var(--step--1); color: var(--text-soft); line-height: var(--lh-ui); }

@media (max-width: 600px) {
  .actions .btn { flex: 1 1 auto; }
  .exit { padding: 0 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .orb-core, .orb[data-state="working"] .ring { animation: none; }
  .view.enter > * { animation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* Phones: the menu can't share a row with the logo, so it takes its own row under it rather than spilling over. */
@media (max-width: 560px) {
  .top { height: auto; min-height: 68px; flex-wrap: wrap; row-gap: 0; padding-top: 8px; padding-bottom: 4px; }
  .nav { flex: 1 1 100%; justify-content: space-between; }
  .nav .exit { padding: 0 10px; }
}

/* Terms and Privacy links (2026-11-22), at the foot of the home and account pages. */
.legal-foot { display: flex; justify-content: center; gap: 10px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); font-family: var(--font-ui); font-size: var(--step--1); color: var(--text-soft); }
.legal-foot a { color: inherit; text-decoration: none; }
.legal-foot a:hover { color: var(--color-text); text-decoration: underline; text-underline-offset: 3px; }
