/* Мастерская дробей — оформление */

:root {
  --ink: #081216;
  --panel: #0f2027;
  --panel-2: #14303a;
  --line: rgba(160, 205, 205, .18);
  --line-strong: rgba(160, 205, 205, .34);
  --text: #e9f3f1;
  --muted: #9ab4b6;
  --accent: #f7b955;
  --accent-strong: #ffd28a;
  --accent-ink: #26190a;
  --mint: #58d3ad;
  --mint-dim: rgba(88, 211, 173, .16);
  --rose: #ff8a7a;
  --rose-dim: rgba(255, 138, 122, .14);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 60px rgba(0, 0, 0, .38);
  --ease: cubic-bezier(.2, .7, .3, 1);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 560px at 12% -8%, rgba(88, 211, 173, .10), transparent 62%),
    radial-gradient(900px 520px at 92% -4%, rgba(247, 185, 85, .10), transparent 58%),
    var(--ink);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(160, 205, 205, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(160, 205, 205, .05) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(1000px 700px at 50% 0%, #000 10%, transparent 85%);
  pointer-events: none;
  z-index: 0;
}

.shell {
  width: min(1140px, 100% - 2 * clamp(16px, 5vw, 48px));
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.12;
  text-wrap: balance;
}

h1 { font-size: clamp(2rem, 4.6vw, 3.35rem); letter-spacing: -.035em; }
h2 { font-size: clamp(1.55rem, 3vw, 2.15rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.4rem); }
h4 { font-size: 1.06rem; letter-spacing: -.01em; }

p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

a { color: inherit; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: .6rem 1rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
  transition: top .18s var(--ease);
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- дроби ---------- */

.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  vertical-align: -.42em;
  line-height: 1.02;
  margin-inline: .12em;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.frac .num { padding: 0 .2em; }
.frac .den { padding: 0 .2em; border-top: 1.6px solid currentColor; }

/* ---------- шапка ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(8, 18, 22, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: clamp(12px, 3vw, 32px);
  min-height: 68px;
  padding-block: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  flex: 0 0 auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(160deg, rgba(247, 185, 85, .22), rgba(247, 185, 85, .06));
  border: 1px solid rgba(247, 185, 85, .35);
  color: var(--accent);
  font-size: 15px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  font-weight: 800;
  font-size: .95rem;
  line-height: 1.05;
  letter-spacing: -.01em;
}

.brand-text em {
  font-style: normal;
  color: var(--muted);
  font-weight: 600;
}

.nav {
  display: flex;
  gap: clamp(10px, 2vw, 22px);
  margin-left: auto;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: .93rem;
  font-weight: 600;
  padding: .35rem .1rem;
  border-bottom: 2px solid transparent;
  transition: color .16s var(--ease), border-color .16s var(--ease);
}

.nav a:hover,
.nav a:focus-visible { color: var(--text); border-bottom-color: var(--accent); }

.header-stats {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--muted);
  white-space: nowrap;
}

.chip-stars { color: var(--accent); border-color: rgba(247, 185, 85, .28); }

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .8rem 1.3rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 650;
  font-size: .97rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease);
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 26px rgba(247, 185, 85, .2);
}

.btn-primary:hover { background: var(--accent-strong); box-shadow: 0 12px 30px rgba(247, 185, 85, .28); }

.btn-ghost {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, .02);
  color: var(--text);
}

.btn-ghost:hover { background: rgba(255, 255, 255, .06); border-color: rgba(160, 205, 205, .5); }

.btn-small { padding: .55rem 1rem; font-size: .88rem; }

.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: .84rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-btn:hover { color: var(--rose); }

/* ---------- общие блоки ---------- */

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .012));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.eyebrow {
  font-family: var(--mono);
  font-size: .76rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mint);
}

.section { padding-block: clamp(48px, 7vw, 96px); scroll-margin-top: 84px; }

.section-head { max-width: 720px; margin-bottom: clamp(24px, 4vw, 40px); }

.section-head h2 { margin-top: .5rem; }

.section-lede {
  margin-top: .9rem;
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 62ch;
}

.subhead { margin: clamp(36px, 5vw, 56px) 0 18px; }

/* ---------- герой ---------- */

.hero {
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  padding-block: clamp(40px, 6vw, 76px) clamp(24px, 4vw, 40px);
  scroll-margin-top: 84px;
}

.hero h1 { margin-top: .7rem; }

.lede {
  margin-top: 1.15rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.08rem);
  max-width: 54ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 1.7rem;
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin-top: 2rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .88rem;
}

