/* Правилата на пътя — app styles. No build step, no external assets. */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, "Helvetica Neue", Arial, sans-serif;

  --bg: #f5f0e6;
  --surface: #fffcf6;
  --surface-2: #efe8db;
  --ink: #1d2326;
  --ink-2: #5a6166;
  --ink-3: #8b8f90;
  --line: #e4dbcb;
  --line-strong: #cfc4b1;

  --blue: #1f5d86;          /* road-sign blue */
  --blue-ink: #ffffff;
  --amber: #eba524;         /* road-line yellow */
  --amber-ink: #1d2326;
  --amber-soft: #f8e6bd;
  --green: #2e8656;
  --green-soft: #dbeee1;
  --red: #c2452f;
  --red-soft: #f6ddd6;

  --hero: #26343c;          /* asphalt card */
  --hero-ink: #f4efe5;
  --hero-ink-2: #b7c0c3;
  --track: #e8e0d1;
  --dash: rgba(29, 35, 38, .16);

  --sky-1: #f3dcb0;
  --sky-2: #f8eedb;
  --asphalt: #3a434a;
  --verge: #dfe7d2;

  --shadow: 0 1px 2px rgba(70, 50, 20, .06), 0 8px 24px rgba(70, 50, 20, .08);
  --shadow-lg: 0 10px 34px rgba(30, 25, 15, .22);
  --radius: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131619;
    --surface: #1c2125;
    --surface-2: #262c31;
    --ink: #eee8dc;
    --ink-2: #aaa499;
    --ink-3: #7d7a72;
    --line: #2b3237;
    --line-strong: #3c444a;

    --blue: #3f85b8;
    --amber: #f1b440;
    --amber-soft: rgba(241, 180, 64, .16);
    --green: #5dba83;
    --green-soft: rgba(93, 186, 131, .15);
    --red: #e0644d;
    --red-soft: rgba(224, 100, 77, .16);

    --hero: #20282e;
    --hero-ink: #f1ebdf;
    --hero-ink-2: #a3acaf;
    --track: #2b3238;
    --dash: rgba(238, 232, 220, .14);

    --sky-1: #1d2a38;
    --sky-2: #2a3342;
    --asphalt: #0f1215;
    --verge: #1b2420;

    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, .5);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.player-open { overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
svg.i { width: 24px; height: 24px; flex: none; display: block; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 12px; }

#view {
  max-width: 640px;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top) + 10px)
    max(16px, env(safe-area-inset-right))
    calc(40px + env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}
body.has-mini #view { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }

.loading { display: grid; place-items: center; min-height: 70vh; }
.brand-mark { width: 46px; height: 46px; flex: none; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; transform: scale(.94); } }

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 14px; padding: 10px 2px 22px; position: relative; }
.top::after {
  content: ""; position: absolute; left: 2px; right: 2px; bottom: 6px; height: 3px; border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--amber) 0 22px, transparent 22px 40px);
  opacity: .5;
}
.top h1 { margin: 0; font-size: 23px; line-height: 1.15; font-weight: 750; letter-spacing: -.01em; }
.top p { margin: 2px 0 0; color: var(--ink-2); font-size: 15px; }

.section-title {
  margin: 30px 4px 12px; font-size: 14px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-2);
}

/* ---------- buttons ---------- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 26px; border-radius: 999px;
  background: var(--amber); color: var(--amber-ink);
  font-size: 18px; font-weight: 750; letter-spacing: .01em;
  box-shadow: 0 4px 14px rgba(235, 165, 36, .32);
  transition: transform .12s ease;
}
.btn-primary:active { transform: scale(.97); }
.btn-primary svg.i { width: 22px; height: 22px; }
.btn-primary.wide { width: 100%; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px;
  background: var(--surface-2); font-weight: 650;
}
.icon-btn {
  width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 50%;
  color: var(--ink-2);
}
.icon-btn:active { background: var(--surface-2); }

/* ---------- road progress bar ---------- */
.road-progress { position: relative; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.road-progress::after {
  content: ""; position: absolute; left: 4px; right: 4px; top: 3px; height: 2px;
  background: repeating-linear-gradient(90deg, var(--dash) 0 9px, transparent 9px 18px);
}
.road-progress i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--amber); z-index: 1; }

