@property --score {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}

:root {
  --bg: #f5f0e6;
  --surface: #fffdf8;
  --surface-muted: #fbf8f0;
  --ink: #18241f;
  --ink-soft: #405047;
  --muted: #778079;
  --line: rgba(24, 36, 31, 0.12);
  --line-strong: rgba(24, 36, 31, 0.2);
  --green: #237a52;
  --green-bright: #2e9d68;
  --green-soft: #e2f2e8;
  --green-faint: rgba(35, 122, 82, 0.07);
  --red: #c1463f;
  --red-soft: #fbe7e4;
  --amber: #d5912f;
  --amber-soft: #fbf0d9;
  --shadow: 0 30px 70px -32px rgba(31, 54, 41, 0.3);
  --shadow-soft: 0 16px 40px -24px rgba(31, 54, 41, 0.24);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 17px;
}

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

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -8%, rgba(229, 173, 74, 0.2), transparent 32rem),
    radial-gradient(circle at 102% 6%, rgba(46, 157, 104, 0.15), transparent 30rem),
    var(--bg);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(24, 36, 31, 0.14) 1px, transparent 1.2px);
  background-size: 27px 27px;
  opacity: 0.48;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.5) 42%, transparent 88%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.5) 42%, transparent 88%);
}

button,
input,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button,
select {
  cursor: pointer;
}

::selection {
  color: var(--surface);
  background: var(--green);
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid rgba(35, 122, 82, 0.45);
  outline-offset: 3px;
}

.app {
  position: relative;
  z-index: 1;
  width: min(100% - 32px, 900px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 54px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  user-select: none;
}

.brand__mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--surface);
  background: var(--ink);
  border-radius: 13px;
  box-shadow: 0 10px 24px -12px rgba(24, 36, 31, 0.65);
  font-size: 27px;
  font-weight: 500;
  line-height: 1;
  transform: rotate(-4deg);
}

.brand__text {
  font-size: 1.16rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand__text span {
  color: var(--green);
}

.ghost-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.45);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.ghost-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.ghost-button:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}

.view {
  animation: view-in 450ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  line-height: 1.3;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  flex: none;
  width: 26px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  opacity: 0.7;
}

.hero {
  max-width: 840px;
  padding-top: clamp(42px, 8vh, 82px);
}

.hero h1 {
  margin: 16px 0 20px;
  font-size: clamp(1.9rem, 8vw, 4.6rem);
  font-weight: 850;
  letter-spacing: -0.065em;
  line-height: 0.98;
  white-space: nowrap;
}

.accent {
  color: var(--green);
  background-image: linear-gradient(transparent 82%, rgba(46, 157, 104, 0.18) 82%);
  background-repeat: no-repeat;
}

.hero__copy {
  max-width: 520px;
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(0.98rem, 1.9vw, 1.1rem);
  line-height: 1.65;
}

.settings-card {
  position: relative;
  margin-top: clamp(30px, 5.5vh, 50px);
  padding: clamp(22px, 4vw, 38px);
  overflow: hidden;
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.settings-card::before {
  content: "×";
  position: absolute;
  top: -92px;
  right: -6px;
  color: rgba(24, 36, 31, 0.032);
  font-size: 330px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  transform: rotate(7deg);
}

.settings-grid,
.start-row {
  position: relative;
  z-index: 1;
}

.settings-grid {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 36px;
}

.panel + .panel {
  padding-left: 34px;
  border-left: 1px solid var(--line);
}

.panel__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 21px;
}

.step-index {
  display: grid;
  flex: none;
  width: 31px;
  height: 31px;
  place-items: center;
  color: var(--green);
  background: var(--green-faint);
  border: 1px solid rgba(35, 122, 82, 0.14);
  border-radius: 50%;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  transform: translateY(1px);
}

.panel h2 {
  margin: 0 0 2px;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.panel__head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.79rem;
}