.hero-facts strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
}

/* правая карточка */

.hero-art { padding: clamp(18px, 2.4vw, 28px); }

.art-label {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.art-eq { margin-top: 1rem; }

.art-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem;
  font-family: var(--mono);
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  line-height: 1.9;
  padding: .7rem .9rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, .22);
  border: 1px solid var(--line);
}

.art-row .op { color: var(--muted); }
.art-row .paren { color: var(--muted); }

.art-row .factor { color: var(--accent); }

.art-out { border-color: rgba(247, 185, 85, .22); }
.art-out .factor { color: var(--mint); }

.art-arrow {
  text-align: center;
  color: var(--mint);
  font-size: 1.35rem;
  line-height: 1;
  padding: .45rem 0;
  animation: nudge 2.4s var(--ease) infinite;
}

@keyframes nudge {
  0%, 70%, 100% { transform: translateY(0); }
  80% { transform: translateY(4px); }
  90% { transform: translateY(0); }
}

.progress-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.ring-wrap { position: relative; width: 74px; height: 74px; flex: 0 0 auto; }

.ring { width: 100%; height: 100%; transform: rotate(-90deg); }

.ring-track,
.ring-value {
  fill: none;
  stroke-width: 9;
}

.ring-track { stroke: rgba(160, 205, 205, .14); }

.ring-value {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset .6s var(--ease);
}

.ring-stars {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: .95rem;
  color: var(--accent);
}

.ring-stars small { font-size: .62rem; color: var(--muted); margin-left: 1px; }

.progress-title { font-weight: 700; font-size: .95rem; }

.progress-sub { color: var(--muted); font-size: .82rem; margin: .2rem 0 .45rem; line-height: 1.45; }

/* ---------- правило ---------- */

.rule-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.rule { padding: 22px; }

.rule-label {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mint);
}

.rule-label-warn { color: var(--rose); }

.formula {
  margin: .8rem 0 .85rem;
  font-family: var(--mono);
  font-size: clamp(1rem, 1.7vw, 1.14rem);
  line-height: 1.7;
  color: var(--text);
  word-spacing: .08em;
}

.rule-note { color: var(--muted); font-size: .92rem; }

/* ---------- демонстратор ---------- */

.demo { margin-top: 16px; padding: clamp(18px, 2.6vw, 28px); }

.demo-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.demo-lede { color: var(--muted); font-size: .93rem; margin-top: .5rem; max-width: 62ch; }

.demo-body {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: clamp(18px, 3vw, 36px);
  align-items: center;
  margin-top: 1.4rem;
}

.demo-grid-wrap { display: flex; flex-direction: column; gap: 10px; }

.demo-grid {
  display: grid;
  gap: 1px;
  aspect-ratio: 1;
  width: 100%;
  background: rgba(160, 205, 205, .14);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 1px;
  overflow: hidden;
}

.cell {
  background: rgba(255, 255, 255, .025);
  transition: background .3s var(--ease), transform .3s var(--ease);
  transform: scale(.92);
}

.cell.on-b { background: rgba(247, 185, 85, .78); transform: scale(1); }
.cell.on-c { background: rgba(88, 211, 173, .7); transform: scale(1); }

.demo-caption {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
  text-align: center;
}

.demo-readout { display: flex; flex-direction: column; gap: .55rem; }

.demo-line {
  font-family: var(--mono);
  font-size: clamp(.95rem, 1.6vw, 1.1rem);
  line-height: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem;
}

.demo-total { color: var(--accent); font-size: clamp(1rem, 1.8vw, 1.16rem); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: .4rem;
  color: var(--muted);
  font-size: .8rem;
}

.legend-item { display: inline-flex; align-items: center; gap: .45rem; }

.swatch { width: 12px; height: 12px; border-radius: 3px; }
.swatch-b { background: rgba(247, 185, 85, .85); }
.swatch-c { background: rgba(88, 211, 173, .8); }

/* ---------- примеры ---------- */

.examples {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.example { padding: 20px; display: flex; flex-direction: column; gap: .55rem; }

.example-num {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--muted);
  letter-spacing: .1em;
}

.steps { display: flex; flex-direction: column; gap: .1rem; font-family: var(--mono); font-size: .96rem; }

.step { color: var(--muted); }
.step-end { color: var(--mint); }

.example-note { color: var(--muted); font-size: .87rem; margin-top: auto; }

/* ---------- ошибка ---------- */

