/* Зебра — дизайн-система «пішохідний перехід»: чорнильні контури, білий папір,
   жорсткі тіні без розмиття, смуги «зебри» як мотив, кольори світлофора лише для змісту.
   Опис токенів і правил — design-system/zebra/MASTER.md */
:root {
  /* поверхні */
  --canvas: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #eeede7;
  /* текст і лінії */
  --ink: #1f2937;
  --ink-soft: #4b5563;
  --hint: #5f6672;
  --line: #1f2937;
  --line-soft: rgba(31, 41, 55, .14);
  --shadow: #1f2937;
  /* дії */
  --btn: #1f2937;
  --on-btn: #ffffff;
  --focus: #2563eb;
  /* головна картка («Іспит»): у світлій — чорнильна, у темній — піднята темна зі світлою обводкою */
  --primary: #1f2937;
  --on-primary: #ffffff;
  --primary-line: #1f2937;
  /* світлофор: сенс, а не декор */
  --go: #16a34a;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --bad: #dc2626;
  --bad-bg: #fee2e2;
  /* чипи результату: у світлій — суцільні, у темній — приглушені (тон + кольоровий текст) */
  --chip-ok: #16a34a; --on-chip-ok: #ffffff;
  --chip-bad: #dc2626; --on-chip-bad: #ffffff;
  --signal: #facc15;
  --on-signal: #1f2937;
  /* медалі рейтингу (2-ге й 3-тє місця; 1-ше — --signal): однакові в обох темах, текст --on-signal */
  --silver: #d4d8de;
  --bronze: #e9b384;
  /* кнопка екстреного виклику: однаково насичена в обох темах, щоб білий текст читався */
  --sos: #dc2626;
  --on-sos: #ffffff;

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --bw: 2px;
  --sh: 3px 3px 0 var(--shadow);
  --sh-press: 1px 1px 0 var(--shadow);
  --t-fast: 120ms;
  --t-base: 220ms;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --font: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Unbounded", var(--font);
  /* смуги переходу */
  --stripes: repeating-linear-gradient(90deg, var(--ink) 0 18px, transparent 18px 30px);

  color-scheme: light;
}
:root.dark {
  --canvas: #101216; --surface: #1a1d23; --surface-2: #252932;
  --ink: #f3f2ee; --ink-soft: #c3c8d0; --hint: #9ca3af;
  --line: #4a505b; --line-soft: rgba(243, 242, 238, .12); --shadow: #4a505b;
  --btn: #f3f2ee; --on-btn: #111318; --focus: #93c5fd;
  --primary: #262b34; --on-primary: #f3f2ee; --primary-line: #f3f2ee;
  --go: #22c55e; --ok: #4ade80; --ok-bg: rgba(74, 222, 128, .14);
  --bad: #f87171; --bad-bg: rgba(248, 113, 113, .14);
  --chip-ok: rgba(74, 222, 128, .16); --on-chip-ok: #4ade80; --chip-bad: rgba(248, 113, 113, .16); --on-chip-bad: #f87171;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not(.tg) {
    --canvas: #101216; --surface: #1a1d23; --surface-2: #252932;
    --ink: #f3f2ee; --ink-soft: #c3c8d0; --hint: #9ca3af;
    --line: #4a505b; --line-soft: rgba(243, 242, 238, .12); --shadow: #4a505b;
    --btn: #f3f2ee; --on-btn: #111318; --focus: #93c5fd;
    --primary: #262b34; --on-primary: #f3f2ee; --primary-line: #f3f2ee;
    --go: #22c55e; --ok: #4ade80; --ok-bg: rgba(74, 222, 128, .14);
    --bad: #f87171; --bad-bg: rgba(248, 113, 113, .14);
    --chip-ok: rgba(74, 222, 128, .16); --on-chip-ok: #4ade80; --chip-bad: rgba(248, 113, 113, .16); --on-chip-bad: #f87171;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--canvas); color: var(--ink); }
body {
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.i { width: 20px; height: 20px; flex: none; }
/* текст лише для скрінрідерів */
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* У повноекранному режимі Telegram накладає свої кнопки (Закрити / ⋯) зверху —
   відступаємо на системну safe area + content safe area, які SDK передає CSS-змінними */
.app {
  max-width: 640px; margin: 0 auto;
  padding: calc(16px + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)) 16px
           calc(32px + var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px));
}
.muted { color: var(--hint); }
.small { font-size: 14px; }
.center { text-align: center; }

/* натискання: «втискаємо» картку в її тінь — без зсуву сусідів */
.pressable, .card, .tile, .row:not(.row--static), .btn, .opt, .pill, .star, .plan, .choice, .linkbox__btn {
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease),
              background-color var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}

