:root {
  --plum: #2A0F1F; --panel: #3D1830; --slot: #4A1D39; --line: #6B3355; --mute: #5C2A48;
  --gold: #F5A623; --gold-lite: #FFD27A; --gold-dark: #B8730F;
  --cream: #FFF4E0; --sand: #E8C9A8; --blue: #8FB8FF; --red: #C8341F;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--plum); color: var(--cream); font-family: Inter, system-ui, sans-serif; }
h1, h2, h3, .display { font-family: "Baloo 2", system-ui, sans-serif; font-weight: 800; margin: 0; line-height: 1.1; }
button { font-family: inherit; cursor: pointer; border: 0; border-radius: 12px; min-height: 44px; padding: 0 14px; font-size: 15px; font-weight: 700; }
button:disabled { opacity: .4; cursor: default; }
input, select { font: inherit; font-size: 16px; color: var(--cream); background: var(--slot); border: 2px solid var(--line); border-radius: 10px; min-height: 44px; padding: 0 12px; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
label { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; color: var(--sand); text-transform: uppercase; }
.btn-gold { background: var(--gold); color: var(--plum); }
.btn-blue { background: var(--blue); color: #1A1330; }
.btn-red { background: var(--red); color: var(--cream); }
.btn-cream { background: var(--cream); color: var(--plum); }
.btn-ghost { background: transparent; color: var(--cream); border: 2px solid var(--gold); }
.btn-quiet { background: var(--slot); color: var(--cream); border: 1px solid var(--line); }
.card { background: var(--panel); border-radius: 14px; padding: 14px; }
.card.hl { border: 2px solid var(--gold); }
.kicker { font-size: 12px; font-weight: 700; letter-spacing: 2px; color: var(--sand); text-transform: uppercase; }
.muted { color: var(--sand); }
.row { display: flex; gap: 8px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.t0 { background: var(--gold); color: var(--plum); }
.t1 { background: var(--blue); color: #1A1330; }
.conn { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); background: var(--red); color: var(--cream); padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; z-index: 99; display: none; }
.conn.show { display: block; }
.hidden { display: none !important; }

/* ---------- phone pages ---------- */
.phone { max-width: 480px; margin: 0 auto; padding: 18px 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.brand { font-family: "Baloo 2", sans-serif; font-weight: 800; color: var(--gold); font-size: 26px; line-height: 1; }
.buzzer { width: 220px; height: 220px; border-radius: 50%; border: 9px solid var(--gold-lite); background: var(--gold); color: var(--plum); font-family: "Baloo 2", sans-serif; font-size: 48px; font-weight: 800; box-shadow: 0 10px 0 var(--gold-dark); align-self: center; }
.buzzer:active:not(:disabled) { transform: translateY(6px); box-shadow: 0 4px 0 var(--gold-dark); }
.react { border-radius: 999px; background: var(--slot); border: 1px solid var(--line); color: var(--cream); font-weight: 600; }
.ans { display: flex; justify-content: space-between; align-items: center; text-align: left; font-weight: 600; font-size: 14px; }
.ans.shown { background: var(--mute); color: var(--sand); }
.ans.hidden-a { background: transparent; color: var(--cream); border: 2px solid var(--gold); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; position: sticky; top: 0; background: var(--plum); padding: 8px 0; z-index: 5; }
.tabs button { background: var(--slot); color: var(--cream); }
.tabs button.on { background: var(--gold); color: var(--plum); }
.qopt { display: flex; justify-content: space-between; gap: 8px; align-items: center; text-align: left; font-weight: 600; background: transparent; color: var(--cream); border: 1px solid var(--line); }
.qopt.planned { border: 2px solid var(--gold); background: var(--slot); }
.prow { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--mute); }
.prow button { min-height: 36px; padding: 0 10px; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #7a6; margin-right: 6px; }
.dot.off { background: var(--line); }

/* ---------- TV ---------- */
.tv { width: 100vw; height: 100vh; overflow: hidden; padding: 2.2vw 3vw; display: flex; flex-direction: column; gap: 1.4vw; position: relative; }
.tv .scores { display: flex; justify-content: space-between; align-items: center; }
.tv .team { width: 16vw; padding: .9vw 0; border-radius: 1.2vw; background: var(--panel); border: .25vw solid var(--line); display: flex; flex-direction: column; align-items: center; gap: .3vw; }
.tv .team.ctl { border-color: var(--gold); box-shadow: 0 0 2vw rgba(245,166,35,.45); }
.tv .team .nm { font-size: 1.2vw; font-weight: 700; letter-spacing: .15vw; text-transform: uppercase; text-align: center; padding: 0 .6vw; }
.tv .team .sc { font-family: "Baloo 2", sans-serif; font-size: 3.8vw; font-weight: 800; line-height: 1; }
.tv .title { text-align: center; }
.tv .title .display { font-size: 4.4vw; color: var(--gold); letter-spacing: .15vw; }
.tv .title .sub { font-size: 1.2vw; letter-spacing: .25vw; color: var(--sand); font-weight: 600; text-transform: uppercase; }
.tv .question { text-align: center; font-family: "Baloo 2", sans-serif; font-weight: 700; font-size: 3.1vw; line-height: 1.1; min-height: 3.4vw; }
.tv .board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: column; gap: 1vw; padding: 1.3vw; border-radius: 1.6vw; background: var(--panel); border: .15vw solid var(--mute); }
.tv .slot { height: 5vw; border-radius: 1vw; display: flex; align-items: center; justify-content: center; background: var(--slot); border: .15vw solid var(--line); font-family: "Baloo 2", sans-serif; font-size: 2.4vw; font-weight: 800; color: var(--sand); perspective: 600px; }
.tv .slot.open { background: var(--gold); color: var(--plum); justify-content: space-between; padding: 0 1.8vw; border-color: var(--gold-lite); animation: flip .5s ease; }
@keyframes flip { from { transform: rotateX(90deg); } to { transform: rotateX(0); } }
.tv .foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.tv .strikes { display: flex; gap: .8vw; align-items: center; }
.tv .x { width: 3.8vw; height: 3.8vw; border-radius: .8vw; border: .15vw dashed var(--line); display: flex; align-items: center; justify-content: center; }
.tv .x.on { background: var(--red); border: 0; }
.tv .pot { display: flex; gap: .8vw; align-items: center; padding: .8vw 1.6vw; border-radius: 999px; background: var(--slot); }
.tv .pot b { font-family: "Baloo 2", sans-serif; font-size: 2.4vw; color: var(--gold); }
.tv .join { display: flex; gap: 1vw; align-items: center; font-size: 1.1vw; text-align: right; color: var(--sand); }
.tv .join b { color: var(--cream); }
.tv .qr { background: var(--cream); border-radius: .6vw; padding: .4vw; line-height: 0; }
.tv .qr img, .tv .qr svg { width: 5.5vw; height: 5.5vw; }
.tv .banner { text-align: center; font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 2.2vw; color: var(--gold-lite); min-height: 2.6vw; }
.tv .center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vw; text-align: center; }
.tv .lobby { display: grid; grid-template-columns: 1fr auto 1fr; gap: 3vw; align-items: start; flex: 1; }
.tv .lobby .tcol { background: var(--panel); border-radius: 1.4vw; padding: 1.6vw; min-height: 50vh; }
.tv .lobby .tcol h2 { font-size: 2.6vw; margin-bottom: 1vw; }
.tv .lobby .pl { font-size: 1.8vw; font-weight: 600; padding: .4vw 0; }
.tv .lobby .bigqr { background: var(--cream); padding: 1vw; border-radius: 1vw; line-height: 0; }
.tv .lobby .bigqr img, .tv .lobby .bigqr svg { width: 20vw; height: 20vw; }
.tv .fm { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5vw; }
.tv .fm .frow { display: flex; justify-content: space-between; align-items: center; height: 4.6vw; padding: 0 1.4vw; margin-bottom: .8vw; border-radius: .9vw; background: var(--slot); border: .15vw solid var(--line); font-family: "Baloo 2", sans-serif; font-size: 2.1vw; font-weight: 700; }
.tv .fm .frow.open { background: var(--gold); color: var(--plum); border-color: var(--gold-lite); }
.tv .timer { font-family: "Baloo 2", sans-serif; font-size: 6vw; font-weight: 800; color: var(--gold); line-height: 1; }
.tv .xflash { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 2vw; background: rgba(42,15,31,.55); z-index: 20; animation: fade 1.3s ease forwards; pointer-events: none; }
.tv .xflash div { width: 16vw; height: 16vw; border-radius: 2vw; background: var(--red); display: flex; align-items: center; justify-content: center; }
@keyframes fade { 0% { opacity: 0; } 10% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
.tv .bubble { position: absolute; bottom: -6vw; padding: .8vw 1.6vw; border-radius: 999px; background: var(--cream); color: var(--plum); font-weight: 800; font-size: 1.6vw; white-space: nowrap; animation: rise 3.2s ease-out forwards; z-index: 15; pointer-events: none; }
.tv .bubble small { font-weight: 600; font-size: 1.1vw; color: var(--mute); margin-left: .5vw; }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 10% { opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(-70vh); opacity: 0; } }
.tv .toast { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); padding: 1.6vw 3vw; border-radius: 1.6vw; background: var(--gold); color: var(--plum); font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 3.4vw; z-index: 18; animation: fade 2.4s ease forwards; pointer-events: none; text-align: center; }
.unlock { position: fixed; inset: 0; background: var(--plum); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vw; z-index: 50; }
.unlock button { font-size: 2vw; min-height: 5vw; padding: 0 4vw; }
