:root {
  --berry: #0ea5e9;
  --berry-dark: #0369a1;
  --berry-light: #e0f2fe;
  --green: #2e7d4f;
  --red: #c0392b;
  --bg: #faf7f8;
  --text: #2a1f22;
  --muted: #7a6b70;
  --border: #e5d8dd;
  --radius: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 2rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--berry);
  color: #fff;
  padding: 0.9rem 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  font-size: 1.15rem;
  margin: 0;
  flex: 1;
  text-align: center;
}

.icon-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  width: 2rem;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem;
}

.screen { display: none; }
.screen.active { display: block; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.85rem;
}

.mode-card {
  cursor: pointer;
  transition: transform 0.08s ease;
}
.mode-card:active { transform: scale(0.98); }
.mode-card h2 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.mode-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.badge {
  display: inline-block;
  background: var(--berry);
  color: #fff;
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.8rem;
  vertical-align: middle;
}

.list { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1rem; }

.list-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  cursor: pointer;
  font-size: 1rem;
  text-align: left;
}
.list-item.selected {
  border-color: var(--berry);
  background: var(--berry-light);
}
.list-item .count { color: var(--muted); font-size: 0.85rem; }

.btn-primary, .btn-secondary {
  display: block;
  width: 100%;
  padding: 0.85rem;
  border-radius: var(--radius);
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
}
.btn-primary { background: var(--berry); color: #fff; }
.btn-primary:disabled { background: #c9a3b3; cursor: not-allowed; }
.btn-secondary { background: #fff; color: var(--berry); border: 1px solid var(--berry); }

.quiz-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
}
#quiz-timer.warn { color: var(--red); font-weight: 700; }

.question-box { margin-bottom: 1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }

#quiz-question { font-size: 1.1rem; line-height: 1.4; margin: 0.3rem 0 0; }

.choices { display: flex; flex-direction: column; gap: 0.6rem; }

.choice-btn {
  text-align: left;
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  font-size: 1rem;
  cursor: pointer;
}
.choice-btn .letter { font-weight: 700; margin-right: 0.5rem; }
.choice-btn.correct { background: #e4f5eb; border-color: var(--green); }
.choice-btn.wrong { background: #fbe7e4; border-color: var(--red); }
.choice-btn.selected { background: var(--berry-light); border-color: var(--berry); }
.choice-btn:disabled { cursor: default; }

.explanation {
  margin-top: 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.explanation p { margin: 0.2rem 0; }

.ai-badge {
  background: #eee;
  color: #555;
  font-size: 0.7rem;
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  margin-left: 0.4rem;
}

#results-breakdown .row, #results-review .review-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  margin-bottom: 0.5rem;
}
#results-breakdown .row { display: flex; justify-content: space-between; }
.review-item .q { font-weight: 600; margin-bottom: 0.3rem; }
.review-item .your-answer { color: var(--red); }
.review-item .correct-answer { color: var(--green); }

label { display: block; margin: 0.8rem 0 0.3rem; font-weight: 600; }
input[type="password"], input[type="text"] {
  width: 100%;
  padding: 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 1rem;
}
