/* Boffin Battle — studio-dark with klaxon red + quiz-lamp amber. */
:root {
  --ink: #0d0f1a;          /* studio dark */
  --panel: #171a2b;
  --panel-2: #1f2340;
  --text: #f2f3fb;
  --muted: #9aa0c3;
  --klaxon: #ff3b30;       /* the buzzer */
  --klaxon-deep: #c2170e;
  --lamp: #ffc233;         /* quiz-lamp amber */
  --win: #3ddc84;
  --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background:
    /* twin studio spotlights raking down from the gantry */
    radial-gradient(60% 55% at 22% -8%, rgba(255, 194, 51, .10), transparent 60%),
    radial-gradient(60% 55% at 78% -8%, rgba(255, 59, 48, .09), transparent 60%),
    /* the room */
    radial-gradient(130% 90% at 50% -10%, #262a4d 0%, var(--ink) 58%),
    /* stage floor warming the base of the page */
    linear-gradient(180deg, transparent 62%, rgba(120, 132, 220, .05) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
main { max-width: 720px; margin: 0 auto; padding: 24px 16px 60px; }
h1.logo {
  font-size: clamp(2rem, 7vw, 3.4rem);
  margin: .4em 0 .1em;
  letter-spacing: .02em;
  text-transform: uppercase;
}
h1.logo .boffin { color: var(--lamp); }
h1.logo .battle { color: var(--klaxon); }
.tagline { color: var(--muted); margin-top: 0; }
.card {
  position: relative;
  background: linear-gradient(180deg, #1b1f38 0%, var(--panel) 100%);
  border: 1px solid #2c315a;
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px 0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 14px 34px rgba(0, 0, 0, .30);
}
/* interactive cards (mode tiles, pack cards) get a lift + amber edge on hover */
.card.lift { transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.card.lift:hover { transform: translateY(-3px); border-color: #46508f; box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 22px 46px rgba(0, 0, 0, .40); }

/* ── showtime bits: eyebrow badge + marquee bulbs ───────────────────── */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255, 59, 48, .12); border: 1px solid rgba(255, 59, 48, .4);
  color: #ff8078; border-radius: 999px; padding: 5px 13px;
  font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--klaxon); box-shadow: 0 0 10px var(--klaxon); animation: onair 1.4s ease-in-out infinite; }
@keyframes onair { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.eyebrow.calm { background: rgba(255, 194, 51, .1); border-color: rgba(255, 194, 51, .38); color: var(--lamp); }
.eyebrow.calm .dot { background: var(--lamp); box-shadow: 0 0 10px var(--lamp); animation: none; }
.marquee {
  display: flex; gap: 12px; justify-content: center; margin: 14px 0 2px;
}
.marquee i {
  width: 9px; height: 9px; border-radius: 50%; display: block;
  background: var(--lamp); box-shadow: 0 0 8px rgba(255, 194, 51, .8);
  animation: chase 1.1s steps(1, end) infinite;
}
.marquee i:nth-child(3n+2) { animation-delay: .366s; }
.marquee i:nth-child(3n) { animation-delay: .733s; }
@keyframes chase { 0%, 66% { opacity: .28; } 33% { opacity: 1; } }
label { display: block; color: var(--muted); font-size: .85rem; margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .08em; }
input {
  width: 100%; padding: 12px 14px; font-size: 1.15rem;
  background: var(--ink); color: var(--text);
  border: 1px solid #333a6b; border-radius: 10px;
}
input#code { text-transform: uppercase; letter-spacing: .35em; font-weight: 700; }
/* the width:100% above is meant for text fields — never let it balloon a toggle */
input[type=radio], input[type=checkbox] { width: auto; padding: 0; font-size: inherit; }
button {
  font: inherit; font-weight: 700; cursor: pointer;
  border: 0; border-radius: 10px; padding: 12px 18px;
  background: linear-gradient(180deg, #ffd05f 0%, var(--lamp) 100%); color: #201500;
  box-shadow: 0 6px 16px rgba(255, 194, 51, .26), 0 1px 0 rgba(255, 255, 255, .5) inset;
}
button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid #333a6b; box-shadow: none; }
button.danger { background: linear-gradient(180deg, #ff5147 0%, var(--klaxon) 100%); color: #fff; box-shadow: 0 6px 16px rgba(255, 59, 48, .28); }
button:disabled { opacity: .45; cursor: default; }
select {
  font: inherit; font-weight: 600; cursor: pointer;
  background: var(--panel-2); color: var(--text);
  border: 1px solid #333a6b; border-radius: 10px; padding: 12px 14px;
}
.error { color: var(--klaxon); min-height: 1.2em; }

/* host board */
.roomcode {
  font-size: clamp(3rem, 14vw, 6rem); font-weight: 800;
  letter-spacing: .3em; text-align: center; color: var(--lamp);
  text-shadow: 0 0 40px rgba(255, 194, 51, .35);
  margin: .1em 0;
}
.players { display: flex; flex-wrap: wrap; gap: 10px; }
.player {
  background: var(--panel-2); border-radius: 999px; padding: 8px 16px;
  font-weight: 600; display: flex; gap: 10px; align-items: center;
}
.player .score { color: var(--lamp); font-variant-numeric: tabular-nums; }
.player.away { opacity: .45; }
.buzzlist { list-style: none; margin: 0; padding: 0; }
.buzzlist li {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel-2); border-radius: 10px;
  padding: 12px 14px; margin: 8px 0; font-size: 1.2rem; font-weight: 700;
}
.buzzlist li:first-child { outline: 2px solid var(--klaxon); }
.buzzlist .pos { color: var(--muted); font-size: .9rem; }
.buzzlist .actions { margin-left: auto; display: flex; gap: 8px; }
.phase { text-align: center; font-size: 1.1rem; color: var(--muted); margin: 12px 0; }
.phase.armed { color: var(--win); }
.phase.locked { color: var(--klaxon); font-weight: 700; }

/* the buzzer */
.buzzwrap { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: 4vh; }
#buzzer {
  width: min(78vw, 340px); height: min(78vw, 340px); border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff6a5f, var(--klaxon) 55%, var(--klaxon-deep));
  box-shadow: 0 14px 0 var(--klaxon-deep), 0 24px 60px rgba(255, 59, 48, .35);
  color: #fff; font-size: 2rem; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform .05s, box-shadow .05s, filter .2s;
}
#buzzer:active { transform: translateY(10px); box-shadow: 0 4px 0 var(--klaxon-deep), 0 10px 30px rgba(255, 59, 48, .3); }
#buzzer:disabled { filter: grayscale(.75) brightness(.6); }
.mystatus { font-size: 1.3rem; text-align: center; min-height: 1.6em; }
.mystatus .first { color: var(--win); font-weight: 800; }
footer { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 40px; }
main > footer { border-top: 1px solid rgba(120, 132, 220, .12); padding-top: 18px; }
footer a { color: var(--muted); }

/* question answering (phone list + console row) */
.qtext { font-size: 1.15rem; font-weight: 700; text-align: center; margin: 0 0 14px; }
#qwrap { width: 100%; max-width: 440px; }
#answers { display: flex; flex-direction: column; gap: 10px; width: 100%; }
#answers.row { flex-direction: row; width: auto; max-width: 60vw; flex-wrap: wrap; justify-content: center; }
#answers button {
  display: flex; align-items: center; gap: 12px; text-align: left;
  font-size: 1.05rem; padding: 14px 16px;
  background: var(--panel-2); color: var(--text); border: 2px solid #333a6b;
}
#answers.row button { font-size: .95rem; padding: 10px 14px; }
#answers button .chip { width: 22px; height: 22px; border-radius: 6px; flex: none; }
#answers button.chosen { border-color: #fff; }
#answers button.correct { border-color: var(--win); box-shadow: 0 0 14px rgba(61, 220, 132, .35); }
#answers button.wrongpick { border-color: var(--klaxon); opacity: .75; }
#answers button:disabled { cursor: default; opacity: .9; }

/* face-cam strip (question view): GL renders each contestant behind its window */
#facestrip {
  position: fixed; left: 0; right: 0; bottom: 92px; z-index: 2;
  display: flex; gap: 12px; justify-content: center; pointer-events: none;
}
.facecard { width: 132px; }
.facewin { height: 100px; border: 2px solid #333a6b; border-bottom: 0; border-radius: 10px 10px 0 0; }
.facelabel {
  display: flex; justify-content: space-between; gap: 6px;
  background: var(--panel); border: 2px solid #333a6b; border-top: 0;
  border-radius: 0 0 10px 10px; padding: 4px 8px; font-size: .78rem;
}
.facelabel b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facelabel .pts { color: var(--lamp); font-variant-numeric: tabular-nums; white-space: nowrap; }
.facecard.good .facewin, .facecard.good .facelabel { border-color: var(--win); }
.facecard.bad .facewin, .facecard.bad .facelabel { border-color: var(--klaxon); }

/* Barry Boffin's lower-third caption */
#hostline {
  position: fixed; left: 16px; bottom: 92px; z-index: 2; max-width: min(560px, 60vw);
  background: rgba(23, 26, 43, .92); border: 1px solid #333a6b; border-left: 4px solid var(--lamp);
  border-radius: 10px; padding: 10px 14px; font-size: .95rem; backdrop-filter: blur(6px);
}
#hostline b { color: var(--lamp); margin-right: 6px; }

/* player picker (nominate a friend / choose a target) */
.pickerbtns { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.pickerbtns button { font-size: 1.1rem; padding: 14px; background: var(--panel-2); color: var(--text); border: 2px solid #333a6b; }
.pickerbtns button:hover { border-color: var(--lamp); }

/* face card: player has locked an answer in */
.facecard.answered .facelabel b::after { content: ' ✓'; color: var(--win); }
/* disconnected player: dim the card so the room can see who's dropped */
.facecard.away { opacity: .5; filter: grayscale(.6); }
.facecard.away .facewin, .facecard.away .facelabel { border-color: #5b67b8; border-style: dashed; }

/* the top-HUD chip (host board + online console): compact "room code" pill */
.topline {
  display: inline-flex; align-items: center; gap: 10px; background: rgba(13, 15, 26, .55);
  border: 1px solid rgba(138, 107, 255, .18); border-radius: 999px; padding: 5px 8px 5px 16px; backdrop-filter: blur(5px);
}
/* while a question/game runs the monitor owns the frame — shrink the top chip to a faded code */
.hud.top.ingame .topline { background: none; border: none; padding: 0; }
.hud.top.ingame .join, .hud.top.ingame #copyLink { display: none; }
.hud.top.ingame .roomcode { font-size: 1.2rem; opacity: .5; letter-spacing: .2em; }
.hud.top.ingame .phase { display: none; }
.hud.top .phase.lobby { display: none; } /* the monitor already shows the 'hit Start' prompt */

/* pack picker modal (host board + online console): Official/Community tabs,
   category sidebar, pack-card grid — per Aidan's sketch */
.packbtn { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.packmodal {
  position: fixed; inset: 0; z-index: 30; background: rgba(5, 6, 14, .78);
  display: flex; align-items: center; justify-content: center; padding: 18px;
  backdrop-filter: blur(4px);
}
.packmodal .pmbox {
  width: min(920px, 100%); max-height: min(680px, 92vh); display: flex; flex-direction: column;
}
/* tabs: rounded folder tabs, active one lit with an amber top accent, blending into the body */
.packmodal .pmtabs { display: flex; gap: 8px; padding: 0 6px; }
.packmodal .pmtab {
  background: linear-gradient(180deg, rgba(31,35,64,.75), rgba(20,24,48,.75)); color: var(--muted);
  border: 1px solid #2c315a; border-bottom: none; border-radius: 14px 14px 0 0; box-shadow: none;
  padding: 11px 26px; font: inherit; font-weight: 700; cursor: pointer; transition: color .15s, background .15s;
}
.packmodal .pmtab:hover { color: var(--text); background: linear-gradient(180deg, rgba(40,46,84,.8), rgba(24,28,54,.8)); }
.packmodal .pmtab.on {
  background: linear-gradient(180deg, #242a4e, #1a1f3c); color: var(--text);
  border-color: #3b4278; position: relative; top: 1px; box-shadow: inset 0 3px 0 var(--lamp);
}
.packmodal .pmbody {
  display: flex; gap: 16px; min-height: 0; flex: 1;
  background: linear-gradient(180deg, #1e2444, #14172e); border: 1px solid #3b4278; border-radius: 16px; border-top-left-radius: 4px;
  padding: 16px; box-shadow: 0 26px 64px rgba(0, 0, 0, .6);
}
/* category rail: quiet pill rows with a count badge */
.packmodal .pmcats {
  flex: none; width: 178px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
  align-self: stretch; padding-right: 2px;
}
.packmodal .pmcat {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: none; border: 1px solid transparent; border-radius: 11px; padding: 9px 12px; text-align: left;
  color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; box-shadow: none; /* kill the base-button amber glow */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background .12s, color .12s;
}
.packmodal .pmcat:hover { background: rgba(91,103,184,.12); color: var(--text); }
.packmodal .pmcat.on { background: rgba(255,194,51,.1); border-color: rgba(255,194,51,.32); color: var(--text); }
.packmodal .pmcat .n { flex: none; color: var(--muted); font-weight: 700; font-size: .76rem; background: rgba(120,132,220,.15); border-radius: 999px; padding: 1px 9px; }
.packmodal .pmcat.on .n { color: var(--lamp); background: rgba(255,194,51,.16); }
.packmodal .pmgrid {
  flex: 1; overflow-y: auto; display: grid; gap: 12px; align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  padding-left: 16px; border-left: 1px solid #2a2f55;
}
/* pack cards: tactile tiles with a coloured icon chip, blurb and a question-count pill */
.packmodal .packcard {
  position: relative; display: flex; flex-direction: column; gap: 6px; text-align: left; min-height: 138px;
  background: linear-gradient(165deg, #262c52 0%, #1a1f3c 100%); border: 1px solid #2f3560; border-radius: 16px; padding: 14px;
  color: var(--text); font: inherit; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.22);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.packmodal .packcard:hover { transform: translateY(-3px); border-color: #5b67b8; box-shadow: 0 12px 30px rgba(0,0,0,.42); }
.packmodal .packcard.sel { border-color: var(--lamp); box-shadow: 0 0 0 1px var(--lamp), 0 12px 30px -6px rgba(255,194,51,.45); }
.packmodal .packcard .pemoji {
  width: 46px; height: 46px; display: grid; place-items: center; font-size: 1.55rem; line-height: 1;
  background: linear-gradient(160deg, #353d72, #262c55); border: 1px solid #3c4488; border-radius: 13px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
}
.packmodal .packcard.sel .pemoji { background: linear-gradient(160deg, #4c4020, #3a3113); border-color: var(--lamp); }
.packmodal .packcard .pname { font-weight: 800; font-size: 1.02rem; margin-top: 2px; }
.packmodal .packcard .pdesc {
  color: var(--muted); font-size: .82rem; line-height: 1.35; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.packmodal .packcard .pauthor { color: #8a91bd; font-size: .74rem; font-style: italic; }
.packmodal .packcard .pcount {
  margin-top: auto; align-self: flex-start; color: var(--lamp); font-size: .72rem; font-weight: 700;
  background: rgba(255,194,51,.1); border: 1px solid rgba(255,194,51,.26); border-radius: 999px; padding: 3px 10px;
}
.packmodal .pmempty { color: var(--muted); grid-column: 1 / -1; padding: 30px; text-align: center; }
@media (max-width: 640px) {
  .packmodal .pmbody { flex-direction: column; }
  .packmodal .pmcats { width: auto; flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .packmodal .pmcat { flex: none; }
  .packmodal .pmgrid { padding-left: 0; border-left: none; border-top: 1px solid #2a2f55; padding-top: 14px; }
}

/* online console with a 3D stage: the monitor is the answer surface; the
   bottom buttons shrink to a quiet fallback strip */
#answers.ghost button { font-size: .8rem; padding: 7px 10px; opacity: .55; }
#answers.ghost button:hover { opacity: 1; }

/* ---- interaction polish: hover / active / focus / links (all pages) ---- */
button { transition: transform .12s ease, filter .12s ease, box-shadow .12s ease; }
/* flat list/card buttons in the pack modal control their own hover — keep the
   generic lift/brighten (which was brightening their borders) off them */
button:hover:not(:disabled):not(#buzzer):not(.packcard):not(.pmcat):not(.pmtab):not(.charcard) { filter: brightness(1.08); transform: translateY(-1px); }
button:active:not(:disabled):not(#buzzer):not(.packcard):not(.pmcat):not(.pmtab):not(.charcard) { transform: translateY(1px); filter: brightness(.96); }
input, select, textarea { transition: border-color .15s ease, box-shadow .15s ease; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--lamp); box-shadow: 0 0 0 3px rgba(255, 194, 51, .22); }
:focus-visible { outline: 3px solid var(--lamp); outline-offset: 2px; }
a { color: var(--lamp); text-decoration: none; }
a:hover { text-decoration: underline; }
footer a { color: var(--muted); }
h1.logo { text-shadow: 0 2px 24px rgba(255, 194, 51, .18); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }

/* shared app-nav bar (account / builder / play) */
.appnav { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.appnav .brand { font-weight: 800; font-size: 1.2rem; letter-spacing: .02em; margin-right: auto; }
.appnav .brand .boffin { color: var(--lamp); } .appnav .brand .battle { color: var(--klaxon); }
.appnav a.navlink { background: var(--panel-2); border: 1px solid #333a6b; border-radius: 999px; padding: 7px 15px; font-weight: 600; font-size: .88rem; color: var(--text); }
.appnav a.navlink:hover { border-color: var(--lamp); text-decoration: none; }
.appnav a.navlink[aria-current="page"] { border-color: var(--lamp); background: #242a4a; color: var(--lamp); }
@media (max-width: 520px) { .appnav .brand { width: 100%; margin: 0 0 4px; } }

/* ---- personal buzzer-sound picker (join step, phone, console) ---- */
.soundchips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 380px) { .soundchips { grid-template-columns: repeat(2, 1fr); } }
.soundchip {
  display: flex; align-items: center; gap: 8px; text-align: left;
  padding: 9px 10px; border: 2px solid #333a6b; border-radius: 12px;
  background: var(--panel-2); color: var(--text); font: inherit; font-size: .82rem; font-weight: 600;
  box-shadow: none; cursor: pointer; min-width: 0;
}
.soundchip .se { font-size: 1.25rem; flex: none; }
.soundchip .sn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.soundchip:hover { border-color: #5b67b8; }
.soundchip.sel { border-color: var(--lamp); background: #242a4a; color: var(--lamp); }
.soundsheet {
  position: fixed; inset: 0; z-index: 40; background: rgba(8, 9, 18, .72);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.soundsheet .ssbox {
  width: min(520px, 100%); max-height: 90vh; overflow-y: auto;
  background: linear-gradient(180deg, #1b1f38, var(--panel)); border: 1px solid var(--lamp);
  border-radius: 16px; padding: 18px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
}
.soundsheet h3 { margin: 0 0 4px; }
.soundsheet .sshint { color: var(--muted); font-size: .85rem; margin: 0 0 12px; }
.soundsheet .ssgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.soundsheet .ssdone { width: 100%; margin-top: 14px; }

/* ── visual character picker (charpick.js) ─────────────────────────────────
   Preview squares, shared by the homepage join step and the console overlay.
   Previews are pre-rendered images, not live 3D — the busiest surface for this
   is a phone joining a party. */
/* auto-fit so a growing roster packs instead of orphaning one card on a new row */
.charcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 10px; }
.charcard {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 0 0 8px; border: 2px solid #333a6b; border-radius: 14px;
  background: var(--panel-2); color: var(--text); font: inherit; font-size: .82rem; font-weight: 700;
  box-shadow: none; cursor: pointer; overflow: hidden; min-width: 0;
  transition: border-color .15s, background .15s, transform .12s;
}
.charcard .cc-art {
  position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1 / 1;
  background: radial-gradient(circle at 50% 32%, #2c3263, #191d36 72%);
}
.charcard .cc-art img { width: 100%; height: 100%; object-fit: contain; display: block; }
.charcard .cc-emo { position: absolute; font-size: 1.9rem; opacity: .5; } /* fallback, sits behind the render */
.charcard .cc-name { max-width: 100%; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.charcard:hover { border-color: #5b67b8; }
.charcard:focus-visible { outline: 3px solid var(--lamp); outline-offset: 2px; }
.charcard.sel { border-color: var(--lamp); background: #242a4a; color: var(--lamp); transform: translateY(-2px); }
.charcard.sel .cc-art { background: radial-gradient(circle at 50% 32%, #3c3a70, #232041 72%); }
