:root {
  color-scheme: light;
  --ink: #17251f;
  --muted: #68756f;
  --paper: #f4f0e6;
  --panel: #fffdf8;
  --line: #d8d0bf;
  --brand: #153b2f;
  --brand-2: #28644e;
  --accent: #d88a2d;
  --danger: #a33a32;
  --shadow: 0 14px 40px rgb(28 42 34 / 12%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at top, #fffaf0, var(--paper) 46%); color: var(--ink); min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.site-header { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: 1rem clamp(1rem, 4vw, 3rem); background: var(--brand); color: white; }
.site-header h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(1.4rem, 3vw, 2.2rem); }
.eyebrow { margin: 0 0 .2rem; text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; opacity: .75; }
.connection { border: 1px solid rgb(255 255 255 / 35%); border-radius: 999px; padding: .35rem .7rem; font-size: .82rem; }
.connection.online { background: rgb(66 181 123 / 30%); }
.app-shell { width: min(1320px, 100%); margin: 0 auto; padding: clamp(1rem, 3vw, 2.5rem); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: clamp(1rem, 3vw, 2rem); }
.home-grid, .game-grid { display: grid; gap: 1.25rem; }
.home-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.game-grid { grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); align-items: start; }
.stack { display: grid; gap: .85rem; }
.inline { display: flex; gap: .65rem; flex-wrap: wrap; align-items: center; }
h2, h3 { margin: 0; }
h2 { font-family: Georgia, serif; font-size: clamp(1.5rem, 4vw, 2.4rem); }
p { line-height: 1.55; }
label { display: grid; gap: .35rem; font-weight: 650; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: .72rem .8rem; background: white; color: var(--ink); }
.primary, .secondary, .danger, .choice, .gap-button, .card-button { border-radius: 11px; padding: .72rem 1rem; border: 1px solid transparent; font-weight: 750; }
.primary { background: var(--brand); color: white; }
.primary:hover { background: var(--brand-2); }
.secondary { background: white; color: var(--brand); border-color: var(--brand); }
.danger { background: white; color: var(--danger); border-color: var(--danger); }
button:disabled { cursor: not-allowed; opacity: .58; }
.room-code { display: inline-block; font-size: clamp(2rem, 8vw, 4.5rem); font-weight: 900; letter-spacing: .14em; color: var(--brand); }
.subtle { color: var(--muted); }
.message { padding: .65rem .85rem; background: #f1eadb; border-left: 4px solid var(--accent); border-radius: 8px; }
.player-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.player-row { display: flex; justify-content: space-between; gap: 1rem; padding: .58rem .7rem; border-bottom: 1px solid #ebe4d6; }
.player-row.me { background: #edf5ef; border-radius: 8px; }
.badge { display: inline-block; font-size: .72rem; border-radius: 999px; padding: .18rem .42rem; background: #e8eee9; margin-left: .3rem; }
.score { font-variant-numeric: tabular-nums; font-weight: 850; }
.quiz-prompt { font-family: Georgia, serif; font-size: clamp(1.5rem, 4vw, 2.7rem); line-height: 1.25; }
.question-media { max-height: 42vh; max-width: 100%; display: block; margin: 0 auto; border-radius: 14px; object-fit: contain; box-shadow: var(--shadow); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .8rem; }
.choice { min-height: 72px; text-align: left; background: white; border-color: var(--line); color: var(--ink); }
.choice:hover { border-color: var(--brand); transform: translateY(-1px); }
.choice.selected { border-color: var(--accent); background: #fff4e2; }
.choice.correct { border-color: var(--brand-2); background: #e5f3ea; }
.choice.wrong { border-color: var(--danger); background: #fbe8e5; }
.timer { font-size: 1.35rem; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--brand); }
.clues { display: grid; gap: .5rem; }
.clue { background: #fff4df; border-radius: 10px; padding: .7rem; }
.timeline-scroll { overflow-x: auto; padding: 1rem 0 1.5rem; }
.timeline { display: flex; align-items: stretch; min-width: max-content; gap: .4rem; }
.timeline-event { width: 170px; border-radius: 12px; border: 1px solid var(--line); background: white; padding: .75rem; display: grid; gap: .35rem; }
.timeline-year { font-size: 1.25rem; font-weight: 900; color: var(--brand); }
.gap-button { align-self: center; background: #f8e7c7; border: 1px dashed var(--accent); color: #6f4618; min-width: 48px; min-height: 54px; }
.gap-button:hover { background: #f4d89f; }
.hand { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; }
.card-button { background: white; border-color: var(--line); text-align: left; min-height: 130px; }
.card-button.selected { outline: 3px solid var(--accent); background: #fff7e8; }
.category { text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; color: var(--muted); }
.tree-list { max-height: 300px; overflow: auto; margin: 0; padding-left: 1.2rem; }
.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%) translateY(140%); background: var(--ink); color: white; padding: .75rem 1rem; border-radius: 999px; box-shadow: var(--shadow); transition: transform .2s ease; z-index: 10; }
.toast.show { transform: translateX(-50%) translateY(0); }
.empty { padding: 1.5rem; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; }

@media (max-width: 820px) {
  .game-grid { grid-template-columns: 1fr; }
  .site-header { align-items: flex-start; }
  .timeline-event { width: 145px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