/* ---------- resume card ---------- */
.resume {
  display: block; position: relative; overflow: hidden; cursor: pointer;
  margin: 6px 0 8px; padding: 20px 20px 20px;
  border-radius: 26px; background: var(--hero); color: var(--hero-ink);
  box-shadow: var(--shadow);
}
@media (prefers-color-scheme: dark) { .resume { box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), var(--shadow); } }
.resume-kicker { font-size: 14px; font-weight: 650; color: var(--amber); letter-spacing: .02em; }
.resume-book { margin-top: 10px; font-size: 15px; color: var(--hero-ink-2); }
.resume-title { margin-top: 2px; font-size: 21px; line-height: 1.25; font-weight: 700; }
.resume-meta { margin-top: 8px; font-size: 15px; color: var(--hero-ink-2); display: flex; gap: 8px; flex-wrap: wrap; }
.resume-meta b { color: var(--hero-ink); font-weight: 650; }
.resume .road-progress { margin: 14px 0 18px; background: rgba(255,255,255,.12); }
.resume .road-progress::after { background: repeating-linear-gradient(90deg, rgba(255,255,255,.28) 0 9px, transparent 9px 18px); }
.resume .btn-primary { width: 100%; }

/* ---------- install hint ---------- */
.hint {
  position: relative; margin: 4px 0 18px; padding: 16px 52px 16px 16px; border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow); border-left: 5px solid var(--blue);
  font-size: 16px;
}
.hint b { font-weight: 700; }
.hint p { margin: 0; }
.hint p + p { margin-top: 6px; color: var(--ink-2); font-size: 15px; }
.hint .glyph { display: inline-block; width: 20px; height: 20px; vertical-align: -4px; color: var(--blue); }
.hint .icon-btn { position: absolute; top: 4px; right: 4px; }
.hint .btn-primary { margin-top: 12px; min-height: 48px; font-size: 16px; }

/* ---------- book cards ---------- */
.books { display: grid; gap: 14px; }
.book {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: start;
  padding: 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
  position: relative;
}
a.book:active { transform: scale(.99); }
.plate {
  min-width: 66px; height: 50px; padding: 0 10px; display: grid; place-items: center;
  border-radius: 10px; background: var(--blue); color: var(--blue-ink);
  font-weight: 800; font-size: 16px; letter-spacing: .02em; white-space: nowrap;
  box-shadow: inset 0 0 0 3px var(--blue), inset 0 0 0 5px rgba(255,255,255,.9);
}
.plate.lg { display: inline-grid; min-width: 84px; height: 62px; font-size: 20px; border-radius: 12px; }
.book-title { font-size: 18px; font-weight: 700; line-height: 1.25; }
.book-note { font-size: 14px; color: var(--ink-3); margin-top: 2px; }
.book-progress { grid-column: 1 / -1; margin-top: 12px; }
.book-meta { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 15px; color: var(--ink-2); }
.book.soon { opacity: .75; }
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 800;
  letter-spacing: .02em; vertical-align: 2px; white-space: nowrap;
}
.pill.new { background: var(--amber); color: var(--amber-ink); }
.pill.soon { background: var(--surface-2); color: var(--ink-2); }
.book .pill { position: absolute; top: 14px; right: 14px; }
.book:has(.pill) .book-title { padding-right: 70px; }

.foot { margin: 34px 4px 0; text-align: center; font-size: 13px; color: var(--ink-3); }
.notice {
  margin: 10px 0; padding: 12px 14px; border-radius: 14px; background: var(--amber-soft);
  font-size: 15px;
}
.empty { text-align: center; padding: 60px 10px; color: var(--ink-2); }
.empty .btn-primary { margin-top: 18px; }

