/* ==========================================================================
   Clickit Cloud — phone remote
   Visual language: navy + cyan glow + neon answer pills (per reference art),
   "Vibrant & Block-based": bold, energetic, high-contrast, large type.
   Vanilla CSS, no build. RTL, mobile-first.
   ========================================================================== */

:root {
  /* base palette */
  --navy-0: #05101f;
  --navy-1: #071528;
  --navy-2: #0b2140;
  --navy-3: #103157;
  --ink: #eaf6ff;
  --ink-dim: #9fc4e6;
  --cyan: #00e5ff;
  --cyan-soft: #4ff2ff;

  /* neon answer colours (A..F) — match the reference pills */
  --a: #ff2d78;  /* pink   */
  --b: #22a8ff;  /* blue   */
  --c: #35e06a;  /* green  */
  --d: #ffc21e;  /* yellow */
  --e: #ff7a1a;  /* orange */
  --f: #b14dff;  /* purple */

  --good: #35e06a;
  --bad: #ff456b;

  --panel: rgba(9, 28, 54, .72);
  --panel-line: rgba(0, 229, 255, .38);
  --radius: 18px;
  --glow: 0 0 22px rgba(0, 229, 255, .35);
  --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%;
  background: var(--navy-0);
  color: var(--ink);
  font-family: var(--font);
  overscroll-behavior: none;
}