/* кнопка «Назад» лише поза Telegram (у Telegram — нативна BackButton) */
.webback {
  display: none; position: sticky; top: 0; z-index: 5; align-items: center; gap: 4px;
  width: 100%; min-height: 48px; padding: 0 12px; border: 0; border-bottom: var(--bw) solid var(--line-soft);
  background: var(--canvas); color: var(--ink); font-weight: 700; text-align: left;
}
.webback .i { width: 22px; height: 22px; }
body.has-back .webback { display: flex; }

/* ---------- маскот ---------- */
.mascot { display: inline-flex; flex: none; }
.mascot svg { width: 100%; height: 100%; }
.mascot--card { width: 44px; height: 52px; }
.mascot--banner { width: 72px; height: 66px; }
.mascot--big { display: flex; width: 132px; height: 152px; margin: 8px auto 0; }

/* ---------- екран завантаження ---------- */
/* Зебра-світлофор чекає на зелене: на «гриві» горить червоний, голова дивиться ліворуч-праворуч (як за ПДР перед
   переходом). Коли застосунок готовий, .boot--go вмикає зелене: Зебра підстрибує, «Рушаймо!» — і пів секунди на це.
   Ряди 1fr / auto / 1fr тримають сцену по центру, а підказка про повільний інтернет з’являється знизу без зсуву */
.boot {
  position: fixed; inset: 0; z-index: 30; display: grid; grid-template-rows: 1fr auto 1fr; justify-items: center;
  background: var(--canvas); transition: opacity 200ms var(--ease);
  --red: #ef4444; --green: #22c55e; --lamp-off: #374151;
}
.boot--out { opacity: 0; pointer-events: none; }
/* з’являємося з невеликою затримкою: якщо застосунок готовий одразу, екран не блимає */
.boot__in {
  grid-row: 2; display: flex; flex-direction: column; align-items: center; width: 100%;
  animation: boot-in 320ms var(--ease) 150ms both;
}
.boot__zebra { display: block; width: 150px; height: 199px; overflow: visible; }
.boot__body, .boot__tilt { transform-box: fill-box; transform-origin: 50% 100%; }

/* оглядається: риси обличчя їдуть убік (смуги вдвічі менше), голова трохи нахиляється — пласкій «поворот» */
.boot__tilt, .boot__face, .boot__stripes { animation: boot-look 3.2s var(--ease) infinite; }
.boot__tilt { --rot: 3deg; }
.boot__face { --dx: 7px; --rot: 0deg; }
.boot__stripes { --dx: 3px; --rot: 0deg; }
.boot__eye { transform-box: fill-box; transform-origin: center; animation: boot-blink 3.2s ease-in-out infinite; }
.boot__joy, .boot__grin { opacity: 0; }

/* світлофор: корпус обведено --line, щоб не зникав на темному полотні */
.boot__case { fill: #1f2937; stroke: var(--line); stroke-width: 3; }
.boot__lamp { fill: var(--lamp-off); transition: fill 120ms; }
.boot__lamp--red { fill: var(--red); }
.boot__shine { fill: #fff; opacity: 0; }
.boot__shine--red { opacity: .75; }
.boot__halo { fill: none; stroke-width: 3; opacity: 0; transform-box: fill-box; transform-origin: center; }
.boot__halo--red { stroke: var(--red); animation: boot-ping 1.6s ease-out infinite; }
.boot__halo--green { stroke: var(--green); }

.boot__say { display: grid; margin: 24px 0 0; font-size: 16px; font-weight: 800; color: var(--ink-soft); }
.boot__say span { grid-area: 1 / 1; text-align: center; transition: opacity 160ms, transform 160ms var(--ease); }
.boot__go { opacity: 0; transform: translateY(6px); color: var(--ok); }

/* зелене — рушаймо. Якщо сцена ще не встигла проявитись (швидкий старт), проявляємо її одразу */
.boot--go .boot__in { animation-delay: 0s; }
.boot--go .boot__lamp--red { fill: var(--lamp-off); }
.boot--go .boot__lamp--green { fill: var(--green); }
.boot--go .boot__shine--red { opacity: 0; }
.boot--go .boot__shine--green { opacity: .75; }
.boot--go .boot__halo--red { animation: none; }
.boot--go .boot__halo--green { animation: boot-ping 600ms ease-out; }
.boot--go .boot__tilt, .boot--go .boot__face, .boot--go .boot__stripes { animation: none; }
.boot--go .boot__body { animation: boot-hop 420ms var(--ease); }
.boot--go .boot__eye, .boot--go .boot__smile { opacity: 0; }
.boot--go .boot__joy, .boot--go .boot__grin { opacity: 1; }
.boot--go .boot__wait { opacity: 0; transform: translateY(-6px); }
.boot--go .boot__go { opacity: 1; transform: none; }
.boot--go .boot__slow { visibility: hidden; }

.boot__slow {
  grid-row: 3; align-self: start; max-width: 300px; margin-top: 32px; padding: 0 16px;
  text-align: center; color: var(--hint); font-size: 15px;
  animation: boot-in 320ms var(--ease) 8s both;
}
.boot__slow p { margin: 0; }
.boot__slow b { color: var(--ink); }
.boot__slow .btn { width: auto; min-height: 44px; margin: 16px auto 0; padding: 8px 24px; font-size: 16px; }

@keyframes boot-in { from { opacity: 0; visibility: hidden; transform: scale(.96); } }
@keyframes boot-look {
  0%, 12%, 50%, 62%, 100% { transform: none; }
  20%, 42% { transform: translateX(calc(var(--dx, 0px) * -1)) rotate(calc(var(--rot, 0deg) * -1)); }
  70%, 92% { transform: translateX(var(--dx, 0px)) rotate(var(--rot, 0deg)); }
}
/* кліпає, коли дивиться прямо */
@keyframes boot-blink { 0%, 52%, 60%, 100% { transform: none; } 56% { transform: scaleY(.1); } }
@keyframes boot-ping { from { opacity: .7; transform: none; } to { opacity: 0; transform: scale(2); } }
@keyframes boot-hop {
  35% { transform: translateY(-16px); }
  70% { transform: scale(1.04, .94); }
}

/* ---------- головна ---------- */
.hero {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 12px;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh); padding: 16px 16px 14px; overflow: hidden;
}
.hero__text { min-width: 0; }
.hero__hi { font-size: 14px; font-weight: 700; color: var(--hint); }
.hero__name {
  margin-top: 2px; font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1.15; letter-spacing: -.01em;
  overflow-wrap: anywhere; text-wrap: balance;
}
.hero__sub { grid-column: 1 / -1; margin: 12px 0 0; font-size: 15px; color: var(--ink-soft); }
.hero__foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 14px; }
.hero__meta { margin: 0; font-size: 14px; color: var(--hint); }
.hero__meta b { color: var(--ink); }

