:root {
  --bg: #faf7f2;
  --ink: #2b2620;
  --muted: #8a8072;
  --accent: #7a3b2e;
  --accent-soft: #eadfd2;
  --good: #3c6e47;
  --bad: #a4402f;
  --card: #ffffff;
  --border: #ddd2c1;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  height: 100dvh;
  height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Georgia, 'Iowan Old Style', serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(12px, env(safe-area-inset-top, 12px)) max(12px, env(safe-area-inset-right, 12px)) max(12px, env(safe-area-inset-bottom, 12px)) max(12px, env(safe-area-inset-left, 12px));
  overflow: hidden;
}
h1 {
  font-weight: normal;
  font-size: 1.3rem;
  letter-spacing: 0.03em;
  margin: 0 0 2px;
  flex-shrink: 0;
}
.subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.stats {
  display: flex;
  gap: 18px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 10px;
  flex-shrink: 0;
}
.stats span b { color: var(--ink); }
#cardArea {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.category {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 8px;
  flex-shrink: 0;
}
.prompt {
  font-size: clamp(1.4rem, 5vw, 2rem);
  margin-bottom: 16px;
  flex-shrink: 0;
}
.options {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  justify-content: center;
}
.option {
  font-family: inherit;
  font-size: clamp(1rem, 4vw, 1.15rem);
  padding: 16px 16px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  flex-shrink: 0;
}
.option:hover:not(:disabled) {
    /*background: var(--accent-soft); */
}
.option:disabled { cursor: default; }
.option.correct {
  border-color: var(--good);
  background: var(--good);
  color: #fff;
}
.option.incorrect {
  border-color: var(--bad);
  background: var(--bad);
  color: #fff;
}
.controls {
  margin-top: 8px;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
button {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 9px 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
button:hover {
    /*background: var(--accent-soft); */
}
button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
button.primary:hover { opacity: 0.9; }
.top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
select {
  font-family: inherit;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  flex-shrink: 0;
  font-size: 0.85rem;
}
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.lang-switch .lang {
  color: var(--muted);
  transition: color 0.2s;
}
.lang-switch .lang.active {
  color: var(--ink);
  font-weight: bold;
}
.switch-track {
  position: relative;
  width: 34px;
  height: 18px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.switch-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.2s;
}
.lang-switch.reversed .switch-thumb {
  transform: translateX(16px);
}
.done {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}
