/* Beske, дизайн «Маркер»: белый фон, синий акцент, пастельные блоки, круглые кнопки */
:root {
  --bg: #fff; --card: #fff; --soft: #eef2fb; --line: #dfe5f2;
  --ink: #17233f; --muted: #525c76; --accent: #2457e6; --btn: #2457e6; --on-accent: #fff; --accent-soft: #e3ecff;
  --yellow: #ffe9a3; --pink: #ffdcd3; --mint: #d3f2df; --blue: #e3ecff;
  --ok: #1d7a45; --ok-soft: #e0f6e6; --bad: #b93b27; --bad-soft: #ffe6e1;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111624; --card: #191f31; --soft: #222a40; --line: #313a56;
    --ink: #e4e9f7; --muted: #a8b1ca; --accent: #8aabff; --btn: #3866e8; --on-accent: #fff; --accent-soft: #222f55;
    --yellow: #3a3318; --pink: #412927; --mint: #1c382d; --blue: #1f2b4f;
    --ok: #7fd6a2; --ok-soft: #193b2b; --bad: #ff9f8e; --bad-soft: #43261f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #111624; --card: #191f31; --soft: #222a40; --line: #313a56;
    --ink: #e4e9f7; --muted: #a8b1ca; --accent: #8aabff; --btn: #3866e8; --on-accent: #fff; --accent-soft: #222f55;
    --yellow: #3a3318; --pink: #412927; --mint: #1c382d; --blue: #1f2b4f;
    --ok: #7fd6a2; --ok-soft: #193b2b; --bad: #ff9f8e; --bad-soft: #43261f; color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 17px/1.55 "Rubik", system-ui, "Segoe UI", Roboto, sans-serif;
  transition: background-color .25s, color .25s;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pic { display: block; max-width: 100%; }
svg:not(.pic) { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wrap { width: min(880px, 100% - 32px); margin-inline: auto; }

/* шапка */
.top-in { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 24px; }
.logo b { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--btn); color: #fff; font-size: 22px; }
.tools { display: flex; align-items: center; gap: 10px; }
.seg { display: flex; padding: 4px; gap: 2px; background: var(--blue); border-radius: 99px; }
.seg button { min-width: 48px; height: 34px; padding: 0 12px; border-radius: 99px; font-size: 14px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--card); font-weight: 700; }
.icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--blue); }
.icon svg { width: 21px; height: 21px; }
.icon .sun { display: none; }
:root[data-dark="1"] .icon .sun { display: block; }
:root[data-dark="1"] .icon .moon { display: none; }

