@font-face {
  font-family: "Space Grotesk";
  src: url("../assets/fonts/space-grotesk-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #08080f;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-2: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef1ff;
  --muted: #9aa3bd;
  --muted-dim: #6d7590;
  --primary: #8b93ff;
  --secondary: #63c9ff;
  --green: #4ade80;
  --red: #ff7a90;
  --amber: #fbbf24;
  --grad: linear-gradient(115deg, #8b93ff 0%, #63c9ff 100%);
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --radius: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.1;
}

p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: rgba(139, 147, 255, 0.35); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

/* ---------- background ---------- */

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
}
.glow-a {
  width: 620px; height: 620px;
  top: -240px; left: -160px;
  background: radial-gradient(circle, rgba(139, 147, 255, 0.22), transparent 65%);
}
.glow-b {
  width: 560px; height: 560px;
  bottom: -220px; right: -140px;
  background: radial-gradient(circle, rgba(99, 201, 255, 0.13), transparent 65%);
}
.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 50% 0%, black 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, black 0%, transparent 75%);
}

/* ---------- shared ---------- */

.wrap {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.dnav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(8, 8, 15, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.dnav-inner {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.dbrand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
}
.dbrand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--grad);
  color: #0a0b14;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.dbrand-name { font-size: 0.9rem; }
.dnav-sep { color: var(--muted-dim); }
.dnav-product {
  font-family: var(--font-display);
  font-size: 0.86rem;
  color: var(--muted);
}
.dnav-back {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.dnav-back svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dnav-back:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }

.app {
  flex: 1;
  padding: clamp(36px, 6vw, 72px) 0 64px;
}

.screen { display: none; }
.screen.is-active {
  display: block;
  animation: screen-in 0.5s var(--ease) both;
}
@keyframes screen-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
}
.spark { color: var(--secondary); }
.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- buttons ---------- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: var(--grad);
  color: #0a0b14;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(139, 147, 255, 0.24);
  transition: transform 0.25s var(--ease), box-shadow 0.25s, filter 0.25s, opacity 0.25s;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 38px rgba(139, 147, 255, 0.34);
  filter: brightness(1.05);
}
.btn-primary:disabled {
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted-dim);
  cursor: not-allowed;
  box-shadow: none;
}
.btn-ico {
  width: 16px; height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.25s var(--ease);
}
.btn-primary:hover:not(:disabled) .btn-ico { transform: translateX(2px); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.btn-tiny { height: 38px; padding: 0 14px; font-size: 0.78rem; border-radius: 9px; }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 10px 0 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.25s, background 0.25s;
}
.ghost-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ghost-btn:hover { color: var(--text); background: var(--surface-2); }

/* ---------- setup ---------- */

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}

.intro h1 {
  margin-top: 16px;
  font-size: clamp(2.5rem, 5.2vw, 4.15rem);
  line-height: 1.02;
}
.intro-copy {
  margin-top: 22px;
  max-width: 48ch;
  color: var(--muted);
  font-size: 0.98rem;
}
.feature-list {
  list-style: none;
  margin: 26px 0 0;
  padding: 0;
  display: grid;
  gap: 11px;
}
.feature-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: #c3c9dd;
  font-size: 0.88rem;
}
.tick {
  flex: none;
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  margin-top: 1px;
  border-radius: 50%;
  border: 1px solid rgba(74, 222, 128, 0.32);
  background: rgba(74, 222, 128, 0.08);
  color: var(--green);
  font-size: 0.62rem;
}
.demo-note {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted-dim);
  font-size: 0.77rem;
  max-width: 46ch;
}

