:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --text: #2b2620;
  --muted: #8a8175;
  --primary: #b5482e;
  --primary-dark: #963a24;
  --correct: #3f7d4f;
  --incorrect: #b5482e;
  --skipped: #8a8175;
  --border: #e4ddd0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1a17;
    --surface: #262320;
    --text: #f0ece3;
    --muted: #a39c8f;
    --primary: #e07a5f;
    --primary-dark: #d3673f;
    --correct: #6fbf7f;
    --incorrect: #e07a5f;
    --skipped: #a39c8f;
    --border: #3a352f;
  }
}

* { box-sizing: border-box; }

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

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  min-height: 100vh;
}

header h1 {
  font-size: 1.5rem;
  text-align: center;
  margin: 8px 0 24px;
}

.hidden { display: none !important; }

.subtitle {
  color: var(--muted);
  text-align: center;
  margin-bottom: 24px;
}

.btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  font-size: 1.05rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:active { background: var(--primary-dark); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: transparent;
  color: var(--incorrect);
  border: 1px solid var(--border);
}

.btn-link {
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
  font-weight: 400;
  padding: 12px;
}

.stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.stat::before { margin-right: 4px; }
.stat-correct { color: var(--correct); }
.stat-correct::before { content: "✔"; }
.stat-incorrect { color: var(--incorrect); }
.stat-incorrect::before { content: "✘"; }
.stat-skipped { color: var(--skipped); }
.stat-skipped::before { content: "⏭"; }
.stat-timer { color: var(--muted); margin-left: auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 20px;
}

.group {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
  min-height: 1em;
}

.spanish {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 24px;
  word-break: break-word;
}

#answer-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 16px;
}

#answer-input:focus {
  outline: 2px solid var(--primary);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.feedback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.feedback #feedback-text {
  font-size: 1.2rem;
  font-weight: 600;
}

.feedback.correct #feedback-text { color: var(--correct); }
.feedback.incorrect #feedback-text,
.feedback.skipped #feedback-text { color: var(--incorrect); }

.feedback #next-btn { max-width: 200px; }

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

.summary p {
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
}

#history h2 {
  font-size: 1rem;
  color: var(--muted);
  margin: 32px 0 12px;
}

.history-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.history-row span:first-child { color: var(--muted); }