/* аватарка-монетка: фото з Telegram, на звороті — Зебра. Монетка — сусідка картки (не в ній), бо при скролі
   картка гасне, а монетка перелітає в міні-шапку; місце в сітці тримає .hero__me, позицію ставить dockHero() */
.hero-wrap { position: relative; }
.hero-wrap .hero { transform-origin: 50% 0; }
.hero__me { width: 72px; height: 72px; flex: none; }
.coin {
  position: absolute; left: 18px; top: 18px; z-index: 12; width: 72px; height: 72px; padding: 0; border: 0; border-radius: 50%;
  background: none; perspective: 500px; container-type: size; will-change: transform;
}
.coin__in {
  position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateY(var(--turn, 0deg));
  transition: transform 900ms cubic-bezier(.2, .85, .25, 1.12);
}
.coin__face {
  position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; border-radius: 50%;
  border: var(--bw) solid var(--line); background: var(--surface-2); transform: rotateY(0deg);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.coin__face--back { transform: rotateY(180deg); }
.coin__face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.coin__face svg { width: 84%; height: 84%; margin-top: 8%; }
.coin__letter { font-family: var(--font-display); font-size: 42cqw; font-weight: 700; line-height: 1; }

/* верхній ряд головної: у повноекранному Telegram — між кнопками «Закрити» і «⌄ ⋯» (content safe area),
   поза ним — смуга 46px згори (її резервує .app.is-home). Спершу там назва «Зебра»; при скролі вона ховається,
   і з'являється міні-шапка профілю. Усе веде dockHero() через --dock-title, --dock-bar і --dock-q */
.app.is-home { padding-top: calc(16px + var(--tg-safe-area-inset-top, 0px) + max(46px, var(--tg-content-safe-area-inset-top, 0px))); }
.dock, .brand, .mini { --dock-row: max(46px, var(--tg-content-safe-area-inset-top, 0px)); }
.brand {
  position: fixed; z-index: 11; left: 50%; top: calc(var(--tg-safe-area-inset-top, 0px) + var(--dock-row) / 2); margin: 0;
  font-size: 20px; line-height: 1; white-space: nowrap; pointer-events: none;
  opacity: var(--dock-title, 1); transform: translate(-50%, calc(-50% - (1 - var(--dock-title, 1)) * 8px));
}
.dock {
  position: fixed; inset: 0 0 auto; z-index: 10; height: calc(var(--tg-safe-area-inset-top, 0px) + var(--dock-row));
  background: var(--canvas); border-bottom: 1.5px solid var(--line-soft); opacity: var(--dock-bar, 0); pointer-events: none;
}
.mini {
  position: fixed; z-index: 11; left: 50%; top: calc(var(--tg-safe-area-inset-top, 0px) + var(--dock-row) / 2);
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 2px; transform: translate(-50%, -50%);
  border: var(--bw) solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); box-shadow: 2px 2px 0 var(--shadow);
  opacity: clamp(0, calc(var(--dock-q, 0) * 6), 1); pointer-events: none;
  /* розгортається вправо від аватарки, що вже «приземлилась» */
  clip-path: inset(-4px calc((1 - var(--dock-q, 0)) * (100% - 30px)) -4px -4px round 999px);
}
.is-docked .mini { pointer-events: auto; }
.mini__me { position: relative; flex: none; width: 26px; height: 26px; perspective: 300px; container-type: size; visibility: hidden; }
.is-docked .mini__me { visibility: visible; }
.is-docked .hero-wrap > .coin { visibility: hidden; }
/* смуга вужчає на вузьких екранах, щоб пігулка не налазила на кнопки Telegram (і на довше «Закрити») */
.mini__bar { width: clamp(36px, 100vw - 345px, 84px); height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.mini__bar span { display: block; height: 100%; border-radius: 99px; background: var(--go); }
.mini__pct { min-width: 30px; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }

.ring { position: relative; width: 66px; height: 66px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring__bg { stroke: var(--surface-2); }
.ring__fg { stroke: var(--go); stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }

.card {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; overflow: hidden;
  margin: 16px 0; padding: 16px; text-align: left;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh);
}
.card--primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary-line); }
/* діагональні смуги переходу праворуч */
.card--primary::after {
  content: ""; position: absolute; inset: 0 0 0 auto; width: 46%; pointer-events: none;
  background: repeating-linear-gradient(115deg, currentColor 0 12px, transparent 12px 24px);
  opacity: .07; -webkit-mask: linear-gradient(90deg, transparent, #000 60%); mask: linear-gradient(90deg, transparent, #000 60%);
}
.card--primary .mascot { background: #fff; border-radius: var(--r-md); padding: 4px; box-sizing: content-box; }
.card__body { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.card__body b { font-family: var(--font-display); font-size: 20px; }
.card__body small { opacity: .8; font-size: 14px; }
.chev { display: grid; place-items: center; color: inherit; opacity: .6; }
.chev .i { width: 22px; height: 22px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 7px; border-radius: 999px;
  font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; background: var(--surface-2); color: var(--ink);
}
.chip .i { width: 15px; height: 15px; stroke-width: 2.5; }
.chip--ok { background: var(--chip-ok); color: var(--on-chip-ok); }
.chip--bad { background: var(--chip-bad); color: var(--on-chip-bad); }
.chip--signal { background: var(--signal); color: var(--on-signal); }
.card .chip { margin-top: 8px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 112px; padding: 14px; text-align: left;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh);
}
.tile b { margin-top: 8px; font-size: 17px; font-weight: 800; }
.tile small { color: var(--hint); font-size: 13px; font-weight: 600; }
.badge {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface-2); color: var(--ink);
}
.badge .i { width: 22px; height: 22px; }
.badge--signal { background: var(--signal); color: var(--on-signal); }
.tile:disabled { cursor: default; box-shadow: none; border-style: dashed; border-color: var(--line-soft); background: transparent; }
.tile:disabled b, .tile:disabled .badge { opacity: .55; }

.pressable:active, .card:active, .tile:not(:disabled):active, .btn:not(:disabled):active, .opt:not(:disabled):active,
.plan:active, .choice:not(:disabled):active {
  transform: translate(2px, 2px); box-shadow: var(--sh-press);
}
.row:not(.row--static):active { background: var(--surface-2); }
.disclaimer { color: var(--hint); font-size: 12px; text-align: center; margin-top: 24px; line-height: 1.45; }
/* вхід на сайті: чий акаунт і «Вийти» (лише поза Telegram) */
.account { display: flex; flex-direction: column; align-items: center; margin-top: 24px; color: var(--hint); font-size: 14px; text-align: center; }
.account b { color: var(--ink); }
.account .linkbtn { margin: 0; color: var(--ink-soft); font-size: 15px; }

/* ---------- заголовки екранів ---------- */
.title { margin: 6px 0 14px; font-size: 24px; }
.title::after { content: ""; display: block; width: 78px; height: 8px; margin-top: 10px; background: var(--stripes); }
.small-title { font-size: 17px; margin-top: 26px; }
.small-title::after { width: 48px; height: 6px; margin-top: 8px; }
.banner {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 14px;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh);
}
.banner h2 { margin: 0 0 4px; font-size: 22px; }
.banner p { margin: 0; }
.intro { text-align: center; margin-bottom: 18px; }
.intro h2 { margin: 10px 0 6px; font-size: 24px; text-wrap: balance; }
.intro p { margin: 0; }

