:root {
  --bg: #f1f3ff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #5b6278;
  --border: #e4e7f5;
  --accent: #2563eb;
  --success: #16a34a;
  --danger: #dc2626;
  --shadow: 0 20px 45px rgba(15, 25, 42, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(37, 99, 235, 0.15), transparent 45%),
    var(--bg);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
  padding: 2rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.app-header {
  text-align: center;
  margin-bottom: 1rem;
}

h1 {
  margin: 0.25rem 0;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 640px;
}

.menu-toggle {
  margin-top: 1rem;
  padding: 0.65rem 1.2rem;
  font-size: 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.menu-toggle:hover {
  border-color: rgba(37, 99, 235, 0.45);
}

.card {
  width: min(960px, 100%);
  background: var(--card);
  border-radius: 24px;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.loading {
  padding: 0.5rem 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.loading.hidden {
  display: none;
}

.progress-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: #e5e7f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #0ea5e9);
  transition: width 0.4s ease;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  gap: 0.25rem;
}

.question-id {
  font-size: 0.9rem;
  color: var(--muted);
}

.question-text {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.5;
  min-height: 4rem;
}

.options {
  display: grid;
  gap: 0.75rem;
}

.choice-button {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #f9fbff;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  font-size: 1rem;
  color: var(--text);
  text-align: left;
}

.choice-button:focus-visible {
  outline: 2px dashed #2563eb;
  outline-offset: 3px;
}

.choice-button:hover {
  border-color: rgba(37, 99, 235, 0.45);
}

.choice-label {
  font-weight: 600;
  width: 1.5rem;
}

.choice-text {
  font-size: 0.95rem;
  color: var(--text);
}

.choice-button.selected {
  border-color: #a78bfa;
  background: #faf5ff;
}

.choice-button.correct {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.15);
}

.choice-button.incorrect {
  border-color: var(--danger);
  background: rgba(220, 38, 38, 0.15);
}

.answer-note {
  margin: 0;
  min-height: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.nav-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nav-button {
  border: none;
  padding: 0.85rem 1.25rem;
  border-radius: 14px;
  font-size: 0.95rem;
  background: #e2e8f0;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.nav-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nav-button:not(:disabled):hover {
  transform: translateY(-1px);
  background: #d1d9f2;
}

.next-button {
  background: var(--accent);
  color: #fff;
}

.next-button:not(:disabled):hover {
  transform: translateY(-1px);
}

.status {
  margin: 0;
  color: #b91c1c;
  font-size: 0.9rem;
  min-height: 1.5rem;
}

.sidebar {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
  z-index: 50;
}

.sidebar--open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.sidebar__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.sidebar__panel {
  position: relative;
  width: min(360px, 90vw);
  background: #fff;
  height: 100%;
  padding: 1.5rem;
  box-shadow: -10px 20px 45px rgba(15, 23, 42, 0.2);
  border-radius: 0 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.sidebar__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.sidebar__title {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 600;
}

.sidebar__subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.sidebar__close {
  border: none;
  background: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
}

.sidebar__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.sidebar__item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  background: #f9fbff;
  cursor: pointer;
  text-align: left;
}

.sidebar__item--active {
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.1);
}

@media (max-width: 600px) {
  .card {
    padding: 1.25rem;
    border-radius: 18px;
  }

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

  .choice-button {
    grid-template-columns: auto;
  }

  .choice-label {
    width: 100%;
  }

  .sidebar__panel {
    width: 100%;
    border-radius: 0;
  }
}

.status {
  margin: 0;
  color: #b91c1c;
  font-size: 0.9rem;
  min-height: 1.5rem;
}

.app-footer {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .card {
    padding: 1.25rem;
    border-radius: 18px;
  }

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

  .choice-button {
    grid-template-columns: auto;
  }

  .choice-label {
    width: 100%;
  }
}
