:root {
  color-scheme: dark;
  --bg: #070a13;
  --bg-soft: #0e1629;
  --panel: rgba(14, 22, 41, 0.74);
  --panel-strong: rgba(19, 30, 55, 0.88);
  --card: rgba(255, 255, 255, 0.075);
  --card-hover: rgba(255, 255, 255, 0.11);
  --text: #f8fafc;
  --muted: #aebbd1;
  --muted-2: #7f8ca4;
  --accent: #7c3aed;
  --accent-2: #22d3ee;
  --accent-3: #f472b6;
  --success: #34d399;
  --danger: #fb7185;
  --warning: #fbbf24;
  --border: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.24);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

body::selection {
  background: rgba(34, 211, 238, 0.35);
}

.ambient,
.ambient-grid {
  position: fixed;
  pointer-events: none;
  z-index: -2;
}

.ambient-one {
  width: 42rem;
  height: 42rem;
  top: -18rem;
  left: -14rem;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.48), transparent 65%);
  filter: blur(8px);
}

.ambient-two {
  width: 44rem;
  height: 44rem;
  right: -16rem;
  bottom: -20rem;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.34), transparent 68%);
  filter: blur(10px);
}

.ambient-grid {
  inset: 0;
  z-index: -3;
  background:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, rgba(244, 114, 182, 0.16), transparent 34rem),
    linear-gradient(180deg, #070a13 0%, #0b1020 48%, #090c16 100%);
  background-size: 42px 42px, 42px 42px, auto, auto;
  mask-image: linear-gradient(to bottom, black, rgba(0,0,0,0.78), transparent 115%);
}

.app-shell {
  width: min(1140px, calc(100% - 34px));
  margin: 0 auto;
}

.hero {
  padding: 28px 0 28px;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(124,58,237,0.95), rgba(34,211,238,0.82));
  box-shadow: 0 12px 38px rgba(34, 211, 238, 0.23);
  font-size: 1.3rem;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
}

.topbar__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.topbar__chips span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(12px);
  font-size: 0.84rem;
}

.hero-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.75fr);
  gap: 28px;
  padding: clamp(26px, 5vw, 48px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.045)),
    radial-gradient(circle at top right, rgba(34,211,238,0.18), transparent 22rem),
    rgba(14, 22, 41, 0.64);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(22px);
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: -2px;
  background: linear-gradient(120deg, transparent 0 18%, rgba(34,211,238,0.38), transparent 40% 100%);
  opacity: 0.32;
  pointer-events: none;
}

.hero-card__content,
.hero-preview {
  position: relative;
  z-index: 1;
}

.eyebrow {
  display: inline-flex;
  margin: 0 0 14px;
  padding: 8px 12px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: 999px;
  color: #cffafe;
  background: rgba(34, 211, 238, 0.10);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 5.45rem);
  line-height: 0.94;
  letter-spacing: -0.065em;
}

.hero__text {
  max-width: 760px;
  margin: 22px 0 30px;
  color: var(--muted);
  line-height: 1.75;
  font-size: clamp(1rem, 2vw, 1.12rem);
}

.hero__actions,
.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 850;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-3) 48%, var(--accent-2));
  box-shadow: 0 16px 38px rgba(124, 58, 237, 0.28);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 18px 48px rgba(34, 211, 238, 0.28);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.12);
}

.hero-preview {
  align-self: center;
  display: grid;
  gap: 14px;
}

.terminal-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid rgba(34, 211, 238, 0.18);
  border-radius: 24px;
  background: rgba(3, 7, 18, 0.62);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.terminal-card__dots {
  display: flex;
  gap: 7px;
  margin-bottom: 4px;
}

.terminal-card__dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.28);
}

.terminal-card code {
  display: block;
  color: #d9f99d;
  white-space: normal;
  line-height: 1.55;
  font-size: 0.92rem;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mini-metrics div {
  padding: 14px 10px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,0.075);
  text-align: center;
}

.mini-metrics strong,
.mini-metrics span {
  display: block;
}

.mini-metrics strong {
  font-size: 1.25rem;
}

.mini-metrics span {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 0.82rem;
}

.layout {
  display: grid;
  gap: 20px;
  padding: 8px 0 42px;
}

.panel,
.stats {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 12px;
}

.stat-card {
  position: relative;
  min-height: 108px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    radial-gradient(circle at top right, rgba(34,211,238,0.12), transparent 11rem),
    rgba(255,255,255,0.064);
  overflow: hidden;
}

.stat-card__icon {
  position: absolute;
  right: 18px;
  top: 14px;
  color: rgba(255,255,255,0.20);
  font-size: 1.7rem;
}

.stat-card__label {
  display: block;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.stat-card strong {
  display: block;
  max-width: 100%;
  font-size: clamp(1.14rem, 2.6vw, 1.5rem);
  line-height: 1.15;
}

.quiz-card,
.result-card,
.review-card {
  padding: clamp(22px, 4.5vw, 38px);
}

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
}