/* ---------- списки ---------- */
.list { background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 12px 14px; text-align: left;
  border: 0; border-bottom: 1.5px solid var(--line-soft); background: transparent;
}
.row:last-child { border-bottom: 0; }
.row__icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); }
.row__icon.is-ok { background: var(--ok-bg); color: var(--ok); }
.row__icon.is-bad { background: var(--bad-bg); color: var(--bad); }
.row__body { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.row__body b { font-weight: 700; }
.row .chev { opacity: .45; }
/* прогрес — «дорога», заповнена зеленим */
.bar { display: block; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 99px; background: var(--go); }

/* ---------- питання ---------- */
.qhead { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; min-height: 44px; }
.qhead .muted { flex: 1; font-weight: 700; }
.timer.warn { background: var(--bad); color: #fff; }
.errs { color: var(--bad); background: var(--bad-bg); }
.star {
  display: grid; place-items: center; width: 44px; height: 44px; margin-right: -6px;
  border: 0; border-radius: 12px; background: transparent; color: var(--hint);
}
.star .i { width: 24px; height: 24px; }
.star.on { color: #eab308; }
.star.on .i { fill: var(--signal); stroke: #a16207; }
.progress { height: 10px; border-radius: 99px; background: var(--surface); border: var(--bw) solid var(--line); overflow: hidden; margin-bottom: 14px; }
.progress span { display: block; height: 100%; background: var(--go); transition: width .3s var(--ease); }
.pills { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px 6px; scrollbar-width: none; }
.pill {
  flex: none; width: 44px; height: 44px; border-radius: 12px; font-size: 15px; font-weight: 800;
  background: var(--surface); border: var(--bw) solid var(--line-soft);
}
.pill.ok { background: var(--go); border-color: var(--go); color: #fff; }
.pill.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.pill.cur { border-color: var(--line); box-shadow: 2px 2px 0 var(--shadow); }

.question { background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); padding: 16px; }
.qimg { display: flex; justify-content: center; margin-bottom: 14px; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); }
.qimg--sm { padding: 8px; }
.qimg--sm .sign { width: 90px; height: 90px; }
.sign { width: 140px; height: 140px; }
img.sign { object-fit: contain; }
.sign--tall { width: 92px; height: 140px; }
.sign.scene { width: 100%; max-width: 300px; height: auto; border-radius: 10px; }
.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { fill: #3a3a3a; filter: none; } }
.qtext { font-size: 18px; font-weight: 800; line-height: 1.4; margin: 0 0 10px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; padding: 3px 10px 3px 8px;
  border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); font-size: 13px; font-weight: 700;
}
.tag .i { width: 15px; height: 15px; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; gap: 12px; align-items: flex-start; min-height: 52px; padding: 12px; text-align: left; line-height: 1.4;
  border-radius: var(--r-md); border: var(--bw) solid var(--line); background: var(--surface); box-shadow: 2px 2px 0 var(--shadow);
}
.opt__n {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px;
  border: var(--bw) solid var(--line); font-size: 13px; font-weight: 800;
}
.opt:disabled { cursor: default; color: inherit; box-shadow: none; }
.opt--ok { border-color: var(--ok); background: var(--ok-bg); }
.opt--ok .opt__n { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.opt--bad { border-color: var(--bad); background: var(--bad-bg); }
.opt--bad .opt__n { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.opt--dim { opacity: .5; border-color: var(--line-soft); }
.explain { margin-top: 14px; padding: 12px 14px; border-radius: var(--r-md); border-left: 5px solid; font-size: 15px; }
.explain b { display: inline-flex; align-items: center; gap: 6px; vertical-align: top; }
.explain b .i { width: 18px; height: 18px; stroke-width: 2.5; }
.explain.ok { background: var(--ok-bg); border-color: var(--ok); }
.explain.ok b { color: var(--ok); }
.explain.bad { background: var(--bad-bg); border-color: var(--bad); }
.explain.bad b { color: var(--bad); }

.actions { margin-top: 18px; }
.actions--col { display: flex; flex-direction: column; gap: 12px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; padding: 14px;
  border: var(--bw) solid var(--btn); border-radius: var(--r-md); box-shadow: var(--sh);
  background: var(--btn); color: var(--on-btn); font-size: 17px; font-weight: 800;
}
a.btn { text-decoration: none; }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn--danger { background: var(--surface); color: var(--bad); border-color: var(--bad); box-shadow: 3px 3px 0 var(--bad); }
.btn--danger:active { box-shadow: 1px 1px 0 var(--bad); }
.btn:disabled { cursor: default; opacity: .5; box-shadow: none; }

/* ---------- результат ---------- */
.verdict { font-family: var(--font-display); font-size: 24px; font-weight: 700; text-align: center; margin: 10px 0 6px; }
.verdict.ok { color: var(--ok); }
.verdict.bad { color: var(--bad); }
.score { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.score div {
  display: flex; flex-direction: column; padding: 12px 6px; text-align: center;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh);
}
.score b { font-family: var(--font-display); font-size: 22px; font-variant-numeric: tabular-nums; }
.score small { color: var(--hint); font-size: 12px; font-weight: 700; }
.review { background: var(--surface); border: var(--bw) solid var(--line-soft); border-radius: var(--r-lg); padding: 14px; margin-bottom: 12px; }
.review .qtext { font-size: 16px; }
.ans { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; font-size: 15px; font-weight: 700; }
.ans .i { width: 18px; height: 18px; margin-top: 2px; stroke-width: 2.75; }
.ans.ok { color: var(--ok); }
.ans.bad { color: var(--bad); }

/* ---------- теорія ---------- */
.prose { background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); padding: 18px; }
.prose__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--signal); color: var(--on-signal); }
.prose__icon .i { width: 24px; height: 24px; }
.prose h2 { margin: 12px 0 8px; font-size: 21px; }
.prose h4 { margin: 18px 0 4px; font-size: 16px; font-weight: 800; }
.prose li { margin: 6px 0; }
.prose .sign-groups li { margin: 12px 0; }
.sign-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 2px; }
.sign-row .sign { width: auto; height: 44px; }

/* ---------- каталог знаків ---------- */
/* «Усі знаки розділу» під темою в «Темах»: продовження рядка теми, відступ — під текстом теми */
.row--has-sub { border-bottom: 0; padding-bottom: 4px; }
.row--sub { min-height: 44px; padding: 2px 14px 12px 62px; }
.row.row--sub:active { background: transparent; }
.sublink {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 10px; border-radius: 999px;
  background: var(--surface-2); font-size: 14px; font-weight: 800;
}
.sublink .i { width: 16px; height: 16px; }
.row--sub:active .sublink { background: var(--line-soft); }
/* пошук + перемикач «плиткою / списком» */
.cat-tools { display: flex; gap: 10px; }
.search {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 12px; color: var(--hint);
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh);
}
.search:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
/* 16px — інакше iOS збільшує сторінку при фокусі */
.search input { flex: 1; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--ink); font: 700 16px/1.4 var(--font); }
.search input:focus { outline: none; }
.search input::placeholder { color: var(--hint); opacity: 1; }
.seg {
  display: flex; gap: 2px; padding: 2px;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh);
}
.seg__btn { display: grid; place-items: center; width: 44px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-soft); }
.seg__btn[aria-pressed="true"] { background: var(--btn); color: var(--on-btn); }
.sgroup .small-title small { display: block; margin-bottom: 2px; color: var(--hint); font: 700 13px/1.4 var(--font); }
.sgroup__note { margin: -4px 0 14px; }
.sgroup[hidden], .stile[hidden], .srow[hidden] { display: none; }
.cat-empty { margin-top: 28px; }
/* номер знака */
.snum {
  display: inline-block; padding: 1px 7px; border-radius: 7px; background: var(--surface-2); color: var(--ink);
  font-size: 12px; font-weight: 800; line-height: 1.5; font-variant-numeric: tabular-nums;
}
/* плитка: на телефоні — дві в ряд, інакше довгі українські слова в назвах не влазять */
.signs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.stile {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 8px 10px; text-align: center;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-md); box-shadow: 2px 2px 0 var(--shadow);
}
.stile:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--shadow); }
.stile .snum { align-self: flex-start; }
.stile img { width: 72px; height: 72px; object-fit: contain; }
.stile__t { font-size: 14px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
/* список */
.srow__img { display: grid; place-items: center; flex: none; width: 48px; height: 48px; }
.srow__img img { width: 48px; height: 48px; object-fit: contain; }
.srow .row__body { gap: 2px; }
.srow .snum { align-self: flex-start; }
/* картка знака */
.sign-card .qimg .sign { width: 100%; max-width: 220px; height: 160px; }
.sign-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sign-card ul { padding-left: 22px; }
.sign-card li p { margin: 0; }
/* посилання на інший знак в описі: мініатюра + номер */
.sref {
  display: inline-flex; align-items: center; gap: 4px; margin: 1px 0; padding: 2px 8px 2px 4px; vertical-align: middle;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; box-shadow: 1.5px 1.5px 0 var(--shadow);
  font-size: 14px; font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums;
}
.sref img { width: 22px; height: 22px; object-fit: contain; }
button.sref:active { transform: translate(1px, 1px); box-shadow: none; }
.sref--self { border-color: var(--line-soft); box-shadow: none; }
/* попередній / наступний знак */
.snav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.snav__btn { gap: 6px; font-variant-numeric: tabular-nums; }
.snav__btn img { width: 28px; height: 28px; object-fit: contain; }
.snav + p { margin-top: 12px; }
/* екстрені виклики в картці домедичної допомоги */
.calls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.call {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; padding: 10px 6px;
  border: var(--bw) solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh);
  background: var(--surface); color: var(--ink); text-align: center; text-decoration: none;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.call:active { transform: translate(2px, 2px); box-shadow: var(--sh-press); }
.call .i { width: 18px; height: 18px; }
.call b { font-family: var(--font-display); font-size: 20px; font-variant-numeric: tabular-nums; }
.call small { color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.call--main {
  grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; justify-content: center; column-gap: 10px; padding: 14px;
  border-color: var(--sos); background: var(--sos); color: var(--on-sos);
}
.call--main .i { width: 22px; height: 22px; }
.call--main b { font-size: 24px; }
.call--main small { flex-basis: 100%; color: var(--on-sos); opacity: .9; }
.prose .note { background: var(--surface-2); border-left: 5px solid var(--signal); border-radius: 10px; padding: 10px 12px; font-size: 15px; }
.cheat { width: 100%; border-collapse: collapse; font-size: 15px; }
.cheat th { text-align: left; padding: 16px 0 6px; font-size: 15px; font-weight: 800; }
.cheat td { padding: 8px 0; border-bottom: 1.5px solid var(--line-soft); vertical-align: top; }
.cheat td:last-child { text-align: right; font-weight: 800; white-space: nowrap; padding-left: 10px; font-variant-numeric: tabular-nums; }
/* описові таблиці конспектів: текст у кожній колонці, з переносами */
.cheat--text { table-layout: fixed; }
.cheat--text td, .cheat--text th { overflow-wrap: anywhere; hyphens: auto; }
.cheat--text td { padding-right: 10px; }
.cheat--text td + td { padding-left: 10px; }
.cheat--text td:last-child { text-align: left; font-weight: 400; white-space: normal; padding-right: 0; }
.cheat--text th + th { padding-left: 10px; }

/* ---------- преміум, друзі, paywall ---------- */
/* статус плану на головній: маленький чіп, але зона дотику ≥ 44px */
.plan {
  position: relative; display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 4px 11px 4px 8px;
  border: var(--bw) solid var(--line); border-radius: 999px; box-shadow: 2px 2px 0 var(--shadow);
  background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.plan::before { content: ""; position: absolute; inset: -7px -4px; }
.plan .i { width: 16px; height: 16px; }
.plan--on { background: var(--signal); color: var(--on-signal); }
.plan:active { box-shadow: 0 0 0 var(--shadow); }

/* замок на платних функціях */
.lock {
  display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px;
  background: var(--signal); color: var(--on-signal);
}
.lock .i { width: 15px; height: 15px; stroke-width: 2.5; }
.tile .lock { position: absolute; top: 12px; right: 12px; }
.tile:disabled .lock { opacity: .55; }

.card--promo .card__body b { font-size: 17px; }
.banner__status { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.banner__status h2 { margin: 0; }
.intro .chip { margin-top: 12px; }

/* статичний блок-картка */
.panel { margin: 16px 0; padding: 14px 16px; background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); }
.panel__head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.panel__head b { flex: 1; min-width: 0; font-weight: 800; }
.panel .bar { margin-bottom: 8px; }
.panel small { display: block; font-size: 14px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px; color: var(--hint); font-weight: 700; }
.empty { display: flex; align-items: center; gap: 14px; }
.empty p { margin: 0; font-size: 15px; }
.mascot--empty { width: 56px; height: 56px; }

/* повідомлення про стан: завантаження, очікування оплати, помилка */
.notice {
  display: flex; align-items: flex-start; gap: 12px; margin: 16px 0; padding: 12px 14px;
  border-radius: var(--r-md); border-left: 5px solid var(--line); background: var(--surface-2); font-size: 15px;
}
.notice > .i, .notice > .spin { width: 22px; height: 22px; margin-top: 1px; }
.notice > .i { stroke-width: 2.25; }
.notice b { display: block; font-weight: 800; }
.notice small { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 14px; }
.notice--bad { background: var(--bad-bg); border-color: var(--bad); }
.notice--bad > .i { color: var(--bad); }
.linkbtn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0; margin-bottom: -10px;
  border: 0; background: none; font-weight: 800; text-decoration: underline; text-underline-offset: 3px;
}

.spin { display: inline-grid; place-items: center; flex: none; }
.spin .i { width: 22px; height: 22px; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* вибір пакета / способу оплати (radiogroup) */
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 12px 14px; text-align: left;
  background: var(--surface); border: var(--bw) solid var(--line-soft); border-radius: var(--r-md);
}
.choice[aria-checked="true"] { border-color: var(--line); box-shadow: var(--sh); }
.choice:disabled { cursor: default; opacity: .6; }
.choice__dot {
  display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%;
  border: var(--bw) solid var(--line); color: var(--on-btn);
}
.choice__dot .i { width: 14px; height: 14px; stroke-width: 3; opacity: 0; }
.choice[aria-checked="true"] .choice__dot { background: var(--btn); border-color: var(--btn); }
.choice[aria-checked="true"] .choice__dot .i { opacity: 1; }
.choice__body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.choice__body b { font-weight: 800; }
.choice__body small { color: var(--hint); font-size: 13px; font-weight: 600; }
.choice__price { font-family: var(--font-display); font-size: 18px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.choice__icon { display: grid; place-items: center; color: var(--ink-soft); }
/* план «Скоро»: видно, але не вибирається */
.choice--soon, .choice--soon .choice__dot { border-style: dashed; }
.choice--soon:disabled { opacity: 1; }
.choice--soon .choice__body, .choice--soon .choice__price { opacity: .55; }
.choice__side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }

/* реферальне посилання + «Копіювати» */
.linkbox {
  display: flex; align-items: center; gap: 8px; margin: 14px 0 0; padding: 6px 6px 6px 14px;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh);
}
.linkbox__url {
  flex: 1; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--ink-soft);
  font: 700 16px/1.4 var(--font); text-overflow: ellipsis;
}
.linkbox__url:focus { outline: none; }
.linkbox:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.linkbox__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none; min-width: 124px; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: var(--r-sm); background: var(--surface-2); font-size: 15px; font-weight: 800;
}
.linkbox__btn .i { width: 18px; height: 18px; }
.linkbox__btn.is-done { background: var(--ok-bg); color: var(--ok); }
.linkbox__btn:active { transform: translate(1px, 1px); }
.hint-ok { display: flex; align-items: center; gap: 6px; margin: 10px 2px 0; color: var(--ok); font-size: 14px; font-weight: 700; }
.hint-ok .i { width: 16px; height: 16px; stroke-width: 2.5; }

