/* Stride · IGCSE PE revision, step by step
   Dark-first, sporty and high-contrast: aimed at 15-16 year olds, so it should
   feel like a training app they'd choose, not a kids' edutainment site.
   Colour is never the only signal - every right/wrong state also has text or a
   symbol. */

:root {
  --bg: #0b0f14;
  --surface: #121821;
  --surface-2: #19222e;
  --line: #263243;
  --text: #ecf1f7;
  --muted: #95a3b6;
  --accent: #c8ff3d;          /* "volt" - fills and highlights */
  --accent-ink: #0b0f14;      /* text on accent fills */
  --accent-text: #c8ff3d;     /* accent used as text on --bg */
  --cyan: #3dd6ff;
  --good: #3ddc84;
  --good-bg: rgba(61, 220, 132, .14);
  --bad: #ff6b78;
  --bad-bg: rgba(255, 107, 120, .14);
  --warn: #ffc24b;
  --sel-bg: rgba(61, 214, 255, .16);
  --track: #263243;
  --lap: #c8ff3d;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: dark;
}

/* Light theme: used when the device prefers light (and the student hasn't
   picked a theme), or when they choose light with the header toggle. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f3f5f8;
    --surface: #ffffff;
    --surface-2: #eef1f5;
    --line: #d8dee7;
    --text: #0e1621;
    --muted: #556274;
    --accent: #c8ff3d;
    --accent-ink: #0b0f14;
    --accent-text: #3f6b00;
    --cyan: #006f91;
    --good: #12804a;
    --good-bg: rgba(18, 128, 74, .1);
    --bad: #c42a3a;
    --bad-bg: rgba(196, 42, 58, .08);
    --warn: #8a5a00;
    --sel-bg: rgba(0, 111, 145, .1);
    --track: #dfe4ea;
    --lap: #6ea300;
    --shadow: 0 8px 24px rgba(14, 22, 33, .08);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
    --bg: #f3f5f8;
    --surface: #ffffff;
    --surface-2: #eef1f5;
    --line: #d8dee7;
    --text: #0e1621;
    --muted: #556274;
    --accent: #c8ff3d;
    --accent-ink: #0b0f14;
    --accent-text: #3f6b00;
    --cyan: #006f91;
    --good: #12804a;
    --good-bg: rgba(18, 128, 74, .1);
    --bad: #c42a3a;
    --bad-bg: rgba(196, 42, 58, .08);
    --warn: #8a5a00;
    --sel-bg: rgba(0, 111, 145, .1);
    --track: #dfe4ea;
    --lap: #6ea300;
    --shadow: 0 8px 24px rgba(14, 22, 33, .08);
    color-scheme: light;
  }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); }
h1, h2, h3 { font-family: var(--display); letter-spacing: .01em; line-height: 1.1; margin: 0 0 .4em; }
h1 { font-size: clamp(2rem, 6vw, 3.1rem); font-weight: 800; text-transform: uppercase; }
h2 { font-size: 1.7rem; font-weight: 700; text-transform: uppercase; }
h3 { font-size: 1.3rem; font-weight: 700; }
p { margin: 0 0 1em; }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

/* ---------- frame ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  /* In the installed app the page runs under the phone's status bar, so pad for it. */
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-mark { display: block; width: 38px; height: 38px; flex: 0 0 auto; }
.brand-text { font-family: var(--display); font-weight: 800; font-style: italic; font-size: 1.6rem; letter-spacing: .03em; text-transform: uppercase; line-height: .95; }
.brand-text small { display: block; font-style: normal; font-family: var(--body); font-weight: 600; font-size: .7rem; letter-spacing: .12em; color: var(--muted); }
.topnav { display: flex; gap: 6px; }
.topnav a {
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem;
  padding: 8px 12px; border-radius: 999px;
}
.topnav a:hover { background: var(--surface-2); }
.pill {
  display: inline-block; min-width: 1.5em; padding: 0 .45em; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: .78rem; font-weight: 700; text-align: center;
}

