:root {
  color-scheme: dark;
  --bg: #071631;
  --panel: #0c2040;
  --line: #22395b;
  --text: #f4f6fa;
  --muted: #91a4c2;
  --gold: #dfbd7c;
  --green: #36d595;
  --blue: #5c9dff;
  --red: #ff6e79;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; background: radial-gradient(ellipse at 50% -20%, #163b73 0, transparent 65%), var(--bg); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .45; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }
.shell {
  max-width: 560px;
  margin: auto;
  padding: 24px max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.masthead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.brand { color: var(--gold); font-size: 22px; font-weight: 650; text-decoration: none; }
.icon-button { width: 44px; height: 44px; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 12px; font-size: 24px; }
.eyebrow { display: block; font-size: 10px; letter-spacing: 2px; color: var(--gold); font-weight: 700; }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tabs button { flex: 1; color: var(--muted); border: 0; border-bottom: 2px solid transparent; background: none; min-height: 48px; padding: 12px 4px; font-size: 14px; }
.tabs .active { border-color: var(--gold); color: var(--gold); }
.form-panel { display: grid; gap: 18px; }
label { display: block; font-size: 13px; margin-bottom: 16px; }
form label { margin-bottom: 0; }
input:not([type=checkbox]) { display: block; width: 100%; height: 50px; margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); padding: 12px; font-size: 16px; min-width: 0; }
input::placeholder { color: #7186a8; }
.muted { color: var(--muted); font-size: 12px; margin-left: 4px; }
.primary, .secondary, .danger, .danger-outline { min-height: 50px; border-radius: 10px; padding: 12px; font-size: 14px; font-weight: 650; }
.primary { background: var(--gold); border: 1px solid var(--gold); color: #101d35; }
.primary:not(:disabled):hover { background: #eed2a0; }
.secondary { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.danger-outline { border: 1px solid #804352; background: #ff6e7910; color: #ff99a2; }
.danger { border: 1px solid #b54a56; background: #872a3b; color: #fff; }
.wide { width: 100%; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; }
.toggle-row small { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 4px; }
input[type=checkbox] { accent-color: var(--gold); width: 22px; height: 22px; flex-shrink: 0; cursor: pointer; }
.footnote { color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; margin: 12px 0; }
.inline-error { color: #ffadb6; font-size: 13px; }
.inline-error:empty { display: none; }
.room-strip { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.room-code { border: 0; padding: 5px 0; background: none; color: var(--gold); font-size: 19px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.subtle-button { background: none; color: var(--muted); border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px; min-height: 44px; font-size: 13px; }
.question-line { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 12px; font-size: 12px; color: var(--muted); gap: 8px; }
.connection { font-size: 12px; white-space: nowrap; }
.connection:before { content: ""; display: inline-block; height: 6px; width: 6px; border-radius: 50%; margin-right: 6px; background: #3cc68a; }
.connection.offline:before { background: #f17586; }
.winner-panel { text-align: center; padding: 32px 0 14px; min-height: 130px; }
.winner-panel h2 { font-size: clamp(25px, 7vw, 36px); margin: 10px 0 6px; letter-spacing: -.8px; overflow-wrap: anywhere; }
.winner-panel p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; }
.buzzer-wrap { text-align: center; margin: 8px 0 20px; }
.buzzer {
  --buzz: var(--green);
  position: relative;
  width: min(100%, 270px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--buzz) 60%, transparent);
  padding: 12px;
  color: var(--buzz);
  background: radial-gradient(circle, var(--buzz) -250%, #0a2038 85%);
  box-shadow: 0 0 50px color-mix(in srgb, var(--buzz) 10%, transparent), 0 10px 30px #0004;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color .18s, color .18s, transform .1s;
}
.buzzer-inner { display: flex; width: 100%; height: 100%; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--buzz) 65%, transparent); background: radial-gradient(circle at 45% 25%, color-mix(in srgb, var(--buzz) 22%, #0c2340), #091c34); flex-direction: column; align-items: center; justify-content: center; gap: 12px; box-shadow: inset 0 0 35px color-mix(in srgb, var(--buzz) 12%, transparent); }
.buzzer-inner strong { font-size: 28px; letter-spacing: .3px; }
.buzzer.blue { --buzz: var(--blue); }
.buzzer.red { --buzz: var(--red); }
.buzzer.idle { --buzz: #8497b3; }
.buzzer:disabled { opacity: .75; }
.buzzer:not(:disabled):active, .buzzer.sending { transform: scale(.96); }
.buzz-hint { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 12px 0; }
.participants { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.section-title h3 { font-size: 15px; margin: 0; }
.section-title > span { color: var(--muted); font-size: 12px; }
.players { list-style: none; margin: 0; padding: 0; }
.player-row { display: flex; gap: 10px; align-items: center; min-height: 62px; border-bottom: 1px solid #22395b80; padding: 12px 0; }
.player-avatar { display: flex; width: 34px; height: 34px; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); flex-shrink: 0; font-size: 12px; color: var(--muted); }
.player-row.first .player-avatar { border-color: var(--gold); color: var(--gold); font-weight: 700; }
.player-info { min-width: 0; flex: 1; }
.player-info strong { display: block; font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.player-info small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.player-time { font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; color: var(--muted); }
.player-row.first .player-time { color: var(--gold); font-weight: 700; }
.player-row.excluded { opacity: .6; }
.self-line { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; margin-top: 16px; overflow-wrap: anywhere; }
.host-controls { padding: 12px 0; }
.host-action-row { display: flex; gap: 10px; margin-top: 8px; }
.host-action-row > * { flex: 1; min-width: 0; font-size: 12px; }
.countdown { margin-top: 16px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
.countdown > span { font-size: 12px; color: var(--muted); }
.countdown strong { font-size: 25px; color: var(--gold); font-variant-numeric: tabular-nums; }
.timer-track { height: 3px; background: var(--line); grid-column: 1/-1; overflow: hidden; }
.timer-track > div { background: var(--gold); height: 100%; width: 100%; transform-origin: left center; }
.host-status, .waiting-controls p { color: var(--muted); font-size: 12px; text-align: center; line-height: 1.5; }
dialog { border: 1px solid var(--line); border-radius: 18px; background: #0b1e3b; color: var(--text); padding: 24px; width: calc(100% - 32px); max-width: 440px; max-height: 85dvh; overflow: auto; box-shadow: 0 30px 100px #0007; }
dialog::backdrop { background: #030b1dc9; backdrop-filter: blur(5px); }
.dialog-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
dialog h2 { font-size: 20px; margin: 0; overflow-wrap: anywhere; }
.dialog-description { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 16px 0 20px; }
dialog .primary, dialog .secondary, dialog .danger { margin-top: 10px; }
dialog hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
#settings-form { display: grid; gap: 16px; }
.check-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.manage-heading { font-size: 14px; margin-top: 20px; }
.manage-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.manage-row > strong { font-size: 13px; display: block; overflow-wrap: anywhere; }
.manage-row > div { display: flex; gap: 8px; }
.manage-row button { flex: 1; min-height: 44px; font-size: 12px; padding: 8px; margin-top: 8px; }
.toast { position: fixed; z-index: 20; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: #e9ce9b; color: #10213b; border: 1px solid var(--gold); border-radius: 12px; padding: 12px 16px; max-width: min(90vw, 440px); width: max-content; font-size: 13px; text-align: center; overflow-wrap: anywhere; box-shadow: 0 10px 30px #0004; }
@media (min-width: 700px) { .shell { padding-top: 38px; } #landing { max-width: 440px; margin: auto; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