.setup-card {
  position: relative;
  padding: clamp(22px, 2.6vw, 30px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.setup-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(139, 147, 255, 0.34), transparent 40%, transparent 65%, rgba(99, 201, 255, 0.18));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.field { margin-bottom: 20px; }
.field label,
.field-label {
  display: block;
  margin-bottom: 9px;
  font-family: var(--font-display);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.select-wrap { position: relative; }
.select-wrap select {
  width: 100%;
  height: 46px;
  padding: 0 42px 0 14px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: rgba(8, 8, 15, 0.66);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
}
.select-wrap select:hover { border-color: rgba(139, 147, 255, 0.45); }
.select-wrap svg {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 16px; height: 16px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(8, 8, 15, 0.55);
}
.seg-btn {
  height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.82rem;
  cursor: pointer;
  transition: color 0.22s, background 0.22s, border-color 0.22s, box-shadow 0.22s;
}
.seg-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.seg-btn.is-on {
  color: #fff;
  border-color: rgba(139, 147, 255, 0.42);
  background: rgba(139, 147, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.setup-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.setup-foot .btn-primary { flex: 1; }
.setup-meta {
  font-size: 0.72rem;
  color: var(--muted-dim);
  text-align: right;
  line-height: 1.4;
}

/* ---------- generating ---------- */

#screen-generating {
  min-height: 58vh;
  display: none;
  place-items: center;
}
#screen-generating.is-active { display: grid; }

.gen-card {
  width: min(460px, 100%);
  padding: 38px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  box-shadow: 0 34px 80px rgba(0, 0, 0, 0.45);
  text-align: center;
}
.gen-card h2 { font-size: 1.5rem; margin-top: 22px; }
.gen-topic {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
}
.orb {
  position: relative;
  width: 84px; height: 84px;
  margin: 0 auto;
  display: grid;
  place-items: center;
}
.orb span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(139, 147, 255, 0.4);
  animation: orb-spin 2.4s linear infinite;
}
.orb span:nth-child(2) { inset: 10px; border-color: rgba(99, 201, 255, 0.5); animation-duration: 1.8s; animation-direction: reverse; border-style: dashed; }
.orb span:nth-child(3) { inset: 24px; border: 0; background: radial-gradient(circle, #8b93ff 0%, rgba(139, 147, 255, 0.1) 70%); filter: blur(0.5px); animation: orb-pulse 1.6s ease-in-out infinite; }
@keyframes orb-spin { to { transform: rotate(360deg); } }
@keyframes orb-pulse { 0%, 100% { transform: scale(0.9); opacity: 0.7; } 50% { transform: scale(1.08); opacity: 1; } }

.gen-steps {
  list-style: none;
  margin: 26px 0 22px;
  padding: 0;
  display: grid;
  gap: 10px;
  text-align: left;
}
.gen-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted-dim);
  transition: color 0.3s;
}
.gen-dot {
  width: 7px; height: 7px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--muted-dim);
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.gen-steps li.is-on { color: var(--text); }
.gen-steps li.is-on .gen-dot { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 10px rgba(139, 147, 255, 0.8); }
.gen-steps li.is-done { color: var(--muted); }
.gen-steps li.is-done .gen-dot { background: var(--green); border-color: var(--green); box-shadow: none; }

.gen-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.gen-bar span {
  display: block;
  height: 100%;
  width: 6%;
  border-radius: inherit;
  background: var(--grad);
  transition: width 0.5s var(--ease);
}

/* ---------- quiz ---------- */

#screen-quiz { max-width: 940px; margin: 0 auto; }

.quiz-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.quiz-meta { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.quiz-stats { margin-left: auto; display: flex; gap: 8px; }
.stat-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(8, 8, 15, 0.6);
}
.stat-label {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-dim);
}
.stat-pill strong {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
.timer-pill.is-low { border-color: rgba(255, 122, 144, 0.45); background: rgba(255, 122, 144, 0.08); }
.timer-pill.is-low strong { color: var(--red); }

.progress-track,
.timer-track {
  height: 4px;
  margin-top: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--grad);
  transition: width 0.4s var(--ease);
}
.timer-track { height: 2px; margin-top: 6px; }
.timer-track span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(139, 147, 255, 0.9), rgba(99, 201, 255, 0.9));
  transition: width 0.1s linear;
}

