:root {
  --ink: #1b2422;
  --muted: #5c6b66;
  --paper: #f3f1ea;
  --card: #fffcf7;
  --line: #d9d3c5;
  --teal: #14343a;
  --teal-2: #1f4c54;
  --good: #1d6b45;
  --good-bg: #e5f4eb;
  --bad: #9d342c;
  --bad-bg: #fbeceb;
  --shadow: 0 1px 0 rgba(20, 52, 58, 0.06);
  color-scheme: light;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  min-height: 100dvh;
}

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--teal);
  color: #f6f3ea;
}

.brand {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 1.05rem;
}

.score {
  margin: 0;
  font-size: 0.95rem;
}

.score strong {
  font-size: 1.15rem;
  margin-left: 4px;
}

main {
  width: min(640px, 100%);
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}

.lead {
  margin: 8px 0 18px;
  color: var(--muted);
  line-height: 1.45;
}

.stack {
  display: grid;
  gap: 12px;
}

.card, .option, .next {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 16px;
  text-align: left;
  box-shadow: var(--shadow);
}

.card {
  min-height: 88px;
  padding: 16px 18px;
  font: inherit;
  cursor: pointer;
}

.card strong {
  display: block;
  font-size: 1.08rem;
  line-height: 1.3;
}

.card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.card:active, .option:active, .next:active { transform: translateY(1px); }

.progress {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.stem {
  margin: 0 0 16px;
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: 1.22rem;
  line-height: 1.45;
}

.option {
  min-height: 64px;
  padding: 14px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font: inherit;
  font-size: 1.05rem;
  line-height: 1.35;
  cursor: pointer;
}

.letter {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: #f6f3ea;
  font-weight: 700;
}

.option.correct {
  background: var(--good-bg);
  border-color: var(--good);
}

.option.correct .letter { background: var(--good); }

.option.wrong {
  background: var(--bad-bg);
  border-color: var(--bad);
}

.option.wrong .letter { background: var(--bad); }

.option:disabled { cursor: default; }

.delta {
  margin: 4px 0 0;
  font-weight: 700;
}

.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }

.next {
  min-height: 56px;
  margin-top: 8px;
  background: var(--teal);
  color: #f6f3ea;
  border-color: var(--teal);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.result {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 18px;
}

.result h1 {
  margin: 0 0 8px;
  font-size: 1.6rem;
}

.result p { margin: 0 0 8px; line-height: 1.4; }

.error {
  background: var(--bad-bg);
  color: var(--bad);
  border-radius: 12px;
  padding: 12px 14px;
}

button:focus-visible, a:focus-visible {
  outline: 3px solid #d38b2c;
  outline-offset: 2px;
}

@media (min-width: 700px) {
  .stem { font-size: 1.35rem; }
  .card { min-height: 96px; }
}