main { padding: 28px 0 64px; }
.view { animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

h1 { font-size: clamp(32px, 6.4vw, 54px); line-height: 1.08; letter-spacing: -.025em; font-weight: 800; text-wrap: balance; }
h2 { font-size: clamp(22px, 3.4vw, 28px); font-weight: 800; margin: 44px 0 16px; }
.lead { color: var(--muted); margin: 14px auto 0; max-width: 46ch; font-size: 18px; }
.card { background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 20px; }

/* главная */
.hero { text-align: center; padding-top: 12px; }
.cta { margin-top: 24px; padding: 16px 32px; border-radius: 99px; background: var(--btn); color: #fff; font-weight: 700; }
.art { display: flex; justify-content: center; align-items: center; gap: clamp(8px, 5vw, 56px); margin-top: 34px; padding: 26px 16px; border-radius: 24px; background: var(--blue); }
.art .pic { width: clamp(80px, 18vw, 160px); aspect-ratio: 7 / 6; }
.row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 22px; align-items: center; width: 100%; text-align: left; padding: 18px 24px 18px 18px; margin-bottom: 12px; border-radius: 18px; background: var(--yellow); transition: transform .15s; }
.row + .row { background: var(--pink); }
.row + .row + .row { background: var(--mint); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; list-style: none; }
.steps li { padding: 20px; border-radius: 18px; background: var(--pink); }
.steps li:nth-child(2) { background: var(--mint); }
.steps li:nth-child(3) { background: var(--blue); }
.steps b { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 12px; border-radius: 50%; background: var(--card); font-weight: 800; }
.steps strong { display: block; font-size: 19px; font-weight: 800; }
.steps p { margin-top: 4px; color: var(--muted); font-size: 15px; }
.row:hover:not(:disabled) { transform: translateY(-2px); }
.row .pic { width: 100%; aspect-ratio: 7 / 6; }
.row strong { display: block; font-size: 21px; line-height: 1.25; font-weight: 800; }
.row small { display: block; margin-top: 4px; color: var(--muted); font-size: 15px; }
.row em { font-style: normal; font-weight: 500; font-size: 15px; padding: 10px 20px; border-radius: 99px; background: var(--card); }

/* страница предмета */
.back { padding: 4px 0 14px; color: var(--muted); font-weight: 500; font-size: 15px; }
.subject { background: var(--yellow); border-radius: 24px; padding: 24px; }
.subject-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.subject-head h1 { font-size: clamp(23px, 4.4vw, 34px); line-height: 1.18; overflow-wrap: anywhere; }
.subject-head p { margin-top: 8px; color: var(--muted); font-size: 15px; }
.subject-head .pic { width: 150px; flex: none; aspect-ratio: 7 / 6; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; }
.stat { background: var(--card); border-radius: 14px; padding: 10px 12px; }
.stat b { display: block; font-size: 24px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.stat.ok b { color: var(--ok); }
.stat.bad b { color: var(--bad); }

.modes { display: grid; gap: 10px; }
.mode { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 16px 18px; background: var(--card); border: 2px solid var(--line); border-radius: 18px; transition: border-color .15s, transform .15s; }
.mode:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.mode:disabled { opacity: .55; }
.mode i { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.mode i svg { width: 22px; height: 22px; }
.mode strong { display: block; font-weight: 600; }
.mode small { display: block; font-size: 14px; color: var(--muted); line-height: 1.4; }
.mode.main { background: var(--btn); border-color: var(--btn); color: var(--on-accent); }
.mode.main small { color: inherit; opacity: .85; }
.mode.main i { background: rgb(255 255 255 / .18); color: inherit; }

/* карта прогресса по блокам */
.blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.block { position: relative; overflow: hidden; padding: 12px 8px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 15px; transition: border-color .15s; }
.block:hover { border-color: var(--accent); }
.block small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.block u { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--ok); }
.block.done { border-color: var(--ok); background: var(--ok-soft); }

.note { margin-top: 28px; color: var(--muted); font-size: 15px; }
.link { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: 15px; padding: 8px 0; margin-top: 4px; }

/* тест */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar button { padding: 8px 0; font-weight: 500; }
.timer.low { color: var(--bad); font-weight: 600; }
.track { height: 6px; border-radius: 6px; background: var(--soft); overflow: hidden; margin: 6px 0 22px; }
.track u { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .35s ease; }
.question { font-size: clamp(20px, 4.4vw, 23px); line-height: 1.45; font-weight: 700; margin-bottom: 20px; overflow-wrap: anywhere; }
.options { display: grid; gap: 10px; list-style: none; }
.option { display: flex; gap: 14px; align-items: flex-start; width: 100%; text-align: left; padding: 15px 16px; background: var(--card); border: 2px solid var(--line); border-radius: 14px; line-height: 1.45; overflow-wrap: anywhere; transition: border-color .15s, background-color .15s; }
.fresh .option { animation: rise .3s ease both; animation-delay: calc(var(--n) * 35ms); }
.option:hover:not(:disabled) { border-color: var(--accent); }
.option b { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--blue); font-size: 14px; font-weight: 600; margin-top: -3px; }
.option.picked { border-color: var(--accent); background: var(--accent-soft); }
.option.picked b { background: var(--btn); color: var(--on-accent); }
.option.right { border-color: var(--ok); background: var(--ok-soft); }
.option.right b { background: var(--ok); color: var(--bg); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option.wrong b { background: var(--bad); color: var(--bg); }
.fresh .option.wrong, .option.shake { animation: shake .35s ease; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.why { display: flex; gap: 16px; margin-top: 18px; padding: 18px 20px; border-radius: 18px; background: var(--yellow); animation: rise .3s ease both; }
.why .pic { width: 52px; height: 52px; flex: none; }
.why strong { display: block; margin-bottom: 4px; color: var(--ok); }
.why.bad strong { color: var(--bad); }
.why p + p { margin-top: 8px; }

.nav { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 16px 0 calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 28%); }
.btn { flex: 1; min-height: 52px; padding: 12px 18px; border-radius: 99px; font-weight: 700; background: var(--btn); color: var(--on-accent); transition: opacity .15s; }
.btn:disabled { opacity: .4; }
.btn.ghost { flex: 0 0 auto; background: var(--blue); color: var(--ink); }
.btn.wide { flex: 1; }

/* итог */
.result { text-align: center; padding: 28px 20px; }
.ring { --p: 0; width: 168px; height: 168px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--soft) 0); }
.ring div { width: 136px; height: 136px; border-radius: 50%; background: var(--card); display: grid; place-content: center; font-size: 38px; font-weight: 700; font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.actions .btn { min-width: 200px; }
.review { margin-top: 12px; }
.review .card { margin-bottom: 10px; box-shadow: none; }
.review .q { font-weight: 600; margin-bottom: 10px; }
.review .a { padding: 8px 12px; border-radius: 10px; margin-top: 6px; background: var(--ok-soft); }
.review .a.bad { background: var(--bad-soft); }
.review .e { margin-top: 10px; color: var(--muted); }

@media (max-width: 600px) {
  .steps { grid-template-columns: 1fr; }
  .row { grid-template-columns: 62px minmax(0, 1fr); gap: 12px; padding: 14px; }
  .row strong { font-size: 18px; }
  .row em { grid-column: 2; justify-self: start; padding: 8px 18px; }
  .subject { padding: 18px; }
  .subject-head .pic { display: none; }
}
@media (max-width: 420px) {
  body { font-size: 16px; }
  .logo span { font-size: 21px; }
  .card { padding: 16px; }
  .why { gap: 12px; padding: 16px; }
  .why .pic { width: 36px; height: 36px; }
  .blocks { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
