/* =============================================================
   DL Academy (academy.dlproject.io) — tokens copied from dlproject.io 00-tokens.css
   plus the semantic traffic-light triple from SPEC §6.
   ============================================================= */

:root {
  --c-bg:             #080808;
  --c-surface:        #111111;
  --c-surface-2:      #171717;
  --c-surface-3:      #1e1e1e;
  --c-text-primary:   #f0f0f0;
  --c-text-secondary: #999999;
  --c-text-tertiary:  #808080;
  --c-text-dim:       #4a4a4a;
  --c-accent:         #c9a070;
  --c-accent-subtle:  rgba(201, 160, 112, 0.12);
  --c-border:         rgba(255, 255, 255, 0.07);
  --c-border-hover:   rgba(255, 255, 255, 0.14);

  /* semantic triple — the only new colours in the system */
  --c-green:  #3fb950;
  --c-yellow: #d29922;
  --c-red:    #f85149;
  --c-grey:   var(--c-text-dim);
  /* CTA green (SPEC §10 landing) — dark ink on it, ~9.6:1 */
  --c-cta:     #00e38c;
  --c-cta-ink: #05241a;

  --font-heading: Georgia, 'Times New Roman', serif;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'Courier New', Courier, monospace;

  --text-2xs:  clamp(0.625rem, 0.58rem + 0.22vw, 0.75rem);
  --text-xs:   clamp(0.75rem, 0.70rem + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.82rem + 0.28vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1.05rem + 0.38vw, 1.25rem);
  --text-xl:   clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --text-2xl:  clamp(1.5rem, 1.3rem + 1vw, 2rem);
  --text-3xl:  clamp(2rem, 1.6rem + 2vw, 3rem);
  --text-hero: clamp(2.25rem, 1.6rem + 3.4vw, 4.5rem);

  --lh-tight: 1.1;
  --lh-base: 1.5;
  --lh-relaxed: 1.7;
  --ls-wide: 0.05em;
  --ls-widest: 0.2em;

  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.25rem; --sp-6: 1.5rem; --sp-8: 2rem; --sp-10: 2.5rem;
  --sp-12: 3rem; --sp-16: 4rem;

  --radius-sm: 2px; --radius-md: 4px; --radius-lg: 8px; --radius-xl: 16px;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 150ms; --dur-base: 250ms;
  --container-max: 1180px;
  --container-pad: clamp(1rem, 4vw, 2.5rem);
}

/* Light theme — same token names, values derived from the dark set
   (dlproject.io tokens file ships dark only; see RAPORT deviations). */
@media (prefers-color-scheme: light) {
  :root {
    --c-bg:             #faf9f7;
    --c-surface:        #ffffff;
    --c-surface-2:      #f2f0ed;
    --c-surface-3:      #e8e5e0;
    --c-text-primary:   #141414;
    --c-text-secondary: #55524d;
    --c-text-tertiary:  #6b6862;
    --c-text-dim:       #b3aea6;
    --c-accent:         #8a6636;
    --c-accent-subtle:  rgba(138, 102, 54, 0.10);
    --c-border:         rgba(0, 0, 0, 0.10);
    --c-border-hover:   rgba(0, 0, 0, 0.20);
    --c-green:  #1a7f37;
    --c-yellow: #9a6700;
    --c-red:    #cf222e;
    --c-cta:     #00b871;
    --c-cta-ink: #04241a;
  }
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  color: var(--c-text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--lh-base);
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--font-heading); font-weight: 400; line-height: var(--lh-tight); margin: 0 0 var(--sp-4); }
h1 { font-size: var(--text-hero); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-lg); }
p { margin: 0 0 var(--sp-4); }
a { color: var(--c-accent); }

.wrap { max-width: var(--container-max); margin: 0 auto; padding: 0 var(--container-pad); }
[hidden] { display: none !important; }
.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;
}

