/* Juegos navideños — cálido y festivo; botones grandes para celular; TV legible a distancia. */
:root {
  --bg: #fbf5ea; --card: #fffdf8; --ink: #2a1f17; --muted: #75685b; --line: #ecdfca;
  --red: #c8372d; --red-d: #a52a21; --green: #1f6b4f; --green-d: #154d39; --gold: #e8b33a; --sky: #2f6fc4;
  --ok: #2f8a4c; --bad: #b8433a; --radius: 18px; --shadow: 0 6px 22px rgba(70, 40, 10, .10);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; }
body.locked { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: .6em 0 .4em; }
.loading { text-align: center; margin-top: 30vh; color: var(--muted); }
.muted { color: var(--muted); } .fine { font-size: 13px; color: var(--muted); } .center { text-align: center; }
.err { color: var(--bad); min-height: 1.4em; margin: 0; }

/* ---------- estructura ---------- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: linear-gradient(90deg, var(--green-d), var(--green)); color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.top .who { display: flex; align-items: center; gap: 4px; border: 0; background: rgba(255,255,255,.14); color: #fff; border-radius: 999px; padding: 6px 12px 6px 6px; min-height: 44px; max-width: 58vw; font-weight: 700; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.top .chip-pts { background: var(--gold); color: #3a2a00; border-radius: 999px; padding: 6px 12px; font-weight: 800; white-space: nowrap; border: 0; min-height: 40px; cursor: pointer; }
.status { font-size: 12px; color: var(--muted); padding: 4px 14px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-right: 6px; vertical-align: middle; }
.dot.ok { background: var(--ok); } .dot.off { background: var(--bad); }
.wrap { max-width: 720px; margin: 0 auto; padding: 6px 14px calc(96px + env(safe-area-inset-bottom)); }
.wrap.narrow { max-width: 480px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
.card.hostbar { background: #fff6dc; border-color: var(--gold); }
.card.hostbar h3 { margin-top: 0; font-size: 15px; color: #8a6400; }
.note { background: #f3e8d6; border-radius: 12px; padding: 12px 14px; }
.big-emoji { font-size: 56px; line-height: 1; }
.gtitle { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; }
.gtitle h2 { margin: 0; font-size: 22px; }
.gtitle .e { font-size: 34px; }

/* pestañas inferiores */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 16px rgba(0,0,0,.06); }
.tabs button { flex: 1; border: 0; background: none; padding: 10px 4px 12px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; min-height: 58px; }
.tabs button b { display: block; font-size: 22px; }
.tabs button.on { color: var(--red); }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 10px 18px; border-radius: 14px;
  border: 2px solid var(--line); background: #fff; font-weight: 800; cursor: pointer; text-decoration: none; color: var(--ink); text-align: center; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 4px 0 var(--red-d); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-d); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #3a2a00; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.big { font-size: 21px; min-height: 62px; }
