:root {
  --ink: #34302B;
  --ink-soft: #6b645b;
  --paper: #FBF6EC;
  --card: #FFFDF8;
  --accent: #FFCF33;
  --accent-deep: #F5B700;
  --pop: #F08A24;
  --pink: #F4A6B8;
  --water: #BFE6F0;
  --good: #3E9B5F;
  --bad: #C9473B;
  --line: #E7DECF;
  --radius: 18px;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'DM Sans', system-ui, -apple-system, Segoe UI, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; margin: 0 0 .4em; line-height: 1.1; }
h1 em, h2 em, h3 em { font-style: italic; color: var(--pop); }
p { line-height: 1.45; margin: 0 0 .8em; }
.muted { color: var(--ink-soft); }
.small { font-size: .88rem; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.wrap { max-width: 520px; margin: 0 auto; padding: 16px 16px 90px; }

.card { background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); padding: 18px; box-shadow: 4px 4px 0 var(--ink); }
.card + .card { margin-top: 16px; }
.card.flat { box-shadow: none; border-color: var(--line); }

.btn { appearance: none; border: 2px solid var(--ink); background: var(--accent); color: var(--ink); border-radius: 999px; padding: 12px 20px; font-weight: 700; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); transition: transform .05s, box-shadow .05s; text-align: center; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.block { display: block; width: 100%; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.dark { background: var(--ink); color: var(--paper); }
.btn.pink { background: var(--pink); }
.btn.danger { background: #fff; color: var(--bad); border-color: var(--bad); box-shadow: 3px 3px 0 var(--bad); }
.btn.sm { padding: 6px 12px; font-size: .9rem; box-shadow: 2px 2px 0 var(--ink); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.input { width: 100%; border: 2px solid var(--ink); border-radius: 14px; padding: 13px 14px; background: #fff; font-size: 1.05rem; outline: none; }
.input:focus { box-shadow: 0 0 0 4px var(--accent); }
textarea.input { min-height: 70px; resize: vertical; }
label.lbl { display: block; font-weight: 700; font-size: .85rem; margin: 10px 0 6px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }

.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; border: 2px solid var(--ink); background: #fff; border-radius: 14px; padding: 14px 16px; margin-top: 10px; cursor: pointer; font-size: 1.05rem; font-weight: 600; }
.opt.on { background: var(--accent); box-shadow: 3px 3px 0 var(--ink); }
.opt .tag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--water); border-radius: 999px; padding: 3px 8px; white-space: nowrap; }

.pill { display: inline-block; border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; font-size: .8rem; font-weight: 700; background: var(--card); }
.pill.yellow { background: var(--accent); }
.pill.pink { background: var(--pink); }
.pill.water { background: var(--water); }
.pill.good { background: var(--good); color: #fff; border-color: var(--good); }

.progress { height: 10px; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; background: #fff; }
.progress > i { display: block; height: 100%; background: var(--accent); }

.bets { display: flex; gap: 8px; margin-top: 14px; }
.bet { flex: 1; border: 2px dashed var(--ink); border-radius: 14px; background: transparent; padding: 10px 6px; font-weight: 800; cursor: pointer; font-size: 1rem; }
.bet.on { border-style: solid; background: var(--pop); color: #fff; box-shadow: 3px 3px 0 var(--ink); }
.bet small { display: block; font-weight: 600; font-size: .7rem; opacity: .85; }

.hero { text-align: center; padding: 10px 0 6px; }
.hero .mascot { width: 88px; height: 88px; }
.mascot { display: inline-block; width: 40px; height: 40px; vertical-align: middle; }
.mascot svg { width: 100%; height: 100%; display: block; }
.bob { animation: bob 2.6s ease-in-out infinite; transform-origin: 50% 80%; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }

.lb { list-style: none; padding: 0; margin: 0; }
.lb li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px dashed var(--line); }
.lb li .rk { width: 28px; font-weight: 800; font-family: var(--serif); }
.lb li .nm { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb li .sc { font-weight: 800; }
.lb li.me { background: #FFF2C2; border-radius: 10px; }

.score-big { font-family: var(--serif); font-size: 3rem; font-weight: 700; line-height: 1; }
.pts.pos { color: var(--good); font-weight: 800; }
.pts.neg { color: var(--bad); font-weight: 800; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 14px; font-weight: 600; z-index: 50; max-width: 90vw; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.err { background: var(--bad); }

.modal-bg { position: fixed; inset: 0; background: rgba(52,48,43,.5); display: flex; align-items: flex-end; justify-content: center; z-index: 40; }
.modal { background: var(--paper); border: 2px solid var(--ink); border-radius: 22px 22px 0 0; padding: 22px 18px 30px; max-width: 520px; width: 100%; max-height: 85vh; overflow: auto; }
.modal ul { padding-left: 18px; line-height: 1.6; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0 14px; }
.topbar .who { font-weight: 700; }
.linkbtn { background: none; border: 0; text-decoration: underline; cursor: pointer; padding: 4px; color: var(--ink-soft); font-weight: 600; }

.waves { position: fixed; left: 0; right: 0; bottom: 0; height: 60px; pointer-events: none; z-index: -1; background:
  radial-gradient(40px 14px at 20px 0, transparent 98%, var(--water) 100%) 0 0 / 40px 60px repeat-x; opacity: .7; }

/* admin */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button { flex: 1; border: 2px solid var(--ink); background: #fff; border-radius: 12px; padding: 9px; font-weight: 700; cursor: pointer; }
.tabs button.on { background: var(--accent); }
.grp { border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-top: 8px; background: #fff; }
.grp.match { border-color: var(--good); background: #EEF8F1; }
.grp .ans { font-size: .88rem; color: var(--ink-soft); margin-top: 4px; }
.grp .ans button { font-size: .75rem; }
.warn { background: #FFF2C2; border: 2px solid var(--accent-deep); border-radius: 12px; padding: 10px 12px; font-size: .9rem; margin-top: 10px; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t td, table.t th { padding: 8px 6px; border-bottom: 1px dashed var(--line); text-align: left; }
details summary { cursor: pointer; font-weight: 700; }

/* tv */
body.tv { overflow: hidden; }
.tv-wrap { height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; padding: 36px 44px; }
.tv-main { display: flex; flex-direction: column; min-width: 0; }
.tv-side { display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.tv-title { font-size: clamp(2.2rem, 4.5vw, 3.2rem); }
.tv-q { font-family: var(--serif); font-size: clamp(1.8rem, 4vw, 3rem); overflow-wrap: anywhere; line-height: 1.12; margin: 8px 0 24px; }
.tv-qr { background: #fff; border: 3px solid var(--ink); border-radius: 22px; padding: 18px; display: inline-block; box-shadow: 6px 6px 0 var(--ink); }
.tv-qr img, .tv-qr canvas { display: block; }
.tv-names { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; overflow: hidden; }
.tv-names .pill { font-size: 1.05rem; padding: 6px 14px; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar { position: relative; border: 3px solid var(--ink); border-radius: 16px; background: #fff; overflow: hidden; min-height: 62px; display: flex; align-items: center; transition: all .4s; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--water); transition: width .8s ease; }
.bar > span { position: relative; padding: 10px 18px; font-size: 1.6rem; font-weight: 700; flex: 1; }
.bar > b { position: relative; padding: 0 18px; font-size: 1.6rem; font-family: var(--serif); }
.bar.match { border-color: var(--good); box-shadow: 0 0 0 5px rgba(62,155,95,.35); }
.bar.match > i { background: #BFE8CB; }
.bar.dim { opacity: .45; }
.reveal-banner { margin-top: 22px; background: var(--accent); border: 3px solid var(--ink); border-radius: 20px; padding: 16px 22px; font-size: 2rem; font-family: var(--serif); box-shadow: 6px 6px 0 var(--ink); animation: pop .5s ease; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.tv-side .card { padding: 16px 18px; }
.tv-side .lb li { font-size: 1.25rem; padding: 7px 4px; }
.chipline { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chipline .pill { font-size: 1rem; background: var(--pop); color: #fff; }
.countdown { font-family: var(--serif); font-size: 9rem; font-weight: 700; line-height: 1; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 22px; margin-top: 30px; }
.podium .step { width: 220px; text-align: center; }
.podium .block { border: 3px solid var(--ink); border-radius: 18px 18px 0 0; background: var(--accent); display: flex; align-items: flex-start; justify-content: center; padding-top: 14px; font-family: var(--serif); font-size: 3rem; font-weight: 700; box-shadow: 6px 0 0 var(--ink); }
.podium .p1 .block { height: 260px; }
.podium .p2 .block { height: 190px; background: var(--water); }
.podium .p3 .block { height: 140px; background: var(--pink); }
.podium .nm { font-size: 1.8rem; font-weight: 800; margin-bottom: 4px; }
.podium .sc { font-size: 1.3rem; margin-bottom: 10px; }
.podium .mascot { width: 70px; height: 70px; }

@media print { .noprint { display: none !important; } body { background: #fff; } }

.tv-controls { position: fixed; right: 18px; bottom: 14px; display: flex; gap: 10px; align-items: center; z-index: 20;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; padding: 6px 8px 6px 14px; box-shadow: 3px 3px 0 var(--ink); }
.tv-controls .btn { font-size: 1rem; box-shadow: none; }
.tv-controls .small { white-space: nowrap; }
/* keep TV content clear of the control bar */
.tv-wrap { padding-bottom: 86px; }
.tv-side { min-height: 0; overflow: hidden; }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti span { position: absolute; top: -60px; font-size: 2.6rem; animation: fall linear infinite; }
@keyframes fall { to { transform: translateY(115vh) rotate(540deg); } }

.tv-main { overflow-wrap: anywhere; }
.tv-main .reveal-banner { font-size: clamp(1.4rem, 3vw, 2rem); }
.confetti .mascot { width: 56px; height: 56px; }

/* ---- wall poster (/tv?print=1) ---- */
.poster { width: 8.5in; min-height: 11in; margin: 0 auto; padding: .55in .6in .5in; box-sizing: border-box; background: var(--paper); display: flex; flex-direction: column; gap: .35in; }
.pz-top { display: flex; align-items: center; justify-content: space-between; gap: .3in; }
.pz-kicker { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15pt; text-transform: uppercase; letter-spacing: .06em; }
.pz-kicker .mascot { width: 44px; height: 44px; flex: none; }
.poster h1 { font-family: var(--serif); font-size: 46pt; line-height: 1.02; margin: 10px 0 0; }
.poster h1 em { font-style: italic; }
.pz-photo { width: 2.5in; height: 2.9in; flex: none; background: #fff; padding: 10px 10px 30px; border: 3px solid var(--ink); border-radius: 8px; box-shadow: 6px 6px 0 var(--ink); transform: rotate(4deg); box-sizing: border-box; }
.pz-photo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 3px; }
.pz-mid { display: flex; gap: .4in; align-items: center; }
.pz-qr { flex: none; text-align: center; }
.pz-qr .tv-qr { background: #fff; border: 4px solid var(--ink); border-radius: 16px; padding: 14px; box-shadow: 8px 8px 0 var(--accent); display: inline-block; }
.pz-scan { font-family: var(--serif); font-style: italic; font-size: 26pt; margin-top: 14px; }
.pz-steps { display: flex; flex-direction: column; gap: .28in; }
.pz-step { display: flex; gap: 14px; align-items: flex-start; }
.pz-step > b { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--accent); border: 3px solid var(--ink); display: grid; place-items: center; font-family: var(--serif); font-size: 20pt; }
.pz-step strong { display: block; font-size: 16pt; line-height: 1.2; }
.pz-step span { display: block; font-size: 12.5pt; opacity: .75; margin-top: 3px; }
.pz-foot { margin-top: auto; text-align: center; background: var(--ink); color: #fff; border-radius: 999px; padding: 14px; font-weight: 800; font-size: 17pt; }
.pz-tools { position: fixed; top: 12px; right: 12px; display: flex; gap: 8px; align-items: center; background: #fff; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--ink); }
@page { size: letter; margin: 0; }
@media print { body { background: var(--paper) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; } .poster { min-height: 11in; height: 11in; overflow: hidden; } }
@media screen and (max-width: 860px) { .poster { width: 100%; min-height: 0; padding: 20px 16px; } .pz-top, .pz-mid { flex-direction: column; } .poster h1 { font-size: 34pt; } }

/* ---- couchside additions ---- */
.confetti i { position: absolute; top: -40px; width: 14px; height: 22px; border-radius: 3px; animation: fall linear infinite; }
.opt[disabled] { opacity: .5; cursor: not-allowed; }
.kind-tag { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; border-radius: 999px; padding: 3px 9px; border: 2px solid var(--ink); background: var(--water); }
.kind-tag.funny { background: var(--pink); }
.kind-tag.mc { background: var(--card); }
.settings .grid { display: grid; grid-template-columns: 1fr; gap: 4px; }
.swatch { width: 44px; height: 44px; border: 2px solid var(--ink); border-radius: 12px; padding: 0; cursor: pointer; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; white-space: pre-wrap; word-break: break-word; }
.pz-mascot { width: 2.2in; height: 2.2in; flex: none; }
.demo-badge { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--paper); font-size: .78rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; pointer-events: none; white-space: nowrap; }
