/* ==========================================================================
   DIS AUTO Academy — Varianta C
   --------------------------------------------------------------------------
   Two accent roles, on purpose:
     • BRAND  = the yellow of the DIS AUTO logo (yellow + black shield) and of
                the v0.3 microsite. It carries identity, highlights and CTAs.
     • ALARM  = red, as asked in the brief. It is *functional*: wrong answers,
                hazards, time pressure, destructive actions. Never decorative.
   Surfaces are graphite; the layout is a training dashboard.
   Mobile first: 320 / 360 / 390 / 430 / 768 / 1024 / 1366 / 1920.
   ========================================================================== */

/* --- 1. Tokens ----------------------------------------------------------- */
:root {
  --bg: #0a0c0f;
  --bg-2: #0d1015;
  --surface: #12161c;
  --surface-2: #161b22;
  --surface-3: #1b212a;
  --surface-4: #222a35;

  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  --text: #e9edf3;
  --text-strong: #ffffff;
  --muted: #98a3b3;
  --muted-2: #707c8c;

  --brand: #ffd21e;
  --brand-2: #e8b400;
  --brand-soft: rgba(255, 210, 30, 0.13);
  --brand-ink: #16170a;

  --danger: #ef4136;
  --danger-2: #c22a20;
  --danger-soft: rgba(239, 65, 54, 0.14);
  --ok: #31c46f;
  --ok-soft: rgba(49, 196, 111, 0.14);
  --info: #5aa8ff;
  --info-soft: rgba(90, 168, 255, 0.14);
  --warn: #ffab2e;

  --radius-xs: 6px;
  --radius-s: 9px;
  --radius: 13px;
  --radius-l: 18px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-2: 0 14px 34px rgba(0, 0, 0, 0.5);
  --shadow-brand: 0 10px 26px rgba(255, 210, 30, 0.16);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 22px;
  --space-6: 30px;
  --space-7: 44px;
  --space-8: 64px;

  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;

  --dur: 0.18s;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --header-h: 60px;
  --shell-max: 1240px;
}

/* --- 2. Base ------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1100px 520px at 12% -12%, rgba(255, 210, 30, 0.055), transparent 62%),
    radial-gradient(900px 480px at 88% 4%, rgba(239, 65, 54, 0.05), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255, 210, 30, 0.14);
}

h1, h2, h3, h4 {
  margin: 0 0 var(--space-3);
  color: var(--text-strong);
  line-height: 1.18;
  text-wrap: balance;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.6rem, 1.25rem + 1.6vw, 2.4rem); }
h2 { font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.7rem); }
h3 { font-size: clamp(1.06rem, 1rem + 0.4vw, 1.22rem); }

p { margin: 0 0 var(--space-3); }
p:last-child { margin-bottom: 0; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: #ffe066; }
img, svg, canvas { max-width: 100%; }
img { height: auto; }
ul, ol { margin: 0 0 var(--space-3); padding-left: 1.15em; }
li + li { margin-top: var(--space-1); }
button, input, select, textarea { font: inherit; color: inherit; }
strong { color: var(--text-strong); }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-5) 0; }
small { font-size: 0.82rem; }
abbr[title] { text-decoration: underline dotted; cursor: help; }
::selection { background: var(--brand); color: var(--brand-ink); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
:focus:not(:focus-visible) { outline: none; }

/* A native select needs explicit colours, or Windows dark mode paints it white. */
select {
  background-color: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  min-height: 44px;
}