body {
  /* layered neon backdrop: drifting glows + dot grid + deep vignette */
  background:
    radial-gradient(120% 80% at 15% -10%, rgba(177, 77, 255, .18), transparent 55%),
    radial-gradient(120% 80% at 90% 110%, rgba(0, 229, 255, .20), transparent 55%),
    radial-gradient(60% 40% at 50% 0%, rgba(34, 168, 255, .12), transparent 60%),
    linear-gradient(180deg, var(--navy-1), var(--navy-0));
  background-attachment: fixed;
  position: relative;
  min-height: 100dvh;
}
body::before {
  /* faint tech dot-grid */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(rgba(120, 200, 255, .07) 1px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(120% 100% at 50% 30%, #000 40%, transparent 85%);
  mask-image: radial-gradient(120% 100% at 50% 30%, #000 40%, transparent 85%);
}

/* ── frame / layout ─────────────────────────────────────────────── */
.frame {
  position: relative; z-index: 1;
  max-width: 480px; margin: 0 auto; min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}

/* ── brand header ───────────────────────────────────────────────── */
.brand {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 8px 0 14px;
}
.brand-logo {
  width: 38px; height: 38px; display: grid; place-items: center;
  font-size: 22px; color: #041018; font-weight: 900;
  background: radial-gradient(circle at 35% 30%, #baf6ff, var(--cyan) 60%, #0088a8);
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  box-shadow: 0 0 18px rgba(0, 229, 255, .7);
}
.brand-name {
  font-weight: 800; font-size: 22px; letter-spacing: .5px;
  text-shadow: 0 0 14px rgba(0, 229, 255, .45);
}
.brand-name span { color: var(--cyan-soft); font-weight: 500; font-style: italic; }

/* ── screens & panes (with soft transition) ─────────────────────── */
.screen { flex: 1; display: flex; flex-direction: column; }
.screen.hidden, .pane.hidden, .hidden { display: none !important; }
.screen, .pane { animation: rise .32s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.title { font-size: 30px; font-weight: 800; text-align: center; margin: 6px 0 4px; }
.subtitle { text-align: center; color: var(--ink-dim); margin: 0 0 22px; font-size: 15px; }
.note { text-align: center; color: var(--ink-dim); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* name of the event this phone joined (from the scanned /e/<code> link) */
.event-badge {
  align-self: center; margin: -4px 0 10px; padding: 5px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 700; letter-spacing: .2px;
  color: #7ff3ff; background: rgba(0, 229, 255, .09);
  border: 1px solid rgba(0, 229, 255, .3);
  display: inline-flex; align-items: center; gap: 6px;
}

/* ── panels & buttons shared ───────────────────────────────────── */
.panel {
  background: var(--panel); border: 1px solid var(--panel-line);
  border-radius: var(--radius); box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, .04);
  backdrop-filter: blur(6px);
}

.cta {
  width: 100%; border: 0; border-radius: 14px; padding: 16px; cursor: pointer;
  font-family: var(--font); font-weight: 800; font-size: 18px; color: #04141e;
  background: linear-gradient(180deg, var(--cyan-soft), var(--cyan));
  box-shadow: 0 6px 22px rgba(0, 229, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.cta:active { transform: translateY(2px) scale(.99); filter: brightness(1.05); }
.cta:disabled { filter: grayscale(.4) brightness(.8); box-shadow: none; }

/* ── login ─────────────────────────────────────────────────────── */
#screen-login { justify-content: center; }
.login-buttons { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.login-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px; border-radius: 14px; cursor: pointer;
  font-family: var(--font); font-weight: 700; font-size: 16px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--panel-line);
  box-shadow: var(--glow); transition: transform .12s, filter .12s;
}
.login-btn:active { transform: translateY(2px); }
.login-btn.guest { background: linear-gradient(180deg, var(--navy-3), var(--navy-2)); }
/* secondary route — deliberately quieter than the ways IN */
.login-btn.ghost {
  background: transparent; border-color: rgba(0, 229, 255, .22);
  color: var(--ink-dim); box-shadow: none; font-size: 15px; padding: 13px;
}
.login-ico {
  width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%;
  background: #fff; color: #444; font-weight: 900;
}

/* ── profile ───────────────────────────────────────────────────── */
#screen-profile { align-items: center; justify-content: center; }
#screen-profile .title, #screen-profile .field, #screen-profile .consent,
#screen-profile .cta, #screen-profile .note { width: 100%; }
.avatar-wrap { display: grid; place-items: center; margin: 6px 0 12px; }
.avatar {
  width: 108px; height: 108px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--cyan); box-shadow: 0 0 26px rgba(0, 229, 255, .55);
  background: var(--navy-2);
}
.avatar.placeholder { display: grid; place-items: center; font-size: 40px; color: var(--ink-dim); }
.avatar.placeholder .ico { width: 44px; height: 44px; stroke-width: 1.5; }
.avatar.small { width: 44px; height: 44px; border-width: 2px; box-shadow: 0 0 12px rgba(0, 229, 255, .5); }
.avatar-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 18px; }
.chip {
  padding: 9px 14px; border-radius: 999px; cursor: pointer; font-size: 14px; font-weight: 600;
  background: var(--panel); border: 1px solid var(--panel-line); color: var(--ink);
  display: inline-flex; align-items: center; gap: 7px;
}
.chip:active { transform: translateY(1px); }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; font-size: 14px; color: var(--ink-dim); }
.field span small { opacity: .65; font-weight: 400; }
.field input {
  padding: 14px; border-radius: 12px; font-size: 17px; font-family: var(--font);
  background: rgba(4, 16, 30, .7); border: 1px solid var(--panel-line); color: var(--ink);
  text-align: right;
}
.field input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 229, 255, .2); }
.consent { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-size: 14px; color: var(--ink-dim); }
.consent input { width: 20px; height: 20px; accent-color: var(--cyan); }
.guest-warning {
  margin-bottom: 18px; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.5;
  color: #ffe9b0; background: rgba(255, 194, 30, .1); border: 1px solid rgba(255, 194, 30, .4);
}
.guest-warning .ico { color: var(--d); vertical-align: -.28em; }

/* ── remote header (identity bar) ──────────────────────────────── */
.remote-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 14px;
  background: var(--panel); border: 1px solid var(--panel-line);
  border-radius: var(--radius); box-shadow: var(--glow);
}
.me-info { flex: 1; min-width: 0; }
.me-name { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-serial { font-size: 12px; color: var(--ink-dim); }
.me-serial b { color: var(--cyan-soft); font-size: 15px; letter-spacing: 1px; }
.me-score {
  font-weight: 800; font-size: 15px; color: #04141e; padding: 7px 12px; border-radius: 999px;
  background: linear-gradient(180deg, #ffe27a, var(--d)); box-shadow: 0 0 16px rgba(255, 194, 30, .55);
  white-space: nowrap; display: inline-flex; align-items: center; gap: 5px;
}
.me-score .ico { stroke-width: 2; }
.mute-btn {
  flex: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 18px;
  display: grid; place-items: center; color: var(--ink);
  background: rgba(4, 16, 30, .6); border: 1px solid var(--panel-line);
}
.mute-btn:active { transform: scale(.92); }

.pane { flex: 1; display: flex; flex-direction: column; }

/* ── waiting / lobby ───────────────────────────────────────────── */
#pane-waiting { align-items: center; justify-content: center; text-align: center; gap: 8px; }
.pulse-ring { position: relative; width: 128px; height: 128px; display: grid; place-items: center; margin-bottom: 6px; }
.pulse-ring::before, .pulse-ring::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--cyan); opacity: 0; animation: sonar 2.4s ease-out infinite;
}
.pulse-ring::after { animation-delay: 1.2s; }
@keyframes sonar { 0% { transform: scale(.5); opacity: .8; } 100% { transform: scale(1.25); opacity: 0; } }
.pulse-core {
  width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; font-size: 34px;
  background: radial-gradient(circle at 35% 30%, #baf6ff, var(--cyan) 62%, #036);
  box-shadow: 0 0 30px rgba(0, 229, 255, .7);
}
/* dark ink on the bright cyan disc - a light stroke would vanish into it */
.pulse-core .ico { width: 38px; height: 38px; stroke-width: 1.6; color: #04283c; }
#waiting-title { font-size: 22px; font-weight: 800; margin: 6px 0; }

/* the personal code that brings a dead/cleared phone back to this remote */
.recovery-box {
  margin: 14px auto 0; max-width: 340px; padding: 12px 16px; border-radius: 14px;
  background: rgba(4, 16, 30, .6); border: 1px dashed rgba(0, 229, 255, .45);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.recovery-box .lbl { font-size: 12px; color: var(--ink-dim); display: flex; align-items: center; gap: 6px; }
.recovery-box .code {
  font-size: 30px; font-weight: 900; letter-spacing: 5px; color: var(--cyan-soft);
  text-shadow: 0 0 16px rgba(0, 229, 255, .5); direction: ltr; font-family: ui-monospace, monospace;
}
.recovery-box .hint { font-size: 11.5px; color: var(--ink-dim); line-height: 1.5; text-align: center; }

/* the code box on the resume screen reads left-to-right, like the code itself */
#resume-code { direction: ltr; text-align: center; letter-spacing: 4px; font-size: 22px; font-weight: 800; }
#screen-resume { justify-content: center; }
#screen-resume .field, #screen-resume .cta, #screen-resume .login-btn { width: 100%; }
.lobby-serial {
  margin: 12px auto 4px; padding: 14px 22px; border-radius: 16px; display: inline-block;
  background: var(--panel); border: 1px solid var(--panel-line); box-shadow: var(--glow);
}
.lobby-serial .lbl { font-size: 12px; color: var(--ink-dim); display: block; }
.lobby-serial .num {
  font-size: 46px; font-weight: 900; line-height: 1.05; letter-spacing: 2px; color: var(--cyan-soft);
  text-shadow: 0 0 18px rgba(0, 229, 255, .6);
}
.admin-message {
  margin-top: 16px; padding: 14px 16px; border-radius: 14px; font-size: 15px; font-weight: 600;
  background: linear-gradient(180deg, rgba(177, 77, 255, .18), rgba(0, 229, 255, .12));
  border: 1px solid var(--panel-line); box-shadow: var(--glow); max-width: 360px;
  animation: rise .4s;
}

/* ── operator switches (set on <body> from the server's `display` flags) ──
   Some events must not show a score or a ranking to the audience: a classroom,
   a staff survey, a vote. The server stops sending the numbers; these rules
   remove the places that would otherwise sit there empty. */
.no-scores .me-score,
.no-scores .score-box,
.no-scores #ended-score { display: none !important; }
.no-leaderboard .leaderboard { display: none !important; }

/* ── icons ─────────────────────────────────────────────────────────
   Stroked line icons (see the <svg class="sprite"> in index.html). They inherit
   the text colour and scale with the font size, so one class covers a 15px chip
   and a 76px result screen. `fill:none` + `stroke:currentColor` is what gives
   the technical, drawn-with-a-pen look instead of the flat cartoon of emoji. */
.sprite { display: none; }
.ico {
  width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.ico-lg { stroke-width: 1.4; }   /* big icons need a proportionally thinner line */

/* ── voting ────────────────────────────────────────────────────── */
#pane-voting { gap: 14px; }
/* timer as a progress bar that shifts colour toward the end */
.timer-bar {
  position: relative; height: 18px; border-radius: 999px; overflow: hidden;
  background: rgba(4, 16, 30, .8); border: 1px solid var(--panel-line); box-shadow: inset 0 0 8px rgba(0, 0, 0, .5);
}
.timer-fill {
  position: absolute; inset: 0; transform-origin: right center; width: 100%;
  background: linear-gradient(90deg, var(--good), var(--cyan) 60%, var(--cyan-soft));
  box-shadow: 0 0 14px rgba(0, 229, 255, .5); transition: transform .25s linear, background .5s;
}
.timer-bar.warn .timer-fill { background: linear-gradient(90deg, var(--d), var(--e)); }
.timer-bar.urgent .timer-fill { background: linear-gradient(90deg, var(--e), var(--bad)); animation: flash .7s steps(2) infinite; }
/* No deadline (the usual case): the bar GROWS from the left with the elapsed
   time (JS sets scaleX along an asymptotic curve) — a real progress bar, not a
   highlight looping across the track, which read as a blink. The shimmer only
   keeps it alive; it never moves the bar backwards. */
.timer-bar.indeterminate .timer-fill {
  transform-origin: left center;
  background: linear-gradient(90deg, var(--good), var(--cyan) 70%, var(--cyan-soft));
}
.timer-bar.indeterminate .timer-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .38) 50%, transparent);
  animation: shimmer 1.8s linear infinite;
}
@keyframes flash { 50% { filter: brightness(1.6); } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.timer-label {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; letter-spacing: .5px;
  color: #eaf8ff; text-shadow: 0 1px 3px rgba(0, 0, 0, .95); /* readable over both the fill and the empty track */
}

.question {
  font-size: 21px; font-weight: 800; line-height: 1.35; text-align: center; padding: 18px 16px;
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius);
  box-shadow: var(--glow); min-height: 64px; display: grid; place-items: center;
}

.vote-stack { display: flex; flex-direction: column; gap: 12px; margin-top: 2px; }
.vote-btn {
  border: 0; background: transparent; padding: 0; cursor: pointer; font-family: var(--font);
  transition: transform .1s;
}
.vote-btn:active { transform: scale(.98); }
.vote-pill {
  display: flex; align-items: center; gap: 14px; padding: 6px 18px 6px 6px;
  border-radius: 999px; background: rgba(4, 16, 30, .55);
  border: 1px solid rgba(0, 229, 255, .25); box-shadow: inset 0 0 10px rgba(0, 0, 0, .4);
}
.vote-pill > span:first-child {
  width: 52px; height: 52px; flex: none; display: grid; place-items: center;
  border-radius: 50%; font-size: 24px; font-weight: 900; color: #06121e;
  box-shadow: 0 0 18px currentColor; text-shadow: 0 1px 1px rgba(0, 0, 0, .35);
}
.vote-text { font-size: 17px; font-weight: 700; text-align: right; color: var(--ink); }

/* per-key neon colours */
.vote-btn[data-key="A"] .vote-pill > span:first-child { background: var(--a); color: var(--a); }
.vote-btn[data-key="B"] .vote-pill > span:first-child { background: var(--b); color: var(--b); }
.vote-btn[data-key="C"] .vote-pill > span:first-child { background: var(--c); color: var(--c); }
.vote-btn[data-key="D"] .vote-pill > span:first-child { background: var(--d); color: var(--d); }
.vote-btn[data-key="E"] .vote-pill > span:first-child { background: var(--e); color: var(--e); }
.vote-btn[data-key="F"] .vote-pill > span:first-child { background: var(--f); color: var(--f); }

/* selected / locked states */
.vote-btn.selected .vote-pill { border-color: #fff; box-shadow: 0 0 26px rgba(255, 255, 255, .5), inset 0 0 12px rgba(255, 255, 255, .15); }
.vote-btn.dimmed { opacity: .38; filter: saturate(.6); }
.vote-stack.locked .vote-btn { pointer-events: none; }
.locked-note {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin-top: 6px; font-weight: 700; color: var(--good);
  text-shadow: 0 0 12px rgba(53, 224, 106, .6);
}

/* pending: pressed, waiting for the server's ack (re-sent until it arrives) */
.vote-btn.pending .vote-pill {
  border-color: var(--cyan);
  box-shadow: 0 0 22px rgba(0, 229, 255, .45);
  animation: pendingPulse .9s ease-in-out infinite;
}
@keyframes pendingPulse { 50% { opacity: .55; } }
.pending-note {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 6px; font-weight: 700; color: var(--cyan);
  text-shadow: 0 0 12px rgba(0, 229, 255, .5);
}
.pending-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan); animation: bounce 1.1s infinite;
}