/* --- buttons ------------------------------------------------------------ */
button, select, input, textarea {
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--c-text-primary);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  background: var(--c-surface-2); color: var(--c-text-primary);
  border: 1px solid var(--c-border); border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-5); cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out-expo),
              background var(--dur-fast) var(--ease-out-expo);
}
.btn:hover { border-color: var(--c-border-hover); background: var(--c-surface-3); }
.btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.btn-primary { background: var(--c-accent); color: #0b0b0b; border-color: var(--c-accent); font-weight: 600; }
.btn-primary:hover { background: var(--c-accent); filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-sm { padding: var(--sp-2) var(--sp-3); font-size: var(--text-xs); }
.btn[aria-pressed="true"] { border-color: var(--c-accent); background: var(--c-accent-subtle); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

input[type="text"], input[type="password"], select, textarea {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-md); padding: var(--sp-3); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--c-accent); outline-offset: 1px; }
textarea { min-height: 8rem; resize: vertical; line-height: var(--lh-base); }

/* --- landing ------------------------------------------------------------ */
.landing { padding: 0 0 var(--sp-16); }
.wrap.landing { padding: var(--sp-10) var(--container-pad) var(--sp-16); }  /* exam screen */
.landing-shell {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--sp-6) var(--container-pad) 0;
  display: grid;
  gap: var(--sp-10);
  grid-template-columns: minmax(0, 1fr);
}
.landing-main { min-width: 0; }

/* mobile / tablet-portrait bar: DL top-left, hamburger top-right */
.landing-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--sp-3);
  padding: var(--sp-4) var(--container-pad);
  border-bottom: 1px solid var(--c-border);
}
.landing-mark {
  font-family: var(--font-heading); font-size: var(--text-xl);
  letter-spacing: var(--ls-wide);
}
.nav-toggle {
  background: transparent; border: 1px solid var(--c-border);
  border-radius: var(--radius-md); padding: var(--sp-3) var(--sp-4); cursor: pointer;
}
.nav-toggle:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 18px; height: 2px; background: var(--c-text-primary); content: '';
}
.nav-toggle-bars::before { transform: translateY(-6px); }
.nav-toggle-bars::after { transform: translateY(4px); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: var(--c-accent); }

/* language pills (SPEC §11) — 7 text codes, top right of the landing, the
   current one highlighted. No flags: a flag is a country, not a language. */
.lang-pills {
  display: flex; flex-wrap: wrap; gap: var(--sp-1);
  margin-left: auto; margin-right: var(--sp-3);
  /* The pills are drawn by JS. Reserving their row here keeps the landing from
     jumping down when they appear (Lighthouse CLS). */
  min-height: 2.125rem; align-items: center;
}
.lang-pill {
  font: inherit; font-size: var(--text-2xs); line-height: 1;
  text-transform: uppercase; letter-spacing: var(--ls-wide);
  padding: var(--sp-2) var(--sp-3);
  background: transparent; color: var(--c-text-secondary);
  border: 1px solid var(--c-border); border-radius: var(--radius-md);
  cursor: pointer;
}
.lang-pill:hover { color: var(--c-text-primary); border-color: var(--c-border-hover); }
.lang-pill:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.lang-pill[aria-current="true"] {
  background: var(--c-accent); border-color: var(--c-accent);
  color: #0b0b0b; font-weight: 700;
}

/* hero */
/* v1.21: a school's logo in the kicker. Formula MB's is dark blue on
   transparent, invisible on our black - so it sits on a white card. */