/* --- 3. Utilities -------------------------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -80px;
  z-index: 120;
  padding: 10px 16px;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
  border-radius: var(--radius-s);
  text-decoration: none;
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--space-3); color: var(--brand-ink); }

.noscript {
  max-width: 640px;
  margin: var(--space-7) auto;
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  color: var(--text);
}
.stack > * + * { margin-top: var(--space-3); }
.stack-4 > * + * { margin-top: var(--space-4); }
.stack-6 > * + * { margin-top: var(--space-6); }
.row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.row--between { justify-content: space-between; }
.row--tight { gap: var(--space-2); }
.grow { flex: 1 1 auto; min-width: 0; }
.tabular { font-variant-numeric: tabular-nums; }
.text-muted { color: var(--muted); }
.text-strong { color: var(--text-strong); }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* --- 4. App shell -------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(10, 12, 15, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header__bar {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 8px var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-strong);
  min-width: 0;
}
.brand__logo { width: 34px; height: 36px; display: block; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand__name { font-weight: 700; letter-spacing: 0.02em; font-size: 1rem; }
.brand__sub {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand);
}
.header-spacer { flex: 1 1 auto; min-width: 0; }

/* Category switch — the choice that follows the learner everywhere. */
.cat-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 4px;
}
.cat-switch__label {
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 0 6px;
}
.cat-switch__btn {
  min-width: 42px;
  min-height: 34px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.cat-switch__btn:hover { color: var(--text-strong); background: rgba(255, 255, 255, 0.06); }
.cat-switch__btn[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand-2);
  color: var(--brand-ink);
}

/* Zone tabs — the five areas of the Academy, always one tap away. */
.nav-tabs { border-top: 1px solid var(--line); background: rgba(13, 16, 21, 0.72); }
.nav-tabs__inner {
  max-width: var(--shell-max);
  margin: 0 auto;
  display: flex;
  gap: 2px;
  padding: 0 var(--space-3);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.nav-tabs__inner::-webkit-scrollbar { display: none; }
.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  min-height: 46px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.nav-tab:hover { color: var(--text-strong); }
.nav-tab[aria-current="page"] { color: var(--text-strong); border-bottom-color: var(--brand); }
.nav-tab__icon { width: 18px; height: 18px; flex: 0 0 auto; }

.site-main {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-8);
}
.site-main:focus { outline: none; }

.site-footer { border-top: 1px solid var(--line); background: rgba(10, 12, 15, 0.72); }
.site-footer__inner {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-6);
  display: grid;
  gap: var(--space-4);
}
.footer-note { color: var(--muted); font-size: 0.86rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-3); font-size: 0.86rem; }

/* --- 5. Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 16px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn:hover {
  background: var(--surface-3);
  border-color: rgba(255, 255, 255, 0.26);
  color: var(--text-strong);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn--primary {
  background: linear-gradient(180deg, #ffe066, var(--brand));
  border-color: var(--brand-2);
  color: var(--brand-ink);
  box-shadow: var(--shadow-brand);
}
.btn--primary:hover { background: linear-gradient(180deg, #fff0a6, #ffdb45); color: var(--brand-ink); }
.btn--ghost { background: transparent; border-color: var(--line); }
.btn--danger { background: rgba(239, 65, 54, 0.09); border-color: rgba(239, 65, 54, 0.45); color: #ff9c95; }
.btn--danger:hover { background: rgba(239, 65, 54, 0.18); border-color: var(--danger); color: #ffc7c2; }
.btn--sm { min-height: 38px; padding: 7px 12px; font-size: 0.86rem; }
.btn--lg { min-height: 54px; padding: 14px 22px; font-size: 1.02rem; }
.btn--block { width: 100%; }
.btn__icon { width: 18px; height: 18px; flex: 0 0 auto; }

/* --- 6. Surfaces, cards, stats ------------------------------------------- */
.card {
  background: linear-gradient(180deg, var(--surface) 0%, rgba(18, 22, 28, 0.55) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-1);
}
.card--pad { padding: var(--space-5); }
.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line);
}
.card__title { margin: 0; font-size: 1.02rem; }
.card__body { padding: var(--space-5); }
.card__foot {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.card--link {
  display: block;
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}
.card--link:hover {
  border-color: rgba(255, 210, 30, 0.38);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  color: var(--text);
}
.card--quiet { background: var(--surface-2); box-shadow: none; }
.card--alarm { border-color: rgba(239, 65, 54, 0.35); }

.eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 700;
  margin: 0 0 var(--space-2);
}