main { max-width: 1040px; margin: 0 auto; padding: 24px 16px 64px; outline: none; }
.loading { color: var(--muted); }
.footer { max-width: 1040px; margin: 0 auto; padding: 24px 16px 48px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }
.footer a { color: var(--muted); }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; }

.eyebrow {
  font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .14em;
  color: var(--accent-text); font-size: .95rem; margin-bottom: .3em;
}
.lede { color: var(--muted); font-size: 1.08rem; max-width: 62ch; }
.muted { color: var(--muted); }
.crumbs { font-size: .9rem; margin-bottom: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-weight: 700; text-decoration: none; cursor: pointer;
  transition: transform .08s ease, background .15s ease;
}
.btn:hover { background: var(--line); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn.small { min-height: 38px; padding: 6px 14px; font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 22px; }
.actions .spacer { flex: 1; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 34px 26px; margin-bottom: 28px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(61, 214, 255, .22), transparent 55%),
    radial-gradient(90% 120% at 0% 100%, rgba(200, 255, 61, .16), transparent 60%),
    var(--surface);
  border: 1px solid var(--line);
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -30px; width: 260px; height: 260px;
  border: 26px solid var(--accent); border-radius: 50%; opacity: .07;
}
.hero h1 span { color: var(--accent-text); }
.loop { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.loop li {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; font-size: .92rem;
}
.loop li b { font-family: var(--display); color: var(--accent-text); font-size: 1.05rem; }

/* ---------- chapter list ---------- */
.section-title { margin: 30px 0 12px; display: flex; align-items: baseline; gap: 12px; }
.section-title h2 { margin: 0; }
.section-title span { color: var(--muted); font-size: .9rem; }
.chapter {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 16px; align-items: center;
  padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); text-decoration: none;
}
a.chapter:hover { border-color: var(--accent); }
.chapter .num {
  font-family: var(--display); font-weight: 800; font-size: 2.4rem; line-height: 1;
  color: var(--accent-text); text-align: center;
}
.chapter h3 { margin: 0 0 2px; }
.chapter p { margin: 0; color: var(--muted); font-size: .9rem; }
.chapter.soon { opacity: .55; }
.chapter.soon .num { color: var(--muted); }
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.tag.live { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tag.done { background: var(--good-bg); color: var(--good); border-color: transparent; }

.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; background: var(--lap); border-radius: inherit; }

/* ---------- lesson list ---------- */
.lesson-row {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center;
  padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  color: var(--text); text-decoration: none;
}
a.lesson-row:hover { border-color: var(--accent); }
.lesson-row .num { font-family: var(--display); font-weight: 800; font-size: 1.6rem; color: var(--accent-text); }
.lesson-row.soon { opacity: .5; }
.lesson-row h3 { margin: 0; font-size: 1.2rem; }
.lesson-row p { margin: 2px 0 0; color: var(--muted); font-size: .88rem; }
.lap { width: 64px; height: 40px; flex: 0 0 auto; }
.lap path { fill: none; }
.lap .lane { stroke: var(--track); stroke-width: 6; }
.lap .run { stroke: var(--lap); stroke-width: 3; stroke-linecap: round; }
.lap .finish { stroke: var(--text); stroke-width: 1.6; }
.lap text { font: 700 9.5px var(--body); fill: var(--text); }
.lap.full .lane { stroke: var(--lap); }
.lap.full .run { stroke: var(--accent-ink); stroke-width: .8; }
.lap.full text { fill: var(--accent-text); font-size: 12px; }