.school-logo {
  display: inline-block; height: 44px; width: auto; max-width: 100%;
  background: #fff; padding: 6px 10px; border-radius: 8px; vertical-align: middle;
}
.hero-kicker {
  font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: var(--ls-widest);
  color: var(--c-text-tertiary); margin: 0 0 var(--sp-3);
}
.hero-title { font-family: var(--font-heading); font-size: var(--text-hero); margin: 0 0 var(--sp-5); }
.hero-line { display: block; }
.hero-line + .hero-line { color: var(--c-accent); }
.hero-frame { position: relative; margin-top: var(--sp-8); }
.hero-media {
  display: block;
  width: 100%;
  object-fit: cover;
  height: clamp(200px, 38vh, 400px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
  background:
    radial-gradient(120% 90% at 50% 110%, rgba(201, 160, 112, 0.30) 0%, rgba(201, 160, 112, 0.05) 45%, transparent 72%),
    linear-gradient(180deg, #0b0b0b 0%, #141210 60%, #1a1512 100%);
}
.hero-cta { margin-top: var(--sp-4); }
.hero-cta-note {
  font-size: var(--text-xs); color: var(--c-text-secondary); margin: var(--sp-2) 0 0;
}
.btn-cta {
  background: var(--c-cta); color: var(--c-cta-ink); border-color: var(--c-cta);
  font-weight: 700; font-size: var(--text-base); padding: var(--sp-4) var(--sp-8);
  letter-spacing: var(--ls-wide);
}
.btn-cta:hover { background: var(--c-cta); border-color: var(--c-cta); filter: brightness(1.08); }
.btn-cta:focus-visible { outline: 2px solid var(--c-cta); outline-offset: 3px; }

.lede { font-size: var(--text-lg); color: var(--c-text-secondary); max-width: 60ch; }
.gate {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-lg); padding: var(--sp-6);
  margin: var(--sp-8) 0; max-width: 34rem;
}
.gate label { display: block; font-size: var(--text-xs); letter-spacing: var(--ls-wide);
  text-transform: uppercase; color: var(--c-text-tertiary); margin-bottom: var(--sp-2); }
.gate-row { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.gate-row > * { flex: 1 1 12rem; }
.error { color: var(--c-red); font-size: var(--text-sm); min-height: 1.4em; }
.blocks { display: grid; gap: var(--sp-6); grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); margin-top: var(--sp-10); }
.block { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: var(--sp-5); }
.block h3 { color: var(--c-accent); font-size: var(--text-base); }
.block p { color: var(--c-text-secondary); font-size: var(--text-sm); margin: 0; }

/* --- left rail: groups as accordions (api/courses.json → group) ---------- */
.course-nav { display: none; }               /* desktop rail turned on at 1024px */
.course-nav.is-open {
  display: block; position: fixed; inset: 0; z-index: 80;
  background: var(--c-bg); overflow-y: auto;
  padding: var(--sp-6) var(--container-pad) var(--sp-16);
}
body.nav-open { overflow: hidden; }
.section-title { font-size: var(--text-xl); margin-bottom: var(--sp-4); }
.nav-group { border-top: 1px solid var(--c-border); }
.nav-group:last-child { border-bottom: 1px solid var(--c-border); }
.nav-group-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  width: 100%; background: transparent; border: 0; cursor: pointer;
  padding: var(--sp-4) 0; text-align: left;
  font-family: var(--font-heading); font-size: var(--text-base); color: var(--c-text-primary);
}
.nav-group-head:hover { color: var(--c-accent); }
.nav-group-head:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.nav-sign { color: var(--c-accent); font-family: var(--font-mono); font-size: var(--text-lg); }
.nav-list { list-style: none; margin: 0 0 var(--sp-4); padding: 0; }
.nav-item { border-left: 2px solid var(--c-border); }
.nav-link {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3);
  width: 100%; background: transparent; border: 0; text-align: left; cursor: pointer;
  padding: var(--sp-2) var(--sp-3); font-size: var(--text-sm); color: var(--c-text-secondary);
}
.nav-link:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.nav-foot {
  font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: var(--ls-wide);
  color: var(--c-text-tertiary); white-space: nowrap;
}
.nav-item.is-live { border-left-color: var(--c-cta); }
.nav-item.is-live .nav-link { color: var(--c-text-primary); }
.nav-item.is-live .nav-foot { color: var(--c-cta); }
.nav-item.is-live .nav-link:hover { background: var(--c-surface-2); }
.nav-item.is-soon .nav-link { color: var(--c-text-tertiary); }
.nav-item.is-soon .nav-link:hover { color: var(--c-text-secondary); }
.course-notify { display: inline-block; font-size: var(--text-xs); margin: 0 0 var(--sp-2) var(--sp-3); }

