/* Powder Puff + BEC — styles. Colors and fonts come from js/theme.js. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--body); color: var(--ink); background: var(--bg); line-height: 1.45; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.display { font-family: var(--display); letter-spacing: .02em; font-weight: 400; }

/* ---------- Header ---------- */
.pp-header {
  color: #fff; position: relative; overflow: hidden; padding: 16px 0 0;
  background:
    radial-gradient(900px 320px at 90% -20%, color-mix(in srgb, var(--orange) 45%, transparent), transparent 60%),
    radial-gradient(600px 260px at -10% 120%, color-mix(in srgb, var(--gold) 25%, transparent), transparent 60%),
    var(--navy);
}
.brand-row { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; }
.logo-aldrich { height: 64px; width: auto; flex: none; }
.logo-bsb { height: 58px; width: auto; flex: none; }
.brand-title { flex: 1; min-width: 0; text-align: center; }
.brand-title h1 { font-family: var(--display); font-weight: 400; font-size: clamp(22px, 5.5vw, 40px); line-height: 1; margin: 2px 0; text-transform: uppercase; letter-spacing: .02em; }
.brand-title .kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--gold2); font-weight: 700; }
.brand-title .sub { font-size: 13px; opacity: .85; }
@media (max-width: 520px) {
  .logo-aldrich { height: 48px; } .logo-bsb { height: 44px; }
  .brand-title .sub { font-size: 11px; }
}

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; padding: 0 16px; max-width: 1100px; margin: 0 auto; overflow-x: auto; scrollbar-width: none; }
.tab { appearance: none; border: 0; background: transparent; color: rgba(255,255,255,.75); padding: 12px 14px; font-weight: 800; font-size: 14px;
  text-transform: uppercase; letter-spacing: .06em; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tab.active { color: #fff; border-bottom-color: var(--orange); }
.tab .live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-left: 6px; vertical-align: middle; animation: pulse 1s infinite; }
.event-screen-menu { padding: 0 16px 12px; color: rgba(255,255,255,.9); }
.event-screen-menu summary { cursor: pointer; width: fit-content; font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.event-screen-menu nav { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; }
.event-screen-menu a { color: #fff; text-decoration: none; padding: 5px 10px; border-radius: 99px; background: rgba(255,255,255,.1); font-size: 12px; font-weight: 700; }
.event-screen-menu a:hover, .event-screen-menu a:focus-visible { background: var(--orange); }
.tab-screen-options { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 0 22px; }
.tab-screen-options a { display: inline-flex; align-items: center; min-height: 42px; padding: 9px 14px; border-radius: 10px; background: var(--navy); color: #fff; font-size: 13px; font-weight: 800; text-decoration: none; }
.tab-screen-options a:hover, .tab-screen-options a:focus-visible { background: var(--orange); }
.event-screen-footer { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding-top: 20px; padding-bottom: 20px; }
.event-screen-group { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.event-screen-group h2 { margin: 0 0 3px; font-family: var(--display); font-size: 18px; font-weight: 400; text-transform: uppercase; }
.event-screen-group a { color: var(--ink); font-size: 13px; font-weight: 700; text-decoration: none; }
.event-screen-group a:hover, .event-screen-group a:focus-visible { color: var(--orange); text-decoration: underline; }
@media (max-width: 720px) { .event-screen-footer { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .event-screen-footer { grid-template-columns: 1fr; } }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Cards / sections ---------- */
main { padding: 18px 0 30px; }
.card { background: var(--card); border-radius: 16px; box-shadow: 0 8px 24px rgba(9,16,30,.08); padding: 16px; margin-bottom: 16px; }
.card h2, .section-title { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: 24px; margin: 0 0 10px; letter-spacing: .02em; }
.card h3 { margin: 14px 0 8px; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.grid2.no-bracket { grid-template-columns: minmax(0, 1fr); }

.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,.12); color: #fff; }
.conn i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.conn.connecting i, .conn.reconnecting i { background: var(--gold); }
.conn.offline i { background: var(--red); animation: pulse 1s infinite; }
.conn.demo i { background: var(--gold); }
.status-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 16px; max-width: 1100px; margin: 0 auto; }

/* ---------- Buttons & forms ---------- */
.btn { appearance: none; border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 800; cursor: pointer; background: var(--navy); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; font-size: 15px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.orange { background: linear-gradient(135deg, var(--orange), var(--orange2)); }
.btn.gold { background: var(--gold); color: var(--navy); }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); }
.btn.small { padding: 7px 11px; font-size: 13px; border-radius: 9px; }
.btn.big { padding: 16px 22px; font-size: 18px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
label.f { display: block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 0 4px; }
input.in, select.in, textarea.in { width: 100%; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; background: #fff; font-size: 16px; }
input.in:focus, select.in:focus, textarea.in:focus { outline: none; border-color: var(--orange); }
textarea.in { min-height: 70px; resize: vertical; }
.score-in { width: 64px !important; text-align: center; font-weight: 800; font-size: 20px !important; padding: 6px !important; }

/* ---------- Toasts ---------- */
#pp-toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 1000; display: grid; gap: 8px; width: min(92vw, 420px); }
.pp-toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 700; box-shadow: 0 10px 30px rgba(0,0,0,.3); transition: opacity .4s, transform .4s; }
.pp-toast.error { background: var(--red); }
.pp-toast.ok { background: var(--green); }
.pp-toast.out { opacity: 0; transform: translateY(10px); }

/* ---------- Avatars ---------- */
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; background: var(--navy3); }
.avatar.initials { display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 16px; background: linear-gradient(135deg, var(--orange), var(--red)); }

/* ---------- Contest: timer ---------- */
.contest-hero { background: radial-gradient(500px 200px at 50% 0%, color-mix(in srgb, var(--orange) 35%, transparent), transparent 70%), var(--navy); color: #fff; border-radius: 18px; padding: 18px; text-align: center; margin-bottom: 16px; }
.contest-hero .label { font-family: var(--display); font-size: 22px; text-transform: uppercase; color: var(--gold2); letter-spacing: .04em; }
.contest-hero .clock { font-family: var(--display); font-size: clamp(64px, 20vw, 120px); line-height: 1; font-variant-numeric: tabular-nums; }
.contest-hero.eating .clock { color: #fff; }
.contest-hero.chewing .clock { color: var(--gold); }
.contest-hero.chewing .label, .contest-hero.done .label { color: var(--orange2); }
.contest-hero.done .clock { color: var(--orange2); }
.contest-hero .meta { font-size: 13px; opacity: .8; }
.bar { height: 8px; background: rgba(255,255,255,.15); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--orange)); border-radius: 99px; transition: width .2s linear; }

/* ---------- Contest: leaderboard ---------- */
.lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lb-row { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 14px; padding: 10px 14px; box-shadow: 0 4px 14px rgba(9,16,30,.06); position: relative; }
.lb-row .rank { font-family: var(--display); font-size: 26px; width: 34px; text-align: center; color: var(--muted); }
.lb-row .name { flex: 1; font-weight: 800; font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .name small { display: block; font-weight: 600; font-size: 12px; color: var(--muted); }
.lb-row .count { font-family: var(--display); font-size: 36px; min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
.lb-row.first { background: linear-gradient(135deg, #fff7e6, #fff); box-shadow: 0 0 0 3px var(--gold), 0 8px 22px rgba(242,180,69,.35); }
.lb-row.first .rank { color: var(--gold); }
.lb-row.bump .count { animation: bump .5s ease-out; }
@keyframes bump { 0% { transform: scale(1.5); color: var(--orange); } 100% { transform: scale(1); } }
.tag { display: inline-block; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; padding: 2px 7px; border-radius: 99px; background: var(--gold); color: var(--navy); margin-left: 6px; vertical-align: middle; }
.tag.red { background: var(--red); color: #fff; }

/* ---------- Winner ---------- */
.winner-card { background: radial-gradient(500px 260px at 50% 0%, color-mix(in srgb, var(--gold) 40%, transparent), transparent 70%), var(--navy); color: #fff; border-radius: 18px; padding: 24px 16px; text-align: center; margin-bottom: 16px; position: relative; overflow: hidden; }
.winner-card .crown { font-family: var(--display); color: var(--gold); text-transform: uppercase; font-size: 22px; letter-spacing: .06em; }
.winner-card .avatar { width: 140px; height: 140px; margin: 12px auto; border: 5px solid var(--gold); font-size: 44px; }
.winner-card .wname { font-family: var(--display); font-size: clamp(30px, 8vw, 54px); text-transform: uppercase; line-height: 1.05; }
.winner-card .wcount { font-size: 20px; font-weight: 800; color: var(--gold2); }
.confetti { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; pointer-events: none; z-index: 5; }
@keyframes fall { to { top: 110%; transform: translateX(40px) rotate(720deg); } }

/* ---------- Judge ---------- */
body.judge { background: var(--navy); color: #fff; padding-bottom: 40px; }
.judge-top { position: sticky; top: 0; z-index: 10; background: var(--navy); padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,.1); }
.judge-top .who { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 800; }
.judge-clock { display: flex; align-items: baseline; justify-content: space-between; margin-top: 6px; }
.judge-clock .clock { font-family: var(--display); font-size: 46px; line-height: 1; font-variant-numeric: tabular-nums; }
.judge-clock .label { font-family: var(--display); font-size: 20px; text-transform: uppercase; color: var(--gold2); }
.judge-state { margin: 10px 14px 0; padding: 10px 12px; border-radius: 12px; font-weight: 800; text-align: center; }
.judge-state.locked { background: var(--red); }
.judge-state.waiting { background: var(--navy3); color: var(--gold2); }
.judge-state.open { background: var(--green); }
.jcards { display: grid; gap: 12px; padding: 12px 14px; }
.jcard { background: var(--navy2); border: 2px solid var(--navy3); border-radius: 18px; padding: 12px; }
.jcard.dim { opacity: .45; }
.jcard .top { display: flex; align-items: center; gap: 10px; }
.jcard .avatar { width: 52px; height: 52px; }
.jcard .nm { flex: 1; font-weight: 800; font-size: 19px; line-height: 1.15; }
.jcard .nm small { display: block; font-size: 12px; color: var(--gold2); font-weight: 700; }
.jcard .cnt { font-family: var(--display); font-size: 58px; line-height: 1; min-width: 80px; text-align: right; font-variant-numeric: tabular-nums; }
.jbtns { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; margin-top: 10px; }
.jbtn { appearance: none; border: 0; border-radius: 14px; height: 68px; font-family: var(--display); font-size: 28px; color: #fff; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.jbtn.minus { background: #39445f; }
.jbtn.half { background: linear-gradient(135deg, var(--gold), #e09a22); color: var(--navy); }
.jbtn.one { background: linear-gradient(135deg, var(--orange), var(--orange2)); font-size: 34px; }
.jbtn:active { transform: scale(.96); filter: brightness(1.15); }
.jbtn:disabled { opacity: .3; }
.judge-foot { padding: 0 14px; }
.judge-foot details { background: var(--navy2); border-radius: 14px; padding: 12px 14px; margin-top: 8px; }
.judge-foot summary { font-weight: 800; cursor: pointer; }
.judge-foot .rules { padding-left: 20px; }
.judge-foot .rules li { margin: 6px 0; }

/* ---------- Rules ---------- */
.rules { padding-left: 22px; margin: 0; }
.rules li { margin: 8px 0; }

/* ---------- Tournament ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 6px; border-bottom: 2px solid var(--line); }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line); }
.tbl td.num, .tbl th.num { text-align: center; font-variant-numeric: tabular-nums; }
.tbl .team-cell { font-weight: 800; }
.tbl .team-cell small { display: block; font-weight: 600; color: var(--muted); font-size: 11px; }
.tbl tr.adv td:first-child { box-shadow: inset 4px 0 0 var(--orange); }
.team-logo { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; vertical-align: middle; margin-right: 6px; }

.games { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.game { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.game .when { font-size: 12px; font-weight: 800; color: var(--muted); text-align: center; line-height: 1.2; }
.game .when b { display: block; font-size: 15px; color: var(--ink); }
.game .vs { display: grid; gap: 2px; }
.game .side { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.game .side.win { font-weight: 900; }
.game .side.lose { color: var(--muted); }
.game .side .sc { font-family: var(--display); font-size: 20px; min-width: 30px; text-align: right; }
.game .label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--orange); font-weight: 800; }
.game.next { border: 2px solid var(--orange); box-shadow: 0 6px 18px rgba(233,93,42,.18); }
.game.done { background: #fafafa; }

/* Bracket */
.bracket-scroll { overflow-x: auto; padding-bottom: 6px; }
.bracket { display: flex; gap: 26px; min-width: max-content; align-items: stretch; }
.b-round { display: flex; flex-direction: column; justify-content: space-around; gap: 14px; min-width: 190px; }
.b-round h4 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--orange); text-align: center; }
.b-game { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 4px 12px rgba(9,16,30,.06); position: relative; }
.b-game .bn { font-size: 10px; font-weight: 800; color: var(--muted); padding: 3px 10px 0; text-transform: uppercase; letter-spacing: .06em; }
.b-slot { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; font-weight: 700; font-size: 14px; }
.b-slot + .b-slot { border-top: 1px solid var(--line); }
.b-slot.win { background: color-mix(in srgb, var(--gold) 22%, #fff); font-weight: 900; }
.b-slot.tbd { color: var(--muted); font-style: italic; font-weight: 600; }
.b-slot .sc { font-family: var(--display); }
.champ-banner { background: radial-gradient(500px 220px at 50% 0%, color-mix(in srgb, var(--gold) 45%, transparent), transparent 70%), var(--navy); color: #fff; border-radius: 18px; padding: 22px 16px; text-align: center; position: relative; overflow: hidden; margin-bottom: 16px; }
.champ-banner .k { font-family: var(--display); color: var(--gold); font-size: 20px; text-transform: uppercase; letter-spacing: .08em; }
.champ-banner .n { font-family: var(--display); font-size: clamp(34px, 9vw, 64px); text-transform: uppercase; line-height: 1.05; }
.champ-banner .c { font-size: 16px; font-weight: 700; color: var(--gold2); }
.champ-banner img.team-logo { width: 90px; height: 90px; border-radius: 18px; margin: 8px auto; display: block; }

.roster { columns: 2; font-size: 14px; margin: 6px 0 0; padding-left: 18px; }

/* ---------- Sponsor tiles ---------- */
.pp-footer { background: var(--navy); color: #fff; padding: 12px 0 14px; text-align: center; }
.footer-label { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; opacity: .7; margin-bottom: 8px; font-weight: 700; }
.sponsor-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.sponsor-tile { background: #fff; border-radius: 14px; height: 70px; width: 150px; display: grid; place-items: center; padding: 8px 12px; }
.pp-footer .sponsor-tiles { gap: 8px; }
.pp-footer .sponsor-tile { height: 54px; width: 126px; border-radius: 10px; padding: 6px 10px; }
.sponsor-tile.dark { background: #01081c; padding: 0; overflow: hidden; }
.sponsor-tile.dark img { height: 100%; width: auto; }
.sponsor-tile img { max-height: 100%; max-width: 100%; object-fit: contain; }
.sponsor-tile.text { background: #000; }
.logo-text { font-family: var(--display); font-size: 22px; letter-spacing: .04em; color: #fff; }

/* ---------- Admin ---------- */
body.admin { background: #eef0f4; }
.admin-bar { background: var(--navy); color: #fff; position: relative; z-index: 20; }
.admin-bar .row { display: flex; align-items: center; gap: 10px; padding: 8px 16px; max-width: 1100px; margin: 0 auto; }
.admin-bar .row img { height: 36px; }
.admin-bar .row b { font-family: var(--display); font-weight: 400; font-size: 20px; text-transform: uppercase; flex: 1; }
.admin-tabs { display: flex; gap: 4px; padding: 0 12px; max-width: 1100px; margin: 0 auto; overflow-x: auto; }
.admin-tabs .tab { font-size: 13px; padding: 10px 12px; }
.adm-table { width: 100%; border-collapse: collapse; }
.adm-table td, .adm-table th { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
.adm-table th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; }
.photo-pick { position: relative; width: 48px; height: 48px; cursor: pointer; flex: none; }
.photo-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.timer-admin { display: grid; gap: 12px; }
.timer-admin .contest-hero { margin: 0; }
.counter-adm { display: flex; align-items: center; gap: 6px; }
.counter-adm .v { font-family: var(--display); font-size: 24px; min-width: 44px; text-align: center; }
.adm-game { display: grid; grid-template-columns: minmax(84px, 110px) minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 8px; border-bottom: 1px solid var(--line); }
.adm-game .teams { display: grid; gap: 6px; }
.adm-game .teams .t { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; }
.adm-game .meta { font-size: 11px; color: var(--muted); font-weight: 800; text-transform: uppercase; text-align: left; line-height: 1.35; }
.adm-game .meta b { display: block; color: var(--ink); font-size: 13px; }
.adm-game .ctl { display: grid; gap: 4px; }
.adm-game.final { background: #f6fff8; }
.note { background: #fff8e8; border: 1px solid #f6d58f; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 8px 0; }
.note.red { background: #fff0f1; border-color: #f4b4bd; }
.linkbox { display: flex; gap: 6px; align-items: center; margin: 4px 0 10px; }
.linkbox input { flex: 1; font-size: 13px !important; }
.log-row { display: grid; grid-template-columns: 80px 90px 1fr; gap: 8px; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.log-row.undone { text-decoration: line-through; opacity: .5; }
.login-card { max-width: 380px; margin: 60px auto; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(5,10,20,.6); z-index: 500; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 18px; padding: 20px; max-width: 520px; width: 100%; max-height: 90vh; overflow: auto; }
.modal h3 { margin: 0 0 8px; font-family: var(--display); font-weight: 400; font-size: 24px; text-transform: uppercase; }

/* ---------- Site accessibility dark mode ---------- */
html[data-theme="dark"] body:not(.judge):not(.tv) { background: var(--bg) !important; color: var(--ink); }
html[data-theme="dark"] .card,
html[data-theme="dark"] .lb-row,
html[data-theme="dark"] .game,
html[data-theme="dark"] .b-game,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .adm-panel,
html[data-theme="dark"] .print-card { background: var(--card); color: var(--ink); }
html[data-theme="dark"] body.admin { background: var(--bg); }
html[data-theme="dark"] .game.done { background: #202d40; }
html[data-theme="dark"] .game.final,
html[data-theme="dark"] .adm-game.final { background: #17352d; }
html[data-theme="dark"] input.in,
html[data-theme="dark"] select.in,
html[data-theme="dark"] textarea.in,
html[data-theme="dark"] .linkbox input { background: #111b2a; color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] input.in::placeholder,
html[data-theme="dark"] textarea.in::placeholder { color: var(--muted); }
html[data-theme="dark"] .note { background: #352d1c; border-color: #79612c; color: #ffe6a8; }
html[data-theme="dark"] .note.red { background: #3a222b; border-color: #85404d; color: #ffd7de; }
html[data-theme="dark"] .sponsor-tile:not(.dark):not(.text) { background: #fff; }
html[data-theme="dark"] .b-slot.win { background: color-mix(in srgb, var(--gold) 24%, var(--card)); }
html[data-theme="dark"] .tbl td,
html[data-theme="dark"] .adm-table td,
html[data-theme="dark"] .adm-table th { border-color: var(--line); }
.modal ul { padding-left: 20px; }

/* ---------- Print ---------- */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

/* ---------- Phone tweaks ---------- */
.status-row .conn { background: var(--navy); }
@media (max-width: 520px) {
  .tab { padding: 12px 10px; font-size: 13px; letter-spacing: .03em; }
  .tbl .hide-sm { display: none; }
  .tbl { font-size: 13px; }
  .tbl td, .tbl th { padding: 8px 4px; }
}
.sponsor-tile { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.sponsor-tile img { max-height: 100%; max-width: 100%; height: auto; width: auto; min-height: 0; }
.sponsor-tile.dark img { height: 100%; max-width: none; }
.grid2 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.card { min-width: 0; }

/* ---------- Time's-up alerts (screen shake + flashing banner) ---------- */
@keyframes quake {
  0%, 100% { transform: none; }
  10% { transform: translate(-14px, 6px) rotate(-1deg); }
  20% { transform: translate(12px, -8px) rotate(1deg); }
  30% { transform: translate(-10px, -4px) rotate(-.6deg); }
  40% { transform: translate(10px, 8px) rotate(.6deg); }
  50% { transform: translate(-8px, 4px); }
  60% { transform: translate(6px, -6px); }
  70% { transform: translate(-4px, 4px); }
  80% { transform: translate(3px, -2px); }
}
.quake { animation: quake 1.1s cubic-bezier(.36,.07,.19,.97) both; }
.alarm { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; pointer-events: none; padding: 16px;
  animation: alarmBg 4s ease forwards; }
.alarm-in { text-align: center; color: #fff; animation: alarmPop 4s cubic-bezier(.2,1.3,.4,1) forwards; }
.alarm .t { font-family: var(--display); font-size: clamp(64px, 22vw, 200px); line-height: .95; text-transform: uppercase; letter-spacing: .02em; text-shadow: 0 6px 30px rgba(0,0,0,.45); }
.alarm .s { font-weight: 900; font-size: clamp(18px, 5vw, 34px); margin-top: 10px; text-shadow: 0 3px 14px rgba(0,0,0,.5); }
.alarm-go { --al: 22, 163, 74; }
.alarm-time { --al: 233, 93, 42; }
.alarm-over { --al: 215, 38, 61; }
@keyframes alarmBg {
  0% { background: rgba(var(--al), 0); }
  6% { background: rgba(var(--al), .96); }
  14% { background: rgba(var(--al), .55); }
  22% { background: rgba(var(--al), .96); }
  30% { background: rgba(var(--al), .6); }
  38% { background: rgba(var(--al), .92); }
  85% { background: rgba(var(--al), .85); }
  100% { background: rgba(var(--al), 0); }
}
@keyframes alarmPop {
  0% { transform: scale(.3); opacity: 0; }
  10% { transform: scale(1.08); opacity: 1; }
  18% { transform: scale(1); }
  85% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.06); }
}
@media (prefers-reduced-motion: reduce) { .alarm-in { animation-name: none; } }

/* ---------- Demo screens bar (demo mode only) ---------- */
.pp-demobar { display: flex; align-items: center; gap: 6px; padding: 8px max(16px, env(safe-area-inset-left, 0px)); overflow-x: auto; scrollbar-width: none;
  background: #1a1300; border-bottom: 2px solid var(--gold); font: 700 12px var(--body); white-space: nowrap; position: relative; z-index: 50; }
.pp-demobar .lbl { color: var(--gold); text-transform: uppercase; letter-spacing: .1em; font-weight: 900; margin-right: 4px; }
.pp-demobar a { color: #fff; text-decoration: none; padding: 5px 10px; border-radius: 99px; background: rgba(255,255,255,.1); }
.pp-demobar a:hover { background: var(--orange); }
.pp-demobar a[aria-current="page"] { background: var(--gold); color: var(--navy); }
.pp-demobar .hint { color: rgba(255,255,255,.65); font-weight: 600; margin-left: 6px; }
.pp-demobar .hint b { color: var(--gold); }
.pp-demobar.on-tv { position: fixed; left: 0; right: 0; top: 0; opacity: 0; transition: opacity .3s; z-index: 200; }
.pp-demobar.on-tv:hover, .pp-demobar.on-tv:focus-within { opacity: 1; }

/* ---------- Fit fixes ---------- */
.lb { grid-template-columns: minmax(0, 1fr); }
.lb-row { min-width: 0; }
.lb-row .count { flex: none; }
@media (max-width: 520px) {
  .brand-title .kicker .sep { display: none; }
  .brand-title .kicker .place { display: block; }
}
@media (max-width: 520px) {
  .card { padding: 14px 12px; }
  .lb-row { gap: 10px; padding: 8px 10px; }
  .lb-row .rank { width: 24px; font-size: 22px; }
  .lb-row .avatar { width: 40px; height: 40px; font-size: 14px; }
  .lb-row .name { white-space: normal; line-height: 1.2; font-size: 16px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .lb-row .count { font-size: 30px; min-width: 44px; }
}
.login-card img { height: 130px; width: auto; margin: 0 auto; display: block; }
.counter-adm { flex-wrap: wrap; }
@media (max-width: 520px) {
  #counts .adm-table td:nth-child(2) { display: none; }
  #counts .adm-table td { padding: 8px 2px; }
  .counter-adm { gap: 4px; }
  .counter-adm .v { min-width: 36px; font-size: 22px; }
}
@media (max-width: 520px) {
  .counter-adm { flex-wrap: nowrap; }
  .counter-adm .btn.small { padding: 7px 8px; min-width: 34px; }
  #counts .adm-table td:last-child { width: 1%; white-space: nowrap; }
}
@media (max-width: 520px) {
  .adm-game { grid-template-columns: 52px minmax(0, 1fr); row-gap: 8px; }
  .adm-game .teams .t { align-items: center; }
  .adm-game .teams .t span { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }
  .adm-game .ctl { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; }
  .adm-game .ctl .btn-row { gap: 6px !important; }
}
.b-round { position: relative; padding-top: 26px; }
.b-round h4 { position: absolute; top: 0; left: 0; right: 0; margin: 0; }

/* ---------- PIN entry ---------- */
.pin-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--navy, #0b1224); }
.pin-card { width: 100%; max-width: 340px; background: #fff; color: #0b1224; border-radius: 18px; padding: 22px 20px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.pin-card h2 { margin: 6px 0 4px; font-size: 24px; }
.pin-card .pin-logo { max-height: 54px; max-width: 70%; }
.pin-hint { margin: 0 0 8px; color: #64748b; font-size: 14px; }
.pin-err { min-height: 20px; color: #d7263d; font-weight: 700; font-size: 14px; }
.pin-in { text-align: center; font-size: 28px; letter-spacing: .3em; margin: 6px 0 12px; width: 100%; box-sizing: border-box; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin-key { font-size: 26px; font-weight: 800; padding: 14px 0; border-radius: 14px; border: 1px solid #e5e7eb; background: #f7f5f0; color: #0b1224; cursor: pointer; touch-action: manipulation; }
.pin-key:active { transform: scale(.96); background: #ffe7d6; }
.pin-key.go { background: #e95d2a; color: #fff; border-color: #e95d2a; }
.pin-letters { margin-top: 12px; background: none; border: 0; color: #64748b; text-decoration: underline; font-size: 13px; cursor: pointer; }
.pin-card select.in { width: 100%; margin-bottom: 8px; }
/* ---------- Ref page ---------- */
.ref-top { background: var(--navy, #0b1224); color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 5; }
.ref-game { background: #fff; border-radius: 14px; padding: 12px 14px; margin: 10px 0; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.ref-game .lbl { font-size: 12px; color: #64748b; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.ref-game .row2 { display: grid; grid-template-columns: 1fr 86px; gap: 8px; align-items: center; margin-top: 8px; font-weight: 800; font-size: 18px; }
.ref-game .row2 input { font-size: 24px; text-align: center; padding: 8px; }
.ref-game.done { opacity: .7; }
.ref-game .btn { margin-top: 10px; width: 100%; }