.zones { display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
.zone {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.zone:hover { border-color: rgba(255, 210, 30, 0.4); background: var(--surface-3); transform: translateY(-2px); color: var(--text); }
.zone__icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-s);
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid rgba(255, 210, 30, 0.22);
}
.zone--alarm .zone__icon { background: var(--danger-soft); color: var(--danger); border-color: rgba(239, 65, 54, 0.28); }
.zone__name { font-weight: 700; color: var(--text-strong); display: flex; align-items: center; gap: 8px; }
.zone__desc { font-size: 0.88rem; color: var(--muted); margin: 2px 0 0; }
.zone__meta { font-size: 0.78rem; color: var(--brand); margin-top: 6px; font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.kpi {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
  min-width: 0;
}
.kpi__label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 4px;
}
.kpi__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.kpi__hint { font-size: 0.78rem; color: var(--muted-2); margin: 4px 0 0; }
.kpi--brand { border-color: rgba(255, 210, 30, 0.3); }
.kpi--alarm { border-color: rgba(239, 65, 54, 0.32); }

.meter { height: 8px; background: var(--surface-4); border-radius: var(--radius-pill); overflow: hidden; }
.meter__fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  border-radius: inherit;
  transition: width 0.45s var(--ease);
}
.meter__fill--ok { background: var(--ok); }
.meter__fill--danger { background: var(--danger); }
.meter--tall { height: 11px; }

.hbar { display: grid; grid-template-columns: 1fr auto; gap: 4px var(--space-3); align-items: center; }
.hbar__label { font-size: 0.9rem; color: var(--text); min-width: 0; }
.hbar__value { font-size: 0.84rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.hbar__track { grid-column: 1 / -1; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.pill--brand { border-color: rgba(255, 210, 30, 0.42); background: var(--brand-soft); color: var(--brand); }
.pill--ok { border-color: rgba(49, 196, 111, 0.4); background: var(--ok-soft); color: #7ee0a5; }
.pill--danger { border-color: rgba(239, 65, 54, 0.42); background: var(--danger-soft); color: #ff9c95; }
.pill--warn { border-color: rgba(255, 171, 46, 0.42); background: rgba(255, 171, 46, 0.12); color: var(--warn); }
.pill__icon { width: 14px; height: 14px; }

.note {
  border-left: 3px solid var(--line-strong);
  background: var(--surface-2);
  border-radius: var(--radius-s);
  padding: var(--space-3) var(--space-4);
  font-size: 0.9rem;
  color: var(--text);
}
.note--brand { border-left-color: var(--brand); background: rgba(255, 210, 30, 0.07); }
.note--alarm { border-left-color: var(--danger); background: rgba(239, 65, 54, 0.07); }
.note--info { border-left-color: var(--info); background: rgba(90, 168, 255, 0.07); }
.note__title { font-weight: 700; color: var(--text-strong); display: block; margin-bottom: 2px; }

/* --- 7. Questions, answers, sessions ------------------------------------ */
.qcard { border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); box-shadow: var(--shadow-1); }
.qcard__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); }
.qcard__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.qcard__body { padding: var(--space-5); }
.qcard__question {
  font-size: clamp(1.05rem, 1rem + 0.5vw, 1.28rem);
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.35;
  margin: 0 0 var(--space-4);
  text-wrap: pretty;
}
.qcard__visual { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 0 var(--space-4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.qcard__foot { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

.options { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.option:hover { border-color: rgba(255, 210, 30, 0.42); background: var(--surface-3); transform: translateY(-1px); }
.option[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.option__key {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--muted);
}
.option[aria-pressed="true"] .option__key { background: var(--brand); border-color: var(--brand-2); color: var(--brand-ink); }
.option__text { min-width: 0; }
.option__mark { margin-left: auto; flex: 0 0 auto; display: grid; place-items: center; color: var(--ok); }
.option--correct { border-color: rgba(49, 196, 111, 0.62); background: var(--ok-soft); }
.option--wrong { border-color: rgba(239, 65, 54, 0.62); background: var(--danger-soft); }
.option--missing { border-color: rgba(49, 196, 111, 0.42); border-style: dashed; }
.option--faded { opacity: 0.66; }
.option[disabled] { cursor: default; }

.pips { display: flex; flex-wrap: wrap; gap: 5px; }
.pip { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-4); border: 1px solid var(--line-strong); }
.pip--done { background: var(--brand); border-color: var(--brand-2); }
.pip--wrong { background: var(--danger); border-color: var(--danger-2); }
.pip--current { box-shadow: 0 0 0 3px rgba(255, 210, 30, 0.22); }

.flag-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}
.flag-btn:hover { color: var(--text-strong); border-color: var(--line-strong); }
.flag-btn[aria-pressed="true"] { color: var(--brand); border-color: rgba(255, 210, 30, 0.42); background: var(--brand-soft); }

.explain { margin-top: var(--space-4); }
.explain__verdict { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 8px; }
.explain__verdict--ok { color: #7ee0a5; }
.explain__verdict--bad { color: #ff9c95; }
.explain__source { font-size: 0.82rem; color: var(--muted-2); margin-top: 10px; }

/* --- 9. Page head, zones, charts ---------------------------------------- */
.page-head { margin-bottom: var(--space-6); }
.page-lead { color: var(--muted); max-width: 62ch; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  text-decoration: none;
}
.back-link:hover { color: var(--brand); }

.zone.zone--current { border-color: rgba(255, 210, 30, 0.5); background: rgba(255, 210, 30, 0.06); }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 84px;
  padding-top: 6px;
}
.chart__bar {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
}
.chart__fill {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--surface-4);
  transform: scaleY(0.02);
  transform-origin: bottom center;
  transition: transform 0.5s var(--ease);
}
.chart__bar--on .chart__fill { background: linear-gradient(180deg, var(--brand), var(--brand-2)); }

.ring-wrap { display: grid; justify-items: center; gap: var(--space-2); }
.ring { width: 132px; height: 132px; transform: rotate(-90deg); }
.ring__track { fill: none; stroke: var(--surface-4); stroke-width: 11; }
.ring__value {
  fill: none;
  stroke: var(--brand);
  stroke-width: 11;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s var(--ease);
}
.ring--ok .ring__value { stroke: var(--ok); }
.ring--danger .ring__value { stroke: var(--danger); }
.ring--muted .ring__value { stroke: var(--muted-2); }
.ring-label { display: grid; gap: 2px; text-align: center; font-size: 0.86rem; color: var(--muted); }
.ring-label strong { font-size: 1.25rem; color: var(--text-strong); }

/* --- 10. Home hero, dashboard grid, Learn -------------------------------- */
.hero {
  display: grid;
  gap: var(--space-5);
  align-items: center;
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background:
    radial-gradient(620px 280px at 8% 0%, rgba(255, 210, 30, 0.09), transparent 68%),
    linear-gradient(180deg, var(--surface-2) 0%, rgba(18, 22, 28, 0.5) 100%);
}
.hero__lead { font-size: 1.06rem; color: var(--text); max-width: 46ch; }
.hero__tags { margin-bottom: var(--space-3); }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-4) 0 var(--space-3); }
.hero__note { font-size: 0.82rem; color: var(--muted-2); }
.hero__media { margin: 0; position: relative; }
.hero__image {
  display: block;
  width: 100%;
  height: clamp(180px, 34vw, 260px);
  object-fit: cover;
  object-position: center 30%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  filter: saturate(0.9) contrast(1.02);
}
.hero__caption {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(6, 8, 11, 0.72);
  border: 1px solid var(--line);
  font-size: 0.74rem;
  color: var(--muted);
}

.dash-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-4); margin-top: var(--space-6); }