.mistake {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: clamp(18px, 3vw, 36px);
  align-items: center;
  margin-top: 16px;
  padding: clamp(20px, 2.6vw, 28px);
  border-color: rgba(255, 138, 122, .25);
}

.mistake-wrong,
.mistake-right {
  font-family: var(--mono);
  font-size: clamp(.95rem, 1.6vw, 1.08rem);
  line-height: 1.9;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem;
}

.mistake-wrong { color: var(--rose); margin-top: .7rem; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.mistake-wrong .mark { text-decoration: none; display: inline-block; color: var(--rose); margin-inline: .3rem; }

.mistake-right { color: var(--mint); margin-top: .4rem; text-decoration: none; }

.mistake-note { color: var(--muted); font-size: .9rem; }

/* ---------- тренажёр ---------- */

.train-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 16px;
  align-items: start;
}

.levels { display: flex; flex-direction: column; gap: 10px; }
.levels > [role="listitem"] { display: block; }

.level {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
}

.level:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, .05); transform: translateX(2px); }

.level[aria-current="true"] {
  border-color: rgba(247, 185, 85, .55);
  background: linear-gradient(90deg, rgba(247, 185, 85, .12), rgba(247, 185, 85, .02));
}

.level-num {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--muted);
}

.level[aria-current="true"] .level-num { color: var(--accent); border-color: rgba(247, 185, 85, .4); }

.level-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.level-title { display: block; font-weight: 650; font-size: .95rem; line-height: 1.25; }
.level-blurb { display: block; color: var(--muted); font-size: .78rem; line-height: 1.35; }

.level-stars { display: flex; gap: 2px; color: rgba(160, 205, 205, .3); font-size: .78rem; }
.level-stars .on { color: var(--accent); }

/* арена */

.arena { padding: clamp(18px, 2.8vw, 30px); min-height: 380px; display: flex; flex-direction: column; }

.arena-empty { margin: auto; max-width: 46ch; text-align: center; display: flex; flex-direction: column; gap: .6rem; }
.arena-empty h3 { margin-top: .2rem; }
.arena-empty p:last-child { color: var(--muted); font-size: .93rem; }

.game-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.game-meta {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.game-score { font-family: var(--mono); font-size: .8rem; color: var(--mint); }

.game-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(160, 205, 205, .15);
  overflow: hidden;
  margin-bottom: 1.6rem;
}

.game-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mint), var(--accent));
  transition: width .35s var(--ease);
}

.task { display: flex; flex-direction: column; gap: .9rem; }

.task-label {
  font-family: var(--mono);
  font-size: .76rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.task-expr {
  font-family: var(--mono);
  font-size: clamp(1.3rem, 3.2vw, 1.9rem);
  line-height: 1.9;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  padding: .9rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, .25);
  border: 1px solid var(--line);
}

.options { display: flex; flex-direction: column; gap: 10px; }

.option {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding: .8rem 1rem;
  text-align: left;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-family: var(--mono);
  font-size: clamp(.98rem, 1.8vw, 1.1rem);
  line-height: 1.9;
  cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease), transform .16s var(--ease);
}

.option:hover:not([disabled]) { border-color: var(--line-strong); background: rgba(255, 255, 255, .055); }
.option:active:not([disabled]) { transform: scale(.995); }

.option .badge {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--muted);
}

.option .option-body { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }

.option.is-correct {
  border-color: rgba(88, 211, 173, .6);
  background: var(--mint-dim);
}
.option.is-correct .badge { color: var(--mint); border-color: rgba(88, 211, 173, .5); }

.option.is-wrong {
  border-color: rgba(255, 138, 122, .55);
  background: var(--rose-dim);
}
.option.is-wrong .badge { color: var(--rose); border-color: rgba(255, 138, 122, .5); }

.option[disabled] { cursor: default; }

.option .mark-icon { margin-left: auto; font-size: .95rem; }

/* ввод ответа */

.answer-row { display: flex; flex-wrap: wrap; gap: 10px; }

.answer-input {
  flex: 1 1 190px;
  min-width: 0;
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, .3);
  color: var(--text);
  font-family: var(--mono);
  font-size: 1.1rem;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}

.answer-input::placeholder { color: rgba(154, 180, 182, .6); }
.answer-input:hover { border-color: rgba(160, 205, 205, .55); }
.answer-input[aria-invalid="true"] { border-color: var(--rose); }

.answer-hint { color: var(--muted); font-size: .82rem; }

/* строки решения */

.lines { display: flex; flex-direction: column; gap: 8px; }