.btn.wide { width: 100%; margin: 6px 0; }
.btn:disabled { opacity: .45; box-shadow: none; }
.btn:active, .opt:active, .pick:active { transform: translateY(2px); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > .btn { flex: 1; }

/* ---------- onboarding ---------- */
.hero { text-align: center; margin: 18px 0 4px; }
.hero h1 { font-size: 30px; margin: 4px 0; }
.hero .snow { font-size: 44px; }
.card label, .lbl { display: block; font-weight: 800; margin: 4px 0 8px; }
.card input[type=text], .card input[type=number], .card textarea, .card input:not([type]) { width: 100%; font-size: 20px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 12px; }
.card textarea { font-size: 17px; min-height: 64px; resize: vertical; }
.card input:focus, .card textarea:focus { outline: none; border-color: var(--red); }
.ages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.seg button, .ages button { flex: 1; min-height: 46px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 800; cursor: pointer; }
.seg button.sel, .ages button.sel { border-color: var(--red); background: #fde7e4; color: var(--red-d); }
.avgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 12px; }
.av { font-size: 28px; line-height: 1; aspect-ratio: 1; min-height: 44px; border-radius: 12px; border: 2px solid var(--line); background: #fff; cursor: pointer; padding: 0; }
.av.used { opacity: .35; } .av.sel { border-color: var(--red); background: #fde7e4; transform: scale(1.06); }
.selfie-row { display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: center; margin-bottom: 12px; }
.selfie-prev { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 4px solid var(--red); }
.selfie-btn { cursor: pointer; }

/* ---------- personas ---------- */
.face { width: 1.8em; height: 1.8em; border-radius: 50%; object-fit: cover; vertical-align: middle; margin: -.25em .35em -.2em 0; background: var(--line); }
.face-e { display: inline-block; width: 1.5em; text-align: center; margin-right: .2em; }
.top .face { width: 34px; height: 34px; margin: 0 4px 0 0; border: 2px solid #fff; }
.top .face-e { font-size: 24px; }
.wall { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 8px 0; }
.wall li { background: #fff; border-radius: 999px; padding: 5px 12px 5px 5px; font-weight: 700; box-shadow: var(--shadow); animation: pop .3s ease-out; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 16px; border: 2px solid var(--line); background: #fff; cursor: pointer; font-weight: 700; font-size: 15px; min-height: 96px; text-align: center; overflow-wrap: anywhere; }
.pick .face { width: 54px; height: 54px; margin: 0; }
.pick .face-e { font-size: 40px; width: auto; margin: 0; }
.pick.sel { border-color: var(--red); background: #fde7e4; }
.pick:disabled { opacity: .5; }

/* ---------- juego: tiempo, preguntas ---------- */
.timer { height: 12px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.timer i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); border-radius: 99px; transition: width .25s linear; }
.timer.hurry i { background: var(--red); }
.secs { font-weight: 900; font-size: 15px; color: var(--muted); text-align: right; }
.prompt { font-size: 24px; font-weight: 800; line-height: 1.25; margin: 6px 0 12px; }
.prompt small { display: block; font-size: 14px; color: var(--muted); font-weight: 700; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .06em; }
.emo { font-size: 64px; text-align: center; letter-spacing: 6px; margin: 8px 0 12px; line-height: 1.15; }
.opts { display: grid; gap: 10px; }
.opt { text-align: left; padding: 14px 16px; min-height: 56px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-weight: 700; cursor: pointer; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; }
.opt .k { width: 26px; height: 26px; border-radius: 8px; background: var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 900; }
.opt.sel { border-color: var(--sky); background: #e5efff; }
.opt.right { border-color: var(--ok); background: #e2f4e7; }
.opt.wrong { border-color: var(--bad); background: #fbe4e1; }
.opt:disabled { cursor: default; }
.result { text-align: center; font-size: 22px; font-weight: 900; margin: 14px 0; }
.result.ok { color: var(--ok); } .result.bad { color: var(--bad); }
.counts { list-style: none; padding: 0; margin: 10px 0; }
.counts li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-weight: 700; }
.counts li .bar { flex: 1; height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.counts li .bar i { display: block; height: 100%; background: var(--red); }
.winner { text-align: center; margin: 8px 0; }
.winner .face { width: 120px; height: 120px; margin: 0 auto 6px; display: block; border: 5px solid var(--gold); }
.winner .face-e { font-size: 90px; display: block; width: auto; margin: 0 auto; }
.winner h3 { font-size: 26px; margin: 4px 0; }

/* bomba */
.bomb { text-align: center; padding: 12px 0; }
.bomb .cat { font-size: 20px; font-weight: 800; }
.bomb .letter { font-size: 120px; font-weight: 900; line-height: 1; color: var(--red); margin: 6px 0; text-shadow: 0 6px 0 rgba(0,0,0,.08); }
.bomb .turn { font-size: 20px; font-weight: 800; }
.bomb.mine { background: #fff1d6; border-radius: 24px; animation: pulse 1s infinite; }
.bomb .fuse { font-size: 64px; }
.alive { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; list-style: none; padding: 0; }
.alive li { background: #fff; border-radius: 999px; padding: 4px 10px 4px 4px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow); }
.alive li.now { outline: 3px solid var(--red); }
.alive li.out { opacity: .35; text-decoration: line-through; }

/* foto pixelada */
.pix { display: block; width: 100%; max-width: 360px; aspect-ratio: 1; margin: 8px auto; border-radius: 24px; background: #ddd; image-rendering: pixelated; box-shadow: var(--shadow); }

/* bingo */
.bcard { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }
.bcell { aspect-ratio: 1; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-size: 12px; font-weight: 800; line-height: 1.15; padding: 4px; display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer; overflow: hidden; overflow-wrap: anywhere; }
.bcell.on { background: var(--green); border-color: var(--green); color: #fff; }
.bcell.on::before { content: "⭐ "; }
.ytbox { position: relative; width: 100%; aspect-ratio: 16/9; border-radius: 14px; overflow: hidden; background: #000; margin: 8px 0; }
.ytbox iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* retratos */
.picons { display: flex; flex-wrap: wrap; gap: 4px; font-size: 28px; margin: 4px 0 8px; }
.psum { margin: .45em 0; font-size: 17px; }
.clues { list-style: none; padding: 0; margin: 0; font-size: 15px; }
.clues li { margin: 4px 0; }
.ptile { border: 2px solid var(--line); border-radius: 16px; background: #fff; padding: 12px; margin: 10px 0; }
.ptile.done { border-color: var(--ok); }
.ptile .code { font-size: 26px; font-weight: 900; color: var(--red); }
.ptile select { width: 100%; font-size: 17px; padding: 10px; border-radius: 12px; border: 2px solid var(--line); background: #fff; margin-top: 8px; }

/* ---------- tablas de puntaje ---------- */
.rank { list-style: none; padding: 0; margin: 8px 0; }
.rank li { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: #fff; border-radius: 14px; margin: 6px 0; box-shadow: var(--shadow); }
.rank li.me { outline: 3px solid var(--gold); }
.rank .place { width: 36px; font-weight: 900; color: var(--red); font-size: 18px; }
.rank .rname { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .pts { font-weight: 900; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; }
.chips button { flex: none; border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 12px; min-height: 42px; font-weight: 800; cursor: pointer; }
.chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 8px; margin: 12px 0; }
.pod { flex: 1; max-width: 200px; text-align: center; background: #fff; border-radius: 16px 16px 0 0; padding: 10px 6px; border: 2px solid var(--line); font-weight: 800; }
.pod .face { display: block; width: 3em; height: 3em; margin: 4px auto; }
.pod .face-e { display: block; font-size: 2.2em; width: auto; margin: 0 auto; }
.pod.p1 { order: 2; min-height: 170px; border-color: var(--gold); background: #fff8e2; }
.pod.p2 { order: 1; min-height: 140px; } .pod.p3 { order: 3; min-height: 120px; }
.medal { font-size: 30px; }
.games { display: grid; gap: 10px; }
.gcard { display: flex; gap: 12px; align-items: center; background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 12px; text-align: left; cursor: pointer; width: 100%; }
.gcard .e { font-size: 36px; }
.gcard b { display: block; }
.gcard small { color: var(--muted); }
.gcard.live { border-color: var(--red); background: #fff1ef; }
.tag { display: inline-block; font-size: 12px; font-weight: 800; border-radius: 8px; padding: 2px 8px; background: #f1e7d6; }
.tag.live { background: var(--red); color: #fff; }
table.pt { width: 100%; border-collapse: collapse; font-size: 15px; }
table.pt td { padding: 6px 4px; border-bottom: 1px solid var(--line); }

/* ---------- capas ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(30, 20, 10, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; border-radius: 22px 22px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); animation: up .2s ease-out; }
#toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); z-index: 40; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; max-width: 92vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--bad); }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation-name: fall; animation-timing-function: cubic-bezier(.25, .6, .5, 1); animation-fill-mode: forwards; }
.confetti i:nth-child(3n) { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- PIN ---------- */
body.pin { display: grid; place-items: center; min-height: 100vh; }
.pinbox { width: min(90vw, 340px); text-align: center; }
.pinbox input { width: 100%; font-size: 28px; text-align: center; letter-spacing: .3em; padding: 12px; border-radius: 12px; border: 2px solid var(--line); margin: 10px 0; }

/* ---------- TV ---------- */
body.tvmode { background: radial-gradient(circle at 20% 10%, #2b7a5c, #123a2b 70%); color: #fff; overflow: hidden; }
.tv { height: 100vh; padding: 3vw 4vw; display: flex; flex-direction: column; gap: 2vw; }
.tv h1 { font-size: 4.4vw; margin: 0; }
.tv .sub { font-size: 2vw; opacity: .85; margin: 0; }
.tv .panel { background: rgba(255,255,255,.96); color: var(--ink); border-radius: 2vw; padding: 2.4vw 3vw; box-shadow: 0 1vw 3vw rgba(0,0,0,.25); }
.tv .grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 3vw; flex: 1; min-height: 0; }
.tv .qr { background: #fff; padding: 1vw; border-radius: 1.4vw; width: 18vw; }
.tv .qr svg { width: 100%; height: auto; display: block; }
.tv .url { font-size: 2vw; font-weight: 800; }
.tv .wall li { font-size: 1.7vw; color: var(--ink); }
.tv .rank li { font-size: 1.8vw; padding: .7vw 1vw; }
.tv .prompt { font-size: 3.6vw; }
.tv .emo { font-size: 6.5vw; margin: 0; }
.tv .opts { grid-template-columns: 1fr 1fr; gap: 1vw; }
.tv .opt { font-size: 2vw; min-height: 4.6vw; padding: .6vw 1.2vw; }
.tv .bomb .letter { font-size: 10vw; margin: 0; }
.tv .bomb .cat { font-size: 3vw; }
.tv .bomb .turn { font-size: 3vw; }
.tv .pix { max-width: 38vw; }
.tv .winner .face { width: 18vw; height: 18vw; }
.tv .winner .face-e { font-size: 14vw; }
.tv .winner h3 { font-size: 4vw; }
.tv .timer { height: 1.4vw; }
.tv .counts li { font-size: 2vw; }
.tv .psum { font-size: 2vw; }
.tv .picons { font-size: 3vw; }
.tv .ytbox { max-height: 60vh; }
.tv-sound { position: fixed; top: 1vw; right: 1vw; z-index: 30; }
.count { position: fixed; inset: 0; display: grid; place-items: center; font-size: 26vw; font-weight: 900; color: var(--gold); background: rgba(10, 40, 25, .8); animation: pulse 1s infinite; z-index: 25; }

@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
@keyframes pulse { 50% { transform: scale(1.03); } }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.tv .tv-join { align-items: center; gap: 2vw; margin-top: 2vw; }
.tv .tv-head { align-items: center; justify-content: space-between; }
.tv .qr.small { width: 8vw; }
.ytdock { position: fixed; right: 10px; bottom: calc(70px + env(safe-area-inset-bottom)); width: 200px; aspect-ratio: 16/9; z-index: 15; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); background: #000; }
.ytdock.tv { right: 3vw; bottom: 3vw; width: 34vw; border-radius: 1.4vw; }
.ytdock iframe { width: 100%; height: 100%; border: 0; display: block; }
.pick small { display: block; font-size: 12px; }
.tv .tv-left { max-width: 58vw; }
.tv p { font-size: 1.8vw; }
.tv .prompt small { font-size: 1.4vw; }
.tv-sound { top: auto; right: auto; bottom: 1vw; left: 1vw; }
.pix { max-width: min(360px, 34vh); }
.tv .pix { max-width: min(38vw, 60vh); }
.tv .winner .face { width: min(14vw, 30vh); height: min(14vw, 30vh); }
.tv .winner .face-e { font-size: min(11vw, 24vh); }
.tv .grid2 .opts { grid-template-columns: 1fr; }
.ytdock { height: 112px; }
.ytdock.tv { height: calc(34vw * 9 / 16); }
.bcell { font-size: 11.5px; overflow-wrap: normal; word-break: normal; hyphens: auto; -webkit-hyphens: auto; }