.steps { display: grid; gap: var(--space-4); margin: 0; padding: 0; list-style: none; }
.step { display: grid; grid-template-columns: 34px 1fr; gap: var(--space-3); align-items: start; }
.step + .step { margin-top: 0; }
.step__num {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  border: 1px solid rgba(255, 210, 30, 0.3);
  color: var(--brand);
  font-weight: 700;
}
.step__title { display: block; font-weight: 700; color: var(--text-strong); text-decoration: none; }
.step__title:hover { color: var(--brand); }
.step__text { display: block; font-size: 0.9rem; color: var(--muted); }

.chapter-list { display: grid; gap: var(--space-4); }
.chapter-card { height: 100%; }
.chapter-card__title { margin-bottom: 4px; }

.lesson-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-5); }
.lesson-section h2 { font-size: 1.12rem; }
.lesson-points { margin: 0; padding-left: 1.15em; }
.lesson-points li { color: var(--text); }
.lesson-points li + li { margin-top: 6px; }
.lesson-section .note { margin-top: var(--space-3); }

.values-grid { display: grid; gap: var(--space-3); }
.values-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
}
.values-row--active { border-color: rgba(255, 210, 30, 0.45); background: rgba(255, 210, 30, 0.06); }
.values-row__label { font-weight: 700; color: var(--text-strong); margin-bottom: 6px; }
.values-row__cells { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.values-row__cells li { display: flex; justify-content: space-between; gap: var(--space-3); font-size: 0.9rem; }
.values-row__column { color: var(--muted); min-width: 0; }
.values-row--active .values-row__cells strong { color: var(--brand); }

/* --- 11. Practice, exam HUD, chapters chips ------------------------------ */
.mode-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-4); margin-top: var(--space-5); }
.mode-card { height: 100%; }