/* ---------- book view ---------- */
.bar { display: flex; align-items: center; gap: 6px; margin: 0 -8px 6px; min-height: 52px; }
.bar-title { font-weight: 700; color: var(--ink-2); }
.book-head { padding: 4px 4px 8px; }
.book-head h1 { margin: 14px 0 2px; font-size: 24px; line-height: 1.2; letter-spacing: -.01em; }
.book-head .book-note { font-size: 15px; }
.book-head .road-progress { margin: 16px 0 8px; }
.book-head .book-meta { margin: 0 0 16px; }
.book-head .btn-primary { width: 100%; }

.chapters { list-style: none; margin: 18px 0 0; padding: 0; }
.group-head {
  margin: 0 4px; padding: 22px 0 6px 62px; font-size: 13.5px; font-weight: 750; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-2);
}
.ch { position: relative; display: flex; align-items: center; }
.ch::before, .group-head::before {   /* the road that links the signs */
  content: ""; position: absolute; left: 31px; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: repeating-linear-gradient(180deg, var(--line-strong) 0 7px, transparent 7px 13px);
}
.chapters > :first-child::before { top: 50%; }
.group-head { position: relative; }
.group-head::before { left: 27px; }
.ch:last-child::before { bottom: 50%; }
.ch-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
  min-height: 72px; padding: 10px 8px; border-radius: 16px;
}
.ch-main:active { background: var(--surface-2); }
.badge {
  position: relative; z-index: 1; width: 46px; height: 46px; flex: none;
  display: grid; place-items: center; font-weight: 750; font-size: 16px; color: var(--blue);
}
.badge::before {
  content: ""; position: absolute; inset: 5px; z-index: -1; border-radius: 9px;
  background: var(--bg); border: 2.5px solid var(--blue);
}
.ch.heard .badge { color: #fff; }
.ch.heard .badge::before { border-radius: 50%; background: var(--green); border-color: var(--green); }
.ch.heard .badge svg.i { width: 22px; height: 22px; }
.ch.current .badge { color: var(--amber-ink); }
.ch.current .badge::before {
  inset: 8px; border-radius: 5px; transform: rotate(45deg);
  background: var(--amber); border: 0; box-shadow: 0 0 0 2.5px #fff, 0 0 0 3.5px rgba(0,0,0,.12);
}
.ch-text { min-width: 0; display: flex; flex-direction: column; }
.ch-title { font-size: 17px; line-height: 1.3; font-weight: 600; }
.ch.current .ch-title { font-weight: 750; }
.ch-meta { margin-top: 3px; font-size: 14.5px; color: var(--ink-2); }
.ch.heard .ch-meta .ok { color: var(--green); font-weight: 650; }
.ch-bar { position: absolute; left: 66px; right: 60px; bottom: 6px; height: 3px; border-radius: 2px; background: var(--track); overflow: hidden; pointer-events: none; }
.ch-bar i { display: block; height: 100%; background: var(--amber); border-radius: 2px; }
.ch-art { margin-right: 2px; }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; margin-right: 6px; vertical-align: -1px; }
.eq i { width: 3px; background: var(--amber); border-radius: 1px; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.4s; } .eq i:nth-child(3) { animation-delay: -.7s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 12px; } }

/* ---------- mini player ---------- */
.mini {
  position: fixed; z-index: 10;
  left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right));
  bottom: calc(10px + env(safe-area-inset-bottom));
  max-width: 620px; margin: 0 auto;
  display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 6px;
  border-radius: 22px; background: var(--hero); color: var(--hero-ink); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.mini-bar { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: rgba(255,255,255,.1); }
