:root {
  color-scheme: light;
  font: 16px system-ui, sans-serif;
  background: #dfe5d9;
  color: #122820;
}
* { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; cursor: pointer; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #a1592c; outline-offset: 2px; }
main {
  height: 100svh;
  max-width: 550px;
  margin: auto;
  padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: #f8f5e9;
}
header, .stats, .actions { display: flex; align-items: center; gap: 6px; }
header, .stats { justify-content: space-between; }
header { border-bottom: 1px solid #c2cec0; }
header a, .sound, .primary, .actions a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
header a { font-weight: 750; text-decoration: none; }
.sound, .primary {
  justify-content: center;
  border: 1px solid #849883;
  border-radius: 10px;
  padding: 5px 11px;
  background: #fffdf5;
  font-weight: 700;
}
.primary { background: #d9ef77; border-color: #5d7534; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.48rem, 6vw, 2.4rem); letter-spacing: -.05em; line-height: 1.02; }
h2 { font-size: clamp(1.05rem, 4.8vw, 1.55rem); line-height: 1.12; }
.label, .badge {
  font-size: .71rem;
  font-weight: 850;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.badge { background: #d9ef77; border-radius: 4px; color: #18351e; padding: 4px 8px; }
section { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 7px; }
#intro, #result, #review { justify-content: center; align-items: start; }
.cover {
  width: 100%; height: min(25svh, 190px); object-fit: cover; object-position: 50% 42%;
  border-radius: 14px 14px 5px 5px;
}
.year-picker { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.year-choice {
  min-height: 44px; padding: 0 2px; font-weight: 800; border: 1px solid #849883;
  background: #fffdf5; border-radius: 8px;
}
.year-choice[aria-pressed=true] { background: #18382b; color: #fffdf5; }
#year-topic, #result-best { font-size: .9rem; }
.stats { font-size: .8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stats span { background: #e0e8d7; border-radius: 5px; padding: 5px 7px; }
.stats #timer { background: #18382b; color: #f1ffb1; }
.urgent .stats #timer { background: #8c3623; color: #fff; }
progress { width: 100%; height: 6px; accent-color: #638327; }
#choices, #listen-choices {
  flex: 1; min-height: 0; display: grid; gap: 7px;
  grid-template: repeat(2, minmax(0, 1fr)) / repeat(2, minmax(0, 1fr));
}
#listen-choices { grid-template: minmax(0, 1fr) / repeat(3, minmax(0, 1fr)); max-height: 190px; }
.card {
  min-height: 44px; display: grid; grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden; padding: 0; border: 1px solid #7c9581; border-radius: 10px;
  background: #18382b; color: #fffdf5; font-size: .92rem; font-weight: 800;
}
.card img { width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.card span { padding: 4px 2px; }
.card.correct { background: #d9ef77; color: #18351e; border-color: #526b30; }
.card.wrong { background: #8c3623; border-color: #713624; }
.card.correct span::before { content: '✓ '; }
.card.wrong span::before { content: '× '; }
#feedback, #listen-feedback, .review-note {
  font-size: .84rem; background: #e7eddf; border: 1px solid #b1c4ab;
  border-radius: 8px; padding: 6px 8px;
}
#feedback { min-height: 3.5em; }
#feedback[data-result=correct] { background: #e5efa9; }
#feedback[data-result=wrong] { background: #ffe7d6; }
#result, #review { padding: 13px; border-radius: 14px; border: 1px solid #a0b49d; background: #eff1df; }
#result h2 { font-size: clamp(1.45rem, 6vw, 2rem); }
.actions { flex-wrap: wrap; }
#listen { justify-content: center; }
#listen summary { min-height: 44px; display: list-item; align-content: center; cursor: pointer; font-weight: 700; }
#listen-hint { font-size: .88rem; }
#listen-credits { min-height: 44px; display: inline-flex; align-items: center; font-size: .84rem; }
.review-photo { width: 100%; height: min(25svh, 165px); object-fit: cover; border-radius: 10px; }
@media (max-height: 540px) {
  main, section { gap: 5px; }
  .cover { height: min(21svh, 105px); }
  #listen-choices { max-height: 125px; }
}
@media (prefers-reduced-motion: no-preference) {
  .card { transition: transform 140ms ease; }
  .card:active:not(:disabled) { transform: scale(.97); }
  .card.correct { animation: correct-pop 240ms ease-out; }
  @keyframes correct-pop { 50% { transform: scale(.98); } }
}