.chapter-chips { display: grid; gap: 10px; }
.chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.chip:hover { border-color: rgba(255, 210, 30, 0.42); background: var(--surface-3); color: var(--text-strong); }
.chip__name { font-weight: 600; }
.chip__meta { color: var(--muted); font-size: 0.84rem; white-space: nowrap; }

.marked-list { margin: 0; padding-left: 1.1em; }
.marked-list li { display: flex; gap: var(--space-3); align-items: baseline; justify-content: space-between; }
.marked-list .truncate { max-width: 26ch; }

/* Session HUD: numbers you need while answering, without a table. */
.session-bar {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.session-bar__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.session-stats { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.session-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.session-stat--ok { border-color: rgba(49, 196, 111, 0.36); color: #7ee0a5; }
.session-stat--bad { border-color: rgba(239, 65, 54, 0.4); color: #ff9c95; }
.session-stat--brand { border-color: rgba(255, 210, 30, 0.4); color: var(--brand); }

.session-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-4); }
.session-hint { font-size: 0.82rem; color: var(--muted-2); }

/* Result blocks: the score ring next to the numbers. */
.result-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-5); align-items: center; }
.result-verdict { font-size: 1.15rem; font-weight: 700; }
.result-verdict--ok { color: #7ee0a5; }
.result-verdict--bad { color: #ff9c95; }

.review-list { display: grid; gap: var(--space-3); }
.review-item {
  border: 1px solid var(--line);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: var(--space-4);
}
.review-item__q { font-weight: 600; color: var(--text-strong); }
.review-item__line { font-size: 0.9rem; color: var(--muted); }
.review-item__line strong { color: var(--text); }

/* --- 12. Drive Lab ------------------------------------------------------- */
.lab-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-4); margin-bottom: var(--space-5); }
.lab-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 28px;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: linear-gradient(180deg, var(--surface-2) 0%, rgba(18, 22, 28, 0.5) 100%);
  color: var(--text);
  text-decoration: none;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.lab-card:hover { transform: translateY(-2px); border-color: rgba(255, 210, 30, 0.42); box-shadow: var(--shadow-2); color: var(--text); }