.mini-bar i { display: block; height: 100%; width: 0; background: var(--amber); }
.mini-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 4px; }
.mini-sign { width: 40px; height: 40px; flex: none; }
.mini-text { min-width: 0; display: flex; flex-direction: column; }
.mini-title { font-weight: 650; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { font-size: 13.5px; color: var(--hero-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-play {
  width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--amber); color: var(--amber-ink);
}
.mini-play svg.i { width: 26px; height: 26px; }

/* ---------- full player ---------- */
.player {
  position: fixed; inset: 0; z-index: 20; background: var(--bg);
  display: flex; flex-direction: column;
  transform: translateY(100%); visibility: hidden;
  transition: transform .34s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .34s;
}
.player.open { transform: none; visibility: visible; transition: transform .34s cubic-bezier(.2, .8, .2, 1); }
.player-inner {
  flex: 1; width: 100%; max-width: 560px; margin: 0 auto; min-height: 0;
  display: flex; flex-direction: column; overflow-y: auto;
  padding:
    calc(env(safe-area-inset-top) + 6px)
    max(20px, env(safe-area-inset-right))
    calc(env(safe-area-inset-bottom) + 18px)
    max(20px, env(safe-area-inset-left));
}
.player-bar { display: flex; align-items: center; justify-content: space-between; margin: 0 -10px; min-height: 52px; }
.player-book { font-size: 15px; font-weight: 700; color: var(--ink-2); letter-spacing: .02em; text-align: center; }

.road {
  position: relative; flex: 1 1 200px; min-height: 120px; max-height: 280px; margin: 8px 0 18px;
  border-radius: 28px; overflow: hidden; perspective: 260px; perspective-origin: 50% 55%;
  background: linear-gradient(180deg, var(--sky-1), var(--sky-2) 55%, var(--verge) 55.1%);
}
.road-sky {   /* a low sun */
  position: absolute; left: 50%; top: 20%; width: 90px; height: 90px; margin-left: -45px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 140, .9), rgba(255, 214, 140, 0) 70%);
}
@media (prefers-color-scheme: dark) { .road-sky { background: radial-gradient(circle, rgba(240, 225, 190, .35), rgba(240, 225, 190, 0) 65%); width: 60px; height: 60px; margin-left: -30px; top: 14%; } }
.road-plane {
  position: absolute; left: 50%; bottom: 0; width: 300px; height: 3000px; margin-left: -150px;
  transform-origin: 50% 100%; transform: rotateX(84deg);
  background: var(--asphalt);
  box-shadow: inset 6px 0 0 rgba(255,255,255,.55), inset -6px 0 0 rgba(255,255,255,.55);
}
.road-line {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 8px; margin-left: -4px;
  background: repeating-linear-gradient(180deg, var(--amber) 0 40px, transparent 40px 80px);
  animation: drive 1.1s linear infinite; animation-play-state: paused;
}
.player.playing .road-line { animation-play-state: running; }
@keyframes drive { from { background-position: 0 0; } to { background-position: 0 80px; } }
.road-sign {
  position: absolute; right: 13%; top: 16%; min-width: 58px; padding: 6px 10px 5px; text-align: center;
  border-radius: 9px; background: var(--blue); color: #fff; line-height: 1;
  box-shadow: inset 0 0 0 2px var(--blue), inset 0 0 0 3.5px rgba(255,255,255,.9), 0 4px 10px rgba(0,0,0,.15);
}
.road-sign::after {   /* post */
  content: ""; position: absolute; left: 50%; top: 100%; width: 4px; height: 60px; margin-left: -2px;
  background: linear-gradient(var(--ink-3), transparent); opacity: .7; z-index: -1;
}
.road-sign span { display: block; font-size: 22px; font-weight: 800; }
.road-sign small { display: block; font-size: 11px; font-weight: 600; opacity: .9; margin-top: 2px; }

.p-titles { text-align: center; padding: 0 4px; }
.p-group { font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); min-height: 1em; }
.p-title { margin: 4px 0 0; font-size: 22px; line-height: 1.25; font-weight: 750; letter-spacing: -.005em; }
.art-chip {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; min-height: 40px; padding: 0 10px 0 16px;
  border-radius: 999px; background: var(--amber-soft); color: var(--ink); font-weight: 700; font-size: 17px;
}
.art-chip svg.i { width: 20px; height: 20px; opacity: .7; }