@media (min-width: 1024px) {
  /* the bar stays for the language pills; only the hamburger goes */
  .landing-bar { border-bottom: none; padding-bottom: 0; }
  .landing-bar .landing-mark { display: none; }
  .nav-toggle { display: none; }
  .landing-shell {
    grid-template-columns: 260px minmax(0, 1fr);
    padding-top: var(--sp-10);
    align-items: start;
  }
  .course-nav { display: block; position: sticky; top: var(--sp-6); }
  .hero-cta { position: absolute; left: var(--sp-6); bottom: var(--sp-6); margin-top: 0; }
  .hero-media { height: clamp(260px, 42vh, 440px); }
}

/* --- top bar ------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--c-bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--c-border);
  padding: var(--sp-3) 0;
}
.topbar-inner { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.brand { font-family: var(--font-heading); font-size: var(--text-base); margin-right: auto; }
.brand span { color: var(--c-accent); }
/* brand doubles as the way home — house icon + wordmark, one link */
.brand-home {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  color: var(--c-text-primary); text-decoration: none;
  font-family: var(--font-heading); font-size: var(--text-base);
  border-radius: 6px;
}
.brand-home:hover { color: var(--c-accent); }
.brand-home:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 3px; }
.icon-home { width: 18px; height: 18px; flex: none; color: currentColor; }
.toolbar { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; padding: var(--sp-4) 0; }
.check {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--text-xs); color: var(--c-text-secondary); cursor: pointer;
}
.check input { width: auto; margin: 0; accent-color: var(--c-accent); }
.ready-line { font-size: var(--text-xs); color: var(--c-text-secondary); margin: 0 0 var(--sp-3); }
.toolbar select { width: auto; min-width: 9rem; }
.counters { display: flex; gap: var(--sp-3); margin-left: auto; font-size: var(--text-xs); flex-wrap: wrap; }
.count { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--c-text-secondary); }
.dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--c-green); }
.dot.yellow { background: var(--c-yellow); }
.dot.red { background: var(--c-red); }
.dot.grey { background: var(--c-grey); }

/* --- question list ------------------------------------------------------ */
.list { display: flex; flex-direction: column; gap: var(--sp-2); padding-bottom: var(--sp-16); }
.list-head, .row { grid-template-columns: 3.2rem minmax(0, 1fr) 5.5rem 5.5rem 8rem; }
.list-head {
  display: grid; gap: var(--sp-3); align-items: center;
  padding: 0 var(--sp-4) var(--sp-2); border-left: 4px solid transparent;
  color: var(--c-text-tertiary); font-size: var(--text-2xs);
  text-transform: uppercase; letter-spacing: var(--ls-wide);
}
.row {
  display: grid;
  gap: var(--sp-3); align-items: center; width: 100%; text-align: left;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-grey);
  border-radius: var(--radius-md); padding: var(--sp-3) var(--sp-4);
  cursor: pointer; color: inherit; font-size: var(--text-sm);
  transition: border-color var(--dur-fast) var(--ease-out-expo);
}
.row:hover { border-color: var(--c-border-hover); }
.row.green { border-left-color: var(--c-green); }
.row.yellow { border-left-color: var(--c-yellow); }
.row.red { border-left-color: var(--c-red); }
.row.grey { border-left-color: var(--c-grey); }
.row-idx { color: var(--c-text-tertiary); font-family: var(--font-mono); font-size: var(--text-xs); }
.row-topic { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.row-text { min-width: 0; overflow-wrap: anywhere; }
.row-result { font-size: var(--text-base); text-align: center; }
.row-tries { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--c-text-secondary); text-align: center; }
.row-status { font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: var(--ls-wide); color: var(--c-text-tertiary); }
.row-status.green { color: var(--c-green); }
.row-status.yellow { color: var(--c-yellow); }
.row-status.red { color: var(--c-red); }
.btn-weak { border-color: var(--c-yellow); color: var(--c-yellow); }
.row-meta { color: var(--c-text-tertiary); font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: var(--ls-wide); }
.badge {
  display: inline-block; font-size: var(--text-2xs); letter-spacing: var(--ls-wide);
  text-transform: uppercase; padding: 0 var(--sp-2); border-radius: var(--radius-sm);
  border: 1px solid var(--c-border-hover); color: var(--c-text-tertiary); margin-left: var(--sp-2);
}
.badge.warn { color: var(--c-yellow); border-color: var(--c-yellow); }
.empty { color: var(--c-text-secondary); padding: var(--sp-8) 0; }

