/* ---------- Theme tokens (brand: deep blue + gold) ---------- */
:root {
  --brand-blue: #174282;     /* hsl(216,70%,30%) */
  --brand-gold: #F7A31D;     /* hsl(37,93%,54%)  */
  --brand-navy: #253551;
  --bg: #071a33;
  --bg-2: #0c2549;
  --panel: #10305f;
  --panel-2: #174282;
  --text: #ffffff;
  --muted: #a9bddb;
  --accent: #F7A31D;         /* gold: primary highlight */
  --accent-2: #2ecc8f;       /* correct */
  --danger: #e8505b;         /* wrong */
  --info: #5aa9ff;
  --d1: #9ec5ff; --d2: #5aa9ff; --d3: #F7A31D; --d4: #f2892b; --d5: #e8505b;
  --radius: 18px;
  --font: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  background: radial-gradient(1100px 700px at 15% -10%, #1b4a8f 0%, var(--bg) 55%),
              radial-gradient(800px 600px at 110% 110%, #2c3d61 0%, transparent 60%), var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}
button { font-family: inherit; }
h1, h2, h3 { margin: 0 0 .4em; font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.gold { color: var(--accent); }
.hidden { display: none !important; }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.06);
}
.card.gold-top { border-top: 6px solid var(--accent); }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: .9rem;
  background: var(--panel-2); color: var(--text);
}
.pill.gold { background: var(--accent); color: #1a1a1a; }
.btn {
  border: 0; cursor: pointer; border-radius: 14px; padding: 12px 18px;
  font-size: 1rem; font-weight: 700; color: #1a1a1a; background: var(--accent);
  transition: transform .08s ease, filter .15s ease; box-shadow: 0 6px 0 rgba(0,0,0,.28);
}
.btn:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,.28); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: var(--panel-2); color: var(--text); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); box-shadow: none; }
.btn.big { font-size: 1.3rem; padding: 18px 28px; border-radius: 20px; }

