:root {
  color-scheme: dark;
  --background: #0b1226;
  --card: #151f39;
  --border: #34415f;
  --text: #f6f3ed;
  --muted: #b0bed7;
  --gold: #ffda83;
  font: 16px/1.5 system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  background: radial-gradient(ellipse at 50% 0, #213363 0%, var(--background) 65%) fixed;
}
[hidden] { display: none !important; }
a { color: var(--gold); text-underline-offset: .25em; }
button, input, textarea { font: inherit; }
button {
  min-height: 44px;
  padding: .6rem 1.05rem;
  border: 1px solid transparent;
  border-radius: .6rem;
  background: var(--gold);
  color: #282013;
  font-weight: 700;
  cursor: pointer;
}
button:hover:enabled { filter: brightness(1.1); }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid #f9e5a9; outline-offset: 4px; }
button.secondary { color: var(--text); background: transparent; border-color: var(--border); }
input, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: .35rem;
  padding: .65rem .8rem;
  color: var(--text);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: .5rem;
}
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 6vw, 3.5rem); line-height: 1.12; letter-spacing: -.04em; }
h2 { font-size: 1.3rem; line-height: 1.35; }
p { color: var(--muted); }
strong, b { color: var(--text); }
#game-header { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem max(1rem, calc((100vw - 1140px) / 2)); }
main { width: min(1140px, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0 4rem; }
#intro { margin-bottom: 1.8rem; }
#intro p { color: var(--gold); margin-top: .5rem; }
.player main { width: min(100% - 2rem, 36rem); }
.player #intro, .waiting { text-align: center; }
.player.playing #game-header, .player.playing #intro { display: none; }
.player.playing main { min-height: 100dvh; display: grid; align-content: center; gap: .75rem; padding: 1rem 0; }
.player.playing #game { display: grid; justify-items: center; }
#buzzer {
  width: min(66vw, 18rem);
  aspect-ratio: 1;
  border: 5px solid #fb6d75;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 32%, #db2b40, #a50f25 70%);
  box-shadow: 0 .65rem 0 #680e21, 0 1rem 2rem #0006;
  color: white;
  font-size: clamp(1.3rem, 5vw, 2rem);
  touch-action: manipulation;
}
#buzzer:active:enabled { transform: translateY(.35rem); box-shadow: 0 .3rem 0 #680e21; }
#buzzer:disabled { opacity: .65; }
#error, #join-error { color: #ffadb3; }
#error, #connection { margin-bottom: .8rem; }
.invite { margin-bottom: 1.4rem; max-width: 33rem; }
.invite div { display: flex; gap: .5rem; margin-top: .35rem; }
.invite input { margin: 0; }
.card, dialog { background: var(--card); border: 1px solid var(--border); border-radius: 1rem; padding: clamp(1rem, 3vw, 1.6rem); }
.card > * + * { margin-top: .8rem; }
dialog { width: min(100% - 2rem, 24rem); color: var(--text); }
dialog::backdrop { background: #060a18ce; }
dialog form, .opening { display: grid; gap: .75rem; }
.opening > * + * { margin-top: 0; }
.host-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(13rem, 17rem); gap: 1rem; align-items: start; }
.roster small { color: var(--gold); }
.roster ul, .results { list-style: none; padding: 0; margin-bottom: 0; }
.roster li { display: flex; justify-content: space-between; gap: 1rem; overflow-wrap: anywhere; padding: .4rem 0; border-top: 1px solid var(--border); }
.chooser { margin-bottom: 1rem; }
.board { display: grid; gap: .45rem; }
.topic-row { display: grid; grid-template-columns: minmax(0, 1.8fr) repeat(5, minmax(0, 1fr)); gap: .4rem; }
.topic-row h3 { display: grid; align-items: center; padding: .4rem; background: var(--card); border-radius: .5rem; font-size: .9rem; line-height: 1.2; }
.topic-row button { padding: .15rem; min-height: clamp(2.7rem, 6vw, 4rem); background: #243a78; border-color: #4966ac; color: var(--gold); font-size: clamp(.9rem, 3vw, 1.55rem); }
.topic-row button.selected { border-color: var(--gold); opacity: 1; }
.question { margin-bottom: 1rem; }
.question h2 { white-space: pre-wrap; }
.question-value { color: var(--gold); }
.responding { margin-bottom: .8rem; }
.actions { display: flex; gap: .55rem; flex-wrap: wrap; }
.end-game, #editor { margin-top: 1rem; }
#editor details { border-top: 1px solid var(--border); padding-top: .5rem; }
#editor summary { cursor: pointer; padding: .5rem 0; }
.topic-edit { display: grid; gap: .8rem; margin-bottom: .75rem; }
.topic-edit fieldset { min-width: 0; display: grid; gap: .5rem; border: 1px solid var(--border); border-radius: .5rem; }
.topic-edit legend { color: var(--gold); padding: 0 .45rem; }
.results { display: grid; gap: .5rem; margin-bottom: 1rem; }
.results li { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; gap: .7rem; align-items: center; overflow-wrap: anywhere; padding: .85rem; border: 1px solid var(--border); border-radius: .6rem; background: var(--card); }
.results li.place-1 { border-color: #e9bf60; color: #ffda83; }
.results li.place-2 { border-color: #a6bddd; color: #cfddf5; }
.results li.place-3 { border-color: #d49b80; color: #f7bfa2; }
@media (max-width: 720px) {
  .host-layout { grid-template-columns: minmax(0, 1fr); }
  main { padding-top: 1.2rem; }
  .topic-row { gap: .25rem; }
  .topic-row h3 { font-size: .75rem; }
}