/* --- question screen ---------------------------------------------------- */
.qgrid { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: var(--sp-6); padding: var(--sp-6) 0 var(--sp-16); align-items: start; }
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: var(--sp-5); }
/* v1.11 item A: the case study is a <details> block now — long enough (≈1.300
   characters) that it has to be foldable, and important enough that it opens
   the first time. `white-space: pre-wrap` keeps the catalogue's own line breaks
   between the transport data bullets; `overflow-wrap: anywhere` is what stops a
   long route or a document number from pushing the phone screen sideways. */
.scenario { background: var(--c-surface-2); border-left: 3px solid var(--c-accent); font-size: var(--text-sm); color: var(--c-text-secondary); margin-bottom: var(--sp-4); max-width: 100%; overflow-x: hidden; }
.scenario > summary { cursor: pointer; font-weight: 600; color: var(--c-text); list-style-position: inside; }
.scenario > summary:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.scenario-body { margin-top: var(--sp-3); line-height: var(--lh-relaxed); white-space: pre-wrap; overflow-wrap: anywhere; }
.qtext { font-size: var(--text-lg); line-height: var(--lh-relaxed); margin-bottom: var(--sp-5); overflow-wrap: anywhere; }
.choices { display: flex; flex-direction: column; gap: var(--sp-3); }
.choice { text-align: left; justify-content: flex-start; padding: var(--sp-4); line-height: var(--lh-base); }
.choice.is-correct { border-color: var(--c-green); background: color-mix(in srgb, var(--c-green) 14%, transparent); }
.choice.is-wrong { border-color: var(--c-red); background: color-mix(in srgb, var(--c-red) 14%, transparent); }
.result { margin-top: var(--sp-5); border-top: 1px solid var(--c-border); padding-top: var(--sp-4); }
.verdict { font-family: var(--font-heading); font-size: var(--text-xl); margin-bottom: var(--sp-3); }
.verdict.ok { color: var(--c-green); }
.verdict.no { color: var(--c-red); }
.kv { font-size: var(--text-sm); color: var(--c-text-secondary); margin-bottom: var(--sp-3); }
.kv strong { color: var(--c-text-primary); font-weight: 600; }
.pill-list { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-2) 0 var(--sp-4); }
.pill { font-size: var(--text-xs); padding: var(--sp-1) var(--sp-3); border-radius: var(--radius-full, 9999px); border: 1px solid var(--c-border-hover); }
.pill.hit { color: var(--c-green); border-color: var(--c-green); }
.pill.miss { color: var(--c-red); border-color: var(--c-red); }
.qnav { display: flex; gap: var(--sp-3); margin-top: var(--sp-5); flex-wrap: wrap; }

/* --- tutor -------------------------------------------------------------- */
.tutor { position: sticky; top: 4.5rem; display: flex; flex-direction: column; gap: var(--sp-3); }
.tutor h3 { margin-bottom: 0; }
.tutor-presets { display: flex; flex-direction: column; gap: var(--sp-2); }
.tutor-log { min-height: 4rem; max-height: 22rem; overflow-y: auto; font-size: var(--text-sm); color: var(--c-text-secondary); white-space: pre-wrap; overflow-wrap: anywhere; }
.tutor-log .turn-user { color: var(--c-accent); }
.tutor-log .turn { margin-bottom: var(--sp-3); }
.tutor-form { display: flex; gap: var(--sp-2); }
.tutor-form input { flex: 1; }

/* --- voice in the course chat (v1.12): 44 px on a phone, no fixed widths. */
.turn-speak { display: inline-block; margin-top: var(--sp-2); padding: 0.25rem 0.6rem; border: 1px solid var(--c-border); border-radius: 999px; background: transparent; color: var(--c-text-secondary); font-size: var(--text-sm); cursor: pointer; max-width: 100%; overflow-wrap: anywhere; }
.turn-speak:hover, .turn-speak:focus-visible { color: var(--c-accent); border-color: var(--c-accent); }
.btn-mic { flex: 0 0 auto; min-width: 3rem; font-size: 1.1rem; line-height: 1; }
.btn-mic[data-listening="true"] { border-color: var(--c-accent); color: var(--c-accent); }
.btn-lessons-back { display: block; width: 100%; margin-bottom: var(--sp-3); font-size: var(--text-lg); text-align: center; overflow-wrap: anywhere; }
.sheet-toggle { display: none; }