.progress-bar {
  position: relative;
  height: 12px;
  overflow: hidden;
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  margin-bottom: 25px;
}

.progress-bar__fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-3), var(--accent-2));
  box-shadow: 0 0 22px rgba(34, 211, 238, 0.35);
  transition: width 0.28s ease;
}

.quiz-card__header {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(124, 58, 237, 0.16);
  color: #ddd6fe;
  border: 1px solid rgba(124, 58, 237, 0.34);
  font-size: 0.84rem;
  font-weight: 850;
}

.badge-soft {
  background: rgba(34, 211, 238, 0.12);
  color: #cffafe;
  border-color: rgba(34, 211, 238, 0.28);
}

#questionTitle {
  margin: 0 0 24px;
  max-width: 920px;
  line-height: 1.28;
  font-size: clamp(1.32rem, 3vw, 2.04rem);
  letter-spacing: -0.025em;
}

.answers {
  display: grid;
  gap: 12px;
}

.answer {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 64px;
  padding: 14px 18px 14px 14px;
  background: rgba(255,255,255,0.066);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  line-height: 1.5;
  color: #edf2ff;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.answer:hover {
  transform: translateY(-2px);
  background: var(--card-hover);
  border-color: rgba(34, 211, 238, 0.44);
  box-shadow: 0 12px 28px rgba(0,0,0,0.18);
}

.answer.selected {
  border-color: rgba(34, 211, 238, 0.74);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.16), rgba(124, 58, 237, 0.15));
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.08);
}

.answer input {
  appearance: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(3,7,18,0.42);
}

.answer input::before {
  content: "";
  width: 15px;
  height: 15px;
  transform: scale(0);
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent-3), var(--accent-2));
  transition: transform 0.15s ease;
}

.answer input:checked::before {
  transform: scale(1);
}

.answer.correct {
  border-color: rgba(52, 211, 153, 0.78);
  background: rgba(52, 211, 153, 0.13);
}

.answer.correct input::before {
  transform: scale(1);
  background: var(--success);
}

.answer.wrong {
  border-color: rgba(251, 113, 133, 0.86);
  background: rgba(251, 113, 133, 0.13);
}

.answer.wrong input::before {
  transform: scale(1);
  background: var(--danger);
}

.feedback {
  margin: 20px 0 0;
  padding: 18px;
  border-radius: 20px;
  line-height: 1.62;
}

.feedback.success {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #d1fae5;
}

.feedback.error {
  background: rgba(251, 113, 133, 0.12);
  border: 1px solid rgba(251, 113, 133, 0.35);
  color: #ffe4e6;
}

.quiz-actions {
  margin-top: 26px;
  justify-content: flex-end;
}

.result-card {
  position: relative;
  text-align: center;
  overflow: hidden;
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(34, 211, 238, 0.16), transparent 28rem);
  pointer-events: none;
}

.result-card > * {
  position: relative;
}

.result-card__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 26px;
  background: rgba(255,255,255,0.09);
  border: 1px solid var(--border);
  font-size: 2rem;
}

.result-card h2,
.review-card h2 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  letter-spacing: -0.04em;
}

.final-score {
  margin: 16px 0 8px;
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 950;
  letter-spacing: -0.055em;
  background: linear-gradient(135deg, #fff, #cffafe 40%, #fbcfe8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.result-message {
  margin: 0 auto 24px;
  max-width: 680px;
  color: var(--muted);
  line-height: 1.65;
}

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

.section-title {
  display: grid;
  gap: 6px;
  margin-bottom: 22px;
}

.section-title span {
  color: var(--accent-2);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.review-list {
  display: grid;
  gap: 16px;
}

.review-item {
  position: relative;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255,255,255,0.064);
  border: 1px solid var(--border);
}

.review-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(var(--accent), var(--accent-2));
}

.review-item h3 {
  margin: 0 0 12px;
  padding-left: 8px;
  font-size: 1rem;
  line-height: 1.45;
}

.review-item p {
  margin: 8px 0;
  padding-left: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.review-item .good {
  color: #bbf7d0;
}

.review-item .bad {
  color: #fecaca;
}

.hidden {
  display: none !important;
}

footer {
  text-align: center;
  color: var(--muted-2);
  padding: 0 0 34px;
}

footer strong {
  color: var(--text);
}

@media (max-width: 900px) {
  .hero-card {
    grid-template-columns: 1fr;
  }

  .hero-preview {
    max-width: 560px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 22px, 1140px);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar__chips {
    justify-content: flex-start;
  }

  .hero-card {
    border-radius: 26px;
    padding: 22px;
  }

  h1 {
    letter-spacing: -0.045em;
  }

  .stats,
  .mini-metrics {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: auto;
  }

  .answer {
    grid-template-columns: 36px 1fr;
    align-items: start;
  }

  .answer input {
    width: 30px;
    height: 30px;
    border-radius: 10px;
  }

  .quiz-actions,
  .hero__actions {
    justify-content: stretch;
  }

  .btn {
    width: 100%;
  }
}

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