:root {
  --bg: #070b12; --card: #131a25; --surface: #0d141e; --surface-raised: #1a2330;
  --line: #344155; --line-strong: #4a5a71; --text: #f8fafc; --muted: #aeb9ca;
  --primary: #4f8cff; --primary-strong: #2f6fe8; --ok: #38d878; --no: #f0525f;
  --radius: 16px; --shadow: 0 20px 55px rgba(0,0,0,.38);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font: 16px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% -10%, rgba(79,140,255,.12), transparent 34rem),
    radial-gradient(circle at 95% 10%, rgba(56,216,120,.055), transparent 30rem),
    var(--bg);
  color: var(--text);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
h1, h2, h3 { margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.error { color: #ff7a85; }

/* Cards / buttons */
.card {
  max-width: 420px; margin: 8vh auto; padding: 2rem 1.5rem;
  background: linear-gradient(180deg, rgba(26,35,48,.98), rgba(15,21,31,.98));
  border: 1px solid var(--line); border-radius: 20px; text-align: center;
  box-shadow: var(--shadow);
}
.card h1 { font-size: 2rem; }
.brand-lockup { display: flex; align-items: center; justify-content: center; gap: .7rem; margin-bottom: 1rem; }
.brand-lockup h1 { margin: 0; letter-spacing: -.035em; }
.brand-lockup h1 span {
  display: inline-block; margin-left: .25rem; padding: .18rem .45rem; vertical-align: .2rem;
  border: 1px solid var(--line-strong); border-radius: 999px; color: var(--muted);
  font-size: .64rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.brand-mark {
  display: inline-grid; place-items: center; flex: 0 0 auto; width: 2.65rem; height: 2.65rem;
  border: 1px solid rgba(122,165,255,.45); border-radius: 13px;
  background: linear-gradient(145deg, #5c98ff, #2965d7); color: #fff;
  box-shadow: 0 10px 24px rgba(47,111,232,.28), inset 0 1px rgba(255,255,255,.25);
}
.brand-mark svg { width: 1.45rem; height: 1.45rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark-large { width: 4.5rem; height: 4.5rem; margin: 0 auto 1.15rem; border-radius: 21px; }
.brand-mark-large svg { width: 2.45rem; height: 2.45rem; }
.landing-card h1 { margin-bottom: .35rem; font-size: 2.7rem; letter-spacing: -.055em; }
.landing-copy { margin: 0 0 1.3rem; color: var(--muted); }
input {
  width: 100%; min-height: 46px; padding: .78rem .95rem; margin: .4rem 0; font: inherit;
  background: #090f18; border: 1px solid var(--line); border-radius: 11px; color: var(--text);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.25);
}
input::placeholder { color: #7f8ca0; }
input:hover { border-color: var(--line-strong); }
input:focus { outline: 3px solid rgba(79,140,255,.2); border-color: #76a5ff; }
.password-field { position: relative; }
.password-field input { padding-right: 3.3rem; }
.password-toggle {
  position: absolute; top: 50%; right: .35rem; display: grid; place-items: center;
  width: 2.75rem; height: 2.75rem; padding: 0; transform: translateY(-50%);
  border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer;
}
.password-toggle:hover, .password-toggle:focus-visible { color: var(--text); background: #222a36; }
.password-toggle:focus-visible { outline: 2px solid #93c5fd; outline-offset: 1px; }
.password-toggle svg { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 1.8; }
.password-toggle[aria-pressed="true"] svg { color: var(--primary); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  width: 100%; min-height: 44px; margin: .4rem 0; padding: .72rem .9rem;
  font-family: inherit; font-size: .925rem; font-weight: 700; line-height: 1.15;
  letter-spacing: -.01em; text-align: center; text-decoration: none;
  border: 1px solid var(--line-strong); border-radius: 11px;
  background: linear-gradient(180deg, #283446, #202a39); color: var(--text); cursor: pointer;
  box-shadow: inset 0 1px rgba(255,255,255,.055), 0 2px 8px rgba(0,0,0,.18);
  transition: border-color .15s ease, background .15s ease, transform .08s ease, box-shadow .15s ease;
}
.btn:hover:not(:disabled) { border-color: #687a94; background: linear-gradient(180deg, #324158, #273447); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible, .admin-menu-btn:focus-visible, .account-menu-item:focus-visible, .icon-btn:focus-visible {
  outline: 3px solid rgba(118,165,255,.38); outline-offset: 2px;
}
.btn svg { width: 1.05rem; height: 1.05rem; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: linear-gradient(180deg, #5b96ff, var(--primary-strong)); border-color: #77a9ff; color: #fff; box-shadow: 0 8px 22px rgba(47,111,232,.25), inset 0 1px rgba(255,255,255,.2); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #70a4ff, #3778eb); border-color: #a2c3ff; }
.btn.small { width: auto; padding: .55rem .75rem; font-size: .875rem; }
.btn.tiny { width: auto; padding: .35rem .6rem; font-size: .8rem; margin: 0 0 0 .3rem; }
.btn.ok { background: #218d51; border-color: #43df80; color: #fff; }
.btn.no { background: #9e303d; border-color: #ef6170; color: #fff; }
.btn.ok:hover:not(:disabled) { background: #279c5b; border-color: #6bea9a; }
.btn.no:hover:not(:disabled) { background: #b03847; border-color: #ff7d89; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Connection pill */
.conn { font-size: .8rem; color: var(--muted); text-transform: lowercase; }
.conn::before { content: "●"; margin-right: .35rem; }
.conn.connected { color: var(--ok); }
.conn.disconnected, .conn.connecting { color: #f59e0b; }

/* ---------- Player buzzer ---------- */
.player, .landing { min-height: 100%; }
.stage { display: flex; flex-direction: column; align-items: center; min-height: 100dvh; padding: 1rem; }
.stage[hidden] { display: none; }
.stage-top { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.pill { padding: .35rem .8rem; border-radius: 999px; font-weight: 700; color: #fff; }
.buzzer-housing {
  position: relative; flex: 1 0 auto; display: grid; place-items: center;
  width: min(84vw, 58vh); aspect-ratio: 1; margin: 4vh 0 3vh;
  border: 2px solid #414851; border-radius: 22%;
  background: linear-gradient(145deg, #30353d 0%, #161a20 48%, #090b0e 100%);
  box-shadow:
    inset 9px 9px 18px rgba(255,255,255,.055),
    inset -12px -14px 20px rgba(0,0,0,.58),
    0 20px 34px rgba(0,0,0,.48);
}
.buzzer-housing::before {
  content: ""; position: absolute; width: 78%; aspect-ratio: 1; border-radius: 50%;
  border: 3px solid #777f88;
  background: linear-gradient(145deg, #a8afb5 0%, #4b525a 32%, #20252b 68%, #737b83 100%);
  box-shadow: inset 0 0 0 7px #1a1e23, 0 7px 13px rgba(0,0,0,.62);
}
.buzzer-housing::after {
  content: ""; position: absolute; inset: 5%; pointer-events: none;
  background:
    radial-gradient(circle at 8% 8%, #b8bec3 0 1.6%, #30363c 1.8% 3%, transparent 3.2%),
    radial-gradient(circle at 92% 8%, #b8bec3 0 1.6%, #30363c 1.8% 3%, transparent 3.2%),
    radial-gradient(circle at 8% 92%, #b8bec3 0 1.6%, #30363c 1.8% 3%, transparent 3.2%),
    radial-gradient(circle at 92% 92%, #b8bec3 0 1.6%, #30363c 1.8% 3%, transparent 3.2%);
}
.buzzer {
  position: relative; z-index: 2; width: 66%; aspect-ratio: 1;
  border-radius: 50%; border: 2px solid #ff7777; color: #fff;
  font-size: clamp(1.7rem, 7vw, 2.7rem); font-weight: 900; letter-spacing: 2px;
  background: radial-gradient(circle at 50% 28%, #ff6969 0%, #df272d 44%, #a3070d 78%, #7b050a 100%);
  box-shadow:
    0 15px 0 #65070b,
    0 21px 24px rgba(0,0,0,.58),
    inset 0 10px 16px rgba(255,255,255,.25),
    inset 0 -15px 20px rgba(70,0,0,.42);
  cursor: pointer; overflow: hidden;
  transition: transform .055s ease, box-shadow .055s ease, filter .12s ease;
}
.buzzer::before {
  content: ""; position: absolute; inset: 6% 14% 53%; border-radius: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,.36), rgba(255,255,255,0));
  transform: rotate(-7deg); pointer-events: none;
}
.buzzer span { position: relative; z-index: 1; text-shadow: 0 2px 3px rgba(70,0,0,.72); }
.buzzer:focus-visible { outline: 4px solid #93c5fd; outline-offset: 6px; }
.buzzer:active:not(:disabled) {
  transform: translateY(11px);
  box-shadow:
    0 4px 0 #65070b,
    0 8px 13px rgba(0,0,0,.48),
    inset 0 8px 15px rgba(255,255,255,.2),
    inset 0 -10px 16px rgba(70,0,0,.45);
}
.buzzer:disabled { cursor: default; }
.buzzer.locked {
  border-color: #89919c;
  background: radial-gradient(circle at 50% 28%, #7b8491 0%, #4b5563 48%, #262e39 100%);
  box-shadow: 0 15px 0 #1d232c, 0 21px 24px rgba(0,0,0,.55), inset 0 10px 16px rgba(255,255,255,.13);
}
.buzzer[disabled]:not(.locked) {
  border-color: #59616d; filter: saturate(.38);
  background: radial-gradient(circle at 50% 28%, #515a68 0%, #343c48 48%, #202630 100%);
  box-shadow: 0 15px 0 #171b22, 0 21px 24px rgba(0,0,0,.5), inset 0 10px 16px rgba(255,255,255,.08);
}
@media (max-height: 600px) {
  .buzzer-housing { width: min(72vw, 52vh); margin: 2vh 0; }
}
.spinner { width: 44px; height: 44px; margin: 0 auto 1rem; border: 4px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.scoreboard { width: 100%; max-width: 420px; }
.score-row { display: flex; align-items: center; gap: .5rem; padding: .4rem .2rem; border-bottom: 1px solid var(--line); }
.score-row .nm { flex: 1; } .score-row .sc { font-weight: 700; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }

/* ---------- Host console ---------- */
.console { max-width: 1180px; margin: 0 auto; padding: 1rem; }
.host-header {
  margin-bottom: 1rem; padding: .85rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(13,20,30,.86); box-shadow: 0 12px 34px rgba(0,0,0,.22);
  backdrop-filter: blur(14px);
}
.host-topline { display: flex; align-items: center; gap: 1rem; margin-bottom: .55rem; }
.host-status {
  display: flex; align-items: center; gap: .4rem; min-height: 1.35rem;
  color: var(--muted); font-size: .78rem; font-weight: 650;
}
.host-status .conn {
  display: inline-block; width: .7rem; height: .7rem; border-radius: 50%;
  background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .13);
}
.host-status .conn::before { content: none; }
.host-status .conn.connected { background: var(--ok); box-shadow: 0 0 0 3px rgba(34, 197, 94, .14); }
.host-status .conn.disconnected { background: var(--no); box-shadow: 0 0 0 3px rgba(239, 68, 68, .13); }
.admin-account { position: relative; margin-left: auto; }
.admin-menu-btn {
  display: flex; align-items: center; gap: .45rem; min-height: 36px; padding: .3rem .55rem .3rem .35rem;
  border: 1px solid var(--line); border-radius: 999px; background: #121b28; color: var(--text);
  font-family: inherit; font-size: .8rem; font-weight: 750; line-height: 1; cursor: pointer;
}
.admin-menu-btn:hover { border-color: var(--line-strong); background: #192536; }
.admin-avatar {
  display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: #27364a; color: #bdd2ff;
}
.admin-avatar svg, .admin-menu-btn .chevron {
  width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.admin-menu-btn .chevron { width: .8rem; transition: transform .16s ease; }
.admin-menu-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.admin-menu {
  position: absolute; z-index: 25; top: calc(100% + .5rem); right: 0; width: 245px;
  padding: .45rem; border: 1px solid var(--line-strong); border-radius: 14px;
  background: #111924; box-shadow: 0 22px 55px rgba(0,0,0,.52);
}
.admin-menu[hidden] { display: none; }
.admin-menu > p { margin: .25rem .55rem .45rem; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .09em; text-align: left; text-transform: uppercase; }
.account-menu-item {
  display: flex; align-items: center; gap: .7rem; width: 100%; padding: .65rem;
  border: 0; border-radius: 10px; background: transparent; color: var(--text); text-align: left; cursor: pointer;
}
.account-menu-item:hover { background: #1b2737; }
.account-menu-item svg {
  width: 1.15rem; height: 1.15rem; flex: 0 0 auto; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.account-menu-item span { display: flex; flex-direction: column; gap: .08rem; }
.account-menu-item strong { font-size: .82rem; }
.account-menu-item small { color: var(--muted); font-size: .7rem; }
.account-menu-divider { height: 1px; margin: .35rem .45rem; background: var(--line); }
.danger-item { color: #ff8b96; }
.bar { display: flex; gap: .7rem; align-items: center; }
.bar #title { flex: 1; min-width: 200px; margin: 0; }
.host-toolbar { display: flex; align-items: stretch; gap: .7rem; }
.timers { display: flex; gap: .5rem; align-items: center; }
.timers label { font-size: .8rem; color: var(--muted); display: flex; flex-direction: column; }
.timers input { width: 74px; margin: 0; }
.timers .btn { align-self: flex-end; margin: 0; }
.toolbar-divider { width: 1px; background: var(--line); }
.host-actions { position: relative; display: flex; align-items: flex-end; }
.controls-help-btn { margin: 0; white-space: nowrap; }
.controls-help {
  position: absolute; z-index: 10; top: calc(100% + .55rem); right: 0;
  width: min(430px, calc(100vw - 2rem)); max-height: min(70vh, 560px); overflow-y: auto;
  padding: .9rem; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); box-shadow: 0 16px 38px rgba(0,0,0,.5);
}
.controls-help[hidden] { display: none; }
.controls-help-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.controls-help h2 { margin: 0; font-size: 1rem; }
.icon-btn {
  display: grid; place-items: center; width: 2rem; height: 2rem; padding: 0;
  border: 1px solid var(--line); border-radius: 8px; background: #202a39; color: var(--text); cursor: pointer;
}
.icon-btn svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.controls-help dl { margin: .7rem 0 0; }
.controls-help dl div {
  display: grid; grid-template-columns: 7.5rem 1fr; gap: .6rem;
  padding: .45rem 0; border-top: 1px solid var(--line);
}
.controls-help dt { font-weight: 700; }
.controls-help dd { margin: 0; color: var(--muted); }
.confirm-splash {
  position: fixed; z-index: 30; inset: 0; display: grid; place-items: center;
  padding: 1rem; background: rgba(3, 6, 11, .78); backdrop-filter: blur(5px);
}
.confirm-splash[hidden] { display: none; }
.confirm-card {
  width: min(430px, 100%); padding: 1.4rem; text-align: center;
  border: 1px solid #5b2630; border-radius: var(--radius); background: var(--card);
  box-shadow: 0 22px 60px rgba(0,0,0,.62);
}
.confirm-icon {
  display: grid; place-items: center; width: 3rem; height: 3rem; margin: 0 auto .8rem;
  border-radius: 50%; background: rgba(239,68,68,.16); color: #ff7b7b;
  border: 1px solid rgba(239,68,68,.45);
}
.confirm-icon svg { width: 1.55rem; height: 1.55rem; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.confirm-card h2 { margin-bottom: .45rem; }
.confirm-card p { margin: 0 0 1rem; color: var(--muted); }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.confirm-actions .btn { margin: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.col {
  min-width: 0; padding: .25rem 1rem 1rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(13,20,30,.74); box-shadow: 0 12px 32px rgba(0,0,0,.18);
}
@media (max-width: 780px) {
  .cols { grid-template-columns: 1fr; }
  .bar { display: grid; grid-template-columns: minmax(0, 1fr); }
  .bar #title { min-width: 0; }
  .host-toolbar { width: 100%; gap: .45rem; }
  .timers { flex: 1 1 auto; min-width: 0; gap: .35rem; }
  .timers label { flex: 1 1 0; min-width: 0; font-size: .68rem; white-space: nowrap; }
  .timers input { width: 100%; min-width: 0; padding: .65rem .5rem; font-size: .9rem; }
  .timers .btn, .controls-help-btn { min-height: 2.7rem; padding: .65rem .65rem; }
  .toolbar-divider { flex: 0 0 1px; }
  .host-actions { flex: 0 0 auto; }
  .col { padding: .15rem .8rem .85rem; }
}
.col h3 { margin-top: 1rem; color: #c2ccda; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .11em; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: .75rem; }
.section-heading h3 { margin-bottom: .5rem; }
.section-heading .btn { margin: 0 0 .35rem; }
.spotlight { border-radius: var(--radius); padding: 2rem 1rem; text-align: center; color: #fff; }
.spotlight.empty { background: #0c131d; color: var(--muted); border: 1px dashed var(--line-strong); }
.spot-name { font-size: 2.2rem; font-weight: 900; } .spot-pos { opacity: .8; }
.controls { display: flex; gap: .5rem; margin: .8rem 0; flex-wrap: wrap; }
.controls .btn { width: auto; flex: 1; }
@media (max-width: 480px) {
  .controls-help dl div { grid-template-columns: 1fr; gap: .12rem; }
}
.order { list-style: none; padding: 0; margin: 0; }
.order-row { display: flex; align-items: center; gap: .5rem; padding: .55rem; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .35rem; background: #101823; }
.order-row.current { border-color: var(--primary); background: #12203a; }
.order-row .nm { flex: 1; } .order-row .acts { display: flex; }
.list { display: flex; flex-direction: column; gap: .35rem; }
.prow { display: flex; align-items: center; gap: .5rem; padding: .55rem; background: #111a26; border: 1px solid var(--line); border-radius: 10px; }
.prow .nm { flex: 1; } .prow .sc { font-weight: 700; margin-right: .3rem; }
.prow.offline { opacity: .5; }
.count { background: var(--primary); color: #fff; border-radius: 999px; padding: 0 .5rem; font-size: .8rem; }