/* --- exam result -------------------------------------------------------- */
.score { font-family: var(--font-heading); font-size: var(--text-3xl); color: var(--c-accent); }

/* --- responsive --------------------------------------------------------- */
@media (max-width: 900px) {
  .qgrid { grid-template-columns: minmax(0, 1fr); }
  .tutor {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    max-height: 72vh; overflow-y: auto; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border-top: 1px solid var(--c-border-hover);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.55);
  }
  .tutor[data-open="false"] { display: none; }
  .sheet-toggle { display: inline-flex; }
}

@media (max-width: 720px) {
  /* the pills get their own full-width row instead of squeezing between the
     brand and the hamburger */
  .lang-pills { order: 3; width: 100%; margin: 0; justify-content: flex-start; }
  .list-head { display: none; }
  /* Row becomes a card; the coloured left edge stays, no horizontal scroll. */
  .row { grid-template-columns: 2.5rem minmax(0, 1fr) 2rem; gap: var(--sp-1) var(--sp-2); }
  .row-idx { grid-row: 1; }
  .row-topic { grid-row: 1; }
  .row-result { grid-row: 1; }
  .row-tries { grid-column: 1; text-align: left; }
  .row-status { grid-column: 2 / span 2; }
  .row-idx, .row-meta { font-size: var(--text-2xs); }
  .counters { width: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}


/* =============================================================
   v1.1 — mobile first (MUST 1), footer, tutor-only course screen
   ============================================================= */

/* --- footer on every screen --------------------------------------------- */
.site-foot {
  border-top: 1px solid var(--c-border);
  padding: var(--sp-6) var(--container-pad) calc(var(--sp-8) + env(safe-area-inset-bottom));
  max-width: var(--container-max); margin: var(--sp-10) auto 0;
  display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-6);
  align-items: baseline; justify-content: space-between;
}
.foot-nav { display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.foot-nav a, .foot-legal a { color: var(--c-text-secondary); text-decoration: none; }
.foot-nav a:hover, .foot-legal a:hover { color: var(--c-accent); }
.foot-nav a:focus-visible, .foot-legal a:focus-visible {
  outline: 2px solid var(--c-accent); outline-offset: 3px;
}
.foot-legal { font-size: var(--text-xs); color: var(--c-text-tertiary); margin: 0; }

/* --- tutor-only course screen (MUST 4) ---------------------------------- */
.tutor-presets-row { flex-direction: row; flex-wrap: wrap; }
.tutor-log-wide { max-height: none; min-height: 12rem; color: var(--c-text-primary); }
#course-topics .row { grid-template-columns: minmax(0, 1fr) auto; cursor: default; }
#course-topics .list { padding-bottom: 0; }

/* =============================================================
   MOBILE (MUST 1). The breakpoint is the phone; everything above it keeps
   the layout the desktop already had.
   ============================================================= */
@media (max-width: 720px) {
  :root {
    /* "base font >= 17px on mobile": the clamp floor is raised, so every step
       built on it (--text-sm, --text-lg, the buttons) moves with it. */
    --text-base: clamp(1.0625rem, 1rem + 0.5vw, 1.1875rem);
    --text-sm:   clamp(1rem, 0.95rem + 0.3vw, 1.0625rem);
    --text-xs:   clamp(0.875rem, 0.84rem + 0.2vw, 0.9375rem);
  }
  body { font-size: var(--text-base); }

  /* One question per screen: the tutor is already a bottom sheet here, so the
     card is the only thing in the viewport. */
  .qgrid { grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); padding-top: var(--sp-4); }
  .card { padding: var(--sp-4); }
  .qtext { font-size: var(--text-lg); }

  /* Answers are tap cards, never a row of small buttons. 56px is the floor the
     v1.1 brief names; the padding usually makes them taller than that. */
  .choices { gap: var(--sp-3); }
  .choice {
    min-height: 56px; padding: var(--sp-4); font-size: var(--text-base);
    align-items: center; border-radius: var(--radius-lg);
  }

  /* "Sledeće / Na tabelu" stay reachable with the thumb while the answer text
     scrolls behind them. */
  .qnav {
    position: sticky; bottom: 0; z-index: 40;
    margin: var(--sp-5) calc(var(--sp-4) * -1) calc(var(--sp-4) * -1);
    padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--c-surface) 94%, transparent);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--c-border);
    gap: var(--sp-2);
  }
  .qnav .btn { flex: 1 1 8rem; min-height: 52px; }

  /* Every control is a touch target. */
  .btn, .nav-toggle, .nav-link, .nav-group-head { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  input[type="text"], input[type="password"], select, textarea { min-height: 48px; }

  /* No horizontal scroll: nothing may set its own width, and long strings wrap
     instead of pushing the page sideways. */
  .wrap, .landing-shell, .landing-bar { max-width: 100%; }
  .qgrid, .card, .list, .row, .toolbar { min-width: 0; max-width: 100%; }
  .toolbar select { width: 100%; min-width: 0; }
  .tutor-form { flex-wrap: wrap; }
  .tutor-form input { flex: 1 1 100%; }
  .btn-mic { flex: 0 0 auto; }
  .turn-speak, .btn-lessons-back { min-height: 44px; }
  .qtext, .row-text, .tutor-log, .lede { overflow-wrap: anywhere; }

  /* MUST 7: the CTA has to be reachable without a scroll, so on a phone it
     comes BEFORE the video instead of under it, and the video frame shrinks to
     what is left. Reading order in the DOM is unchanged. */
  .hero { padding-top: var(--sp-2); }
  .hero-kicker { margin-bottom: var(--sp-2); }
  .hero-title { font-size: var(--text-2xl); margin-bottom: var(--sp-3); }
  .lede { font-size: var(--text-base); margin-bottom: var(--sp-3); }
  .hero-frame {
    margin-top: var(--sp-4);
    display: flex; flex-direction: column-reverse; gap: var(--sp-4);
  }
  .hero-cta { margin-top: 0; }
  .hero-cta .btn-cta { width: 100%; min-height: 56px; }
  /* A fixed height, not a vh one: on a phone the viewport height changes when
     the URL bar collapses, and a vh-sized hero then reflows the page under the
     reader's thumb (it was the last thing Lighthouse still counted as CLS). */
  .hero-media { height: 190px; aspect-ratio: auto; }
  .gate { margin-top: var(--sp-6); padding: var(--sp-5); }

  .site-foot { flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-8); }
  .tutor-presets-row .btn { flex: 1 1 9rem; }
}

