:root {
  --ground: #f4f1ea;
  --surface: #fffdf8;
  --ink: #1f1c18;
  --muted: #6b645a;
  --line: #ded8cc;
  --accent: #c8402f;
  --accent-ink: #ffffff;
  --right: #1f7a4d;
  --wrong: #b3261e;
  font-family: system-ui, "Noto Sans Thai", "Leelawadee UI", "Yu Gothic UI", "Noto Sans JP", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #17150f;
    --surface: #221f18;
    --ink: #f1ece1;
    --muted: #a59d8e;
    --line: #3a3529;
    --accent: #ef6a57;
    --accent-ink: #1b1109;
    --right: #5cc892;
    --wrong: #f2857a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--ground);
  color: var(--ink);
  line-height: 1.6;
}

main { width: 100%; max-width: 640px; }

.volume {
  position: fixed;
  top: 12px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.volume input { width: 120px; accent-color: var(--accent); }

@media (max-width: 480px) {
  body { padding-top: 52px; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
}

.center { text-align: center; }

h1 { margin: 0 0 6px; font-size: 1.9rem; line-height: 1.25; }
h2 { margin: 8px 0 2px; font-size: 1.5rem; line-height: 1.3; }

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lede, .meta, .status { color: var(--muted); }
.lede { margin: 0 0 20px; }
.meta { margin: 0; }
.status { margin: 16px 0 4px; font-weight: 600; }
.warning { margin: 0 0 14px; min-height: 1.6em; color: var(--wrong); }
.error { color: var(--wrong); }

fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 14px; padding: 8px 14px 12px; }
legend { padding: 0 6px; color: var(--muted); font-size: 0.9rem; }
.choice { display: block; padding: 2px 0; }
.rounds { display: flex; align-items: center; gap: 10px; }
.rounds input { width: 84px; padding: 6px 8px; font: inherit; color: inherit; background: var(--ground); border: 1px solid var(--line); border-radius: 8px; }

button { font: inherit; cursor: pointer; }

.primary {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 13px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.primary:disabled { opacity: 0.4; cursor: not-allowed; }

.waiting { margin-top: 18px; color: var(--muted); font-size: 0.9rem; }
.waiting ul { margin: 8px 0 0; padding-left: 20px; overflow-wrap: anywhere; }

.round-head { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); }
.cue { font-size: 0.9rem; }
.seconds { color: var(--ink); font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.timer { height: 8px; margin: 6px 0 20px; background: var(--line); border-radius: 4px; overflow: hidden; }
.timer-fill { height: 100%; background: var(--accent); transform-origin: left; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 10px 12px;
  text-align: left;
  color: inherit;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.option:hover, .option:focus-visible { border-color: var(--accent); outline: none; }
.key { flex: none; color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.label { overflow-wrap: anywhere; }

.reveal { text-align: center; }
.verdict { margin: 0 0 12px; font-weight: 700; }
.verdict.right, .results .right .mark { color: var(--right); }
.verdict.wrong, .results .wrong .mark { color: var(--wrong); }
.cover { display: block; width: min(260px, 100%); margin: 0 auto 10px; border-radius: 8px; }
.reveal a { display: inline-block; margin-top: 10px; color: var(--accent); }

.results { margin: 16px 0 0; padding: 0; list-style: none; }
.results li { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.mark { flex: none; font-weight: 700; }

@media (max-width: 480px) {
  .panel { padding: 20px; }
  .options { grid-template-columns: 1fr; }
}

.about-link { margin: 18px 0 0; text-align: center; font-size: 0.9rem; }
.about-link a, .about a { color: var(--accent); }
.about h2 { margin-top: 22px; font-size: 1.1rem; }
.about ul { padding-left: 20px; }
.about a.primary { color: var(--accent-ink); text-align: center; text-decoration: none; }