.line-btn {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding: .7rem .9rem;
  text-align: left;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: clamp(.95rem, 1.7vw, 1.05rem);
  line-height: 1.9;
  cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}

.line-btn:hover:not([disabled]) { border-color: var(--line-strong); background: rgba(255, 255, 255, .055); }
.line-btn .line-num { color: var(--muted); font-size: .76rem; flex: 0 0 auto; }
.line-btn .option-body { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }

.line-btn.is-correct { border-color: rgba(88, 211, 173, .6); background: var(--mint-dim); }
.line-btn.is-wrong { border-color: rgba(255, 138, 122, .55); background: var(--rose-dim); }
.line-btn[disabled] { cursor: default; }

/* обратная связь */

.feedback {
  margin-top: 1.1rem;
  padding: .9rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .2);
  font-size: .93rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  animation: rise .22s var(--ease);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.feedback.good { border-color: rgba(88, 211, 173, .4); }
.feedback.bad { border-color: rgba(255, 138, 122, .4); }

.feedback-title { font-weight: 700; }
.feedback.good .feedback-title { color: var(--mint); }
.feedback.bad .feedback-title { color: var(--rose); }

.feedback p { color: var(--muted); font-size: .9rem; }
.feedback .feedback-math { font-family: var(--mono); color: var(--text); font-size: .95rem; display: flex; flex-wrap: wrap; align-items: center; gap: .28rem; }

.game-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 1.3rem; flex-wrap: wrap; }

/* результат */

.result { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: .5rem; max-width: 460px; }

.result-stars { display: flex; gap: 8px; font-size: 2rem; color: rgba(160, 205, 205, .25); }

.result-stars .on { color: var(--accent); animation: pop .35s var(--ease) backwards; }
.result-stars .on:nth-child(1) { animation-delay: .05s; }
.result-stars .on:nth-child(2) { animation-delay: .18s; }
.result-stars .on:nth-child(3) { animation-delay: .31s; }

@keyframes pop {
  from { opacity: 0; transform: scale(.6) rotate(-12deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

.result h3 { margin-top: .3rem; }
.result p { color: var(--muted); font-size: .94rem; }
.result .result-score { font-family: var(--mono); color: var(--accent); font-size: 1.05rem; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 1rem; }

/* ---------- экзамен ---------- */

.exam-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 16px;
  align-items: start;
}

.exam-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  align-items: flex-start;
}

.exam-score { font-family: var(--mono); font-size: 2.6rem; line-height: 1; color: var(--accent); }
.exam-score small { font-size: 1rem; color: var(--muted); }

.exam-score-label {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.exam-grade { font-weight: 650; color: var(--text); margin: .5rem 0 .2rem; }
.exam-note { color: var(--muted); font-size: .82rem; }

/* ---------- подвал ---------- */

.app-footer { border-top: 1px solid var(--line); margin-top: 40px; }

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 26px;
  color: var(--muted);
  font-size: .84rem;
}

.noscript {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  padding: 14px;
  background: var(--rose);
  color: #2a0d08;
  text-align: center;
  font-weight: 600;
  z-index: 50;
}

/* ---------- адаптив ---------- */

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .rule-grid { grid-template-columns: 1fr 1fr; }
  .examples { grid-template-columns: 1fr; }
  .demo-body { grid-template-columns: 1fr; }
  .demo-grid { max-width: 320px; }
  .train-layout,
  .exam-layout { grid-template-columns: 1fr; }
  .levels { display: grid; grid-template-columns: 1fr 1fr; }
  .mistake { grid-template-columns: 1fr; }
  .nav { gap: 12px; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .header-inner { flex-wrap: wrap; min-height: 0; gap: 10px 14px; }
  .nav { order: 3; width: 100%; margin-left: 0; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 8px; }
  .header-stats { margin-left: auto; }
  .hero-facts { gap: 8px 18px; font-size: .82rem; }
  .rule-grid { grid-template-columns: 1fr; }
  .levels { grid-template-columns: 1fr; }
  .arena { min-height: 320px; }
  .section { padding-block: 44px; }
  .art-row { font-size: 1.05rem; line-height: 2.1; }
}

@media (max-width: 420px) {
  .brand-text { font-size: .85rem; }
  .chip { padding: .28rem .55rem; font-size: .76rem; }
  .hero-actions .btn { flex: 1 1 100%; }
  .demo-grid { max-width: 100%; }
  .task-expr { font-size: 1.12rem; padding: .7rem .75rem; }
  .option, .line-btn { font-size: .9rem; padding: .65rem .7rem; }
}

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