.seek { margin: 22px 0 0; padding: 14px 0; touch-action: none; cursor: pointer; outline-offset: 4px; }
.seek-track { position: relative; height: 8px; border-radius: 4px; background: var(--track); }
.seek-track::after {
  content: ""; position: absolute; left: 4px; right: 4px; top: 3px; height: 2px;
  background: repeating-linear-gradient(90deg, var(--dash) 0 9px, transparent 9px 18px);
}
.seek-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px; background: var(--amber); z-index: 1; }
.seek-thumb {
  position: absolute; top: 50%; left: 0; z-index: 2; width: 24px; height: 24px; margin: -12px 0 0 -12px;
  border-radius: 50%; background: var(--surface); border: 3px solid var(--amber); box-shadow: 0 2px 6px rgba(0,0,0,.2);
  transition: transform .12s ease;
}
.seek.drag .seek-thumb { transform: scale(1.3); }
.times { display: flex; justify-content: space-between; font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.controls { display: flex; align-items: center; justify-content: space-between; margin: 18px -6px 6px; }
.ctl { width: 60px; height: 60px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); }
.ctl svg.i { width: 32px; height: 32px; }
.ctl:active { background: var(--surface-2); }
.ctl-play {
  width: 86px; height: 86px; background: var(--amber); color: var(--amber-ink);
  box-shadow: 0 6px 20px rgba(235, 165, 36, .38);
  transition: transform .12s ease;
}
.ctl-play:active { background: var(--amber); transform: scale(.95); }
.ctl-play svg.i { width: 42px; height: 42px; }
.buffering .ctl-play svg.i, .buffering .mini-play svg.i { animation: pulse 1s ease-in-out infinite; }

.extras { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 999px;
  background: var(--surface-2); font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums;
}
.pill-btn svg.i { width: 20px; height: 20px; }
.pill-btn.on { background: var(--amber-soft); }

/* ---------- bottom sheet ---------- */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(12, 14, 16, .45); animation: fade .2s ease;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 80vh; max-height: 80dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 26px 26px 0 0;
  padding: 6px 14px calc(18px + env(safe-area-inset-bottom));
  animation: rise .26s cubic-bezier(.2, .8, .2, 1);
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40%); opacity: .4; } }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 4px auto 6px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -4px 6px 6px; }
.sheet-head h3 { margin: 0; font-size: 19px; line-height: 1.25; }
.sheet-sub { margin: -2px 6px 12px; color: var(--ink-2); font-size: 15px; }
.opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  min-height: 56px; padding: 0 16px; border-radius: 14px; font-size: 18px;
}
.opt:active { background: var(--surface-2); }
.opt.on { background: var(--amber-soft); font-weight: 750; }
.opt .t { color: var(--ink-2); font-size: 15px; font-variant-numeric: tabular-nums; }
.opt svg.i { color: var(--amber); }
.speed-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 4px 2px 6px; }
.speed-grid .opt { justify-content: center; background: var(--surface-2); font-weight: 700; min-height: 60px; }
.speed-grid .opt.on { background: var(--amber); color: var(--amber-ink); }
.opt.off { color: var(--red); font-weight: 650; }

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 50; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  max-width: min(92vw, 520px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 12px 18px; border-radius: 14px; background: var(--ink); color: var(--bg);
  font-size: 15.5px; font-weight: 550; box-shadow: var(--shadow-lg); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.player-open .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }

/* ================================================================ Листовки (quiz.js) */
.plate.warn { background: transparent; box-shadow: none; padding: 0; min-width: 0; width: 66px; }
.plate.warn.lg { width: 84px; height: 72px; }
.warn-sign { width: 56px; height: 52px; display: block; }
.plate.lg .warn-sign { width: 76px; height: 70px; }
.mist-n { color: var(--red); font-weight: 650; }
.q-bar { position: sticky; top: 0; z-index: 5; background: var(--bg); }
.q-bar .bar-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-bar-right { display: flex; align-items: center; gap: 8px; margin-right: 8px; }