/* ---------- Generic pieces ---------- */
.timer { font-variant-numeric: tabular-nums; font-weight: 800; }
.timer.warn { color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes pop { 0% { transform: scale(.7); opacity: 0; } 60% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
@keyframes bounceIn { 0% { transform: translateY(20px); opacity: 0; } 100% { transform: none; opacity: 1; } }
.pop { animation: pop .35s ease-out; }

.dtag { font-size: .8rem; font-weight: 800; padding: 2px 10px; border-radius: 999px; color: #1a1a1a; }
.dtag.d1 { background: var(--d1); } .dtag.d2 { background: var(--d2); } .dtag.d3 { background: var(--d3); } .dtag.d4 { background: var(--d4); } .dtag.d5 { background: var(--d5); }

.bar { height: 14px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; transition: width .4s ease; }

.progress { display: flex; gap: 6px; }
.progress i { flex: 1; height: 8px; border-radius: 999px; background: var(--bg-2); }
.progress i.done { background: var(--accent); }
.progress i.now { background: var(--info); animation: pulse 1.2s infinite; }

.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
.emoji-grid button {
  font-size: 2rem; aspect-ratio: 1; border-radius: 16px; border: 0; cursor: pointer;
  background: var(--panel-2); transition: transform .1s; line-height: 1;
}
.emoji-grid button:hover { transform: scale(1.1); background: var(--panel); }

.rank { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; border-radius: 50%; font-weight: 800; background: var(--panel-2); }
.rank.r1 { background: var(--accent); color: #1a1a1a; }
.rank.r2 { background: #cfd8e6; color: #1a1a1a; }
.rank.r3 { background: #d9945a; color: #1a1a1a; }

/* ---------- Player (mobile-first) ---------- */
.app { max-width: 560px; margin: 0 auto; padding: 14px; min-height: 100%; display: flex; flex-direction: column; gap: 12px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.topbar .me { font-size: 1.6rem; }
.topbar .score { font-size: 1.4rem; font-weight: 800; color: var(--accent); }
.qcard .prompt { font-size: 1.25rem; font-weight: 700; line-height: 1.3; margin: 6px 0 14px; }
.qcard img { max-width: 100%; border-radius: 12px; margin-bottom: 12px; }
.choices { display: grid; gap: 10px; }
.choice {
  text-align: left; border: 0; cursor: pointer; border-radius: 14px; padding: 14px 16px; font-size: 1.05rem; font-weight: 600;
  background: var(--panel-2); color: var(--text); display: flex; gap: 12px; align-items: flex-start; line-height: 1.3;
  box-shadow: 0 4px 0 rgba(0,0,0,.28); transition: transform .08s;
}
.choice:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.28); }
.choice:disabled { opacity: .6; }
.choice .letter { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; background: rgba(255,255,255,.14); }
.choice.correct { background: var(--accent-2); color: #08261c; }
.choice.wrong { background: var(--danger); color: #fff; }
.choice.mine { outline: 3px solid var(--accent); }
.speed { height: 8px; }
.feedback { font-size: 2.2rem; font-weight: 900; text-align: center; padding: 40px 10px; border-radius: var(--radius); }
.feedback.ok { background: var(--accent-2); color: #08261c; }
.feedback.bad { background: var(--danger); color: #fff; }
.feedback.pass { background: var(--panel-2); }
.feedback small { display: block; font-size: 1rem; font-weight: 600; margin-top: 8px; opacity: .85; }
.countdown { font-size: 7rem; font-weight: 900; text-align: center; color: var(--accent); animation: pop .5s; }
.visual { width: 100%; border-radius: 14px; background: var(--bg-2); display: block; }
.takeaway { font-size: 1.05rem; line-height: 1.4; border-left: 6px solid var(--accent); padding: 10px 14px; background: var(--bg-2); border-radius: 0 12px 12px 0; }

/* ---------- Big screen ---------- */
.screen { padding: 28px 40px; min-height: 100vh; display: flex; flex-direction: column; gap: 22px; }
.screen h1 { font-size: 3rem; }
.screen .timer { font-size: 6rem; line-height: 1; }
.screen .lobby-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.screen .lobby-grid span { font-size: 2.6rem; background: var(--panel); border-radius: 16px; padding: 6px 12px; animation: pop .4s; }
.track { display: grid; gap: 10px; align-items: start; }
.track .col { background: var(--panel); border-radius: 16px; min-height: 220px; padding: 10px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.track .col.finish { background: var(--panel-2); border: 2px solid var(--accent); }
.track .col h4 { margin: 0 0 4px; font-size: 1.1rem; color: var(--muted); }
.track .col .chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.track .col .chips span { font-size: 1.9rem; line-height: 1; background: var(--bg-2); border-radius: 12px; padding: 4px 6px; }
.track .col .chips span.off { opacity: .35; filter: grayscale(1); }
.lb { display: grid; gap: 8px; }
.lb .row { background: var(--panel-2); border-radius: 12px; padding: 8px 14px; font-size: 1.4rem; flex-wrap: nowrap; }
.lb .row .emo { font-size: 1.9rem; }
.lb .row .pts { margin-left: auto; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.screen .review { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: start; }
.screen .review .visual { width: 100%; max-height: 62vh; object-fit: contain; }
.screen .review .prompt { font-size: 2rem; font-weight: 800; line-height: 1.25; }
.screen .review .choices { gap: 10px; }
.screen .review .choice { font-size: 1.25rem; padding: 12px 18px; cursor: default; position: relative; }
.screen .review .choice .pct { margin-left: auto; font-weight: 900; white-space: nowrap; }
.screen .review .choice .fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.12); border-radius: 14px; z-index: 0; }
.screen .review .choice > * { position: relative; z-index: 1; }
.screen .takeaway { font-size: 1.7rem; padding: 14px 20px; }
.screen .stat { font-size: 1.2rem; }
.qr { background: #fff; padding: 14px; border-radius: 16px; display: inline-block; }
.winner { font-size: 4rem; font-weight: 900; text-align: center; animation: pop .6s; }
.trophy { font-size: 6rem; text-align: center; animation: bounceIn .6s; }
.champion { font-size: 7rem; text-align: center; line-height: 1; }

/* ---------- Host ---------- */
.host { max-width: 1200px; margin: 0 auto; padding: 16px; display: grid; gap: 14px; grid-template-columns: 1fr 340px; }
.host .main { display: grid; gap: 14px; align-content: start; }
.host .side { display: grid; gap: 14px; align-content: start; }
.host .controls { display: flex; flex-wrap: wrap; gap: 10px; }
.host table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.host td, .host th { padding: 6px 8px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.06); }
.host tr.cur { background: rgba(247,163,29,.18); }
.host tr.click { cursor: pointer; }
.host tr.click:hover { background: rgba(255,255,255,.05); }
.host .kick { background: transparent; border: 0; color: var(--danger); cursor: pointer; font-weight: 700; }
.host .phase { font-size: 1.6rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.host .notes { background: var(--bg-2); border-left: 6px solid var(--accent); border-radius: 0 12px 12px 0; padding: 12px 16px; }
.host .notes li { margin: 6px 0; font-size: 1.05rem; line-height: 1.4; }
.host .review-visual { max-width: 260px; border-radius: 12px; background: var(--bg-2); }
.host .feed .row { padding: 4px 8px; border-radius: 8px; font-size: .9rem; flex-wrap: nowrap; }
.host .feed .row.ok b { color: var(--accent-2); } .host .feed .row.bad b { color: var(--danger); } .host .feed .row.pass b { color: var(--muted); }

/* ---------- Sessions / wager / scoreboard additions ---------- */
.code-big { font-size: 4.5rem; font-weight: 900; letter-spacing: .18em; color: var(--accent); line-height: 1.1; margin: 8px 0; }
.sound-pill { position: fixed; right: 18px; bottom: 18px; z-index: 50; border: 0; cursor: pointer; border-radius: 999px; padding: 10px 16px; font-weight: 700; font-family: inherit; background: var(--panel-2); color: var(--text); opacity: .75; }
.sound-pill:hover { opacity: 1; }
.sound-pill.attention { background: var(--accent); color: #1a1a1a; opacity: 1; animation: pulse 1.6s infinite; }
.screen .lobby-grid span.locked { outline: 3px solid var(--accent); }
table.board { width: 100%; border-collapse: separate; border-spacing: 0 8px; font-size: 1.6rem; }
table.board th { text-align: left; color: var(--muted); font-size: 1rem; font-weight: 600; padding: 0 14px; }
table.board td { background: var(--panel); padding: 8px 14px; }
table.board td:first-child { border-radius: 14px 0 0 14px; width: 60px; }
table.board td:last-child { border-radius: 0 14px 14px 0; }
table.board td.emo { font-size: 2rem; width: 70px; }
table.board td.pts { font-weight: 800; color: var(--accent); text-align: right; font-variant-numeric: tabular-nums; }
.wagers { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.wagers .wg { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; font-size: 1.2rem; background: var(--panel-2); }
.wagers .wg .emo { font-size: 1.8rem; }
.wagers .wg b { margin-left: auto; font-size: 1.4rem; }
.wagers .wg.won b { color: var(--accent-2); } .wagers .wg.lost b { color: var(--danger); }
input[type=range] { accent-color: var(--accent); }
label.field { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
label.field > input[type=checkbox] { width: 22px; height: 22px; margin: 6px 0; }
@media (max-width: 900px) { .host { grid-template-columns: 1fr; } }
@media (max-width: 800px) { .screen { padding: 16px; } .screen .review { grid-template-columns: 1fr; } }