.range-control {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.range-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.range-label {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.select-shell {
  position: relative;
  display: block;
}

.select-shell select {
  width: 92px;
  height: 62px;
  padding: 0 38px 0 17px;
  color: var(--ink);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: none;
  font-size: 1.72rem;
  font-weight: 850;
  letter-spacing: -0.05em;
  line-height: 1;
  appearance: none;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.select-shell select:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.select-shell select:focus {
  background: #fff;
  border-color: rgba(35, 122, 82, 0.5);
  box-shadow: 0 0 0 4px rgba(35, 122, 82, 0.1);
}

.select-shell svg {
  position: absolute;
  top: 50%;
  right: 13px;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  pointer-events: none;
  transform: translateY(-50%);
}

.range-connector {
  flex: 1;
  min-width: 14px;
  height: 1px;
  margin-bottom: 31px;
  background-image: linear-gradient(90deg, var(--line-strong) 50%, transparent 50%);
  background-size: 8px 1px;
}

.range-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
  padding: 9px 12px;
  color: var(--ink-soft);
  background: var(--green-faint);
  border-radius: 11px;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.range-summary span {
  white-space: nowrap;
}

.range-summary strong {
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: right;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.range-hint {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

.preset-button {
  padding: 5px 11px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  transition:
    color 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease;
}

.preset-button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.65);
  border-color: var(--line-strong);
}

.preset-button.is-active {
  color: var(--green);
  background: var(--green-soft);
  border-color: transparent;
}

.mode-grid {
  display: grid;
  gap: 10px;
}

.mode-card {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 13px 42px 13px 13px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.42);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.mode-card:hover {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(35, 122, 82, 0.32);
  transform: translateY(-1px);
}

.mode-card.is-selected {
  background: var(--green-soft);
  border-color: rgba(35, 122, 82, 0.43);
  box-shadow: inset 0 0 0 1px rgba(35, 122, 82, 0.07);
}

.mode-card__icon {
  display: grid;
  flex: none;
  width: 43px;
  height: 43px;
  place-items: center;
  color: var(--ink-soft);
  background: rgba(24, 36, 31, 0.055);
  border-radius: 13px;
  transition:
    color 180ms ease,
    background-color 180ms ease;
}

.mode-card__icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.mode-card__icon--infinity {
  padding-bottom: 3px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  line-height: 1;
}

.mode-card.is-selected .mode-card__icon {
  color: #fff;
  background: var(--green);
}

.mode-card__content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.mode-card__title {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.mode-card__desc {
  color: var(--muted);
  font-size: 0.71rem;
  line-height: 1.35;
}

.mode-card__check {
  position: absolute;
  top: 50%;
  right: 14px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  background: rgba(255, 255, 255, 0.6);
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  transform: translateY(-50%);
  transition:
    background-color 180ms ease,
    border-color 180ms ease;
}

.mode-card__check svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: #fff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
  opacity: 0;
  transform: scale(0.4);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.mode-card.is-selected .mode-card__check {
  background: var(--green);
  border-color: var(--green);
}

.mode-card.is-selected .mode-card__check svg {
  opacity: 1;
  transform: scale(1);
}

.toggle-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.toggle-row__copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.toggle-row__title {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.toggle-row__desc {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.35;
}

.toggle-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.toggle-switch {
  position: relative;
  flex: none;
  width: 43px;
  height: 25px;
  background: #e4e0d6;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(24, 36, 31, 0.06);
  transition: background-color 180ms ease;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(24, 36, 31, 0.22);
  transition: transform 180ms cubic-bezier(0.34, 1.3, 0.64, 1);
}

.toggle-row input:checked + .toggle-switch {
  background: var(--green);
}

.toggle-row input:checked + .toggle-switch::after {
  transform: translateX(18px);
}

.toggle-row input:focus-visible + .toggle-switch {
  outline: 3px solid rgba(35, 122, 82, 0.4);
  outline-offset: 3px;
}

.start-row {
  display: flex;
  align-items: center;
  gap: 23px;
  margin-top: 31px;
  padding-top: 27px;
  border-top: 1px solid var(--line);
}

.primary-button {
  display: inline-flex;
  min-height: 57px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 11px 8px 23px;
  color: var(--surface);
  background: var(--ink);
  border: 0;
  border-radius: 16px;
  box-shadow: 0 14px 26px -15px rgba(24, 36, 31, 0.55);
  font-weight: 750;
  transition:
    background-color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.primary-button:not(:disabled):hover {
  background: var(--green);
  box-shadow: 0 17px 30px -15px rgba(35, 122, 82, 0.5);
  transform: translateY(-2px);
}

.primary-button:not(:disabled):active {
  transform: translateY(0);
}

.primary-button:disabled {
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.36;
}

.button-arrow {
  display: grid;
  flex: none;
  width: 36px;
  height: 36px;
  place-items: center;
  background: rgba(255, 255, 255, 0.13);
  border-radius: 11px;
  font-size: 1.18rem;
  line-height: 1;
  transition: transform 180ms ease;
}

.primary-button:not(:disabled):hover .button-arrow {
  transform: translateX(2px);
}

.start-button {
  flex: 1 1 380px;
  max-width: 430px;
}

.session-note {
  display: flex;
  max-width: 245px;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.session-note svg {
  flex: none;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.train-view {
  padding-top: clamp(32px, 6vh, 64px);
}

.train-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.train-heading h1 {
  margin: 9px 0 0;
  font-size: clamp(2.8rem, 6.2vw, 4.3rem);
  font-weight: 850;
  letter-spacing: -0.065em;
  line-height: 0.96;
}

.streak-badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  padding: 7px 12px 7px 8px;
  color: #795213;
  background: var(--amber-soft);
  border: 1px solid rgba(213, 145, 47, 0.22);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  animation: badge-in 320ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.streak-badge__icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--amber);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 50%;
}

.streak-badge__icon svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 25px;
}

.stat {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  padding: 12px 15px;
  background: rgba(255, 253, 248, 0.76);
  border: 1px solid rgba(24, 36, 31, 0.09);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.stat__icon {
  display: grid;
  flex: none;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
}

.stat__icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.stat--correct .stat__icon {
  color: var(--green);
  background: var(--green-soft);
}

.stat--wrong .stat__icon {
  color: var(--red);
  background: var(--red-soft);
}

.stat--accuracy .stat__icon {
  color: var(--amber);
  background: var(--amber-soft);
}

.stat__body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.stat__label {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.065em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.stat__value {
  font-size: 1.38rem;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.stat__value.bump {
  animation: stat-bump 330ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.progress-panel {
  margin-top: 13px;
  padding: 12px 15px;
  background: rgba(255, 253, 248, 0.6);
  border: 1px solid rgba(24, 36, 31, 0.08);
  border-radius: 14px;
}

.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.progress-copy span:last-child {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  background: #e7e3d8;
  border-radius: 999px;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-bright));
  border-radius: inherit;
  transition: width 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

.problem-card {
  position: relative;
  display: flex;
  min-height: 352px;
  flex-direction: column;
  justify-content: space-between;
  margin-top: 14px;
  padding: 21px clamp(18px, 5vw, 45px) 26px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(24, 36, 31, 0.09);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  transition:
    background-color 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease;
}

.problem-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(circle at 50% 47%, rgba(46, 157, 104, 0.16), transparent 55%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.problem-card.is-correct::after {
  opacity: 1;
}

.problem-card.is-wrong::after {
  background: radial-gradient(circle at 50% 47%, rgba(193, 70, 63, 0.13), transparent 55%);
  opacity: 1;
}

.problem-card.is-correct {
  background: #f4fbf6;
  border-color: rgba(35, 122, 82, 0.47);
  box-shadow:
    0 30px 70px -32px rgba(35, 122, 82, 0.48),
    0 0 0 3px rgba(35, 122, 82, 0.08);
  animation: card-pop 620ms cubic-bezier(0.22, 1.4, 0.36, 1);
}

.problem-card.is-wrong {
  background: #fef7f5;
  border-color: rgba(193, 70, 63, 0.4);
  box-shadow:
    0 30px 70px -32px rgba(193, 70, 63, 0.34),
    0 0 0 3px rgba(193, 70, 63, 0.07);
  animation: card-shake 480ms ease;
}

.problem-meta {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.problem-meta__hint {
  color: rgba(119, 128, 121, 0.75);
  font-weight: 700;
  letter-spacing: 0.055em;
}

.problem {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.4vw, 16px);
  padding: clamp(29px, 6vh, 51px) 0 20px;
  font-size: clamp(3.35rem, 9vw, 6.25rem);
  font-variant-numeric: tabular-nums;
}

.operand {
  font-weight: 850;
  letter-spacing: -0.065em;
  line-height: 0.95;
}

.operator {
  color: var(--muted);
  font-size: 0.54em;
  font-weight: 500;
  line-height: 1;
  transform: translateY(0.02em);
}

.answer-input {
  width: 2.35ch;
  height: 1.13em;
  padding: 0 0.03em 0.045em;
  color: var(--ink);
  background: rgba(35, 122, 82, 0.075);
  border: 0;
  border-bottom: 0.052em solid rgba(35, 122, 82, 0.55);
  border-radius: 0.12em 0.12em 0 0;
  outline: none;
  font-family: inherit;
  font-size: 0.94em;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  letter-spacing: -0.045em;
  line-height: 1;
  text-align: center;
  caret-color: var(--green);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease;
}

.answer-input::placeholder {
  color: rgba(24, 36, 31, 0.2);
}

.answer-input:focus {
  background: rgba(35, 122, 82, 0.12);
  border-bottom-color: var(--green);
  box-shadow: 0 0.1em 0 -0.045em rgba(35, 122, 82, 0.15);
}

.answer-input:disabled {
  opacity: 1;
  -webkit-text-fill-color: currentColor;
}

.problem-card.is-correct .answer-input {
  color: var(--green);
  border-bottom-color: var(--green);
}

.problem-card.is-wrong .answer-input {
  color: var(--red);
  border-bottom-color: var(--red);
}

.feedback {
  position: relative;
  z-index: 2;
  min-height: 24px;
  margin: 0 auto 15px;
  color: var(--muted);
  font-size: clamp(0.82rem, 1.9vw, 0.97rem);
  text-align: center;
  transition: color 180ms ease;
}

.feedback.is-correct {
  color: var(--green);
  font-weight: 750;
  animation: feedback-in 300ms ease both;
}

.feedback.is-wrong {
  color: var(--red);
  font-weight: 650;
  animation: feedback-in 300ms ease both;
}

.feedback.is-hint {
  color: var(--amber);
  font-weight: 700;
  animation: feedback-in 300ms ease both;
}

.feedback.is-correct::before {
  content: "✓ ";
  font-weight: 850;
}

.feedback.is-wrong::before {
  content: "× ";
  font-weight: 850;
}

.check-button {
  z-index: 2;
  width: min(100%, 282px);
  min-height: 54px;
  flex: none;
  justify-content: center;
  margin: 0 auto;
  padding: 8px 20px;
}

.check-button.is-next {
  background: var(--green);
}

.check-button.is-next:not(:disabled):hover {
  background: var(--ink);
}

.key-hint {
  padding: 3px 7px;
  color: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  font-size: 0.64rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.particles {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

.answer-burst {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.answer-burst::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 128px;
  height: 128px;
  margin: -64px 0 0 -64px;
  border: 3px solid var(--green);
  border-radius: 50%;
  opacity: 0;
}

.answer-burst.is-correct::before {
  animation: answer-ring 820ms cubic-bezier(0.16, 0.76, 0.35, 1) forwards;
}

.answer-burst.is-wrong::before {
  border-color: var(--red);
  animation: answer-ring 820ms cubic-bezier(0.16, 0.76, 0.35, 1) forwards;
}

.answer-burst__mark {
  display: grid;
  width: 126px;
  height: 126px;
  place-items: center;
  color: #fff;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 22px 48px -18px rgba(35, 122, 82, 0.75);
  font-size: 4.7rem;
  font-weight: 500;
  line-height: 1;
  opacity: 0;
  transform: scale(0.3);
}

.answer-burst.is-correct .answer-burst__mark {
  animation: answer-mark-correct 980ms cubic-bezier(0.22, 1.25, 0.36, 1) forwards;
}

.answer-burst.is-wrong .answer-burst__mark {
  background: var(--red);
  box-shadow: 0 22px 48px -18px rgba(193, 70, 63, 0.7);
  font-size: 5rem;
  animation: answer-mark-wrong 980ms cubic-bezier(0.22, 1.25, 0.36, 1) forwards;
}

.particle {
  position: absolute;
  width: var(--size, 9px);
  height: var(--size, 9px);
  background: var(--green-bright);
  border-radius: 3px;
  opacity: 0;
  animation: particle-burst var(--duration, 850ms) cubic-bezier(0.16, 0.76, 0.35, 1) var(--delay, 0ms) forwards;
}

.particle--round {
  border-radius: 50%;
}

.particle--amber {
  background: #e6a83e;
}

.particle--ink {
  background: var(--ink);
}

.train-footer {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  text-align: center;
}

.train-footer span {
  display: inline-block;
  padding: 2px 6px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.7);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 0.62rem;
  font-weight: 800;
}

.result-view {
  display: flex;
  justify-content: center;
  padding-top: clamp(32px, 6vh, 65px);
}

.result-card {
  position: relative;
  width: min(100%, 660px);
  padding: clamp(28px, 5vw, 46px);
  overflow: hidden;
  text-align: center;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.result-card::before {
  content: "";
  position: absolute;
  top: -105px;
  left: 50%;
  width: 360px;
  height: 220px;
  background: radial-gradient(ellipse, rgba(46, 157, 104, 0.14), transparent 68%);
  pointer-events: none;
  transform: translateX(-50%);
}

.result-card .eyebrow {
  justify-content: center;
}

.result-card h1 {
  position: relative;
  margin: 13px 0 12px;
  font-size: clamp(2.55rem, 6vw, 4rem);
  font-weight: 850;
  letter-spacing: -0.062em;
  line-height: 0.98;
}

.result-copy {
  max-width: 430px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.result-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(27px, 6vw, 58px);
  margin: 32px 0;
}

.score-ring {
  --score: 0%;
  position: relative;
  display: grid;
  flex: none;
  width: 168px;
  height: 168px;
  place-items: center;
  background: conic-gradient(var(--green) var(--score), #e8eee8 0);
  border-radius: 50%;
  box-shadow: 0 16px 38px -24px rgba(35, 122, 82, 0.45);
}

.score-ring::before {
  content: "";
  position: absolute;
  inset: 7px;
  background: rgba(255, 253, 248, 0.72);
  border-radius: 50%;
}

.score-ring__inner {
  position: relative;
  display: flex;
  width: 130px;
  height: 130px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(24, 36, 31, 0.04);
}

.score-ring__inner strong {
  font-size: 2.05rem;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  letter-spacing: -0.06em;
  line-height: 1;
}

.score-ring__inner span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.result-stats {
  width: min(100%, 225px);
  text-align: left;
}

.result-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 22px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.result-stat:first-child {
  padding-top: 0;
}

.result-stat:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.result-stat span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.result-stat strong {
  font-size: 1.14rem;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.result-stat--correct strong {
  color: var(--green);
}

.result-stat--wrong strong {
  color: var(--red);
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.result-actions .primary-button {
  min-width: 195px;
}

.secondary-button {
  min-height: 57px;
  padding: 8px 21px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  font-weight: 700;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.secondary-button:hover {
  color: var(--ink);
  background: var(--surface-muted);
  border-color: var(--ink-soft);
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes badge-in {
  from {
    opacity: 0;
    transform: scale(0.75) translateY(3px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes stat-bump {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.22);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes feedback-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-pop {
  0% {
    transform: scale(1);
  }
  28% {
    transform: scale(1.024);
  }
  55% {
    transform: scale(0.993);
  }
  78% {
    transform: scale(1.005);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes card-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  12% {
    transform: translateX(-12px);
  }
  26% {
    transform: translateX(10px);
  }
  40% {
    transform: translateX(-8px);
  }
  54% {
    transform: translateX(6px);
  }
  68% {
    transform: translateX(-4px);
  }
  82% {
    transform: translateX(2px);
  }
}

@keyframes answer-mark-correct {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-12deg);
  }
  22% {
    opacity: 1;
    transform: scale(1.12) rotate(3deg);
  }
  38% {
    transform: scale(0.98) rotate(0);
  }
  70% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.92);
  }
}

@keyframes answer-mark-wrong {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(10deg);
  }
  18% {
    opacity: 1;
    transform: scale(1.12) rotate(-4deg);
  }
  34% {
    transform: scale(0.98) rotate(2deg);
  }
  70% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.92);
  }
}

@keyframes answer-ring {
  0% {
    opacity: 0.62;
    transform: scale(0.72);
  }
  100% {
    opacity: 0;
    transform: scale(1.85);
  }
}

@keyframes particle-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2) rotate(0deg);
  }
  14% {
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(var(--scale, 1)) rotate(var(--rotate, 90deg));
  }
}

@media (max-width: 780px) {
  .settings-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .panel + .panel {
    margin-top: 25px;
    padding-top: 25px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mode-card {
    min-height: 76px;
  }
}

@media (max-width: 620px) {
  .start-row {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .start-button {
    width: 100%;
    max-width: none;
    flex: none;
  }

  .session-note {
    max-width: none;
    justify-content: center;
    text-align: center;
  }

  .result-actions {
    flex-direction: column;
  }

  .result-actions .primary-button,
  .result-actions .secondary-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .app {
    width: min(100% - 24px, 900px);
    padding: 17px 0 38px;
  }

  .brand__mark {
    width: 39px;
    height: 39px;
    border-radius: 12px;
    font-size: 25px;
  }

  .hero {
    padding-top: 38px;
  }

  .hero h1 {
    margin-top: 13px;
  }

  .settings-card {
    padding: 20px;
    border-radius: 27px;
  }

  .mode-grid {
    grid-template-columns: 1fr;
  }

  .mode-card {
    min-height: 0;
  }

  .train-heading h1 {
    font-size: 2.65rem;
  }

  .streak-badge {
    padding-right: 9px;
    font-size: 0.66rem;
  }

  .stats-row {
    gap: 7px;
    margin-top: 20px;
  }

  .stat {
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    padding: 10px;
  }

  .stat__icon {
    width: 28px;
    height: 28px;
    border-radius: 9px;
  }

  .stat__icon svg {
    width: 14px;
    height: 14px;
  }

  .stat__label {
    font-size: 0.59rem;
  }

  .stat__value {
    font-size: 1.22rem;
  }

  .problem-card {
    min-height: 324px;
    padding: 17px 13px 22px;
    border-radius: 27px;
  }

  .problem-meta__hint {
    display: none;
  }

  .problem {
    gap: 7px;
    padding: 28px 0 17px;
    font-size: clamp(2.85rem, 13.5vw, 4.3rem);
  }

  .feedback {
    margin-bottom: 13px;
  }

  .train-footer {
    display: none;
  }

  .result-view {
    padding-top: 28px;
  }

  .result-card {
    padding: 27px 20px;
    border-radius: 28px;
  }

  .result-body {
    gap: 23px;
    margin: 27px 0;
  }

  .score-ring {
    width: 150px;
    height: 150px;
  }

  .score-ring__inner {
    width: 116px;
    height: 116px;
  }

  .score-ring__inner strong {
    font-size: 1.8rem;
  }

  .result-stats {
    width: 100%;
    max-width: 290px;
  }
}

@media (max-width: 390px) {
  .select-shell select {
    width: 82px;
    padding-left: 14px;
    padding-right: 32px;
  }

  .select-shell svg {
    right: 10px;
  }

  .range-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .range-summary strong {
    text-align: left;
  }

  .streak-badge {
    display: none;
  }

  .problem {
    font-size: 2.75rem;
  }

  .answer-input {
    width: 2.25ch;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .particles,
  .answer-burst {
    display: none;
  }
}
