:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #24292b;
  --muted: #6b7280;
  --border: #e2e0da;
  --accent: #2f6f5e;
  --accent-ink: #ffffff;
  --good: #2f6f5e;
  --bad: #a4443a;
  --radius: 14px;
  --tap: 52px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px 16px 40px;
}

.hidden {
  display: none !important;
}

header.app-header {
  padding: 8px 4px 20px;
}

header.app-header h1 {
  font-size: 22px;
  margin: 0 0 6px;
}

.reminder {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.test-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.test-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-height: var(--tap);
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.test-card:active {
  background: #f0efe9;
}

.test-card-title {
  font-weight: 600;
  font-size: 17px;
}

.test-card-range {
  color: var(--muted);
  font-size: 14px;
  margin-top: 2px;
}

.test-card-score {
  text-align: right;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.test-card-score strong {
  color: var(--ink);
  font-size: 15px;
  display: block;
}

.mode-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.big-button {
  display: block;
  width: 100%;
  min-height: var(--tap);
  border-radius: var(--radius);
  border: none;
  font: inherit;
  font-weight: 600;
  font-size: 17px;
  cursor: pointer;
  padding: 12px 16px;
}

.big-button.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.big-button.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}

.big-button:active {
  opacity: 0.85;
}

.section-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 20px 0 10px;
}

/* Quiz screen */
.quiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.progress-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.progress-text {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}

.mode-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}

.mode-toggle button {
  flex: 1;
  border: none;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 8px;
  cursor: pointer;
}

.mode-toggle button.active {
  background: var(--accent);
  color: var(--accent-ink);
}

.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 16px;
}

.question-type-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
  margin-bottom: 8px;
}

.question-text {
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 16px;
}

.speak-hint {
  font-size: 13px;
  color: var(--muted);
  margin: -8px 0 16px;
}

.staleness-hint {
  font-size: 13px;
  color: var(--muted);
  margin: -8px 0 16px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-button {
  display: block;
  width: 100%;
  text-align: left;
  min-height: var(--tap);
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  cursor: pointer;
}

.option-button:active {
  background: #f0efe9;
}

.option-button.correct {
  border-color: var(--good);
  background: #eaf3f0;
}

.option-button.incorrect {
  border-color: var(--bad);
  background: #f8ecea;
}

.option-button:disabled {
  cursor: default;
}

.text-input {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--border);
  font: inherit;
  font-size: 16px;
  margin-bottom: 12px;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
}

.feedback {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 15px;
}

.feedback.good {
  background: #eaf3f0;
  color: var(--good);
}

.feedback.bad {
  background: #f8ecea;
  color: var(--bad);
}

.feedback.info {
  background: #eef1f4;
  color: var(--muted);
}

.answer-reveal {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 4px;
}

.answer-reveal strong {
  color: var(--ink);
}

.quiz-actions {
  display: flex;
  gap: 10px;
}

.quiz-actions .big-button {
  flex: 1;
}

/* Summary screen */
.summary-score {
  text-align: center;
  padding: 24px 0 8px;
}

.summary-score .big-number {
  font-size: 48px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.summary-score .big-label {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
}

.missed-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 20px;
}

.missed-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.missed-item .q {
  font-weight: 600;
  margin-bottom: 6px;
}

.missed-item .a {
  font-size: 14px;
  color: var(--muted);
}

.missed-item .a strong {
  color: var(--ink);
}

.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.back-link {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  padding: 8px 0;
  margin-bottom: 8px;
  cursor: pointer;
  text-align: left;
}

@media (min-width: 600px) {
  .options-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