/* друзі */
.avatar {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-2); font-weight: 800;
}
.fstatus { display: inline-flex; align-items: center; gap: 5px; color: var(--hint); font-size: 13px; font-weight: 700; }
.fstatus .i { width: 15px; height: 15px; stroke-width: 2.5; }
.fstatus.is-ok { color: var(--ok); }

/* рейтинг */
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lb { gap: 10px; }
.lb--me { background: var(--surface-2); box-shadow: inset 5px 0 0 var(--signal); }
.lb--me .avatar { background: var(--surface); }
.lb .row__body b { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lb .chip { padding: 1px 8px; font-size: 12px; }
.place {
  display: grid; place-items: center; flex: none; min-width: 30px; height: 30px; padding: 0 5px; border-radius: 999px;
  font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--hint);
}
.place--1, .place--2, .place--3 { border: var(--bw) solid var(--line); color: var(--on-signal); }
.place--1 { background: var(--signal); }
.place--2 { background: var(--silver); }
.place--3 { background: var(--bronze); }
.lb__score { display: flex; flex-direction: column; align-items: flex-end; flex: none; line-height: 1.2; }
.lb__score b { font-family: var(--font-display); font-size: 18px; font-variant-numeric: tabular-nums; }
.lb__score small { color: var(--hint); font-size: 12px; font-weight: 700; }
/* перемикач «Тиждень / Весь час» */
.tabs {
  display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; gap: 4px; margin-bottom: 16px; padding: 4px;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh);
}
.tab {
  min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--ink-soft); font-size: 15px; font-weight: 800;
  transition: background-color var(--t-base) var(--ease), color var(--t-base) var(--ease);
}
.tab[aria-selected="true"] { background: var(--btn); color: var(--on-btn); }
/* призи тижня */
.panel__head .chip { flex: none; }
.prizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.prize {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px 8px;
  border-radius: var(--r-md); background: var(--surface-2); text-align: center;
}
.prize .place { margin-bottom: 4px; }
.prize b { font-family: var(--font-display); font-size: 20px; font-variant-numeric: tabular-nums; }
.panel .prize small { display: block; color: var(--hint); font-size: 12px; font-weight: 700; }
/* розрив між топом і власним рядком, коли користувач нижче */
.lb__gap { width: 30px; height: 18px; margin: 4px auto; background: radial-gradient(circle, var(--hint) 2.5px, transparent 3px) 0 50% / 10px 10px repeat-x; }

@media (max-width: 360px) {
  .hero__name { font-size: 21px; }
  .hero__me { width: 60px; height: 60px; }
  .grid { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; animation-iteration-count: 1 !important; }
  .pressable:active, .card:active, .tile:active, .btn:active, .opt:active, .plan:active, .choice:active { transform: none; }
  /* без руху: Зебра просто стоїть на червоне */
  .boot__tilt, .boot__face, .boot__stripes, .boot__eye, .boot__halo { animation: none !important; }
}
