/* quiz.css — botario Quiz prototype styles.
 * Relies on tokens from botario-tokens.css.
 * Root carries: data-bg (white|pink|dark), data-mode (enterprise|playful),
 * and --accent (tile accent color), set by the React app from Tweaks.
 */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--bo-font-sans);
  color: var(--bo-text);
  background: #c9ccd6;          /* neutral gray behind the app frame */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; }

#root { min-height: 100vh; }

/* ============================================================= APP SHELL */
.app {
  --accent: var(--bo-magenta-500);
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- stage that holds the active surface ---- */
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

/* Background variants on the host surface */
.surface {
  position: relative;
  width: 100%;
  max-width: 1180px;
  min-height: min(820px, calc(100vh - 132px));
  border-radius: var(--bo-radius-xl);
  background: var(--bo-bg);
  box-shadow: var(--bo-shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
[data-bg="pink"] .surface { background: var(--bo-bg-pink); }
[data-bg="dark"]  .surface { background: #14141f; color: #eef0f6; }
[data-bg="dark"]  .surface .muted { color: #9aa0b4; }

/* soft pink halo, like the marketing hero */
.surface::before {
  content: "";
  position: absolute;
  inset: -30% -10% auto -10%;
  height: 70%;
  background: var(--bo-halo-pink);
  opacity: .7;
  pointer-events: none;
}
[data-bg="dark"] .surface::before { opacity: .28; }

/* ============================================================= VIEW TOGGLE */
.viewbar {
  position: fixed;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(10px);
  border: 1px solid var(--bo-line);
  border-radius: var(--bo-radius-pill);
  box-shadow: var(--bo-shadow-md);
}
.viewbar .seg {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--bo-text-muted);
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--bo-radius-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--bo-dur) var(--bo-ease);
}
.viewbar .seg.active { background: var(--bo-ink); color: #fff; }
.viewbar .seg i { font-size: 15px; }
.viewbar .divider { width: 1px; height: 22px; background: var(--bo-line); margin: 0 2px; }
.viewbar .resetbtn {
  border: none; background: transparent; color: var(--bo-text-faint);
  cursor: pointer; padding: 8px 10px; border-radius: var(--bo-radius-pill);
  font-size: 15px;
}
.viewbar .resetbtn:hover { color: var(--bo-magenta-500); background: var(--bo-magenta-50); }

/* ============================================================= BRAND */
.brandmark { display: inline-flex; align-items: center; gap: 10px; }
.brandmark .glyph {
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--bo-magenta-500);
  position: relative; flex: none;
  box-shadow: 0 4px 14px rgba(230,0,126,.28);
}
.brandmark .glyph::after {
  content: ""; position: absolute; left: 7px; bottom: -5px;
  border-width: 6px 6px 0 0; border-style: solid;
  border-color: var(--bo-magenta-500) transparent transparent transparent;
}
.brandmark .glyph .dots { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 4px; }
.brandmark .glyph .dots i { width: 4px; height: 4px; border-radius: 50%; background: #fff; }
.brandmark .word { font-weight: 700; letter-spacing: -.02em; font-size: 19px; color: var(--bo-ink); }
[data-bg="dark"] .brandmark .word { color: #fff; }
.brandmark .word b { color: var(--bo-magenta-500); font-weight: 700; }

/* ============================================================= BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 14px 26px; border-radius: var(--bo-radius-md);
  font-weight: 600; font-size: 16px; border: 1px solid transparent;
  cursor: pointer; transition: all var(--bo-dur) var(--bo-ease);
  white-space: nowrap;
}
.btn-primary { background: var(--bo-magenta-500); color: #fff; box-shadow: 0 8px 22px rgba(230,0,126,.30); }
.btn-primary:hover { background: var(--bo-magenta-600); transform: translateY(-1px); box-shadow: 0 12px 28px rgba(230,0,126,.34); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { background: #f0f2f6; color: var(--bo-text-faint); box-shadow: none; cursor: not-allowed; }
.btn-dark { background: var(--bo-ink); color: #fff; }
.btn-dark:hover { background: #000; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--bo-ink); border-color: var(--bo-line); }
.btn-ghost:hover { border-color: var(--bo-magenta-300); color: var(--bo-magenta-600); }
[data-bg="dark"] .btn-ghost { color: #eef0f6; border-color: rgba(255,255,255,.18); }
.btn-lg { padding: 17px 34px; font-size: 18px; }
.btn i { font-size: 1.05em; }

/* ============================================================= LANDING */
.landing { width: 100%; max-width: 520px; margin: 0 auto; padding: 48px 36px; }
.landing .kicker { text-align: center; margin-bottom: 26px; }
.landing h1 { font-size: var(--bo-text-3xl); font-weight: 800; letter-spacing: -.02em; color: var(--bo-ink); margin: 18px 0 8px; line-height: 1.1; }
.landing .sub { color: var(--bo-text-muted); font-size: 17px; margin-bottom: 30px; }
.field { margin-bottom: 18px; text-align: left; }
.field label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--bo-text-muted); margin-bottom: 8px; }
.field input {
  width: 100%; padding: 15px 16px; border: 1px solid var(--bo-line);
  border-radius: var(--bo-radius-sm); font-size: 16px; font-family: inherit; color: var(--bo-ink);
  transition: all var(--bo-dur) var(--bo-ease); background: #fff;
}
.field input:focus { outline: none; border-color: var(--bo-magenta-400); box-shadow: 0 0 0 4px var(--bo-magenta-50); }
.field input::placeholder { color: var(--bo-text-faint); }
.mark-note { font-family: var(--bo-font-mark); font-weight: 700; color: var(--bo-magenta-500); font-size: 23px; transform: rotate(-3deg); display: inline-block; }

/* ============================================================= LOBBY */
.lobby { display: grid; grid-template-columns: 360px 1fr; gap: 0; height: 100%; flex: 1; }
.lobby .joinpanel {
  padding: 44px 40px; background: var(--bo-ink); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center;
}
.lobby .joinpanel .label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--bo-magenta-200); font-weight: 700; }
.lobby .joinpanel .brandmark .word { color: #fff; }
.qr-card { background: #fff; padding: 18px; border-radius: var(--bo-radius-lg); box-shadow: var(--bo-shadow-lg); }
.qr-card svg { display: block; }
.pin { font-size: 13px; color: #c2c6d4; }
.pin b { color: #fff; font-size: 30px; letter-spacing: .18em; font-weight: 800; display: block; margin-top: 4px; }
.joinurl { font-family: var(--bo-font-mono); font-size: 13px; color: #c2c6d4; }

.lobby .roster { padding: 40px 44px; display: flex; flex-direction: column; min-height: 0; }
.roster .rosterhead { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 22px; }
.roster h2 { font-size: var(--bo-text-2xl); font-weight: 800; letter-spacing: -.02em; color: var(--bo-ink); margin: 0; }
[data-bg="dark"] .roster h2 { color: #fff; }
.roster .count { font-weight: 700; color: var(--bo-magenta-500); font-size: 18px; }
.playergrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-content: start; overflow: auto; padding-right: 4px; }

.pchip {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px;
  background: #fff; border: 1px solid var(--bo-line); border-radius: var(--bo-radius-md);
  box-shadow: var(--bo-shadow-xs);
  animation: chipIn .42s var(--bo-ease-out);
}
[data-bg="dark"] .pchip { background: #1d1d2b; border-color: rgba(255,255,255,.08); }
@keyframes chipIn { from { transform: translateY(10px) scale(.95); } to { transform: none; } }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 14px; }
.pchip .pname { font-weight: 600; font-size: 15px; color: var(--bo-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-bg="dark"] .pchip .pname { color: #eef0f6; }
.pchip.you { border-color: var(--bo-magenta-300); box-shadow: 0 0 0 3px var(--bo-magenta-50); }

/* ============================================================= GAME / HOST */
.game { display: flex; flex-direction: column; height: 100%; flex: 1; padding: 30px 44px 26px; gap: 18px; position: relative; z-index: 1; }
.gamehead { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.counter { display: inline-flex; align-items: center; gap: 12px; }
.counter .pill { background: var(--bo-ink); color: #fff; border-radius: var(--bo-radius-pill); padding: 8px 16px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.counter .pill b { color: var(--bo-magenta-200); }
.progress-dots { display: flex; gap: 4px; align-items: center; }
.progress-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--bo-line); transition: all var(--bo-dur); }
.progress-dots i.done { background: var(--bo-magenta-400); }
.progress-dots i.now { background: var(--bo-magenta-500); transform: scale(1.5); }
.progress-mini { font-size: 13px; color: var(--bo-text-faint); font-weight: 600; white-space: nowrap; }

/* timer ring */
.timer { position: relative; width: 84px; height: 84px; flex: none; }
.timer svg { transform: rotate(-90deg); display: block; }
.timer .ring-bg { stroke: var(--bo-line); }
.timer .ring-fg { stroke: var(--bo-magenta-500); stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke .3s; }
.timer.warn .ring-fg { stroke: var(--bo-warning); }
.timer.danger .ring-fg { stroke: var(--bo-danger); }
.timer .num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 26px; color: var(--bo-ink); }
[data-bg="dark"] .timer .num { color: #fff; }
[data-bg="dark"] .timer .ring-bg { stroke: rgba(255,255,255,.12); }
.timer.pulse { animation: timerPulse .9s ease-in-out infinite; }
@keyframes timerPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* question */
.qbody { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; min-height: 0; }
.qtext { font-size: clamp(26px, 3.4vw, 44px); font-weight: 800; letter-spacing: -.02em; line-height: 1.12; color: var(--bo-ink); max-width: 16ch; text-wrap: balance; margin: 0; }
[data-bg="dark"] .qtext { color: #fff; }
.qvisual { display: flex; align-items: center; justify-content: center; height: clamp(120px, 18vh, 200px); }
.qvisual svg { height: 100%; width: auto; }

/* answers */
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile {
  position: relative; display: flex; align-items: center; gap: 16px;
  padding: 18px 20px; border-radius: var(--bo-radius-md);
  background: #fff; border: 2px solid var(--bo-line);
  text-align: left; cursor: default; overflow: hidden;
  transition: transform var(--bo-dur) var(--bo-ease), box-shadow var(--bo-dur) var(--bo-ease);
}
[data-bg="dark"] .tile { background: #1d1d2b; border-color: rgba(255,255,255,.10); }
.tile .badge {
  width: 42px; height: 42px; border-radius: 11px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 19px; color: #fff;
  background: var(--accent);
}
.tile .opt { font-size: clamp(16px, 1.5vw, 21px); font-weight: 600; color: var(--bo-ink); z-index: 1; }
[data-bg="dark"] .tile .opt { color: #eef0f6; }
/* live vote fill behind the option */
.tile .votefill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--bo-magenta-50); transition: width .5s var(--bo-ease); z-index: 0; }
[data-bg="dark"] .tile .votefill { background: rgba(230,0,126,.16); }
.tile .votecount { margin-left: auto; font-weight: 800; font-size: 17px; color: var(--bo-text-muted); z-index: 1; min-width: 28px; text-align: right; }
.tile .resultmark { margin-left: auto; font-size: 24px; z-index: 1; }

/* states */
.tile.selectable { cursor: pointer; }
.tile.selectable:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--bo-shadow-md); }
.tile.selected { border-color: var(--accent); box-shadow: 0 0 0 4px var(--bo-magenta-50); background: var(--bo-magenta-50); }
[data-bg="dark"] .tile.selected { background: rgba(230,0,126,.12); box-shadow: 0 0 0 4px rgba(230,0,126,.18); }
.tile.correct { border-color: var(--bo-success); background: #e9f9f0; }
.tile.correct .resultmark { color: var(--bo-success); }
[data-bg="dark"] .tile.correct { background: rgba(24,169,87,.16); }
.tile.wrong { border-color: var(--bo-danger); background: #fdecee; }
.tile.wrong .resultmark { color: var(--bo-danger); }
[data-bg="dark"] .tile.wrong { background: rgba(224,43,58,.16); }
.tile.dimmed { opacity: .5; }

/* playful mode: 4 distinct colored tiles + shapes */
[data-mode="playful"] .tile { color: #fff; border: none; }
[data-mode="playful"] .tile .opt { color: #fff; }
[data-mode="playful"] .tile .votecount { color: rgba(255,255,255,.85); }
[data-mode="playful"] .tile .badge { background: rgba(255,255,255,.22); }
[data-mode="playful"] .tile.t0 { background: #e6007e; }
[data-mode="playful"] .tile.t1 { background: #2da9b8; }
[data-mode="playful"] .tile.t2 { background: #7c5cff; }
[data-mode="playful"] .tile.t3 { background: #ff7a3d; }
[data-mode="playful"] .tile .votefill { background: rgba(255,255,255,.20); }
[data-mode="playful"] .tile.selectable:hover { transform: translateY(-2px) scale(1.01); box-shadow: var(--bo-shadow-lg); }
[data-mode="playful"] .tile.selected { box-shadow: 0 0 0 4px rgba(255,255,255,.6), var(--bo-shadow-lg); }
[data-mode="playful"] .tile.dimmed { opacity: .35; }
[data-mode="playful"] .tile.correct, [data-mode="playful"] .tile.wrong { color: #fff; }

/* host footer */
.gamefoot { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.answered { display: inline-flex; align-items: center; gap: 12px; color: var(--bo-text-muted); font-weight: 600; font-size: 15px; }
.answered .bar { width: 180px; height: 8px; border-radius: 999px; background: var(--bo-line); overflow: hidden; }
.answered .bar i { display: block; height: 100%; background: var(--bo-magenta-500); border-radius: 999px; transition: width .5s var(--bo-ease); }
[data-bg="dark"] .answered { color: #c2c6d4; }
[data-bg="dark"] .answered .bar { background: rgba(255,255,255,.12); }
.allin-flag { color: var(--bo-success); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }

/* ============================================================= LEADERBOARD */
.lb { display: flex; flex-direction: column; height: 100%; flex: 1; padding: 34px 48px; position: relative; z-index: 1; }
.lb .lbhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.lb h2 { font-size: var(--bo-text-3xl); font-weight: 800; letter-spacing: -.02em; color: var(--bo-ink); margin: 0; }
[data-bg="dark"] .lb h2 { color: #fff; }
.lb .lbsub { color: var(--bo-text-muted); font-weight: 600; }
.lblist { position: relative; flex: 1; overflow: hidden; }
.lbrow {
  position: absolute; left: 0; right: 0;
  display: flex; align-items: center; gap: 16px;
  height: 58px; padding: 0 18px;
  background: #fff; border: 1px solid var(--bo-line); border-radius: var(--bo-radius-md);
  box-shadow: var(--bo-shadow-xs);
  will-change: transform;
}
[data-bg="dark"] .lbrow { background: #1d1d2b; border-color: rgba(255,255,255,.08); }
.lbrow .rank { width: 34px; font-weight: 800; font-size: 19px; color: var(--bo-text-faint); text-align: center; flex: none; }
.lbrow .lname { font-weight: 700; font-size: 17px; color: var(--bo-ink); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-bg="dark"] .lbrow .lname { color: #eef0f6; }
.lbrow .delta { font-weight: 800; font-size: 14px; color: var(--bo-success); display: inline-flex; align-items: center; gap: 3px; opacity: 0; transition: opacity .3s; }
.lbrow .delta.show { opacity: 1; }
.lbrow .score { font-weight: 800; font-size: 20px; color: var(--bo-ink); min-width: 40px; text-align: right; }
[data-bg="dark"] .lbrow .score { color: #fff; }
.lbrow.you { border-color: var(--bo-magenta-300); box-shadow: 0 0 0 3px var(--bo-magenta-50); }
.lbrow.top1 { background: linear-gradient(90deg, #fff6e6, #fff); border-color: #f4cf6a; }
.lbrow.top2 { background: linear-gradient(90deg, #f3f4f8, #fff); border-color: #d3d7e2; }
.lbrow.top3 { background: linear-gradient(90deg, #fbeede, #fff); border-color: #e7b98a; }
[data-bg="dark"] .lbrow.top1 { background: linear-gradient(90deg, rgba(244,163,0,.22), #1d1d2b); }
[data-bg="dark"] .lbrow.top2 { background: linear-gradient(90deg, rgba(255,255,255,.10), #1d1d2b); }
[data-bg="dark"] .lbrow.top3 { background: linear-gradient(90deg, rgba(255,122,61,.20), #1d1d2b); }
.medal { font-size: 20px; }

/* ============================================================= PODIUM (final) */
.final { display: flex; flex-direction: column; height: 100%; flex: 1; padding: 30px 48px; position: relative; z-index: 1; }
.final .crown { text-align: center; margin-bottom: 6px; }
.final h2 { text-align: center; font-size: var(--bo-text-3xl); font-weight: 800; color: var(--bo-ink); margin: 4px 0 2px; letter-spacing: -.02em; }
[data-bg="dark"] .final h2 { color: #fff; }
.final .winnerline { text-align: center; color: var(--bo-text-muted); font-weight: 600; margin-bottom: 18px; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 18px; margin-bottom: 22px; }
.pcol { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 180px; }
.pcol .pavatar { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 26px; box-shadow: var(--bo-shadow-md); }
.pcol .pblock { width: 100%; border-radius: var(--bo-radius-md) var(--bo-radius-md) 0 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 16px 8px; color: #fff; }
.pcol.r1 .pblock { background: linear-gradient(180deg, #f6b93b, #e69313); height: 188px; }
.pcol.r2 .pblock { background: linear-gradient(180deg, #b8bfcf, #8a93a8); height: 142px; }
.pcol.r3 .pblock { background: linear-gradient(180deg, #d9925a, #b5703a); height: 110px; }
.pcol .pblock .pn { font-weight: 800; font-size: 19px; }
.pcol .pblock .ps { font-weight: 700; font-size: 14px; opacity: .9; }
.pcol .place { font-size: 30px; font-weight: 900; }
.pcol.r1 .place { color: #e69313; } .pcol.r2 .place { color: #8a93a8; } .pcol.r3 .place { color: #b5703a; }
.runners { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 22px; flex: 1; overflow: auto; align-content: start; }
.runner { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--bo-radius-sm); }
.runner:hover { background: var(--bo-bg-alt); }
[data-bg="dark"] .runner:hover { background: rgba(255,255,255,.05); }
.runner .rrank { width: 26px; font-weight: 800; color: var(--bo-text-faint); }
.runner .rname { flex: 1; font-weight: 600; color: var(--bo-ink); }
[data-bg="dark"] .runner .rname { color: #eef0f6; }
.runner .rscore { font-weight: 800; color: var(--bo-magenta-500); }
.runner.you { background: var(--bo-magenta-50); }
[data-bg="dark"] .runner.you { background: rgba(230,0,126,.14); }

/* confetti */
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 2; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(120vh) rotate(720deg); opacity: .9; } }

/* ============================================================= PLAYER PHONE */
.phonewrap { display: flex; align-items: center; justify-content: center; gap: 40px; flex-wrap: wrap; }
.phonehint { max-width: 240px; color: var(--bo-ink); }
.phonehint h3 { font-size: 22px; font-weight: 800; margin: 0 0 8px; letter-spacing: -.02em; }
.phonehint p { color: var(--bo-text-muted); font-size: 15px; line-height: 1.5; margin: 0 0 14px; }
.phonehint .mark-note { font-size: 26px; }

.pscreen { height: 100%; display: flex; flex-direction: column; background: var(--bo-bg); }
.pscreen.dark { background: #14141f; color: #fff; }
.pscreen .ptop { padding: 14px 18px 10px; display: flex; align-items: center; justify-content: space-between; }
.pscreen .ptag { font-size: 12px; font-weight: 700; color: var(--bo-text-faint); letter-spacing: .08em; text-transform: uppercase; }
.pbtns { padding: 14px; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 12px; flex: 1; }
.pbtn {
  border: none; border-radius: var(--bo-radius-md); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 30px;
  transition: transform .12s var(--bo-ease);
  position: relative;
}
.pbtn.c0 { background: #e6007e; } .pbtn.c1 { background: #2da9b8; }
.pbtn.c2 { background: #7c5cff; } .pbtn.c3 { background: #ff7a3d; }
.pbtn:active { transform: scale(.96); }
.pbtn.sel { box-shadow: 0 0 0 5px rgba(14,14,26,.16), inset 0 0 0 4px #fff; }
.pscreen.dark .pbtn.sel { box-shadow: 0 0 0 5px rgba(255,255,255,.25), inset 0 0 0 4px #fff; }
.pbtn.dim { opacity: .35; }
.pbtn .pcheck { position: absolute; top: 8px; right: 10px; font-size: 22px; }
.pbtn .optlabel { font-size: 15px; font-weight: 700; padding: 0 10px; text-align: center; }

.pcenter { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 28px 22px; text-align: center; }
.pcenter .big { font-size: 26px; font-weight: 800; color: var(--bo-ink); letter-spacing: -.02em; }
.pscreen.dark .pcenter .big { color: #fff; }
.pcenter .small { color: var(--bo-text-muted); font-size: 15px; }
.pstatusbar { padding: 12px 18px; font-size: 14px; text-align: center; font-weight: 700; }
.pscreen .pq { padding: 16px 18px 4px; font-size: 17px; font-weight: 700; color: var(--bo-ink); text-align: center; line-height: 1.25; }
.pscreen.dark .pq { color: #fff; }

.feedback-correct { color: var(--bo-success); }
.feedback-wrong { color: var(--bo-danger); }
.score-pop { font-size: 54px; font-weight: 900; letter-spacing: -.03em; }

/* utility */
.muted { color: var(--bo-text-muted); }
.center { text-align: center; }
.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
/* NOTE: entrance keyframes are transform-only (never start at opacity:0) so
   content is always visible even if the rendering clock is throttled. */
.fade-in { animation: fadeIn .45s var(--bo-ease-out); }
@keyframes fadeIn { from { transform: translateY(12px); } to { transform: none; } }
.pop-in { animation: popIn .5s var(--bo-ease-out); }
@keyframes popIn { 0% { transform: scale(.85); } 60% { transform: scale(1.05); } 100% { transform: scale(1); } }

@media (max-width: 900px) {
  .lobby { grid-template-columns: 1fr; }
  .lobby .joinpanel { padding: 28px; }
}

/* ---------- live mode: real phone fills the viewport (?join) ---------- */
.livewrap { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bo-bg); }
.livewrap .pscreen { flex: 1; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.livewrap .pbtns { grid-auto-rows: minmax(96px, 1fr); }

/* reconnecting banner shown when the phone's SSE link drops */
.reconnect-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--bo-ink, #0E0E1A); color: #fff;
  font-weight: 700; font-size: 14px;
}
/* small, unobtrusive "leave / change name" affordance on the phone */
.player-leave {
  align-self: center; margin: 6px auto calc(10px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  color: var(--bo-text-faint); font: inherit; font-size: 13px; opacity: .8;
}
.player-leave:hover { opacity: 1; color: var(--bo-text-muted); }
