:root {
  color-scheme: dark;
  --bg: #101114;
  --surface: #17191f;
  --surface-strong: #20232b;
  --border: #303541;
  --text: #f4f7fb;
  --muted: #a7b0c0;
  --accent: #38d5b3;
  --accent-strong: #62f0d0;
  --danger: #ff6b7c;
  --success: #67e28f;
  --warning: #ffd166;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(56, 213, 179, 0.18), transparent 32rem),
    linear-gradient(135deg, #101114 0%, #151820 58%, #111417 100%);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(23, 25, 31, 0.88);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

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

button {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: var(--surface-strong);
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.primary-button {
  border-color: rgba(56, 213, 179, 0.55);
  color: #07120f;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  font-weight: 800;
}

.ghost-button {
  color: var(--muted);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.status-grid article {
  min-height: 92px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(23, 25, 31, 0.78);
}

.status-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

.description {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.quiz-form {
  display: grid;
  gap: 16px;
}

.question-card {
  margin: 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(23, 25, 31, 0.9);
}

.question-card.correct {
  border-color: rgba(103, 226, 143, 0.72);
}

.question-card.incorrect {
  border-color: rgba(255, 107, 124, 0.72);
}

legend {
  padding: 0;
  margin-bottom: 16px;
  font-size: 1.05rem;
  font-weight: 760;
  line-height: 1.45;
}

.options {
  display: grid;
  gap: 10px;
}

.option {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #12141a;
  color: var(--muted);
}

.option:has(input:checked) {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(56, 213, 179, 0.08);
}

.option.correct-answer {
  border-color: rgba(103, 226, 143, 0.88);
  color: var(--success);
}

.option.wrong-answer {
  border-color: rgba(255, 107, 124, 0.88);
  color: var(--danger);
}

.option input {
  margin: 3px 0 0;
  accent-color: var(--accent);
}

.footer-actions {
  margin-top: 22px;
  justify-content: flex-end;
}

.results {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(23, 25, 31, 0.92);
}

.results h2 {
  margin: 0 0 12px;
  font-size: 1.4rem;
}

.results ul {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.55;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1040px);
    padding-top: 20px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 20px;
  }

  .actions,
  .footer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  button {
    width: 100%;
  }

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

  .question-card {
    padding: 18px;
  }
}
