/* ==========================================================
   TBP Scoring: stage styles
   ========================================================== */

/* ---- FONTS -------------------------------------------------
   HEADING FONT SWAP: change the ONE url below to your Mango
   Grotesque file (e.g. fonts/mango-grotesque.woff2), and add
   that filename to the ASSETS list in sw.js so it works offline.
------------------------------------------------------------- */
@font-face { font-family: "TBP Heading"; src: url("fonts/bebas-neue-400.woff2") format("woff2"); font-weight: 400; font-display: block; }

@font-face { font-family: "Instrument Sans"; src: url("fonts/instrument-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("fonts/instrument-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("fonts/instrument-sans-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --black: #080808;      /* Stage Black */
  --pink: #FF3EA5;       /* Party Pink: numbers + primary */
  --cyan: #29B6F6;       /* Neon Cyan: accents + secondary */
  --gold: #FFC633;       /* Spark Gold: trivia only */
  --surface: #141414;
  --surface-2: #1d1d1d;
  --line: #2c2c2c;
  --text: #F5F5F5;
  --muted: #9C9C9C;

  --font-heading: "TBP Heading", "Bebas Neue", Impact, sans-serif;
  --font-body: "Instrument Sans", -apple-system, system-ui, sans-serif;

  --tap: 56px;           /* minimum touch target */
  --radius: 14px;
  --gutter: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--black);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.35;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
input { -webkit-user-select: text; user-select: text; }
button, input { font: inherit; color: inherit; }
button { touch-action: manipulation; cursor: pointer; }
[hidden] { display: none !important; }

.h { font-family: var(--font-heading); font-weight: 400; letter-spacing: 0.02em; line-height: 0.95; text-transform: uppercase; }
.muted { color: var(--muted); }

/* ---- BUTTONS ---------------------------------------------- */
.btn {
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 18px;
  border-radius: 12px;
  border: 2px solid var(--cyan);
  background: transparent;
  color: var(--cyan);
  font-family: var(--font-heading);
  font-size: 26px;
  letter-spacing: 0.03em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .06s ease, background-color .1s ease;
}
.btn:active:not(:disabled) { transform: scale(0.95); }
.btn:disabled { opacity: 0.28; cursor: default; }
.btn-primary { background: var(--pink); border-color: var(--pink); color: var(--black); }
.btn-pink-o { border-color: var(--pink); color: var(--pink); }
.btn-ghost { border-color: var(--line); color: var(--text); }
.btn-block { width: 100%; }

/* ---- TOP BAR ---------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(8,8,8,0.97);
  border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top) + 8px) var(--gutter) 10px;
}
.topbar-row { display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex: 1; }
.brand-mark { font-family: var(--font-heading); font-size: 34px; color: var(--pink); line-height: 1; }
.brand-show { font-family: var(--font-heading); font-size: 24px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1; }
.badge {
  font-family: var(--font-heading); font-size: 22px; letter-spacing: 0.04em;
  padding: 8px 12px; border-radius: 10px; border: 2px solid var(--line); color: var(--muted); background: transparent;
  white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center;
}
.badge-catchable { border-color: var(--cyan); color: var(--cyan); }
.badge-decided { border-color: var(--pink); color: var(--pink); }
.badge-tie { background: var(--pink); border-color: var(--pink); color: var(--black); }
.badge-warn { border-color: var(--pink); color: var(--pink); background: rgba(255,62,165,0.12); }
.badge-lock { border-color: var(--text); color: var(--text); }
.undo-btn { padding: 0 16px; }

.tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 10px; }
.tab {
  min-height: var(--tap); border-radius: 12px; border: 2px solid var(--line);
  background: var(--surface); color: var(--muted);
  font-family: var(--font-heading); font-size: 24px; letter-spacing: 0.03em; line-height: 1;
  padding: 4px 6px;
}
.tab.is-active { border-color: var(--pink); color: var(--black); background: var(--pink); }
.tab-num { opacity: 0.6; margin-right: 4px; }

/* ---- VIEW ------------------------------------------------- */
.view { padding: 16px var(--gutter) calc(env(safe-area-inset-bottom) + 40px); }
.section-title { font-family: var(--font-heading); font-size: 34px; margin: 4px 0 12px; color: var(--text); }
.hint { color: var(--muted); font-size: 16px; margin: 0 0 14px; }
.banner {
  border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.banner-lock { border-color: var(--text); }
.banner .h { font-size: 28px; }

/* ---- TEAM GRID -------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.card {
  position: relative; text-align: left;
  min-height: 128px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 2px solid var(--line);
  display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  transition: transform .06s ease;
}
.card:active { transform: scale(0.97); }
.card-table { font-family: var(--font-heading); font-size: 22px; color: var(--cyan); line-height: 1; }
.card-name { font-weight: 600; font-size: 16px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.card-name.is-empty { color: #5a5a5a; font-weight: 400; }
.card-total { font-family: var(--font-heading); font-size: 52px; color: var(--pink); line-height: 0.9; }
.card-tag {
  position: absolute; top: 10px; right: 10px;
  font-family: var(--font-heading); font-size: 16px; letter-spacing: 0.04em;
  color: var(--gold); border: 1.5px solid var(--gold); border-radius: 6px; padding: 2px 6px; line-height: 1.1;
}
.card-dance { position: absolute; top: 10px; right: 10px; font-family: var(--font-heading); font-size: 16px; color: var(--black); background: var(--cyan); border-radius: 6px; padding: 3px 6px; line-height: 1.1; }
.card-dance + .card-tag { top: 38px; }

/* Bingo cards */
.card-bingo.is-on { border-color: var(--pink); background: rgba(255,62,165,0.14); }
.bingo-pill {
  font-family: var(--font-heading); font-size: 24px; text-align: center; border-radius: 10px;
  padding: 8px 6px; border: 2px dashed var(--line); color: var(--muted); line-height: 1;
}
.card-bingo.is-on .bingo-pill { border: 2px solid var(--pink); background: var(--pink); color: var(--black); }
.card-sub { font-size: 14px; color: var(--muted); }
.card-sub b { font-family: var(--font-heading); font-weight: 400; font-size: 26px; color: var(--pink); }

/* ---- SCORING PANEL ---------------------------------------- */
.panel-wrap {
  position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,0.78);
  display: flex; align-items: stretch; justify-content: center;
  padding: calc(env(safe-area-inset-top) + 12px) calc(env(safe-area-inset-right) + 12px) calc(env(safe-area-inset-bottom) + 12px) calc(env(safe-area-inset-left) + 12px);
}
.panel {
  width: 100%; max-width: 1120px; background: var(--black); border: 2px solid var(--line); border-radius: 20px;
  display: flex; flex-direction: column; overflow: hidden;
}
.panel-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-id { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 240px; }
.panel-table { font-family: var(--font-heading); font-size: 40px; color: var(--cyan); line-height: 1; white-space: nowrap; }
.name-input {
  flex: 1; min-width: 0; min-height: var(--tap); border-radius: 12px; border: 2px solid var(--line);
  background: var(--surface); padding: 0 14px; font-size: 20px; font-weight: 600;
}
.name-input:focus { outline: none; border-color: var(--cyan); }
.name-input:disabled { opacity: 0.6; }
.panel-total { text-align: right; }
.panel-total .lbl { font-family: var(--font-heading); font-size: 18px; color: var(--muted); display: block; line-height: 1; }
.panel-total .num { font-family: var(--font-heading); font-size: 60px; color: var(--pink); line-height: 0.9; }
.panel-nav { display: flex; gap: 8px; }
.panel-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 14px 14px; flex: 1; }
.lock-note { margin: 10px 0 4px; padding: 10px 14px; border: 2px solid var(--text); border-radius: 12px; font-family: var(--font-heading); font-size: 22px; }

.row {
  display: grid; grid-template-columns: 170px 96px 1fr; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row-label { font-family: var(--font-heading); font-size: 30px; line-height: 1; }
.row-label small { display: block; font-family: var(--font-body); font-size: 13px; color: var(--muted); letter-spacing: 0; text-transform: none; margin-top: 4px; }
.row-value { font-family: var(--font-heading); font-size: 56px; color: var(--pink); text-align: center; line-height: 1; }
.row-value.is-gold { color: var(--gold); }
.row-value.is-blank { color: #4a4a4a; }
.steps { display: grid; grid-template-columns: repeat(4, minmax(64px, 1fr)); gap: 10px; }
.steps .btn { min-width: 0; min-height: 68px; font-size: 32px; padding: 0 8px; }
.toggle-btn { min-height: 64px; font-size: 30px; width: 100%; }
.toggle-btn.is-on { background: var(--cyan); border-color: var(--cyan); color: var(--black); }

.row-pad { grid-template-columns: 170px 96px 1fr; }
.pad { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; }
.pad .btn { min-width: 0; min-height: 64px; font-size: 30px; padding: 0; border-color: rgba(255,198,51,0.55); color: var(--gold); }
.pad .btn.is-on { background: var(--gold); border-color: var(--gold); color: var(--black); }

/* ---- SETUP ------------------------------------------------ */
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.box { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; }
.box-wide { grid-column: 1 / -1; }
.box-label { font-family: var(--font-heading); font-size: 24px; color: var(--cyan); margin: 0 0 10px; line-height: 1; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.seg .btn { font-size: 24px; padding: 6px 10px; line-height: 1.05; }
.seg .btn.is-on { background: var(--cyan); color: var(--black); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper .val { font-family: var(--font-heading); font-size: 56px; color: var(--pink); min-width: 80px; text-align: center; line-height: 1; }
.stepper .val.is-gold { color: var(--gold); }
.stepper .btn { font-size: 28px; }

.team-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.team-row { display: grid; grid-template-columns: 92px 1fr; gap: 8px; }
.team-row input {
  min-height: var(--tap); border-radius: 12px; border: 2px solid var(--line); background: var(--black);
  padding: 0 12px; font-size: 18px; width: 100%; min-width: 0;
}
.team-row input:focus { outline: none; border-color: var(--cyan); }
.team-row input.tbl { font-family: var(--font-heading); font-size: 26px; color: var(--cyan); text-align: center; padding: 0 6px; }
.team-row input.is-dupe { border-color: var(--pink); }
.team-row input:disabled { opacity: 0.55; }
.setup-foot { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 22px; }
.setup-meta { color: var(--muted); font-size: 14px; }

/* ---- LOCK ------------------------------------------------- */
.lock-big { min-height: 120px; font-size: 64px; width: 100%; border-radius: 20px; margin-bottom: 8px; }
.lock-sub { text-align: center; color: var(--muted); margin: 0 0 20px; }

/* ---- STATUS + LEADERBOARD --------------------------------- */
.status {
  border-radius: 18px; padding: 16px 20px; margin-bottom: 16px; border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.status .big { font-family: var(--font-heading); font-size: 52px; line-height: 0.95; }
.status .detail { color: var(--muted); font-size: 17px; }
.status-catchable { border-color: var(--cyan); }
.status-catchable .big { color: var(--cyan); }
.status-decided { border-color: var(--pink); }
.status-decided .big { color: var(--pink); }
.status-tie { border-color: var(--pink); background: var(--pink); color: var(--black); }
.status-tie .detail { color: var(--black); }
.status-none .big { color: var(--muted); }

.board { width: 100%; border-collapse: collapse; }
.board th { font-family: var(--font-heading); font-weight: 400; font-size: 20px; color: var(--muted); text-align: right; padding: 8px 8px; border-bottom: 2px solid var(--line); }
.board th.l, .board td.l { text-align: left; }
.board td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: right; font-size: 18px; }
.board td.num { font-family: var(--font-heading); font-size: 30px; line-height: 1; }
.board td.rank { font-family: var(--font-heading); font-size: 34px; color: var(--cyan); width: 56px; line-height: 1; }
.board td.final { font-family: var(--font-heading); font-size: 42px; color: var(--pink); line-height: 1; }
.board td.tname { font-weight: 600; word-break: break-word; }
.board tr.is-first td { background: rgba(255,62,165,0.10); }
.board .tbl { color: var(--cyan); }
.board .bingo-yes { color: var(--pink); }

/* ---- MODAL + TOAST ---------------------------------------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,0.82); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { width: 100%; max-width: 560px; background: var(--surface); border: 2px solid var(--pink); border-radius: 20px; padding: 22px; }
.modal h2 { font-family: var(--font-heading); font-weight: 400; font-size: 40px; margin: 0 0 8px; line-height: 1; }
.modal p { margin: 0 0 20px; color: #d6d6d6; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translate(-50%, 30px);
  background: var(--surface-2); border: 2px solid var(--cyan); color: var(--text); border-radius: 14px;
  padding: 12px 18px; font-weight: 600; z-index: 80; opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease; max-width: calc(100vw - 32px); text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: none; }
.toast.is-on.has-action { pointer-events: auto; }
.toast .btn { margin-left: 12px; min-height: 44px; font-size: 20px; }

/* ---- STAGE 2: TRIVIA SETUP --------------------------------- */
.btn-gold { border-color: var(--gold); color: var(--gold); }
.quiz-head { display: flex; justify-content: space-between; align-items: baseline; }
.quiz-max { font-family: var(--font-heading); font-size: 22px; color: var(--muted); }
.quiz-max b { font-weight: 400; font-size: 34px; color: var(--gold); }
.stepper-sm { margin-bottom: 10px; }
.stepper-sm .val { font-size: 40px; min-width: 56px; }
.quiz-rows { display: flex; flex-direction: column; gap: 8px; }
.quiz-row { display: grid; grid-template-columns: 40px 56px 52px 56px 1fr; gap: 6px; align-items: center; }
.quiz-q { font-family: var(--font-heading); font-size: 24px; color: var(--cyan); }
.btn-mini { padding: 0; font-size: 28px; }
.quiz-pts { font-family: var(--font-heading); font-size: 30px; color: var(--gold); text-align: center; line-height: 1; }
.quiz-pts small { font-size: 14px; margin-left: 2px; color: var(--muted); }
.quiz-ans { min-height: var(--tap); border-radius: 12px; border: 2px solid var(--line); background: var(--black); padding: 0 12px; font-size: 17px; width: 100%; min-width: 0; }
.quiz-ans:focus { outline: none; border-color: var(--gold); }
.quiz-ans:disabled { opacity: 0.55; }

/* ---- STAGE 2: ROUND SCREEN ---------------------------------- */
.round-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.round-head .section-title { margin: 0; }
.mark-btn { font-size: 28px; padding: 0 24px; min-height: 60px; }
.progress { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex: 1; min-width: 220px; }
.progress-track { flex: 1; height: 14px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.progress-fill { height: 100%; background: var(--gold); border-radius: 8px; transition: width .2s ease; }
.progress-text { font-size: 16px; color: var(--muted); white-space: nowrap; }
.progress-text b { font-family: var(--font-heading); font-weight: 400; font-size: 26px; color: var(--gold); }
.btn-mini-gold { min-height: 44px; font-size: 18px; padding: 0 10px; margin-top: 8px; }

/* ---- STAGE 2: MARKING SCREEN -------------------------------- */
.panel { position: relative; }
.mark-top { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mark-top .progress { margin: 0; }
.mark-title { font-family: var(--font-heading); font-size: 30px; color: var(--gold); white-space: nowrap; }
.mark-team { display: grid; grid-template-columns: 150px 1fr auto 150px; gap: 14px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.mark-nav { min-height: 88px; font-size: 34px; width: 100%; }
.mark-who { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.mark-tbl { font-family: var(--font-heading); font-size: 48px; color: var(--cyan); line-height: 0.95; }
.mark-name { font-weight: 600; font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.mark-name.is-empty { color: #5a5a5a; font-weight: 400; }
.mark-list { min-height: 44px; font-size: 20px; padding: 0 12px; }
.mark-score { text-align: right; }
.mark-score .lbl { display: block; font-family: var(--font-heading); font-size: 18px; color: var(--muted); line-height: 1.1; }
.mark-score .num { font-family: var(--font-heading); font-size: 72px; color: var(--gold); line-height: 0.9; }
.mark-score .num small { font-size: 30px; color: var(--muted); }
.pad-note { margin: 10px 0 4px; padding: 10px 14px; border: 2px dashed var(--gold); border-radius: 12px; color: #e8e8e8; }
.pad-note b { color: var(--gold); }
.key { margin: 10px 0 6px; padding: 10px 12px; border: 2px solid var(--gold); border-radius: 14px; background: rgba(255,198,51,0.07); }
.key-title { font-family: var(--font-heading); font-size: 20px; color: var(--gold); display: block; margin-bottom: 6px; }
.key-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; }
.key-item { font-size: 18px; font-weight: 600; line-height: 1.25; word-break: break-word; }
.key-item b { font-family: var(--font-heading); font-weight: 400; font-size: 22px; color: var(--gold); margin-right: 8px; }
.key-item small { color: var(--muted); font-weight: 400; }
.qrow { display: grid; grid-template-columns: 90px 1fr; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.qrow:last-child { border-bottom: 0; }
.qlist { display: grid; grid-template-columns: 1fr; column-gap: 28px; }
@media (min-width: 1000px) { .qlist { grid-template-columns: 1fr 1fr; } .qlist .qrow:nth-last-child(2):nth-child(odd) { border-bottom: 0; } }
.qlabel { font-family: var(--font-heading); font-size: 38px; line-height: 0.95; }
.qrow.is-open .qlabel { color: var(--gold); }
.qlabel small { display: block; font-family: var(--font-body); font-size: 13px; color: var(--muted); }
.qbtns { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; }
.qbtn { min-width: 0; min-height: 68px; font-size: 32px; padding: 0; border-color: rgba(255,198,51,0.55); color: var(--gold); }
.qbtn.is-on { background: var(--gold); border-color: var(--gold); color: var(--black); }
.qbtns:has(.qbtn-wide) { grid-template-columns: 1fr 1fr; }
.jump { position: absolute; inset: 0; background: var(--black); z-index: 5; display: flex; flex-direction: column; border-radius: 18px; }
.jump-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.jump-head .h { font-size: 32px; }
.jump-grid { overflow-y: auto; padding: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; align-content: start; }
.jump-item { min-height: 84px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); text-align: left; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.jump-tbl { font-family: var(--font-heading); font-size: 26px; color: var(--cyan); line-height: 1; }
.jump-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jump-state { font-size: 13px; color: var(--muted); }
.jump-item.is-part { border-color: rgba(255,198,51,0.6); }
.jump-item.is-part .jump-state { color: var(--gold); }
.jump-item.is-done { border-color: var(--gold); background: rgba(255,198,51,0.12); }
.jump-item.is-done .jump-state { color: var(--gold); font-weight: 700; }
.jump-item.is-current { outline: 3px solid var(--pink); outline-offset: 1px; }

/* ---- STAGE 3: BIG-SCREEN REVEAL ----------------------------- */
.present-btn { font-size: 30px; padding: 0 26px; min-height: 64px; }
.present-opts { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.present-opts .muted { font-size: 15px; flex: 1; min-width: 240px; }
.toggle-sm { font-size: 22px; }
.toggle-sm.is-on { background: var(--cyan); color: var(--black); }
.modal-wrap { z-index: 100; }
body.is-presenting { overflow: hidden; }

.present {
  position: fixed; inset: 0; z-index: 90; background: #000; color: #fff; overflow: hidden;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  touch-action: none; -webkit-user-select: none; user-select: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.present::before {
  content: ""; position: absolute; inset: -20%; pointer-events: none;
  background: radial-gradient(ellipse at 50% 55%, rgba(255,62,165,0.16), transparent 55%), radial-gradient(ellipse at 50% 120%, rgba(41,182,246,0.12), transparent 60%);
}
.pr-confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.pr-slide { position: relative; z-index: 2; width: 100%; padding: 4vh 5vw; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.5vh; }
.pr-slide, .pr-slide * { font-family: var(--font-heading); text-transform: uppercase; letter-spacing: 0.02em; }

/* Title */
.pr-show { font-size: clamp(36px, 9vmin, 120px); color: var(--pink); line-height: 0.95;
  text-shadow: 0 0 18px rgba(255,62,165,0.75), 0 0 48px rgba(255,62,165,0.45); animation: pr-rise .9s cubic-bezier(.2,.8,.2,1) both; }
.pr-champs { font-size: clamp(56px, 17vmin, 230px); line-height: 0.88; color: #fff;
  text-shadow: 0 0 24px rgba(255,255,255,0.25); animation: pr-rise .9s .35s cubic-bezier(.2,.8,.2,1) both, pr-glow 3.2s 1.4s ease-in-out infinite; }

/* Places */
.pr-label { font-size: clamp(30px, 7vmin, 96px); color: var(--cyan); line-height: 1; animation: pr-rise .6s cubic-bezier(.2,.8,.2,1) both; }
.pr-tie { display: inline-block; background: var(--cyan); color: #000; padding: 0.06em 0.3em 0; border-radius: 0.12em; margin-right: 0.15em; }
.pr-teams { display: flex; justify-content: center; align-items: center; gap: 4vw; flex-wrap: wrap; width: 100%; }
.pr-team { animation: pr-slide-in .8s .25s cubic-bezier(.16,.9,.25,1.05) both; max-width: 100%; }
.pr-team:nth-child(2) { animation-delay: .45s; }
.pr-team:nth-child(3) { animation-delay: .65s; }
.pr-team:nth-child(4) { animation-delay: .85s; }
.pr-name { font-size: clamp(48px, 14vmin, 200px); line-height: 0.92; color: #fff; word-break: break-word; }
.pr-name.is-long { font-size: clamp(40px, 10vmin, 150px); }
.pr-table { font-size: clamp(22px, 4.5vmin, 60px); color: var(--cyan); margin-top: 1vh; }
.pr-score { animation: pr-pop .6s .9s cubic-bezier(.2,1.4,.4,1) both; line-height: 0.9; }
.pr-score span { font-size: clamp(56px, 15vmin, 210px); color: var(--pink); text-shadow: 0 0 22px rgba(255,62,165,0.5); }
.pr-score small { display: block; font-size: clamp(18px, 3.4vmin, 44px); color: #bdbdbd; margin-top: 0.4vh; }

.is-tie .pr-name { font-size: clamp(40px, 10vmin, 140px); }
.is-many .pr-name { font-size: clamp(32px, 7vmin, 96px); }

/* 1st place: biggest + pink */
.is-first .pr-label { color: var(--pink); font-size: clamp(36px, 9vmin, 120px); text-shadow: 0 0 20px rgba(255,62,165,0.6); }
.is-first .pr-tie { background: var(--pink); }
.is-first .pr-name { font-size: clamp(64px, 19vmin, 280px); color: var(--pink);
  text-shadow: 0 0 22px rgba(255,62,165,0.8), 0 0 60px rgba(255,62,165,0.45); }
.is-first .pr-name.is-long { font-size: clamp(48px, 13vmin, 190px); }
.is-first.is-tie .pr-name { font-size: clamp(44px, 12vmin, 170px); }
.is-first.is-many .pr-name { font-size: clamp(34px, 8vmin, 110px); }
.is-crowd .pr-teams { gap: 1.2vh 3vw; }
.is-crowd .pr-name, .is-first.is-crowd .pr-name { font-size: clamp(22px, 4.2vmin, 56px); }
.is-crowd .pr-table { font-size: clamp(14px, 2.2vmin, 28px); margin-top: 0; }
.is-first .pr-team { animation: pr-zoom 1s .3s cubic-bezier(.16,1.2,.3,1) both; }
.is-first .pr-score span { color: #fff; text-shadow: 0 0 22px rgba(255,255,255,0.35); }

/* Top 10 */
.pr-top10-slide { gap: 2vh; }
.pr-top10-title { font-size: clamp(40px, 9vmin, 120px); color: var(--pink); line-height: 1; text-shadow: 0 0 18px rgba(255,62,165,0.6); animation: pr-rise .6s both; }
.pr-list { list-style: none; margin: 0; padding: 0; width: min(100%, 1100px); display: flex; flex-direction: column; gap: 0.8vh; }
.pr-row { display: grid; grid-template-columns: 2.4em 1fr auto; align-items: baseline; gap: 0.6em; font-size: clamp(22px, 5.2vmin, 64px); line-height: 1.05;
  padding: 0.12em 0.4em; border-bottom: 2px solid rgba(255,255,255,0.08); text-align: left; animation: pr-slide-in .55s cubic-bezier(.16,.9,.25,1.05) both; }
.pr-list.is-dense .pr-row { font-size: clamp(18px, 4.2vmin, 52px); }
.pr-rank { color: var(--cyan); }
.pr-rname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-rname small { font-size: 0.5em; color: var(--cyan); margin-left: 0.4em; }
.pr-rscore { color: var(--pink); }
.pr-row.is-first .pr-rname, .pr-row.is-first .pr-rank { color: var(--pink); }
.pr-row.is-first .pr-rscore { color: #fff; }

/* Hidden exit: invisible until held, then a faint ring fills over 2s */
.pr-exit { position: absolute; top: 0; left: 0; width: 96px; height: 96px; z-index: 5; display: flex; align-items: center; justify-content: center; }
.pr-exit svg { width: 40px; height: 40px; opacity: 0; transform: rotate(-90deg); }
.pr-exit circle { fill: none; stroke: rgba(255,255,255,0.55); stroke-width: 3; stroke-dasharray: 101; stroke-dashoffset: 101; }
.pr-exit.is-holding svg { opacity: 1; }
.pr-exit.is-holding circle { transition: stroke-dashoffset 2s linear; stroke-dashoffset: 0; }

@keyframes pr-rise { from { opacity: 0; transform: translateY(6vh); } to { opacity: 1; transform: none; } }
@keyframes pr-slide-in { from { opacity: 0; transform: translateX(-60vw) skewX(-8deg); } to { opacity: 1; transform: none; } }
@keyframes pr-zoom { 0% { opacity: 0; transform: scale(0.3); } 60% { opacity: 1; transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes pr-pop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@keyframes pr-glow { 50% { text-shadow: 0 0 34px rgba(255,62,165,0.55), 0 0 8px rgba(255,255,255,0.4); } }

/* Reduce motion: no slides, zooms or confetti, just a quick fade */
.present.no-motion *, .present.no-motion *::before { animation: pr-fade .25s ease both !important; }
@media (prefers-reduced-motion: reduce) { .present * { animation: pr-fade .25s ease both !important; } }
@keyframes pr-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---- STAGE 4: PRESETS ------------------------------------- */
.seg-4 { grid-template-columns: repeat(4, 1fr); }
.chip { font-family: var(--font-heading); font-size: 18px; color: var(--cyan); border: 1.5px solid var(--cyan); border-radius: 8px; padding: 3px 8px 1px; line-height: 1.1; }
.preset-note { margin: 10px 0 0; color: var(--muted); font-size: 15px; }
.show-name-row { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; margin-top: 12px; }
.show-name { min-height: var(--tap); border-radius: 12px; border: 2px solid var(--line); background: var(--black); padding: 0 14px; font-size: 20px; font-weight: 600; width: 100%; min-width: 0; }
.show-name:focus { outline: none; border-color: var(--cyan); }
.show-name:disabled { opacity: 0.55; }
.default-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.default-text { flex: 1; min-width: 220px; color: var(--muted); font-size: 15px; }
.default-text b { color: var(--text); font-weight: 600; }
.btn-sm { font-size: 22px; padding: 0 16px; }
.qcol { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.qtopic { font-size: 15px; font-weight: 600; color: #d8d8d8; }
.key-topic { color: var(--muted); font-weight: 400; }

/* ---- STAGE 5: ONE-TAP CARDS, HELP, TAP TARGETS ------------ */
.badge { min-height: var(--tap); }
.help-btn { font-size: 30px; padding: 0; width: var(--tap); }
.toast .btn { min-height: var(--tap); }
.btn-mini-gold, .mark-list { min-height: var(--tap); }

.card-quick { padding: 0; gap: 0; min-height: 0; justify-content: flex-start; }
.card-quick:active { transform: none; }
.card-quick.is-dance { border-color: var(--cyan); }
.card-open {
  position: static; display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left;
  background: transparent; border: 0; padding: 12px 14px 8px; color: inherit; border-radius: var(--radius);
  min-height: 112px; transition: background-color .1s ease;
}
.card-open:active { background: rgba(255,255,255,0.05); }
.card-bonus { font-size: 13px; color: var(--muted); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 10px 10px; }
.quick .btn { min-width: 0; font-size: 30px; padding: 0; }
.qk-dance { margin: 0 10px 10px; width: calc(100% - 20px); min-width: 0; font-size: 22px; padding: 0 6px; }
.qk-dance.is-on { background: var(--cyan); color: var(--black); }
.card-total.is-bump { animation: bump .35s ease; transform-origin: left center; }
@keyframes bump { 40% { transform: scale(1.18); color: #fff; } }

.modal-help { max-width: 640px; border-color: var(--cyan); }
.help-steps { margin: 6px 0 14px; padding-left: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 10px; }
.help-steps li { counter-increment: s; display: grid; grid-template-columns: 40px 1fr; column-gap: 10px; font-size: 16px; color: #e0e0e0; }
.help-steps li::before { content: counter(s); grid-row: span 2; font-family: var(--font-heading); font-size: 34px; color: var(--pink); line-height: 1; }
.help-steps b { font-family: var(--font-heading); font-weight: 400; font-size: 22px; color: var(--cyan); letter-spacing: .02em; }
.help-foot { font-size: 14px; color: var(--muted) !important; }

/* ---- STAGE 6: LOCK TAB CARDS -------------------------------- */
.card-info { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 8px; }
.card-bingo .card-bonus { display: block; margin-top: 2px; }
.bingo-btn { margin: 0 10px 8px; width: calc(100% - 20px); min-width: 0; font-size: 24px; padding: 0 6px; border-color: var(--pink); color: var(--pink); border-style: dashed; }
.bingo-btn.is-on { background: var(--pink); color: var(--black); border-style: solid; }
.card-sub b.is-bump { display: inline-block; animation: bump .35s ease; transform-origin: left center; }

/* ---- PORTRAIT / NARROW ------------------------------------ */
@media (max-width: 900px) {
  .tab { font-size: 20px; }
  .tab-num { display: none; }
  .brand-show { font-size: 20px; }
  .row { grid-template-columns: 130px 80px 1fr; gap: 10px; }
  .row-label { font-size: 26px; }
  .row-value { font-size: 48px; }
  .steps .btn { font-size: 28px; }
  .board td.rank { width: 40px; }
  .board .col-hide { display: none; }
  .mark-team { grid-template-columns: 110px 1fr auto 110px; gap: 10px; }
  .mark-tbl { font-size: 38px; }
  .mark-score .num { font-size: 56px; }
  .mark-nav { font-size: 28px; }
}
@media (max-width: 720px) {
  .setup-grid, .team-rows { grid-template-columns: 1fr; }
  .row, .row-pad { grid-template-columns: 1fr 80px; }
  .row .steps, .row .pad, .row .toggle-btn { grid-column: 1 / -1; }
  .board .col-hide2 { display: none; }
  .quiz-row { grid-template-columns: 36px 56px 48px 56px 1fr; }
  .show-name-row { grid-template-columns: 1fr; gap: 6px; }
}
@media (max-width: 900px) { .seg-4 { grid-template-columns: repeat(2, 1fr); } }