.lab-card__icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--brand-soft);
  border: 1px solid rgba(255, 210, 30, 0.24);
  color: var(--brand);
}
.lab-card--alarm .lab-card__icon { background: var(--danger-soft); border-color: rgba(239, 65, 54, 0.3); color: var(--danger); }
.lab-card--ok .lab-card__icon { background: var(--ok-soft); border-color: rgba(49, 196, 111, 0.3); color: #7ee0a5; }
.lab-card__title { display: block; font-weight: 700; color: var(--text-strong); }
.lab-card__blurb { display: block; font-size: 0.88rem; color: var(--muted); margin-top: 2px; }
.lab-card__meta { display: block; font-size: 0.78rem; color: var(--brand); margin-top: 6px; }
.lab-card__go { color: var(--muted-2); display: grid; place-items: center; }
.lab-card:hover .lab-card__go { color: var(--brand); }

/* Traffic light of the Reaction Test. */
.light {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  width: fit-content;
  margin: 0 auto;
  padding: var(--space-4);
  border-radius: var(--radius-l);
  background: #0b0e12;
  border: 1px solid var(--line);
}
.light__bulb {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #1a2029;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.06);
  transition: background 0.06s linear, box-shadow 0.06s linear;
}
.light[data-state="red"] .light__bulb--red { background: var(--danger); box-shadow: 0 0 24px rgba(239, 65, 54, 0.6); }
.light[data-state="amber"] .light__bulb--amber { background: var(--warn); box-shadow: 0 0 24px rgba(255, 171, 46, 0.55); }
.light[data-state="green"] .light__bulb--green { background: var(--ok); box-shadow: 0 0 30px rgba(49, 196, 111, 0.7); }
.light-status { text-align: center; font-weight: 600; color: var(--text); min-height: 1.6em; }
.light-status[data-tone="alarm"] { color: #ff9c95; }
.light-status[data-tone="ok"] { color: #7ee0a5; }
.light-status[data-tone="brand"] { color: var(--brand); }

/* Canvas scenes: hazard perception and the trailer yard. */
.scene {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 0 auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #0d1015;
  touch-action: manipulation;
}

/* Touch/mouse controls: two rows, full-width forward and reverse. */
.controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 62px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.control:hover { background: var(--surface-3); }
.control[aria-pressed="true"] { background: var(--brand); border-color: var(--brand-2); color: var(--brand-ink); }
/* DOM order is: left, forward, reverse, right — the pad is defined here. */
.control:nth-child(2) { grid-row: 1; grid-column: 1 / -1; }
.control:nth-child(1) { grid-row: 2; grid-column: 1; }
.control:nth-child(4) { grid-row: 2; grid-column: 2; }
.control:nth-child(3) { grid-row: 3; grid-column: 1 / -1; }
.control__label { font-size: 0.84rem; }

/* Profile axes. */
.axes { display: grid; gap: var(--space-4); }
.axis__label { font-weight: 700; color: var(--text-strong); }
.axis__value { color: var(--brand); font-weight: 700; }

.explainer {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  background: var(--surface-2);
}

/* Forms (only the optional display name). */
.field { display: grid; gap: 6px; }
.field__label { font-size: 0.86rem; color: var(--muted); }
.text-input {
  min-height: 48px;
  padding: 10px 14px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px; /* below 16px Android zooms the whole layout on focus */
  min-width: 0;
  flex: 1 1 200px;
}
.text-input::placeholder { color: var(--muted-2); }

/* --- 13. Responsive ------------------------------------------------------
   320 / 360 / 390 / 430 / 768 / 1024 / 1366 / 1920. Mobile first: everything
   above is single column; the breakpoints only add columns when they fit.
   ---------------------------------------------------------------------- */
@media (min-width: 640px) {
  .hero { grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr); }
  .zones { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chapter-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lab-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-grid { grid-template-columns: auto minmax(0, 1fr); }
  .lesson-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chapter-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scene { max-width: 460px; }
  .substack-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .zones { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lab-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .site-main { padding-top: var(--space-6); }
  .scene { max-width: 520px; }
}

@media (min-width: 1366px) {
  .zones { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .mode-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mode-grid > :first-child { grid-column: span 1; }
}

@media (max-width: 380px) {
  :root { --space-5: 18px; --space-6: 24px; }
  .hero { padding: var(--space-4); }
  .hero__actions .btn { width: 100%; }
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .session-bar__row { gap: 6px; }
  .cat-switch__label { display: none; }
  .brand__sub { display: none; }
  .nav-tab { padding: 10px; font-size: 0.86rem; }
}

/* Long words and numbers must never push the layout sideways on a 320px screen. */
.session-stat, .pill, .kpi__value, .hbar__value, .chip__meta { overflow-wrap: anywhere; }
.site-main, .card, .qcard, .mode-card, .lab-card { min-width: 0; }

/* --- 14. Motion preferences --------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto; }
  .card--link:hover, .zone:hover, .btn:hover, .lab-card:hover, .chip:hover { transform: none; }
  .chart__fill, .ring__value, .meter__fill { transition: none; }
}

/* --- 15. Print (a clean chapter page for study on paper) ----------------- */
@media print {
  .site-header, .site-footer, .nav-tabs, .session-actions, .controls, .hud-chip, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .qcard, .note { border-color: #bbb; background: #fff; box-shadow: none; }
  .page-lead, .text-muted, .footer-note { color: #333; }
  h1, h2, h3, .kpi__value { color: #000; }
}