/* ---------- lesson steps ---------- */
.stepper { display: flex; gap: 6px; margin: 0 0 22px; padding: 0; list-style: none; overflow-x: auto; }
.stepper a {
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem;
}
.stepper a[aria-current="step"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.stepper a .tick { color: var(--good); font-weight: 800; }
.stepper a[aria-current="step"] .tick { color: var(--accent-ink); }

.video {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden;
  background: #000; border: 1px solid var(--line);
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.credit { font-size: .82rem; color: var(--muted); margin-top: 8px; }

.notes { margin: 0; padding-left: 1.1em; }
.notes li { margin-bottom: .45em; }
.notes li::marker { color: var(--accent-text); }
.spec { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.spec li { font-size: .82rem; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }

.extras { display: grid; gap: 10px; }
.extra { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.extra b { display: block; }
.extra small { color: var(--muted); }

.check-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-top: 16px;
  border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); cursor: pointer;
}
.check-row input { width: 24px; height: 24px; accent-color: var(--accent); }

/* ---------- games ---------- */
.game-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.game-head .count { font-family: var(--display); font-size: 1.2rem; color: var(--muted); }
.how { color: var(--muted); font-size: .95rem; }

.chip {
  display: inline-flex; align-items: center; min-height: 42px; padding: 8px 14px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  font-weight: 600; cursor: pointer; text-align: left; line-height: 1.3;
}
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"], .chip.selected { background: var(--sel-bg); border-color: var(--cyan); }
.chip.good { background: var(--good-bg); border-color: var(--good); color: var(--text); cursor: default; }
.chip.bad { background: var(--bad-bg); border-color: var(--bad); }
.chip.used { visibility: hidden; }
.bank { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px; border-radius: var(--radius); background: var(--bg); border: 1px dashed var(--line); margin: 14px 0; }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.match .col { display: grid; gap: 8px; align-content: start; }
.match .chip { width: 100%; }
@media (max-width: 560px) { .match .chip { font-size: .88rem; padding: 8px 10px; } }

.shake { animation: shake .35s; }
@keyframes shake { 0%, 100% { transform: none } 25% { transform: translateX(-5px) } 75% { transform: translateX(5px) } }

.slot {
  display: inline-flex; align-items: center; justify-content: center; min-width: 120px; min-height: 36px;
  padding: 2px 12px; margin: 2px 2px; border-radius: 8px; vertical-align: middle;
  border: 2px dashed var(--muted); background: transparent; color: var(--text); font-weight: 700; cursor: pointer;
}
.slot.filled { border-style: solid; border-color: var(--line); background: var(--surface-2); }
.slot.selected { border-color: var(--cyan); background: var(--sel-bg); }
.slot.good { border: 2px solid var(--good); background: var(--good-bg); cursor: default; }
.slot.bad { border: 2px solid var(--bad); background: var(--bad-bg); }
.fill-text { font-size: 1.08rem; line-height: 2.3; }
.fill-text p { margin: 0 0 .6em; }

.label-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 720px) { .label-wrap { grid-template-columns: 1fr; } }
/* Diagrams sit on white "paper" in both themes, like an exam diagram, so the
   skeleton artwork (which has its own white ground) never shows a seam. */
.diagram { width: 100%; height: auto; max-height: 78vh; display: block; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.diagram .marker circle { fill: var(--accent); stroke: #0b0f14; stroke-width: 1.2; }
.diagram .marker text { font: 800 9px var(--body); fill: #0b0f14; text-anchor: middle; dominant-baseline: central; }
.diagram .marker.active circle { fill: var(--cyan); }
.diagram .leader { stroke: #0b0f14; stroke-width: .9; }
.label-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.label-list li { display: flex; align-items: center; gap: 10px; }
.label-list .n {
  flex: 0 0 30px; height: 30px; display: grid; place-items: center; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: .85rem;
}
.label-list .slot { flex: 1; justify-content: flex-start; }

.buckets { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 10px; }
.bucket {
  min-height: 140px; padding: 12px; border-radius: var(--radius); border: 2px dashed var(--line); background: var(--bg);
  display: flex; flex-direction: column; gap: 8px; cursor: pointer; text-align: left; color: var(--text);
}
.bucket:hover, .bucket.ready { border-color: var(--cyan); }
.bucket h4 { margin: 0 0 4px; font-family: var(--display); text-transform: uppercase; font-size: 1.1rem; }
.bucket .items { display: flex; flex-wrap: wrap; gap: 6px; }

.quiz-q { font-size: 1.15rem; font-weight: 600; margin: 12px 0; }
.options { display: grid; gap: 8px; }
.options .chip { width: 100%; min-height: 52px; }
.feedback { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); font-weight: 500; }
.feedback.good { background: var(--good-bg); border-left: 4px solid var(--good); }
.feedback.bad { background: var(--bad-bg); border-left: 4px solid var(--bad); }

.result {
  display: flex; align-items: center; gap: 16px; margin-top: 18px; padding: 16px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--line);
}
.result .big { font-family: var(--display); font-weight: 800; font-size: 2.6rem; line-height: 1; color: var(--accent-text); }

.game-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.game-tabs a {
  padding: 8px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem;
}
.game-tabs a[aria-current="page"] { color: var(--text); border-color: var(--cyan); background: var(--sel-bg); }
.game-tabs .tick { color: var(--good); }

/* ---------- exam ---------- */
.qhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.qnum { font-family: var(--display); font-weight: 800; font-size: 1.1rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.marks { font-family: var(--display); font-weight: 800; font-size: 1.2rem; color: var(--accent-text); }
.stem { font-size: 1.12rem; }
.stem .context { color: var(--muted); }
.paper {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  border-top: 4px solid var(--accent);
}
textarea, input[type="text"] {
  width: 100%; padding: 14px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; line-height: 1.6;
}
textarea { min-height: 150px; resize: vertical; }
textarea:focus, input[type="text"]:focus { border-color: var(--cyan); outline: none; }
.fields { display: grid; gap: 10px; }
.field { display: grid; grid-template-columns: minmax(90px, 160px) 1fr; gap: 10px; align-items: center; }
.field label { font-weight: 700; }
.hint { font-size: .85rem; color: var(--muted); margin-top: 8px; }
.q-diagram { max-width: 300px; margin: 6px auto 16px; }

.ms-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
@media (max-width: 820px) { .ms-layout { grid-template-columns: 1fr; } }
.your-answer { white-space: pre-wrap; background: var(--bg); border-radius: var(--radius-sm); padding: 14px; border: 1px solid var(--line); }
.ms { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; border-top: 4px solid var(--cyan); }
.ms .instruction { font-weight: 600; }
.ms-points { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 8px; }
.ms-points label {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line); cursor: pointer;
}
.ms-points input { flex: 0 0 auto; width: 22px; height: 22px; margin-top: 1px; accent-color: var(--accent); }
.ms-points label:has(input:checked) { border-color: var(--good); background: var(--good-bg); }
.ms-points .pt-head { font-weight: 700; display: block; }
.ms-group { margin-top: 14px; font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.accept { font-size: .9rem; color: var(--muted); font-style: italic; }
.scorebar { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--bg); margin: 14px 0; }
.scorebar .big { font-family: var(--display); font-weight: 800; font-size: 2.2rem; line-height: 1; color: var(--accent-text); }
.tip { padding: 14px 16px; border-radius: var(--radius-sm); background: rgba(255, 194, 75, .1); border-left: 4px solid var(--warn); margin: 14px 0; }
.tip b { color: var(--warn); }
.capped { color: var(--warn); font-size: .88rem; font-weight: 600; }

.qnav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.qnav a {
  display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 8px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-weight: 700;
}
.qnav a[aria-current="page"] { border-color: var(--accent); color: var(--text); }
.qnav a.full { background: var(--good-bg); color: var(--good); border-color: transparent; }
.qnav a.part { background: rgba(255, 194, 75, .12); color: var(--warn); border-color: transparent; }

/* ---------- done / PB chase ---------- */
.split-done {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 4px;
  border-radius: var(--radius); background: var(--good-bg); border: 1px solid var(--good);
}
.split-done .lap { width: 80px; height: 50px; }
.split-done b { font-family: var(--display); font-size: 1.4rem; text-transform: uppercase; }
.stat-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.stat { flex: 1 1 140px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.stat .big { font-family: var(--display); font-weight: 800; font-size: 2.3rem; line-height: 1; color: var(--accent-text); }
.stat small { color: var(--muted); }
.revisit-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.revisit-item p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.reflection { font-style: italic; color: var(--text); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

@media (max-width: 560px) {
  main { padding-top: 16px; }
  .card, .paper, .ms { padding: 16px; }
  .chapter { grid-template-columns: 44px 1fr; }
  .chapter .num { font-size: 1.9rem; }
  .chapter .tag, .chapter .lap { grid-column: 2; justify-self: start; }
  .brand-text small { display: none; }
  .brand-text { font-size: 1.35rem; white-space: nowrap; }
  .brand-mark { width: 34px; height: 34px; }
  .topnav { gap: 0; }
  .topnav a { padding: 8px 9px; white-space: nowrap; }
  .stepper { flex-wrap: wrap; overflow: visible; }
  .stepper a { padding: 7px 12px; font-size: .85rem; }
  .field { grid-template-columns: 1fr; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- video title cards ---------- */
.poster {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  width: 100%; aspect-ratio: 16 / 9; padding: 4.5% 5%; /* % of width: cqw would refer to the parent here */ overflow: hidden; container-type: inline-size;
  border: 1px solid #263243; border-radius: var(--radius); cursor: pointer; text-align: left; color: #ecf1f7;
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(61, 214, 255, .28), transparent 60%),
    radial-gradient(70% 90% at 0% 100%, rgba(200, 255, 61, .18), transparent 65%),
    #0b0f14;
}
.poster > * { position: relative; }
.poster-stripes {
  position: absolute !important; inset: -10% -20% -10% 45%;
  background: repeating-linear-gradient(115deg, rgba(200, 255, 61, .9) 0 1.2cqw, transparent 1.2cqw 4.2cqw);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 55%); mask-image: linear-gradient(90deg, transparent, #000 55%);
  opacity: .22; transition: opacity .25s ease, transform .4s ease;
}
.poster-big {
  position: absolute !important; right: 4cqw; bottom: -6cqw;
  font: italic 800 34cqw/1 var(--display); letter-spacing: -.02em;
  color: transparent; -webkit-text-stroke: .35cqw rgba(200, 255, 61, .55);
}
.poster-brand { display: flex; align-items: center; gap: 1.6cqw; font: italic 800 max(13px, 3.6cqw)/1 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.poster-mark { width: max(20px, 5.4cqw); height: max(20px, 5.4cqw); }
.poster-text { display: flex; flex-direction: column; gap: 1.2cqw; max-width: 72%; }
.poster-eyebrow { font: 700 max(11px, 2.6cqw)/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: #c8ff3d; }
.poster-title { font: 800 max(20px, 7.2cqw)/0.98 var(--display); text-transform: uppercase; text-wrap: balance; }
.poster-foot { display: flex; align-items: center; gap: 3cqw; }
.poster-play {
  display: inline-flex; align-items: center; gap: 1.4cqw; padding: 1.8cqw 3.6cqw; border-radius: 999px;
  background: #c8ff3d; color: #0b0f14; font: 800 max(12px, 2.8cqw)/1 var(--body); text-transform: uppercase; letter-spacing: .06em;
  box-shadow: 0 0 0 0 rgba(200, 255, 61, .5); transition: box-shadow .25s ease, transform .15s ease;
}
.poster-credit { font: 600 max(10px, 2.1cqw)/1.2 var(--body); color: #95a3b6; }
.poster:hover .poster-stripes, .poster:focus-visible .poster-stripes { opacity: .38; transform: translateX(-2%); }
.poster:hover .poster-play, .poster:focus-visible .poster-play { box-shadow: 0 0 0 1.4cqw rgba(200, 255, 61, .18); transform: scale(1.03); }

/* ---------- training ---------- */
.boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 6px; list-style: none; padding: 0; margin: 4px 0 0; }
.boxes li { display: grid; gap: 2px; text-align: center; padding: 8px 4px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.boxes b { font-family: var(--display); font-size: 1.5rem; line-height: 1; }
.boxes small { font-size: .7rem; color: var(--muted); line-height: 1.2; }
.boxes li.locked { background: var(--good-bg); border-color: var(--good); }
.boxes li.locked b { color: var(--good); }

.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.board-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 14px; align-items: center;
  padding: 12px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  border-left: 5px solid var(--line);
}
.board-row.ready { border-left-color: var(--good); }
.board-row.training { border-left-color: var(--warn); }
.board-row.work { border-left-color: var(--bad); }
.board-row .pos { font: italic 800 1.9rem/1 var(--display); color: var(--muted); text-align: center; }
.board-row:first-child .pos { color: var(--accent-text); }
.board-name { display: grid; gap: 2px; min-width: 0; }
.board-name .meter { margin-top: 6px; }
.board-row.training .meter > i { background: var(--warn); }
.board-row.work .meter > i { background: var(--bad); }
.board-score { display: grid; justify-items: end; gap: 4px; }
.band-ready { background: var(--good-bg); color: var(--good); border-color: transparent; }
.band-training { background: rgba(255, 194, 75, .14); color: var(--warn); border-color: transparent; }
.band-work { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
@media (max-width: 560px) {
  .board-row { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; }
  .board-row > .btn { grid-column: 2 / -1; justify-self: start; }
}

.rep-progress { display: grid; gap: 6px; margin-bottom: 14px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.flashcard {
  position: relative; padding: 26px 24px; border-radius: 18px; background: var(--surface);
  border: 1px solid var(--line); border-top: 4px solid var(--accent); box-shadow: var(--shadow); min-height: 260px;
}
.flashcard.missed { border-top-color: var(--warn); }
.flashcard .card-front { font: 700 clamp(1.3rem, 4vw, 1.8rem)/1.25 var(--body); margin: 8px 0 10px; }
.flashcard .back { margin-top: 18px; padding-top: 18px; border-top: 2px dashed var(--line); animation: reveal .25s ease; }
.flashcard .back-label { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-text); margin-bottom: 6px; }
.flashcard .back-one { font-size: 1.25rem; font-weight: 700; }
.card-note { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .95rem; }
.flashcard .not-yet { border-color: var(--bad); }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- account ---------- */
.topbar { flex-wrap: nowrap; }
.topnav { margin-left: auto; }
.account { display: flex; align-items: center; }
.account-wrap { position: relative; }
.avatar {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  background: var(--surface-2); color: var(--text); border: 2px solid var(--lap); font: 700 .85rem var(--body);
}
.avatar.sync-saving { border-style: dashed; }
.avatar.sync-offline { border-color: var(--warn); }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: min(280px, 86vw);
  display: grid; gap: 10px; padding: 14px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.account-menu p { margin: 0; }
.account-menu a, .account-menu .linkish { color: var(--text); font-weight: 600; text-align: left; }
.account-name small { word-break: break-all; }
.sync { font-size: .85rem; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); }
.sync-saved { color: var(--good); background: var(--good-bg); }
.sync-offline { color: var(--warn); }

.card.narrow { max-width: 560px; margin: 10px auto; }
.signin h1 { margin-bottom: .3em; }
.signin-buttons { display: grid; gap: 10px; margin: 18px 0; }
.signin-btn { justify-content: flex-start; gap: 12px; background: #fff; color: #1f1f1f; border: 1px solid #dadce0; min-height: 52px; font-weight: 600; }
.signin-btn:hover { background: #f6f8fa; }
.dev-signin { margin: 16px 0; padding: 14px; border-radius: var(--radius-sm); border: 1px dashed var(--warn); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }

.dialog {
  max-width: min(460px, 92vw); padding: 22px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(5, 8, 12, .6); }
@media (max-width: 560px) {
  .account .btn.small { padding: 6px 12px; }
}

/* ---------- theme toggle ---------- */
.theme-toggle {
  display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle svg { width: 18px; height: 18px; }
.topbar-end { display: flex; align-items: center; gap: 8px; }
@media (max-width: 420px) {
  .topbar { gap: 8px; }
  .topnav a { padding: 8px 5px; font-size: .92rem; }
  .topbar-end { gap: 6px; }
  .avatar, .theme-toggle { width: 34px; height: 34px; }
}

/* ---------- install the app ---------- */
.install-card { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.install-card img { border-radius: 14px; flex: 0 0 auto; }
.install-card div { flex: 1; min-width: 0; }
.install-card p { margin: 2px 0 0; font-size: .92rem; }
.share-icon { width: 1.1em; height: 1.1em; vertical-align: -0.2em; }
