/* =========================================================
   Exchange Arena — styles
   Hand-written (no Tailwind runtime) for fast loads on iPads/phones.
   ========================================================= */

:root {
  --violet: #6d5dfc;
  --violet-d: #5443e8;
  --violet-l: #eeebff;
  --tw: #2f80ed;
  --tw-l: #e3efff;
  --ph: #f43f5e;
  --ph-l: #ffe4e9;
  --green: #16a34a;
  --green-l: #dcfce7;
  --amber: #f59e0b;
  --red: #dc2626;
  --ink: #1e1b3a;
  --ink-2: #4b4870;
  --muted: #8a87a8;
  --line: #e6e4f2;
  --bg: #f5f4fb;
  --card: #ffffff;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(30, 27, 58, .06), 0 8px 24px rgba(30, 27, 58, .08);
  --shadow-lg: 0 20px 50px rgba(30, 27, 58, .18);
  --stage: #14122b;
  --stage-2: #1f1c3d;
  --stage-3: #2c2852;
  --opt-0: #f59e0b;
  --opt-1: #10b981;
  --opt-2: #6366f1;
  --opt-3: #ec4899;
  --opt-4: #0ea5e9;
  --opt-5: #84cc16;
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Quicksand', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }
button:disabled { cursor: not-allowed; }
input, select, textarea { font-size: max(16px, 1em); } /* prevents iOS zoom on focus */
:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Views ---------- */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; animation: viewIn .35s var(--ease-out); }
.view.hidden { display: none; }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px) scale(.99); } to { opacity: 1; transform: none; } }