.question-card {
  margin-top: 26px;
  padding: clamp(22px, 3.4vw, 36px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012));
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.question-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.q-index {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.q-diff {
  font-family: var(--font-display);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.q-diff[data-diff="easy"] { color: #8ce8b0; border-color: rgba(74, 222, 128, 0.3); background: rgba(74, 222, 128, 0.07); }
.q-diff[data-diff="medium"] { color: #b9c2ff; border-color: rgba(139, 147, 255, 0.32); background: rgba(139, 147, 255, 0.08); }
.q-diff[data-diff="hard"] { color: #ffc578; border-color: rgba(251, 191, 36, 0.28); background: rgba(251, 191, 36, 0.07); }

.question-card h2 {
  margin-top: 14px;
  font-size: clamp(1.3rem, 2.6vw, 1.75rem);
  line-height: 1.28;
  letter-spacing: -0.02em;
}

.options {
  display: grid;
  gap: 9px;
  margin-top: 24px;
}
.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 13px 46px 13px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.022);
  color: #d4d9ea;
  text-align: left;
  font-size: 0.9rem;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease), opacity 0.25s;
}
.option:hover:not(:disabled) {
  border-color: rgba(139, 147, 255, 0.42);
  background: rgba(139, 147, 255, 0.07);
  transform: translateX(2px);
}
.option:disabled { cursor: default; }
.option-key {
  flex: none;
  display: grid;
  place-items: center;
  width: 27px; height: 27px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: rgba(8, 8, 15, 0.6);
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.option:hover:not(:disabled) .option-key { color: var(--primary); border-color: rgba(139, 147, 255, 0.4); }
.option.is-correct {
  border-color: rgba(74, 222, 128, 0.55);
  background: rgba(74, 222, 128, 0.09);
  color: #e9fff2;
}
.option.is-correct .option-key { border-color: rgba(74, 222, 128, 0.55); background: rgba(74, 222, 128, 0.16); color: #c8ffdc; }
.option.is-wrong {
  border-color: rgba(255, 122, 144, 0.55);
  background: rgba(255, 122, 144, 0.08);
  color: #ffe9ed;
}
.option.is-wrong .option-key { border-color: rgba(255, 122, 144, 0.5); background: rgba(255, 122, 144, 0.14); color: #ffd6de; }
.option.is-dim { opacity: 0.45; }
.option.is-correct::after,
.option.is-wrong::after {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
}
.option.is-correct::after { content: "✓"; color: var(--green); }
.option.is-wrong::after { content: "✕"; color: var(--red); }

.feedback {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  animation: screen-in 0.35s var(--ease) both;
}
.feedback.is-good { border-color: rgba(74, 222, 128, 0.32); background: rgba(74, 222, 128, 0.055); }
.feedback.is-bad { border-color: rgba(255, 122, 144, 0.32); background: rgba(255, 122, 144, 0.05); }
.feedback-head {
  display: flex;
  align-items: center;
  gap: 9px;
}
.feedback-icon {
  display: grid;
  place-items: center;
  width: 21px; height: 21px;
  border-radius: 50%;
  font-size: 0.7rem;
  background: rgba(74, 222, 128, 0.16);
  color: var(--green);
}
.feedback.is-bad .feedback-icon { background: rgba(255, 122, 144, 0.16); color: var(--red); }
.feedback-head strong { font-family: var(--font-display); font-size: 0.86rem; font-weight: 600; }
.feedback-points {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--muted);
}
.feedback p {
  margin-top: 7px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
}

.question-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
}
.kbd-hint { font-size: 0.72rem; color: var(--muted-dim); }
kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  font-family: var(--font-display);
  font-size: 0.64rem;
  text-align: center;
  color: var(--muted);
}

/* ---------- result ---------- */

.result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012));
  box-shadow: 0 34px 80px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.result-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(26px, 4vw, 54px);
  align-items: center;
  padding: clamp(26px, 4vw, 44px);
}