/* The bottom sheet and the sticky question nav would otherwise sit on top of
   each other on a short phone. */
@media (max-width: 720px) {
  .tutor[data-open="true"] ~ * .qnav, .tutor[data-open="true"] .qnav { z-index: 30; }
}

/* =============================================================
   v1.2 — MUST 12: the tutor pill. One tutor UI in the exercise.
   ============================================================= */
.tutor-pill {
  position: fixed; right: var(--sp-4); bottom: var(--sp-6);
  z-index: 70; display: flex; flex-direction: column; align-items: flex-end;
  gap: var(--sp-3); max-width: min(24rem, calc(100% - var(--sp-8)));
}

.pill-face {
  display: inline-flex; align-items: center; gap: var(--sp-3);
  min-height: 48px; padding: var(--sp-2) var(--sp-4) var(--sp-2) var(--sp-2);
  border-radius: 9999px; cursor: pointer; text-align: left;
  background: var(--c-surface); color: var(--c-text-primary);
  border: 1px solid var(--c-border-hover);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font: inherit; font-size: var(--text-sm);
  max-width: 100%;
}
.pill-face:hover { border-color: var(--c-accent); }
.pill-face:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 3px; }

.pill-avatar {
  position: relative; flex: 0 0 auto; width: 34px; height: 34px;
  border-radius: 50%; background: var(--c-accent); color: #100c06;
  display: grid; place-items: center; font-weight: 700;
}
.pill-avatar::after { content: "T"; font-family: var(--font-heading); }
/* the "online" dot — the idle state is an avatar and this, nothing else */
.pill-dot {
  position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--c-green);
  border: 2px solid var(--c-surface);
}
.pill-name { font-weight: 600; white-space: nowrap; }