.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand img, img.brand-logo { height: 54px; width: auto; aspect-ratio: 520 / 261; flex: none; object-fit: contain; }
.brand-name { font-weight: 700; font-size: 1.35rem; line-height: 1; letter-spacing: -.01em; }
.brand-name b { color: var(--violet); font-weight: 700; }
.brand-sub { font-size: .78rem; color: var(--muted); font-weight: 500; margin-top: 3px; }
.credit { font-size: .8rem; color: var(--muted); text-align: center; }
.credit strong { color: var(--ink-2); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 14px;
  font-weight: 600; font-size: 1rem; line-height: 1.1;
  transition: transform .15s var(--ease-spring), box-shadow .2s, background-color .2s, opacity .2s;
  user-select: none; -webkit-user-select: none; white-space: nowrap;
}
.btn:active:not(:disabled) { transform: scale(.96); }
.btn:disabled { opacity: .45; }
.btn-primary { background: var(--violet); color: #fff; box-shadow: 0 4px 0 var(--violet-d); }
.btn-primary:hover:not(:disabled) { background: #7b6dff; }
.btn-primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--violet-d); transform: translateY(3px) scale(.98); }
.btn-green { background: #22c55e; color: #fff; box-shadow: 0 4px 0 #15803d; }
.btn-green:active:not(:disabled) { box-shadow: 0 1px 0 #15803d; transform: translateY(3px) scale(.98); }
.btn-soft { background: var(--violet-l); color: var(--violet-d); }
.btn-soft:hover:not(:disabled) { background: #e2ddff; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: rgba(109, 93, 252, .08); }
.btn-danger { background: #fee2e2; color: var(--red); }
.btn-danger:hover:not(:disabled) { background: #fecaca; }
.btn-lg { min-height: 60px; font-size: 1.2rem; border-radius: 16px; padding: 0 28px; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: .9rem; border-radius: 11px; }
.btn-block { width: 100%; }
.icon-btn { width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 12px; font-size: 1.1rem; }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 2px solid var(--line); border-radius: 12px; background: #fff;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(109, 93, 252, .15); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
.select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%234b4870' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.code-input { text-transform: uppercase; text-align: center; font-weight: 700; font-size: 1.6rem; letter-spacing: .3em; padding-left: calc(14px + .3em); }
.code-input::placeholder { letter-spacing: .05em; font-size: 1rem; font-weight: 500; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.hint { font-size: .82rem; color: var(--muted); line-height: 1.35; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #d7d4ea; transition: background .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 24px; height: 24px; top: 3px; left: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .25s var(--ease-spring); }
.switch input:checked + span { background: var(--violet); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid var(--violet); outline-offset: 2px; }

/* Segmented control */
.seg { display: inline-flex; background: #efedf8; border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { min-height: 36px; padding: 0 14px; border-radius: 9px; font-weight: 600; color: var(--ink-2); font-size: .92rem; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--violet-d); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; top: calc(12px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { padding: 14px 18px; border-radius: 14px; color: #fff; font-weight: 600; box-shadow: var(--shadow-lg); background: #22c55e; animation: toastIn .35s var(--ease-spring); transition: opacity .3s, transform .3s; }
.toast.error { background: var(--red); }
.toast.info { background: var(--ink); }
.toast.out { opacity: 0; transform: translateY(-10px); }
@media (min-width: 900px) { #toasts { top: auto; bottom: 24px; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(.95); } to { opacity: 1; transform: none; } }

/* Connection pill */
#conn { position: fixed; bottom: calc(10px + var(--safe-b)); left: 50%; transform: translateX(-50%); z-index: 900; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 99px; font-size: .85rem; font-weight: 600; box-shadow: var(--shadow-lg); display: flex; gap: 8px; align-items: center; }
#conn::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); animation: pulse 1s infinite; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(20, 18, 43, .5); z-index: 800; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn .2s; }
.modal { width: min(640px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; animation: popIn .3s var(--ease-spring); }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 1.15rem; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: scale(.92) translateY(10px); } }

/* =========================================================
   LANDING
   ========================================================= */
#view-landing { overflow-y: auto; background:
  radial-gradient(900px 500px at 10% -10%, rgba(56, 189, 248, .25), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, rgba(251, 113, 133, .25), transparent 60%),
  var(--bg); }
.landing-wrap { margin: auto; width: 100%; max-width: 920px; padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 24px; }
.hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hero-logo { display: block; width: min(520px, 92vw); height: auto; aspect-ratio: 1040 / 521; animation: logoIn .8s var(--ease-spring) both, logoFloat 6s ease-in-out .8s infinite; filter: drop-shadow(0 14px 28px rgba(30, 27, 58, .22)); }
.hero h1 { margin: 0; font-size: clamp(2.2rem, 7vw, 3.4rem); line-height: 1; letter-spacing: -.02em; }
.hero h1 .x { background: linear-gradient(90deg, var(--tw), var(--violet), var(--ph)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0; color: var(--ink-2); font-weight: 500; }
@keyframes logoFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes logoIn { from { opacity: 0; transform: scale(.85) translateY(10px); } }
.landing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.landing-card { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.landing-card h2 { margin: 0; font-size: 1.3rem; display: flex; align-items: center; gap: 10px; }
.landing-card h2 .emoji { font-size: 1.6rem; }
.landing-card.player { border-top: 6px solid var(--violet); }
.landing-card.host { border-top: 6px solid var(--ink); }
.resume-banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; background: #fff7e6; border: 2px dashed #fbbf24; }
@media (max-width: 720px) { .landing-grid { grid-template-columns: 1fr; } .landing-card.host { order: 2; } }

/* =========================================================
   HOST SETUP (Settings)
   ========================================================= */
#view-host-setup { background: var(--bg); }
.topbar { display: flex; align-items: center; gap: 12px; padding: calc(12px + var(--safe-t)) 20px 12px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.topbar .spacer { flex: 1; }
.room-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--violet-l); color: var(--violet-d); font-weight: 700; padding: 6px 12px; border-radius: 10px; letter-spacing: .12em; }
.room-chip small { letter-spacing: 0; font-weight: 600; color: var(--muted); }
.tabs { display: flex; gap: 6px; padding: 10px 20px 0; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; padding: 12px 16px; font-weight: 600; color: var(--muted); border-radius: 12px 12px 0 0; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.tab .count { background: #efedf8; color: var(--ink-2); border-radius: 99px; padding: 1px 8px; font-size: .78rem; }
.tab[aria-selected="true"] { color: var(--violet-d); }
.tab[aria-selected="true"]::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 4px; border-radius: 4px 4px 0 0; background: var(--violet); animation: tabLine .3s var(--ease-spring); }
@keyframes tabLine { from { transform: scaleX(.3); opacity: 0; } }
.setup-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; padding-bottom: calc(20px + var(--safe-b)); }
.panel { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; animation: viewIn .3s var(--ease-out); }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 1.4rem; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.two-col { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.sticky { position: sticky; top: 0; }

.checklist { display: flex; gap: 8px; flex-wrap: wrap; }
.check-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; padding: 6px 10px; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--muted); }
.check-pill.ok { color: var(--green); background: var(--green-l); border-color: transparent; }

/* Faction columns */
.faction-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .faction-cols { grid-template-columns: 1fr; } }
.faction-col h3 { margin: 0 0 10px; display: flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.group-card { background: #fff; border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; border-left: 6px solid var(--tw); animation: popIn .3s var(--ease-spring); }
.group-card.ph { border-left-color: var(--ph); }
.group-card header { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px 14px; }
.group-card header strong { flex: 1; font-size: 1.05rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-card .students { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 12px 14px; }
.student-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 10px; border-radius: 99px; background: #f3f2fa; font-weight: 500; font-size: .92rem; animation: popIn .25s var(--ease-spring); }
.student-chip .online { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.student-chip button { width: 26px; height: 26px; border-radius: 50%; color: var(--muted); font-size: .9rem; }
.student-chip button:hover { background: #fee2e2; color: var(--red); }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; border: 2px dashed var(--line); border-radius: 14px; background: rgba(255,255,255,.6); }
.empty .big { font-size: 2.2rem; display: block; margin-bottom: 6px; }

/* Question list */
.report-block { background: #fff; border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.report-block > header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: #faf9ff; border-bottom: 1px solid var(--line); }
.report-block > header strong { flex: 1; font-size: 1.05rem; }
.q-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid #f2f1f8; }
.q-row:last-child { border-bottom: 0; }
.q-row .q-text { font-weight: 500; }
.q-row .q-ans { font-size: .85rem; color: var(--green); font-weight: 600; margin-top: 2px; }
.q-row .actions { display: flex; gap: 4px; }
.badge { display: inline-flex; align-items: center; justify-content: center; padding: 3px 9px; border-radius: 8px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.badge.mcq { background: #e0e7ff; color: #4338ca; }
.badge.tf { background: var(--green-l); color: #15803d; }
.badge.fitb { background: #ffedd5; color: #c2410c; }

/* Settings list */
.settings-section { overflow: hidden; }
.settings-section > h3 { margin: 0; padding: 16px 20px 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.setting { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-top: 1px solid #f2f1f8; }
.setting:first-of-type { border-top: 0; }
.setting .txt { flex: 1; min-width: 0; }
.setting .txt b { display: block; font-weight: 600; }
.setting .txt small { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; line-height: 1.3; }
.setting .ctl { flex: none; display: flex; align-items: center; gap: 8px; }
.setting .ctl .input, .setting .ctl .select { width: auto; min-width: 90px; min-height: 42px; }
@media (max-width: 560px) { .setting { flex-direction: column; align-items: stretch; gap: 10px; } .setting .ctl { justify-content: flex-start; } }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }
.danger { border: 2px solid #fecaca; }
.saved-note { font-size: .85rem; color: var(--green); font-weight: 600; opacity: 0; transition: opacity .3s; }
.saved-note.show { opacity: 1; }

/* Option editor rows */
.opt-edit { display: flex; gap: 8px; align-items: center; }
.opt-edit .dot { width: 34px; height: 34px; border-radius: 10px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.opt-edit input[type="radio"] { width: 22px; height: 22px; accent-color: var(--green); flex: none; }

/* =========================================================
   HOST GAME (projector / smartboard)
   ========================================================= */
#view-host-game { background: radial-gradient(1200px 700px at 50% -20%, #2a2560, var(--stage) 60%); color: #fff; font-size: clamp(14px, 1.15vw, 22px); }
.hg-top { display: flex; align-items: center; gap: 1.2em; padding: .8em 1.4em; flex: none; }
.hg-top .brand img { height: 3em; width: auto; }
.hg-top .brand-name { font-size: 1.3em; color: #fff; }
.hg-top .brand-sub { color: #a7a3d6; font-size: .72em; }
.tug { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .35em; }
.tug-labels { display: flex; justify-content: space-between; font-weight: 700; font-size: 1.1em; }
.tug-labels .ph { color: #fda4af; } .tug-labels .tw { color: #93c5fd; }
.tug-labels .num { display: inline-block; font-variant-numeric: tabular-nums; }
.tug-bar { position: relative; height: 1.5em; border-radius: 99px; background: var(--ph); overflow: hidden; box-shadow: inset 0 2px 6px rgba(0,0,0,.35); }
.tug-bar .tw-fill { position: absolute; top: 0; right: 0; bottom: 0; width: 50%; background: linear-gradient(90deg, #60a5fa, var(--tw)); transition: width 1s var(--ease-spring); }
.tug-bar::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, #e11d48, #fb7185); }
.tug-knot { position: absolute; top: 50%; left: 50%; width: 2.1em; height: 2.1em; margin: -1.05em 0 0 -1.05em; border-radius: 50%; background: #fff; border: .25em solid #facc15; box-shadow: 0 0 0 .2em rgba(0,0,0,.25), 0 0 20px rgba(250, 204, 21, .6); transition: left 1s var(--ease-spring); z-index: 2; display: flex; align-items: center; justify-content: center; font-size: .85em; }
.tug-wrap { position: relative; padding: .3em 0; }
.hg-top .tools { display: flex; gap: .4em; }
.hg-icon { width: 2.4em; height: 2.4em; border-radius: .7em; background: var(--stage-3); color: #fff; font-size: 1em; display: inline-flex; align-items: center; justify-content: center; transition: background .2s, transform .15s; }
.hg-icon:hover { background: #3b3670; }
.hg-icon:active { transform: scale(.92); }
.hg-icon[aria-pressed="false"] { opacity: .5; }

.hg-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(14em, 20%) 1fr; gap: 1em; padding: 0 1.4em 1em; }
.hg-main.no-lb { grid-template-columns: 1fr; }
.hg-main.no-lb .lb { display: none; }
.lb { background: var(--stage-2); border-radius: 1.1em; padding: 1em; display: flex; flex-direction: column; min-height: 0; border: 1px solid rgba(255,255,255,.06); }
.lb h3 { margin: 0 0 .7em; text-align: center; font-size: 1.05em; color: #c4c0ef; letter-spacing: .05em; text-transform: uppercase; }
.lb-list { position: relative; flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: .45em; }
.lb-row { display: flex; align-items: center; gap: .6em; padding: .55em .7em; border-radius: .7em; background: rgba(255,255,255,.05); border-left: .3em solid var(--tw); font-weight: 600; }
.lb-row.ph { border-left-color: var(--ph); }
.lb-row .rank { width: 1.6em; text-align: center; color: #a7a3d6; flex: none; }
.lb-row:nth-child(1) .rank { color: #facc15; }
.lb-row:nth-child(2) .rank { color: #e5e7eb; }
.lb-row:nth-child(3) .rank { color: #f59e0b; }
.lb-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .sc { font-variant-numeric: tabular-nums; }
.lb-row .fire { font-size: .85em; }
.lb-row.bump { animation: bump .6s var(--ease-spring); }
@keyframes bump { 30% { transform: scale(1.06); background: rgba(250, 204, 21, .25); } }

.stage { position: relative; background: var(--stage-2); border-radius: 1.3em; border: 1px solid rgba(255,255,255,.06); overflow: hidden; min-height: 0; }
.stage-screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.6em 2em; text-align: center; animation: stageIn .5s var(--ease-out); }
@keyframes stageIn { from { opacity: 0; transform: scale(.97); } }
.stage-kicker { text-transform: uppercase; letter-spacing: .14em; font-weight: 700; color: #a7a3d6; font-size: .95em; }
.stage-title { font-size: 3.2em; font-weight: 700; margin: .2em 0; line-height: 1.1; }

/* lobby */
.lobby { display: grid; grid-template-columns: auto 1fr; gap: 2em; align-items: center; width: 100%; max-width: 70em; }
.lobby .qr { background: #fff; border-radius: 1em; padding: .8em; width: 13em; height: 13em; display: flex; align-items: center; justify-content: center; color: var(--ink); font-size: .8em; }
.lobby .qr img, .lobby .qr svg { width: 100%; height: 100%; image-rendering: pixelated; }
.lobby .join-info { text-align: left; }
.lobby .code { font-size: 4.4em; font-weight: 700; letter-spacing: .15em; line-height: 1; background: var(--stage-3); display: inline-block; padding: .1em .35em; border-radius: .25em; margin: .15em 0; }
.lobby .url { color: #c4c0ef; font-size: 1.05em; word-break: break-all; }
.joined { margin-top: 1.4em; width: 100%; max-width: 70em; }
.joined-head { color: #a7a3d6; font-weight: 600; margin-bottom: .6em; }
.joined-list { display: flex; flex-wrap: wrap; gap: .5em; justify-content: center; max-height: 9em; overflow: hidden; }
.joined-chip { padding: .35em .9em; border-radius: 99px; background: var(--stage-3); font-weight: 600; animation: chipIn .5s var(--ease-spring); }
.joined-chip.tw { box-shadow: inset 0 -3px 0 var(--tw); }
.joined-chip.ph { box-shadow: inset 0 -3px 0 var(--ph); }
@keyframes chipIn { from { opacity: 0; transform: scale(.4) translateY(20px); } }
@media (max-width: 900px) { .lobby { grid-template-columns: 1fr; justify-items: center; } .lobby .join-info { text-align: center; } }

/* wager */
.wager-art { font-size: 5em; animation: coinFlip 2.2s ease-in-out infinite; display: inline-block; }
@keyframes coinFlip { 0%, 100% { transform: rotateY(0) translateY(0); } 50% { transform: rotateY(180deg) translateY(-.15em); } }
.counter-big { font-size: 1.4em; color: #c4c0ef; margin-top: 1em; }
.counter-big b { color: #fff; font-size: 1.6em; font-variant-numeric: tabular-nums; }
.progress { width: min(30em, 80%); height: .7em; background: var(--stage-3); border-radius: 99px; overflow: hidden; margin: .8em auto 0; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #a78bfa, #f0abfc); border-radius: 99px; transition: width .5s var(--ease-out); }

/* question */
.q-head { display: flex; align-items: center; justify-content: center; gap: .8em; margin-bottom: .6em; }
.q-pill { background: var(--stage-3); color: #c4c0ef; border-radius: 99px; padding: .3em .9em; font-weight: 700; font-size: .9em; }
.stage-q { font-size: 2.8em; font-weight: 700; line-height: 1.15; max-width: 22em; margin: .1em 0 .7em; text-wrap: balance; }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8em; width: 100%; max-width: 56em; }
.opt { position: relative; display: flex; align-items: center; gap: .8em; padding: .8em 1em; border-radius: .9em; font-size: 1.6em; font-weight: 700; text-align: left; color: #fff; background: var(--c); box-shadow: 0 .2em 0 rgba(0,0,0,.25); animation: optIn .5s var(--ease-spring) both; transition: opacity .5s, transform .5s var(--ease-spring), filter .5s; }
.opt .shape { width: 1.5em; height: 1.5em; flex: none; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.18); border-radius: .35em; font-size: .8em; }
.opt .cnt { margin-left: auto; font-size: .8em; background: rgba(0,0,0,.2); border-radius: 99px; padding: .1em .6em; font-variant-numeric: tabular-nums; }
.opt.dim { opacity: .28; filter: grayscale(.6); transform: scale(.97); }
.opt.right { box-shadow: 0 0 0 .18em #fff, 0 0 2em rgba(255,255,255,.4); transform: scale(1.03); }
.opt.right::after { content: '✓'; position: absolute; right: -.4em; top: -.4em; background: #22c55e; width: 1.4em; height: 1.4em; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .75em; border: .15em solid #fff; animation: popIn .4s var(--ease-spring); }
.opt-grid .opt:nth-child(2) { animation-delay: .07s; } .opt-grid .opt:nth-child(3) { animation-delay: .14s; } .opt-grid .opt:nth-child(4) { animation-delay: .21s; } .opt-grid .opt:nth-child(5) { animation-delay: .28s; } .opt-grid .opt:nth-child(6) { animation-delay: .35s; }
@keyframes optIn { from { opacity: 0; transform: translateY(1em) scale(.9); } }
.fitb-box { font-size: 1.6em; color: #c4c0ef; display: flex; align-items: center; gap: .5em; }
.typing-dots { display: inline-flex; gap: .25em; }
.typing-dots i { width: .45em; height: .45em; border-radius: 50%; background: #c4c0ef; animation: dot 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; } .typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-.4em); opacity: 1; } }

.timer-ring { position: absolute; top: 1em; right: 1em; width: 5em; height: 5em; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke-width: 8; }
.timer-ring .bg { stroke: var(--stage-3); }
.timer-ring .fg { stroke: #22c55e; stroke-linecap: round; transition: stroke-dashoffset .25s linear, stroke .3s; }
.timer-ring .num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.8em; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer-ring.warn .fg { stroke: #f59e0b; }
.timer-ring.danger .fg { stroke: #ef4444; }
.timer-ring.danger { animation: tick 1s infinite; }
@keyframes tick { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.12); } }
.answered-strip { position: absolute; left: 1.2em; bottom: 1em; display: flex; align-items: center; gap: .6em; color: #c4c0ef; font-weight: 600; }
.answered-strip b { color: #fff; font-size: 1.5em; font-variant-numeric: tabular-nums; }

/* reveal */
.reveal-answer { font-size: 3.4em; font-weight: 700; color: #4ade80; background: rgba(34, 197, 94, .12); border: .06em solid rgba(74, 222, 128, .5); padding: .15em .7em; border-radius: .4em; margin: .15em 0 .4em; animation: revealPop .7s var(--ease-spring); }
@keyframes revealPop { 0% { opacity: 0; transform: scale(.4) rotate(-6deg); } 60% { transform: scale(1.08) rotate(1deg); } }
.reveal-stats { display: flex; gap: 1em; justify-content: center; margin-bottom: 1em; flex-wrap: wrap; }
.stat { background: var(--stage-3); border-radius: .8em; padding: .5em 1.1em; min-width: 7em; }
.stat b { display: block; font-size: 1.8em; font-variant-numeric: tabular-nums; }
.stat span { color: #a7a3d6; font-size: .85em; font-weight: 600; }
.gainers { display: flex; flex-wrap: wrap; gap: .5em; justify-content: center; max-width: 60em; max-height: 8.5em; overflow: hidden; }
.gainer { background: rgba(255,255,255,.07); border-radius: 99px; padding: .35em .5em .35em .9em; font-weight: 600; display: inline-flex; gap: .5em; align-items: center; animation: chipIn .5s var(--ease-spring) both; }
.gainer em { font-style: normal; background: #22c55e; border-radius: 99px; padding: .05em .55em; font-variant-numeric: tabular-nums; }
.gainer.tw { box-shadow: inset 0 -3px 0 var(--tw); } .gainer.ph { box-shadow: inset 0 -3px 0 var(--ph); }
.fitb-answers { display: flex; flex-wrap: wrap; gap: .5em; justify-content: center; margin-bottom: 1em; max-width: 50em; }
.fitb-answers span { background: var(--stage-3); border-radius: .6em; padding: .3em .8em; font-weight: 600; }
.fitb-answers span.ok { background: rgba(34, 197, 94, .25); color: #bbf7d0; }

/* final / podium */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 1em; margin-top: 1em; }
.pod { width: 9em; display: flex; flex-direction: column; align-items: center; gap: .4em; }
.pod .who { font-weight: 700; font-size: 1.25em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .pts { color: #c4c0ef; font-weight: 600; }
.pod .block { width: 100%; border-radius: .8em .8em 0 0; display: flex; align-items: flex-start; justify-content: center; padding-top: .3em; font-size: 2.4em; font-weight: 700; transform-origin: bottom; animation: rise 1s var(--ease-spring) both; }
.pod.p1 .block { height: 5em; background: linear-gradient(#facc15, #ca8a04); animation-delay: 1.2s; }
.pod.p2 .block { height: 3.6em; background: linear-gradient(#e5e7eb, #9ca3af); animation-delay: .7s; }
.pod.p3 .block { height: 2.6em; background: linear-gradient(#fdba74, #c2410c); animation-delay: .2s; }
.pod.p1 .who, .pod.p1 .pts { animation: fadeUp .5s 1.8s both; } .pod.p2 .who, .pod.p2 .pts { animation: fadeUp .5s 1.3s both; } .pod.p3 .who, .pod.p3 .pts { animation: fadeUp .5s .8s both; }
@keyframes rise { from { transform: scaleY(0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(.6em); } }
.winner-banner { font-size: 2.4em; font-weight: 700; animation: revealPop .8s var(--ease-spring) 2.2s both; }
.winner-banner.tw { color: #93c5fd; } .winner-banner.ph { color: #fda4af; }

/* control bar */
.hg-ctrl { flex: none; background: var(--stage-2); border-top: 1px solid rgba(255,255,255,.06); padding: .8em 1.4em calc(.8em + var(--safe-b)); display: flex; gap: .8em; align-items: center; flex-wrap: wrap; font-size: max(14px, .85em); }
.hg-ctrl .grp { display: flex; gap: .5em; align-items: center; }
.hg-ctrl .grow { flex: 1; min-width: 10em; }
@media (max-width: 1280px) { .kbd-hint { display: none; } .hg-ctrl { gap: .5em; } .step { padding: 0 .7em; } }
.hg-select { background: var(--stage-3); color: #fff; border: 1px solid rgba(255,255,255,.1); border-radius: .7em; min-height: 46px; padding: 0 2.2em 0 .9em; font-weight: 600; width: 100%; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23c4c0ef' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .9em center; }
.hg-select option, .hg-select optgroup { color: var(--ink); background: #fff; }
.hg-label { color: #a7a3d6; font-weight: 600; font-size: .85em; white-space: nowrap; }
.steps { display: flex; gap: .35em; }
.step { min-height: 46px; padding: 0 1em; border-radius: .7em; background: var(--stage-3); color: #c4c0ef; font-weight: 700; white-space: nowrap; transition: background .2s, color .2s, transform .15s; }
.step:hover:not(:disabled) { background: #3b3670; color: #fff; }
.step:disabled { opacity: .35; }
.step.next { background: #22c55e; color: #fff; box-shadow: 0 0 0 0 rgba(34, 197, 94, .7); animation: nextGlow 1.8s infinite; }
@keyframes nextGlow { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); } 70% { box-shadow: 0 0 0 .6em rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.kbd-hint { color: #7d79ad; font-size: .78em; }
.kbd-hint kbd { background: var(--stage-3); border-radius: 4px; padding: 1px 6px; font-family: inherit; color: #c4c0ef; }
@media (max-width: 1000px) {
  .hg-main { grid-template-columns: 1fr; }
  .hg-main .lb { display: none; }
  .hg-top { flex-wrap: wrap; }
  .hg-top .tug { order: 3; flex-basis: 100%; }
  .kbd-hint { display: none; }
}

/* =========================================================
   PLAYER
   ========================================================= */
#view-player-login { background: var(--bg); }
.login-wrap { flex: 1; overflow-y: auto; padding: calc(16px + var(--safe-t)) 16px calc(24px + var(--safe-b)); }
.login-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.name-group h3 { margin: 6px 0 8px; font-size: .95rem; display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.name-btn { min-height: 64px; padding: 10px 12px; border-radius: 14px; background: #fff; box-shadow: var(--shadow); font-weight: 600; font-size: 1.08rem; border: 3px solid transparent; border-bottom-width: 5px; border-bottom-color: var(--tw-l); transition: transform .15s var(--ease-spring), border-color .2s; text-align: center; line-height: 1.15; word-break: break-word; }
.name-btn.ph { border-bottom-color: var(--ph-l); }
.name-btn:active { transform: scale(.95); }
.name-btn[aria-pressed="true"] { border-color: var(--violet); background: var(--violet-l); transform: scale(1.03); }
.login-footer { position: sticky; bottom: 0; padding: 12px 16px calc(12px + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 30%); }

#view-player-game { background: var(--bg); }
.p-head { flex: none; display: flex; align-items: center; gap: 12px; padding: calc(10px + var(--safe-t)) 16px 10px; background: #fff; box-shadow: 0 2px 10px rgba(30, 27, 58, .06); z-index: 5; }
.p-head img { height: 44px; width: auto; }
.p-head .who { flex: 1; min-width: 0; }
.p-head .who b { display: block; font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-head .who small { font-weight: 600; font-size: .85rem; display: flex; align-items: center; gap: 6px; }
.p-score { text-align: right; }
.p-score small { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.p-score b { font-size: 1.9rem; line-height: 1; color: var(--violet); font-variant-numeric: tabular-nums; display: inline-block; }
.p-score b.bump { animation: scoreBump .6s var(--ease-spring); }
@keyframes scoreBump { 40% { transform: scale(1.35); color: #22c55e; } }
.streak { display: inline-flex; align-items: center; gap: 2px; background: #fff3e0; color: #c2410c; border-radius: 99px; padding: 2px 8px; font-weight: 700; font-size: .85rem; animation: popIn .4s var(--ease-spring); }
.p-body { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.p-screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 16px calc(20px + var(--safe-b)); text-align: center; overflow-y: auto; animation: viewIn .35s var(--ease-out); }
.p-screen h2 { margin: 0 0 6px; font-size: clamp(1.6rem, 6vw, 2.2rem); line-height: 1.15; }
.p-screen p { margin: 0; color: var(--ink-2); font-size: 1.05rem; }
.p-inner { width: 100%; max-width: 640px; display: flex; flex-direction: column; gap: 14px; }
.p-illus { font-size: 4.5rem; line-height: 1; margin-bottom: 12px; display: inline-block; }
.float { animation: float 3s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.wiggle { animation: wiggle 2.4s ease-in-out infinite; }
@keyframes wiggle { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-12deg); } 85% { transform: rotate(10deg); } 95% { transform: rotate(-4deg); } }
.loader-dots { display: flex; gap: 8px; justify-content: center; margin-top: 18px; }
.loader-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--violet); animation: dot 1.2s infinite; }
.loader-dots i:nth-child(2) { animation-delay: .15s; background: var(--tw); } .loader-dots i:nth-child(3) { animation-delay: .3s; background: var(--ph); }

.wager-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; width: 100%; }
.wager-btn { position: relative; min-height: 120px; border-radius: 20px; background: #fff; box-shadow: 0 6px 0 #d9d5f3, var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; transition: transform .15s var(--ease-spring), box-shadow .15s; animation: optIn .45s var(--ease-spring) both; }
.wager-btn:nth-child(2) { animation-delay: .07s; } .wager-btn:nth-child(3) { animation-delay: .14s; } .wager-btn:nth-child(4) { animation-delay: .21s; }
.wager-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 #d9d5f3, var(--shadow); }
.wager-btn .coin { width: 58px; height: 58px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fde68a, #f59e0b 70%); border: 3px solid #d97706; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #78350f; font-size: 1.3rem; box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.wager-btn .lbl { font-weight: 700; color: var(--ink); font-size: 1.05rem; }
.wager-btn .sub { color: var(--muted); font-size: .85rem; font-weight: 500; }
@media (max-width: 480px) {
  .wager-grid { grid-template-columns: 1fr; }
  .wager-btn { min-height: 84px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; justify-items: start; padding: 10px 16px; }
  .wager-btn .coin { grid-row: span 2; }
}

.ans-meta { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--violet-l); color: var(--violet-d); font-weight: 600; font-size: .92rem; }
.p-question { font-size: clamp(1.15rem, 4.5vw, 1.6rem); font-weight: 600; line-height: 1.25; color: var(--ink); }
.ans-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.ans-grid.single { grid-template-columns: 1fr; }
@media (max-width: 420px) { .ans-grid { grid-template-columns: 1fr; } }
.ans-btn { position: relative; min-height: 96px; border-radius: 18px; background: var(--c); color: #fff; font-weight: 700; font-size: clamp(1.1rem, 4.4vw, 1.5rem); padding: 14px 14px 14px 58px; text-align: left; box-shadow: 0 6px 0 rgba(0,0,0,.2); transition: transform .12s var(--ease-spring), box-shadow .12s; animation: optIn .4s var(--ease-spring) both; word-break: break-word; }
.ans-btn .shape { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; background: rgba(0,0,0,.18); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.ans-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 rgba(0,0,0,.2); }
.ans-btn:nth-child(2) { animation-delay: .05s; } .ans-btn:nth-child(3) { animation-delay: .1s; } .ans-btn:nth-child(4) { animation-delay: .15s; } .ans-btn:nth-child(5) { animation-delay: .2s; } .ans-btn:nth-child(6) { animation-delay: .25s; }
.p-timer { width: 100%; height: 10px; border-radius: 99px; background: #e6e4f2; overflow: hidden; }
.p-timer i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #22c55e, #84cc16); border-radius: 99px; transform-origin: left; transition: transform .25s linear, background .3s; }
.p-timer.warn i { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.p-timer.danger i { background: linear-gradient(90deg, #ef4444, #f97316); }
.fitb-input { font-size: 1.5rem !important; text-align: center; font-weight: 700; min-height: 64px; border-width: 3px; }

.p-full { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px calc(24px + var(--safe-b)); text-align: center; color: #fff; animation: fadeIn .3s; overflow-y: auto; }
.p-full.locked { background: linear-gradient(160deg, #6d5dfc, #8b3dff); }
.p-full.correct { background: linear-gradient(160deg, #22c55e, #059669); }
.p-full.wrong { background: linear-gradient(160deg, #f43f5e, #b91c1c); }
.p-full.none { background: linear-gradient(160deg, #64748b, #334155); }
.p-full.presenter { background: linear-gradient(160deg, #f59e0b, #ea580c); }
.p-full.final { background: linear-gradient(160deg, #6d5dfc, #db2777); }
.p-full h2 { font-size: clamp(2.2rem, 9vw, 3.4rem); margin: 0 0 6px; line-height: 1.05; }
.p-full p { margin: 0; font-size: 1.15rem; opacity: .95; }
.p-full .emoji { font-size: 5.5rem; line-height: 1; margin-bottom: 14px; display: inline-block; }
.p-full .emoji.pop { animation: emojiPop .8s var(--ease-spring); }
.p-full.wrong .emoji { animation: shake .6s; }
@keyframes emojiPop { 0% { transform: scale(0) rotate(-30deg); } 60% { transform: scale(1.25) rotate(8deg); } }
@keyframes shake { 10%, 90% { transform: translateX(-4px); } 20%, 80% { transform: translateX(8px); } 30%, 50%, 70% { transform: translateX(-12px); } 40%, 60% { transform: translateX(12px); } }
.pts-pill { display: inline-block; margin-top: 14px; background: rgba(0,0,0,.2); padding: 10px 24px; border-radius: 99px; font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; animation: popIn .5s .2s var(--ease-spring) both; }
.correct-was { margin-top: 18px; background: rgba(255,255,255,.18); border-radius: 16px; padding: 12px 18px; font-size: 1.05rem; max-width: 520px; }
.correct-was b { display: block; font-size: 1.4rem; margin-top: 2px; }
.your-ans { margin-top: 10px; font-size: .95rem; opacity: .85; }
.p-full .btn { margin-top: 26px; background: rgba(255,255,255,.2); color: #fff; border: 2px solid rgba(255,255,255,.5); }
.lock-icon { animation: lockSnap .6s var(--ease-spring); }
@keyframes lockSnap { 0% { transform: scale(1.6) rotate(-20deg); opacity: 0; } }
.rank-big { font-size: 5rem; font-weight: 700; line-height: 1; animation: revealPop .8s var(--ease-spring); }

/* Flags */
.flag { display: inline-block; width: 1.5em; height: 1em; border-radius: 3px; overflow: hidden; vertical-align: -0.12em; box-shadow: 0 0 0 1px rgba(0,0,0,.08); flex: none; }
.flag svg { display: block; width: 100%; height: 100%; }

/* Confetti canvas */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 950; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =========================================================
   Exchange program additions
   ========================================================= */
/* Group cards: presentation link + group play */
.slides-row { display: flex; align-items: center; gap: 8px; padding: 0 12px 10px 14px; }
.slides-row .input { min-height: 40px; padding: 6px 12px; font-size: 16px; border-width: 1.5px; }
.ok-dot { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--green-l); color: var(--green); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.student-chip.team { background: var(--violet-l); color: var(--violet-d); font-weight: 600; }
.name-btn.team { border-color: var(--violet-l); }
.name-btn small { display: block; font-size: .78rem; color: var(--muted); font-weight: 500; margin-top: 2px; }

/* Presenting on the master screen */
#view-host-game.presenting .hg-main { padding-bottom: .6em; }
.stage-screen.present { padding: 0; justify-content: stretch; align-items: stretch; animation: fadeIn .4s; }
.slides { flex: 1; width: 100%; border: 0; background: #000; border-radius: 1.3em 1.3em 0 0; }
.slides-bar { flex: none; display: flex; align-items: center; gap: .6em; padding: .5em .8em; background: var(--stage-3); font-weight: 600; }
.slides-bar > span { flex: 1; display: flex; align-items: center; gap: .5em; }
.slides-btn { color: #fff; background: rgba(255,255,255,.1); border-radius: .6em; padding: .4em .8em; text-decoration: none; font-weight: 600; font-size: .9em; }
.slides-btn:hover { background: rgba(255,255,255,.2); }
.present-card { display: inline-flex; align-items: center; gap: .5em; font-size: 3.4em; font-weight: 700; padding: .15em .6em; border-radius: .4em; background: var(--stage-3); margin: .2em 0; animation: revealPop .7s var(--ease-spring); }
.present-card.tw { box-shadow: inset 0 -.12em 0 var(--tw); } .present-card.ph { box-shadow: inset 0 -.12em 0 var(--ph); }
.present-card .flag { font-size: .7em; }
.mic-art { font-size: 4em; margin: .2em 0 .3em; animation: wiggle 2.4s ease-in-out infinite; }

/* Live counts per team + who we're waiting for */
.team-counts { display: inline-flex; gap: 1em; margin-left: 1em; color: #c4c0ef; font-weight: 600; }
.stage-screen > .team-counts { margin: .8em 0 0; font-size: 1.2em; }
.team-counts span { display: inline-flex; align-items: center; gap: .35em; }
.waiting-on { position: absolute; right: 1.2em; bottom: 1em; max-width: 50%; text-align: right; color: #a7a3d6; font-size: .9em; }
.brave { margin: -.3em 0 .8em; color: #fde68a; font-weight: 600; animation: fadeUp .5s .4s both; }
.timer-ring.grace .fg { stroke: #a78bfa; }
.timer-ring.grace { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.tug-labels .avg-tag { font-size: .65em; opacity: .7; font-weight: 600; }

/* Student device: delivery confirmation, read aloud, bigger text */
.send-status { margin-top: 18px; padding: 8px 16px; border-radius: 99px; font-weight: 600; font-size: .95rem; background: rgba(255,255,255,.18); }
.send-status.sending { animation: pulse 1.2s infinite; }
.send-status.ok { background: rgba(255,255,255,.25); }
.chip-btn { cursor: pointer; border: 0; background: #e0f2fe; color: #0369a1; }
.chip-btn:active { transform: scale(.95); }
#p-textsize { width: 40px; height: 40px; min-height: 40px; font-weight: 700; }
#p-textsize[aria-pressed="true"] { background: var(--violet); color: #fff; }
body.big-text .p-question { font-size: clamp(1.5rem, 6vw, 2.1rem); }
body.big-text .ans-btn { font-size: clamp(1.4rem, 5.6vw, 1.9rem); min-height: 116px; }
body.big-text .p-screen p, body.big-text .wager-btn .lbl { font-size: 1.25rem; }
body.big-text .fitb-input { font-size: 1.9rem !important; }
