
:root {
  --ink: #10233f;
  --ink-soft: #35506d;
  --paper: #f4f7fb;
  --surface: #ffffff;
  --line: #d8e1ee;
  --blue: #2563eb;
  --blue-dark: #1748bd;
  --teal: #08756f;
  --teal-soft: #dff6f1;
  --amber: #875100;
  --amber-soft: #fff1cf;
  --coral: #a82132;
  --coral-soft: #ffe5e8;
  --shadow: 0 18px 50px rgba(16, 35, 63, 0.12);
  --radius: 8px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100dvh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.08), rgba(8, 117, 111, 0.04) 38%, transparent 72%), var(--paper);
  letter-spacing: 0;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--blue); font-weight: 800; }
.auth-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-panel, .panel { background: rgba(255, 255, 255, 0.96); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-panel { width: min(100%, 430px); padding: 28px; }
.auth-panel h1, .topbar h1, .player-header h1 { margin: 4px 0 0; font-size: 32px; line-height: 1.15; }
.auth-panel h2, .panel h2, .player-status-row h2 { margin: 4px 0 0; font-size: 22px; line-height: 1.25; }
.subtle, .hint { color: var(--ink-soft); line-height: 1.6; }
.hint { margin: 14px 0 0; font-size: 14px; }
.eyebrow { margin: 0; color: var(--teal); font-size: 12px; font-weight: 900; letter-spacing: 0; text-transform: uppercase; }
.field { display: grid; gap: 8px; margin: 20px 0; color: var(--ink-soft); font-size: 14px; font-weight: 800; }
.field input { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; color: var(--ink); background: #fff; outline: none; }
.field input:focus, .button:focus-visible, .buzz-button:focus-visible { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18); outline: none; }
.form-error { min-height: 22px; margin: 12px 0 0; color: var(--coral); font-weight: 800; }
.button { min-height: 44px; border: 1px solid transparent; border-radius: var(--radius); padding: 0 16px; font-weight: 900; transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button.primary { color: #fff; background: var(--blue); box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22); }
.button.primary:hover:not(:disabled) { background: var(--blue-dark); }
.button.secondary { color: var(--ink); background: #eef4ff; border-color: #cfe0ff; }
.button.danger { color: var(--coral); background: var(--coral-soft); border-color: #ffc2c9; }
.button.ghost { color: var(--ink-soft); background: transparent; border-color: var(--line); }
.button.wide { width: 100%; }
.button:disabled, .buzz-button:disabled { opacity: 0.54; transform: none; box-shadow: none; }
.app-shell { width: min(1480px, 100%); margin: 0 auto; padding: 24px; }
.topbar, .player-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding: 20px 22px; color: #fff; background: linear-gradient(135deg, #10233f 0%, #1b4169 58%, #0f6c68 100%); border-radius: var(--radius); box-shadow: var(--shadow); }
.topbar .eyebrow, .player-header .eyebrow { color: #94f0df; }
.topbar-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.status-pill { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; border-radius: 999px; padding: 0 12px; color: var(--ink); background: #edf2f8; border: 1px solid rgba(16, 35, 63, 0.08); font-size: 13px; font-weight: 900; white-space: nowrap; }
.status-pill.success { color: #075f57; background: var(--teal-soft); }
.status-pill.warning { color: var(--amber); background: var(--amber-soft); }
.status-pill.danger { color: var(--coral); background: var(--coral-soft); }
.status-pill.neutral { color: var(--ink-soft); background: #edf2f8; }
.network-banner { display: none; margin-bottom: 12px; padding: 12px 14px; border-radius: var(--radius); color: var(--coral); background: var(--coral-soft); border: 1px solid #ffc2c9; font-weight: 900; }
.network-banner.show { display: block; }
.host-grid { display: grid; grid-template-columns: minmax(260px, 0.9fr) minmax(360px, 1.45fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.panel { padding: 18px; }
.live-panel { min-height: 430px; }
.participants-panel { grid-column: 1 / 3; }
.section-heading, .player-status-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-heading.compact { margin-bottom: 10px; }
.control-stack { display: grid; gap: 10px; }
.join-box { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #f9fbff; }
.join-box a { display: block; overflow-wrap: anywhere; line-height: 1.35; }
.qr-frame { display: grid; place-items: start; width: 150px; min-height: 150px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 8px; }
.qr-frame svg { width: 132px; height: 132px; display: block; }
.buzz-list, .scoreboard, .participant-list { display: grid; gap: 10px; }
.participant-list.compact { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.empty-state { display: grid; place-items: center; min-height: 160px; padding: 22px; color: var(--ink-soft); text-align: center; border: 1px dashed #bfccd9; border-radius: var(--radius); background: #f9fbff; }
.buzz-item, .score-row, .participant-row { display: grid; align-items: center; gap: 10px; min-height: 58px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: #fff; }
.buzz-item { grid-template-columns: 58px 1fr auto; }
.buzz-list.small .buzz-item { grid-template-columns: 48px 1fr; }
.rank { display: grid; place-items: center; width: 44px; height: 44px; color: #fff; background: var(--ink); border-radius: var(--radius); font-size: 20px; font-weight: 950; }
.rank.first { background: var(--blue); }
.rank.second { background: var(--teal); }
.rank.third { background: var(--amber); }
.item-title { margin: 0; font-size: 20px; font-weight: 950; line-height: 1.25; }
.item-meta { margin: 4px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.4; }
.judge-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.score-row { grid-template-columns: 1fr auto auto; }
.score-value { min-width: 54px; color: var(--blue); font-size: 24px; font-weight: 950; text-align: right; }
.participant-row { grid-template-columns: 1fr auto auto; }
.dot { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; background: #9aa9ba; }
.dot.online { background: var(--teal); }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 20; max-width: min(92vw, 460px); padding: 12px 16px; color: #fff; background: rgba(16, 35, 63, 0.94); border-radius: var(--radius); box-shadow: var(--shadow); opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.player-page { display: grid; place-items: start center; padding: 18px; }
.player-shell { width: min(100%, 560px); }
.player-header { margin-bottom: 14px; }
.join-panel, .buzzer-panel { padding: 20px; }
.join-form { margin-top: 14px; }
.round-card { display: grid; gap: 16px; margin: 14px 0 20px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #f9fbff; }
.round-card p { min-height: 54px; margin: 0; color: var(--ink); font-size: 20px; font-weight: 850; line-height: 1.35; }
.buzz-button { width: 100%; min-height: 176px; border: 0; border-radius: var(--radius); color: #fff; background: linear-gradient(135deg, var(--blue), var(--teal)); box-shadow: 0 18px 42px rgba(8, 117, 111, 0.28); font-size: 42px; font-weight: 950; letter-spacing: 0; touch-action: manipulation; transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease; }
.buzz-button:not(:disabled):active { transform: scale(0.98); filter: saturate(1.1); }
.top-three { border-top: 1px solid var(--line); padding-top: 16px; }
[hidden] { display: none !important; }
@media (max-width: 1120px) {
  .host-grid { grid-template-columns: 1fr 1fr; }
  .live-panel { grid-column: 1 / 3; grid-row: 1; }
  .participants-panel { grid-column: auto; }
}
@media (max-width: 760px) {
  .app-shell, .player-page { padding: 12px; }
  .topbar, .player-header { align-items: flex-start; flex-direction: column; padding: 18px; }
  .topbar-meta { justify-content: flex-start; }
  .host-grid { grid-template-columns: 1fr; }
  .live-panel, .participants-panel { grid-column: auto; }
  .buzz-item, .score-row, .participant-row { grid-template-columns: 1fr; }
  .judge-actions { justify-content: stretch; }
  .judge-actions .button, .participant-row .button, .score-row .button { width: 100%; }
  .rank { width: 100%; }
  .auth-panel h1, .topbar h1, .player-header h1 { font-size: 28px; }
  .buzz-button { min-height: 154px; font-size: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