/* ── answered (waiting for the reveal) ─────────────────────────── */
#pane-answered { align-items: center; justify-content: center; text-align: center; gap: 14px; }
.answered-dots { display: flex; gap: 10px; }
.answered-dots i {
  width: 14px; height: 14px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan); animation: bounce 1.1s infinite;
}
.answered-dots i:nth-child(2) { animation-delay: .18s; }
.answered-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes bounce { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-10px); opacity: 1; } }
#answered-title { font-size: 22px; font-weight: 800; }
.answered-your { font-size: 15px; color: var(--ink-dim); }
.answered-your b {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  color: #06121e; font-weight: 900; vertical-align: middle; margin: 0 6px;
}

/* ── personal result ───────────────────────────────────────────── */
#pane-result { align-items: center; justify-content: center; text-align: center; gap: 10px; }
.result-emoji {
  line-height: 0; color: var(--cyan-soft);
  filter: drop-shadow(0 0 18px rgba(0, 229, 255, .45)); animation: pop .4s cubic-bezier(.2, 1.4, .4, 1);
}
.result-emoji .ico { width: 88px; height: 88px; }
/* the verdict colours the icon too, not just the headline */
#pane-result.correct .result-emoji { color: var(--good); filter: drop-shadow(0 0 20px rgba(53, 224, 106, .55)); }
#pane-result.wrong .result-emoji { color: var(--bad); filter: drop-shadow(0 0 20px rgba(255, 69, 107, .55)); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#result-title { font-size: 30px; font-weight: 900; margin: 4px 0; }
#result-detail { color: var(--ink-dim); font-size: 15px; margin: 0; max-width: 340px; }
#pane-result.correct #result-title { color: var(--good); text-shadow: 0 0 20px rgba(53, 224, 106, .6); }
#pane-result.wrong #result-title { color: var(--bad); text-shadow: 0 0 20px rgba(255, 69, 107, .6); }
.score-box {
  margin-top: 14px; padding: 18px 22px; border-radius: var(--radius); min-width: 240px;
  background: var(--panel); border: 1px solid var(--panel-line); box-shadow: var(--glow);
  display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: var(--ink-dim);
}
.score-box b { color: var(--ink); font-size: 22px; }
.score-gained { color: var(--good); font-weight: 800; font-size: 20px; text-shadow: 0 0 12px rgba(53, 224, 106, .5); min-height: 22px; }
.result-rank {
  margin-top: 4px; font-weight: 800; font-size: 17px; color: #06121e;
  background: linear-gradient(180deg, #ffe27a, var(--d)); border-radius: 999px; padding: 8px 14px;
  box-shadow: 0 0 18px rgba(255, 194, 30, .55);
}
.result-rank:empty { display: none; }

/* ── leaderboard (shared standings, mirrors the big screen) ─────── */
.leaderboard {
  margin-top: 16px; width: 100%; max-width: 360px; padding: 14px 14px 8px;
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius);
  box-shadow: var(--glow);
}
.lb-title { font-weight: 800; font-size: 16px; margin-bottom: 10px; text-align: center; }
.lb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lb-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px;
  background: rgba(4, 16, 30, .5); font-size: 15px;
}
.lb-row.me { background: rgba(0, 229, 255, .16); border: 1px solid var(--panel-line); }
.lb-rank { width: 28px; flex: none; text-align: center; font-weight: 800; font-size: 15px; }
/* top three: a metal disc with the place number, instead of a medal emoji */
.lb-medal {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  font-size: 13px; font-weight: 900; color: #10222e;
}
.lb-medal.m1 { background: linear-gradient(160deg, #fff3bf, #ffc21e); box-shadow: 0 0 12px rgba(255, 194, 30, .55); }
.lb-medal.m2 { background: linear-gradient(160deg, #f4f8fb, #b6c4d0); box-shadow: 0 0 10px rgba(210, 226, 238, .4); }
.lb-medal.m3 { background: linear-gradient(160deg, #f3c9a2, #cd7f42); box-shadow: 0 0 10px rgba(205, 127, 66, .45); }
.lb-av {
  width: 30px; height: 30px; flex: none; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--panel-line); background: var(--navy-2);
}
.lb-av-ph { display: grid; place-items: center; font-weight: 800; color: var(--cyan-soft); font-size: 14px; }
.lb-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; font-weight: 600; }
.lb-score {
  flex: none; font-weight: 800; color: #04141e; padding: 3px 10px; border-radius: 999px;
  background: linear-gradient(180deg, #ffe27a, var(--d));
}

/* ── end of event ──────────────────────────────────────────────── */
#pane-ended { align-items: center; justify-content: flex-start; text-align: center; gap: 10px; padding-top: 8px; overflow-y: auto; }
.ended-hero { line-height: 0; color: var(--d); filter: drop-shadow(0 0 20px rgba(255, 194, 30, .5)); animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
.ended-hero .ico { width: 78px; height: 78px; }
.ended-title { font-size: 28px; font-weight: 900; margin: 2px 0; }
.ended-score { font-size: 16px; color: var(--ink-dim); margin: 0 0 6px; }
.ended-uses {
  width: 100%; max-width: 360px; margin-top: 14px; padding: 14px 16px; text-align: right;
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); box-shadow: var(--glow);
}
.ended-uses-title { font-weight: 800; font-size: 16px; margin-bottom: 8px; }
.ended-uses ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; font-size: 15px; color: var(--ink); }
.ended-uses li { display: flex; align-items: center; gap: 10px; text-align: right; }
.ended-uses li .ico { color: var(--cyan-soft); }
#pane-ended .cta { margin-top: 16px; }

/* ── "event hasn't started yet" screen (QR scanned ahead of time) ─ */
#screen-event-wait { align-items: center; justify-content: center; text-align: center; }

/* ── admin console ─────────────────────────────────────────────── */
.admin-card {
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius);
  box-shadow: var(--glow); padding: 16px; margin-bottom: 16px;
}
.admin-card h3 { margin: 0 0 10px; font-size: 17px; font-weight: 800; }
.admin-card input[type="text"], .admin-card input[type="password"], .admin-card textarea {
  background: var(--navy-2); border: 1px solid var(--panel-line); border-radius: 12px;
  color: var(--ink); font: inherit; font-size: 15px; padding: 11px 13px; width: 100%; box-sizing: border-box;
}
.admin-card textarea { min-height: 74px; resize: vertical; }
/* one row per audience-visibility switch (score / standings) */
.switch-row {
  display: flex; align-items: flex-start; gap: 12px; cursor: pointer;
  padding: 11px 12px; border-radius: 12px; margin-bottom: 8px;
  background: rgba(4, 16, 30, .5); border: 1px solid rgba(0, 229, 255, .18);
}
.switch-row:hover { border-color: var(--panel-line); }
.switch-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--cyan); flex: none; margin-top: 2px; }
.switch-row small { color: var(--ink-dim); font-size: 12.5px; line-height: 1.5; }
/* reveals one participant's recovery code on demand (never rendered upfront) */
.code-btn {
  background: transparent; border: 1px solid var(--panel-line); color: var(--ink-dim);
  border-radius: 8px; padding: 3px 8px; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.code-btn:hover { color: var(--ink); border-color: var(--cyan); }
.admin-card input:focus, .admin-card textarea:focus {
  outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 229, 255, .18);
}
.btn-secondary {
  background: var(--navy-3); border: 1px solid var(--panel-line); border-radius: 12px;
  color: var(--ink); font: inherit; font-weight: 700; font-size: 14px; padding: 10px 14px; cursor: pointer;
}
.btn-secondary:active { transform: translateY(1px); }
.stat-row {
  display: flex; justify-content: space-between; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .06); font-size: 14px;
}
.stat-row span { color: var(--ink-dim); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 7px 8px; text-align: right; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.admin-table th { color: var(--ink-dim); font-weight: 700; }

/* one row per event in the events panel */
.ev-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 12px; margin-top: 10px; border-radius: 12px;
  background: rgba(4, 16, 30, .5); border: 1px solid transparent;
}
.ev-row.active { background: rgba(0, 229, 255, .12); border-color: var(--panel-line); }
.ev-main { flex: 1 1 190px; min-width: 0; }
.ev-name { font-weight: 800; font-size: 15px; }
.ev-meta { font-size: 12px; color: var(--ink-dim); margin-top: 2px; direction: ltr; text-align: right; }
.ev-live { font-size: 11px; font-weight: 800; color: #04141e; background: var(--good); padding: 2px 9px; border-radius: 999px; }
.ev-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.ev-actions .btn-secondary { padding: 7px 11px; font-size: 13px; }

/* ── footer ────────────────────────────────────────────────────── */
.foot {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-top: 16px; font-size: 11px; color: var(--ink-dim);
}
.foot-meta { display: flex; align-items: center; gap: 8px; opacity: .8; }
.wa-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; max-width: 420px; padding: 14px 16px; border-radius: 14px;
  background: rgba(37, 211, 102, .16); border: 1.5px solid rgba(37, 211, 102, .65);
  color: #25d366; font-weight: 800; font-size: 16px; text-decoration: none;
  box-shadow: 0 0 18px rgba(37, 211, 102, .35);
}
.wa-btn svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
.wa-btn:active { transform: scale(.97); }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot.on { background: var(--good); box-shadow: 0 0 10px var(--good); animation: pulse 2s infinite; }
.dot.off { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
@keyframes pulse { 50% { opacity: .4; } }

@media (max-height: 640px) {
  .pulse-ring { width: 96px; height: 96px; }
  .pulse-core { width: 60px; height: 60px; font-size: 26px; }
  .pulse-core .ico { width: 30px; height: 30px; }
  .result-emoji .ico { width: 70px; height: 70px; }
  .ended-hero .ico { width: 62px; height: 62px; }
  .vote-pill > span:first-child { width: 46px; height: 46px; font-size: 21px; }
}