.score-ring {
  position: relative;
  width: clamp(150px, 18vw, 186px);
  height: clamp(150px, 18vw, 186px);
}
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 10;
}
.ring-fg {
  fill: none;
  stroke: var(--primary);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 477.5;
  stroke-dashoffset: 477.5;
  transition: stroke-dashoffset 1.1s var(--ease);
  filter: drop-shadow(0 0 8px rgba(139, 147, 255, 0.55));
}
.ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.ring-label strong {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.ring-label span {
  font-size: 0.7rem;
  color: var(--muted-dim);
}

.result-copy h2 { font-size: clamp(1.8rem, 3.4vw, 2.4rem); margin-top: 10px; }
#result-sub { margin-top: 10px; color: var(--muted); font-size: 0.92rem; }
.result-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.result-stats > div {
  min-width: 104px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(8, 8, 15, 0.45);
}
.result-stats span {
  display: block;
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-dim);
}
.result-stats strong {
  display: block;
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

.result-lower {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
  border-top: 1px solid var(--border);
}
.review { padding: clamp(24px, 3.4vw, 36px); }
.review h3,
.leaderboard h3 {
  font-size: 1rem;
  letter-spacing: -0.01em;
}
.review-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.review-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.018);
}
.review-mark {
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 0.62rem;
  margin-top: 1px;
}
.review-item.ok .review-mark { background: rgba(74, 222, 128, 0.14); color: var(--green); }
.review-item.miss .review-mark { background: rgba(255, 122, 144, 0.14); color: var(--red); }
.review-q { font-size: 0.82rem; color: #d3d8e8; line-height: 1.5; }
.review-a { margin-top: 4px; font-size: 0.74rem; color: var(--muted-dim); }
.review-a strong { color: var(--muted); font-weight: 500; }

.leaderboard {
  padding: clamp(24px, 3.4vw, 36px);
  border-left: 1px solid var(--border);
  background: rgba(8, 8, 15, 0.32);
}
.lb-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.lb-scope { font-size: 0.66rem; color: var(--muted-dim); }
.save-score { display: flex; gap: 8px; margin-top: 15px; }
.save-score input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(8, 8, 15, 0.7);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
}
.save-score input::placeholder { color: var(--muted-dim); }
.save-score input:focus { border-color: rgba(139, 147, 255, 0.5); outline: none; }
.lb-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
  counter-reset: rank;
}
.lb-item {
  counter-increment: rank;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.8rem;
}
.lb-item::before {
  content: counter(rank);
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  font-family: var(--font-display);
  font-size: 0.66rem;
  color: var(--muted-dim);
}
.lb-item:first-child::before { background: rgba(251, 191, 36, 0.16); color: var(--amber); }
.lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-family: var(--font-display); font-size: 0.74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-empty {
  margin-top: 16px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted-dim);
  font-size: 0.78rem;
  text-align: center;
}
.lb-note { margin-top: 14px; font-size: 0.68rem; color: var(--muted-dim); line-height: 1.5; }

/* ---------- footer ---------- */

.dfoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 24px 0 30px;
  border-top: 1px solid var(--border);
  font-size: 0.74rem;
  color: var(--muted-dim);
}
.dfoot a { color: var(--muted); text-decoration: none; }
.dfoot a:hover { color: var(--text); }
.dfoot-links { display: flex; gap: 18px; }
.dfoot-links a { text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.15); text-underline-offset: 3px; }

/* ---------- responsive ---------- */

@media (max-width: 960px) {
  .setup-grid { grid-template-columns: 1fr; }
  .intro-copy,
  .demo-note { max-width: 62ch; }
  .setup-card { width: min(560px, 100%); margin-inline: auto; }
  .result-lower { grid-template-columns: 1fr; }
  .leaderboard { border-left: 0; border-top: 1px solid var(--border); }
}

@media (max-width: 720px) {
  .dbrand-name { display: none; }
  .dnav-sep { display: none; }
  .dnav-product { font-size: 0.8rem; }
  .dnav-inner { height: 58px; }
  .dnav-back { font-size: 0.74rem; padding: 7px 10px; }
  .app { padding-top: 30px; }
  .intro h1 { font-size: clamp(2.15rem, 10.5vw, 3rem); }
  .feature-list li { font-size: 0.84rem; }
  .question-card { padding: 20px 17px; }
  .question-foot { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .question-foot .btn-primary { width: 100%; }
  .kbd-hint { display: none; }
  .result-main { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .result-actions { justify-content: center; }
  .result-stats { justify-content: center; }
  .result-lower { grid-template-columns: 1fr; }
  .review-item { text-align: left; }
  .quiz-stats { width: 100%; margin-left: 0; }
  .quiz-stats .stat-pill { flex: 1; justify-content: center; }
  .option { font-size: 0.86rem; }
  .dfoot { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 460px) {
  .wrap { width: calc(100% - 30px); }
  .setup-foot { flex-direction: column; align-items: stretch; }
  .setup-meta { text-align: center; }
  .score-ring { width: 140px; height: 140px; }
  .save-score { flex-direction: column; }
  .save-score .btn-ghost { width: 100%; }
}

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