.q-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.q-tile {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; min-height: 104px; padding: 16px;
  border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.q-tile:active { transform: scale(.98); }
.q-tile.exam { background: var(--hero); color: var(--hero-ink); }
.q-tile.exam::before { content: ""; position: absolute; left: 16px; right: 16px; top: 18px; height: 4px; border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--amber) 0 16px, transparent 16px 28px); opacity: .8; }
.q-tile.mist::before { content: ""; position: absolute; left: 16px; top: 14px; width: 14px; height: 14px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.q-tile.mist.empty-tile::before { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.q-tile-t { font-size: 18px; font-weight: 750; }
.q-tile-s { font-size: 14.5px; color: var(--ink-2); }
.q-tile.exam .q-tile-s { color: var(--hero-ink-2); }

.seg { display: flex; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface-2); margin: 0 0 10px; }
.seg button { flex: 1; min-height: 46px; padding: 4px 6px; border-radius: 12px; font-size: 14.5px; font-weight: 650; text-align: center; line-height: 1.2; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.secs { display: grid; gap: 2px; }
.sec { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 76px; padding: 10px 6px 10px 4px; border-radius: 16px; text-align: left; }
.sec:active { background: var(--surface-2); }
.sec .ch-text { flex: 1; }
.sec-bar { display: block; height: 4px; margin-top: 8px; border-radius: 2px; background: var(--track); overflow: hidden; }
.sec-bar i { display: block; height: 100%; background: var(--green); border-radius: 2px; }
.sec .chev { transform: rotate(180deg); color: var(--ink-3); width: 20px; height: 20px; }
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hist-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface); font-size: 15px; }
.hist-row > span:first-child { flex: 1; color: var(--ink-2); }
.hist-score { font-weight: 750; font-variant-numeric: tabular-nums; }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.no { background: var(--red-soft); color: var(--red); }