/* the one-line hint. Hidden unless the pill has something to say, so the idle
   pill really is just the avatar. */
.pill-line { display: none; overflow-wrap: anywhere; color: var(--c-text-secondary); }
.tutor-pill[data-state="hint"] .pill-line,
.tutor-pill[data-state="done"] .pill-line { display: inline; }
.tutor-pill[data-state="hint"] .pill-face,
.tutor-pill[data-state="done"] .pill-face { border-radius: var(--radius-xl); }
.tutor-pill[data-state="hint"] .pill-face { border-color: var(--c-accent); }
.tutor-pill[data-state="hint"] .pill-name::after,
.tutor-pill[data-state="done"] .pill-name::after { content: " ·"; }

/* the chat. On a desktop it is a panel over the page; on a phone it is the
   bottom sheet the brief asks for. */
.pill-panel {
  width: min(24rem, calc(100vw - var(--sp-8)));
  display: flex; flex-direction: column; gap: var(--sp-3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}
.pill-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.pill-head h3 { margin: 0; }
.tutor-pill[data-open="true"] .pill-face { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .tutor-pill[data-state="hint"] .pill-face { animation: pill-in 220ms ease-out; }
  @keyframes pill-in { from { opacity: 0.4; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

@media (max-width: 720px) {
  /* Never over the sticky "Sledeće / Na tabelu" bar: the pill floats above it,
     and the chat becomes a full-width bottom sheet. */
  .tutor-pill {
    right: var(--sp-3); left: var(--sp-3);
    bottom: calc(5.5rem + env(safe-area-inset-bottom));
    max-width: none;
  }
  .tutor-pill[data-open="true"] {
    left: 0; right: 0; bottom: 0; padding: 0;
  }
  .pill-panel {
    width: 100%;
    max-height: 76vh; overflow-y: auto;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom));
  }
  .pill-face { max-width: 100%; }
}

/* v1.3 — group access with an expiry date.
   The day counter is deliberately quiet: it belongs in the topbar the way a
   battery icon belongs in a status bar, noticed only when it matters. */
.code-days {
  font-size: var(--text-xs); color: var(--c-text-tertiary); opacity: 0.8;
  white-space: nowrap; margin-left: auto;
}
@media (max-width: 520px) { .code-days { margin-left: 0; order: 9; } }

/* The landing notice when the code has run out. Not `.error` red — nothing
   went wrong, the access simply ended, and the free ten still work. */
.code-expired {
  font-size: var(--text-sm); line-height: 1.5;
  border: 1px solid var(--c-border); border-left: 3px solid var(--c-accent);
  border-radius: 0.4rem; padding: 0.7rem 0.9rem; margin: 0 0 0.75rem;
}
.code-expired a { color: var(--c-accent); }


/* v1.5 item 3 — the optional picture above a question. It is an illustration,
   not a hero: capped so it never pushes the question itself below the fold. */
.q-image {
  display: block;
  width: 100%;
  max-width: 640px;
  max-height: 40vh;
  object-fit: contain;
  margin: 0 0 var(--sp-4);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  background: var(--c-surface-2);
}

/* v1.6 — „Samo 1./2./3. deo". A pressed chip is a filter, not a mode, so it
   sits next to the topic select and not in the mode group. */
.chips{display:flex;gap:.35rem;flex-wrap:wrap}
.chip[aria-pressed="true"]{border-color:var(--c-accent);color:var(--c-accent)}
.score-parts{font-size:1.05rem;color:var(--c-text-secondary);margin:.25rem 0 .75rem}

/* v1.15: the Malta B rules moved to `css/malta.css`, loaded with js/malta.js.
   They style screens a COD95 visitor never opens, and the initial payload has
   a ceiling. */