.q-card { padding-bottom: 8px; }
.q-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 2px 8px; font-size: 14.5px; color: var(--ink-2); }
.pill.pts { background: var(--surface-2); color: var(--ink-2); vertical-align: 0; }
.q-text { margin: 0 2px 14px; font-size: 20px; line-height: 1.38; font-weight: 680; letter-spacing: -.003em; }
.q-fig { margin: 0 0 14px; text-align: center; }
.q-fig .zoom { display: inline-block; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: var(--shadow); cursor: zoom-in; }
.q-fig .zoom img { display: block; max-width: 100%; max-height: 42vh; width: auto; height: auto; min-width: 160px; object-fit: contain; }
.q-video { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; background: #000; }
.q-replay { margin-top: 10px; }
.q-replay svg.i { width: 22px; height: 22px; }
.q-vid-err { margin: 8px 0 0; color: var(--red); font-size: 15px; }
.q-hint { margin: 0 2px 10px; font-size: 14.5px; color: var(--ink-3); }

.ans-list { display: grid; gap: 10px; }
.ans-list.pics { grid-template-columns: 1fr 1fr; }
.ans {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 14px 16px;
  border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); border: 2.5px solid transparent;
  font-size: 17.5px; line-height: 1.35; text-align: left; transition: border-color .12s, background .12s;
}
.ans:active { transform: scale(.99); }
.ans .box {
  flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  border: 2.5px solid var(--line-strong); color: transparent; background: var(--bg);
}
.ans .box svg.i { width: 20px; height: 20px; }
.ans.on { border-color: var(--blue); }
.ans.on .box { background: var(--blue); border-color: var(--blue); color: #fff; }
.ans-t { flex: 1; min-width: 0; }
.ans.pic { flex-direction: column; justify-content: center; padding: 12px; gap: 10px; }
.ans.pic .box { position: absolute; top: 8px; left: 8px; }
.ans.pic img { display: block; max-width: 100%; max-height: 120px; border-radius: 8px; background: #fff; margin-top: 18px; }
.ans .mark { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; }
.ans.pic .mark { position: absolute; top: 8px; right: 8px; }
.ans.ok { border-color: var(--green); background: var(--green-soft); }
.ans.ok .box { background: var(--green); border-color: var(--green); }
.ans.ok .mark { background: var(--green); }
.ans.bad { border-color: var(--red); background: var(--red-soft); }
.ans.bad .box { background: var(--red); border-color: var(--red); }
.ans.bad .mark { background: var(--red); }
.ans.miss { border: 2.5px dashed var(--green); }
.ans .mark.miss-t { width: auto; border-radius: 999px; padding: 0 10px; height: 26px; font-size: 13px; font-weight: 750; color: var(--green); background: var(--green-soft); }
.ans[aria-disabled="true"] { cursor: default; }
.ans[aria-disabled="true"]:active { transform: none; }

.q-result { margin: 16px 0 0; padding: 14px 16px; border-radius: 16px; font-size: 18px; font-weight: 750; }
.q-result.good { background: var(--green-soft); color: var(--green); }
.q-result.bad { background: var(--red-soft); color: var(--red); }
.refs { margin-top: 14px; }
.refs-t { font-size: 14.5px; color: var(--ink-2); margin: 0 2px 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 18px 0 14px; border-radius: 999px;
  background: var(--blue); color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: inset 0 0 0 2px var(--blue), inset 0 0 0 3.5px rgba(255,255,255,.75);
}
.chip svg.i { width: 18px; height: 18px; }
.chip:disabled { background: var(--surface-2); color: var(--ink-3); box-shadow: none; padding: 0 16px; cursor: default; }

.q-nav { display: flex; gap: 10px; margin-top: 18px; }
.q-nav .btn-primary { flex: 1; }
.btn-primary:disabled { opacity: .45; box-shadow: none; cursor: default; }
.nav-btn { flex: none; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); }
.nav-btn:disabled { opacity: .35; }

.x-timer { font-variant-numeric: tabular-nums; font-weight: 750; font-size: 16px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); }
.x-timer.low { background: var(--red-soft); color: var(--red); }
.x-submit { min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--amber); color: var(--amber-ink); font-weight: 750; font-size: 15px; }
.x-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; margin-top: 22px; }
.x-cell { height: 40px; border-radius: 10px; background: var(--surface-2); font-size: 14px; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: center; }
.x-cell.done { background: var(--amber-soft); color: var(--ink); }
.x-cell.cur { box-shadow: inset 0 0 0 2.5px var(--amber); color: var(--ink); }
.x-intro { padding: 4px 4px 0; }
.x-intro h1 { margin: 14px 0 10px; font-size: 24px; }
.x-rules { margin: 0 0 22px; padding-left: 20px; display: grid; gap: 8px; color: var(--ink-2); font-size: 16.5px; }
.x-rules b { color: var(--ink); }
.x-res { margin: 8px 0 6px; padding: 22px 20px; border-radius: 24px; text-align: center; }
.x-res.pass { background: var(--green-soft); }
.x-res.fail { background: var(--red-soft); }
.x-verdict { font-size: 15px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.x-res.pass .x-verdict { color: var(--green); }
.x-res.fail .x-verdict { color: var(--red); }
.x-score { font-size: 56px; font-weight: 800; line-height: 1.1; margin: 6px 0; font-variant-numeric: tabular-nums; }
.x-score small { font-size: 26px; color: var(--ink-2); font-weight: 700; }
.x-res p { margin: 0; color: var(--ink-2); font-size: 15.5px; }
.x-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.x-row { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.x-row:active { background: var(--surface-2); }
.x-row-t { font-size: 16px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.x-row-m { font-size: 14px; color: var(--red); font-weight: 650; }
.x-again { margin-top: 22px; }

.lightbox {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: calc(env(safe-area-inset-top) + 56px) 10px calc(env(safe-area-inset-bottom) + 20px);
  background: rgba(8, 10, 12, .92); animation: fade .18s ease; overflow: auto;
}
.lightbox img { width: 100%; max-width: 900px; max-height: 100%; object-fit: contain; background: #fff; border-radius: 10px; }
.lb-close { position: absolute; top: calc(env(safe-area-inset-top) + 6px); right: 8px; color: #fff; }

/* short phones (iPhone SE) */
@media (max-height: 700px) {
  .road { min-height: 90px; margin-bottom: 12px; }
  .p-title { font-size: 20px; }
  .seek { margin-top: 12px; }
  .controls { margin-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}
