/* Pantalla de la tele: todo en rem, y 1rem escala con la pantalla (120rem × 67.5rem = 16:9). */
html { font-size: min(calc(100vw / 120), calc(100vh / 67.5)); }
body { height: 100vh; overflow: hidden; font-size: 1.6rem; }

#app { height: 100vh; display: flex; align-items: center; justify-content: center; }
.loading { color: var(--muted); font-size: 2.4rem; }

.screen { width: 120rem; height: 67.5rem; padding: 3rem 4rem; display: flex; flex-direction: column; gap: 2rem; position: relative; }

:focus { outline: none; }
:focus-visible, .btn:focus { outline: 0.35rem solid var(--gold); outline-offset: 0.35rem; }

.btn { font-size: 2rem; }
.controls { display: flex; justify-content: flex-end; gap: 1.5rem; margin-top: auto; }

/* ---------- Lobby ---------- */
.lobby { flex-direction: row; gap: 5rem; align-items: center; }
.lobby-join { flex: 0 0 44rem; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1.4rem; }
.lobby-join .logo { font-size: 10rem; }
.tag { margin: 0; font-size: 2.6rem; color: var(--muted); }
.qr { background: #fff; padding: 1.6rem; border-radius: 2rem; width: 28rem; height: 28rem; display: grid; place-items: center; box-shadow: 0 1rem 3rem #0006; }
.qr img, .qr canvas { width: 24.8rem !important; height: 24.8rem !important; image-rendering: pixelated; }
.qr .noqr { color: var(--card-ink); font-size: 1.8rem; }
.url { margin: 0; font-size: 2rem; color: var(--muted); }
.code { margin: 0; font-size: 2.4rem; }
.code b { font-size: 4.4rem; letter-spacing: 0.3em; color: var(--gold); margin-left: 0.6rem; }

.lobby-side { flex: 1; display: flex; flex-direction: column; gap: 2rem; height: 100%; padding: 2rem 0; }
.lobby-side h2 { margin: 0; font-size: 3.2rem; }
.lobby-side h2 span { color: var(--muted); font-weight: 400; }
.players { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 1.2rem; align-content: flex-start; min-height: 22rem; }
.players li { background: var(--bg-3); padding: 1rem 1.8rem; border-radius: 1.2rem; font-size: 2.4rem; font-weight: 600; animation: popIn 0.35s cubic-bezier(.2,.9,.3,1.4) both; }
.players li.off { opacity: 0.4; }
.players li.empty { background: none; color: var(--muted); font-weight: 400; padding-left: 0; animation: pulse 2s infinite; }
.settings { display: flex; flex-wrap: wrap; gap: 2rem 3rem; }
.setting { display: flex; flex-direction: column; gap: 0.8rem; }
.setting > span { color: var(--muted); font-size: 1.8rem; }
.seg { display: flex; background: var(--bg-2); border-radius: 999px; padding: 0.4rem; gap: 0.3rem; }
.seg button { border: 0; background: none; border-radius: 999px; padding: 0.7rem 1.6rem; font-size: 2rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--ink); color: var(--card-ink); }
.lobby-side .btn.primary { align-self: flex-start; font-size: 3rem; padding: 1.2rem 4rem; margin-top: auto; }
.hint { margin: 0; color: var(--muted); font-size: 1.8rem; }

/* ---------- Ronda ---------- */
.topbar { display: grid; grid-template-columns: 22rem 1fr 13rem; gap: 2.5rem; align-items: center; }
.round-info { font-size: 2.4rem; display: flex; flex-direction: column; }
.round-info small { color: var(--muted); font-size: 1.7rem; }

.picante { display: flex; align-items: center; gap: 1.6rem; background: var(--picante); border-radius: 1.6rem; padding: 1.2rem 2rem; box-shadow: 0 0.5rem 0 #b81f55; animation: popIn 0.5s cubic-bezier(.2,.9,.3,1.4) both; }
.picante .chili { font-size: 4rem; }
.picante b { display: block; font-size: 2.4rem; }
.picante small { display: block; font-size: 1.7rem; opacity: 0.9; }

.letter { width: 13rem; height: 13rem; border-radius: 50%; background: var(--ink); color: var(--card-ink); display: grid; place-items: center; font-size: 8.5rem; font-weight: 700; box-shadow: 0 0.6rem 0 #0005; }
.letter.spinning { color: var(--muted); }
.letter.landed { animation: land 0.6s cubic-bezier(.2,.9,.3,1.6); background: var(--gold); }

.timer { display: flex; align-items: center; gap: 2rem; }
.timer-bar { flex: 1; height: 1.4rem; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.timer-bar i { display: block; height: 100%; width: 100%; background: var(--good); border-radius: 999px; transition: width 0.25s linear, background 0.3s; }
.timer span { font-size: 4.2rem; font-weight: 700; width: 11rem; text-align: right; font-variant-numeric: tabular-nums; }
.timer.hurry i { background: var(--bad); }
.timer.hurry span { color: var(--bad); animation: pulse 1s infinite; }

.cats { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1.6rem; }
.card { background: var(--c); color: var(--card-ink); border-radius: 1.6rem; aspect-ratio: 3 / 4; padding: 1.4rem; display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 700; font-size: 2rem; line-height: 1.15; position: relative; box-shadow: 0 0.6rem 0 #0004; animation: deal 0.6s cubic-bezier(.2,.9,.3,1.2) both; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
.card .num { position: absolute; top: 0.8rem; left: 1rem; font-size: 1.6rem; opacity: 0.55; }
.card .bomb { position: absolute; top: 0.6rem; right: 0.8rem; font-size: 2.2rem; }
.card .x2 { position: absolute; bottom: 0.8rem; left: 50%; transform: translateX(-50%); background: var(--picante); color: #fff; border-radius: 0.8rem; padding: 0.1rem 0.8rem; font-size: 1.6rem; }

.progress { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-top: auto; }
.pchip { background: var(--bg-2); border-radius: 1.2rem; padding: 0.9rem 1.4rem; display: flex; align-items: center; gap: 1.2rem; font-size: 2rem; font-weight: 600; }
.pchip.off { opacity: 0.4; }
.pchip.full { background: var(--bg-3); box-shadow: inset 0 0 0 0.25rem var(--gold); }
.dots { display: flex; gap: 0.4rem; }
.dots i { width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--line); transition: background 0.2s; }
.dots i.on { background: var(--gold); }

.overlay { position: fixed; inset: 0; background: #170f30e8; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 50; animation: fadeIn 0.2s; transition: opacity 0.5s; }
.overlay.out { opacity: 0; }
.overlay .big { font-size: 16rem; font-weight: 700; color: var(--picante); animation: land 0.6s cubic-bezier(.2,.9,.3,1.6); }
.overlay .sub { font-size: 3.4rem; color: var(--muted); }

/* ---------- Tablero (revisión y resultados) ---------- */
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; }
.head h2 { margin: 0; font-size: 4rem; }
.head p { margin: 0.4rem 0 0; color: var(--muted); font-size: 2rem; }
.badge { background: var(--bg-3); border-radius: 999px; padding: 0.8rem 1.8rem; font-size: 2.2rem; font-weight: 600; white-space: nowrap; }

.board { flex: 1; min-height: 0; overflow: hidden; }
.grid { display: grid; gap: 0.6rem; font-size: 1.6rem; }
.bh { background: var(--c, var(--bg-3)); color: var(--card-ink); border-radius: 0.8rem; padding: 0.7rem 0.8rem; font-weight: 700; font-size: 1.4rem; line-height: 1.15; display: flex; align-items: center; justify-content: center; text-align: center; min-height: 4.6rem; position: relative; }
.bh.name, .bh.extra { background: none; color: var(--muted); }
.bh .x2 { background: var(--picante); color: #fff; border-radius: 0.6rem; padding: 0 0.5rem; font-size: 1.2rem; margin-left: 0.5rem; white-space: nowrap; }
.rn { display: flex; align-items: center; font-weight: 700; font-size: 2rem; padding-left: 0.4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell { background: var(--bg-2); border-radius: 0.8rem; padding: 0.6rem 0.8rem; display: flex; flex-direction: column; justify-content: center; min-height: 4.2rem; overflow-wrap: anywhere; line-height: 1.15; font-weight: 500; border-left: 0.4rem solid var(--s, transparent); }
.cell small { color: var(--muted); font-size: 1.2rem; }
.cell.empty { color: var(--muted); align-items: center; }
.cell.bad s { color: var(--bad); }
.cell.bad { background: #ff5a5f22; }
.cell.voting { box-shadow: 0 0 0 0.3rem var(--gold); animation: pulse 1.2s infinite; }

/* Votación general (sobre el tablero de revisión) */
.vote-panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 70rem; background: var(--bg-2); border-radius: 2.4rem; padding: 3.2rem 4rem; text-align: center; box-shadow: 0 2rem 6rem #000a, 0 0 0 0.4rem var(--gold); animation: popIn 0.35s cubic-bezier(.2,.9,.3,1.4) both; z-index: 10; }
.vote-panel[hidden] { display: none; }
.vote-panel p { margin: 0; }
.vp-title { font-size: 2.4rem; color: var(--gold); font-weight: 700; }
.vp-word { font-size: 7rem; font-weight: 700; margin: 1rem 0; overflow-wrap: anywhere; line-height: 1.1; }
.vp-meta { font-size: 2rem; color: var(--muted); }
.vp-meta .tagc { background: var(--c); color: var(--card-ink); border-radius: 0.8rem; padding: 0.2rem 0.9rem; font-weight: 700; }
.vp-cta { font-size: 3rem; margin-top: 2.4rem !important; }
.vp-count { font-size: 2.4rem; color: var(--muted); margin-top: 0.8rem !important; animation: pulse 1.5s infinite; }
.vp-tally { display: flex; justify-content: center; gap: 5rem; font-size: 5rem; font-weight: 700; margin-top: 2rem; }
.vp-result { font-size: 3.4rem; font-weight: 700; margin-top: 1.6rem !important; }
.vote-panel.res-valida { box-shadow: 0 2rem 6rem #000a, 0 0 0 0.4rem var(--good); }
.vote-panel.res-valida .vp-result { color: var(--good); }
.vote-panel.res-invalida, .vote-panel.res-empate { box-shadow: 0 2rem 6rem #000a, 0 0 0 0.4rem var(--bad); }
.vote-panel.res-invalida .vp-result, .vote-panel.res-empate .vp-result { color: var(--bad); }
.cell b { font-size: 1.5rem; color: var(--s); }
.cell.s-invalida span { text-decoration: line-through; opacity: 0.6; }
.num-cell { display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.num-cell.neg { color: var(--bad); }
.num-cell.big { color: var(--gold); font-size: 2.4rem; }

.prep-hint { margin: 0; font-size: 2.2rem; color: var(--muted); text-align: center; }
.prep-hint b { color: var(--gold); }
.pchip .coins { color: var(--gold); }
.pchip .state { color: var(--muted); font-weight: 500; }
.pchip.full .state { color: var(--good); }

.shop-log { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.6rem; font-size: 1.6rem; max-height: 13rem; overflow: hidden; }
.shop-log li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; }
.shop-log .bought { color: var(--muted); }
.shop-log .fx { background: var(--bg-2); border-radius: 0.8rem; padding: 0.2rem 0.8rem; }
.shop-log .fx.pos { color: var(--good); }
.shop-log .fx.neg { color: var(--bad); }
.shop-log .fx small { color: var(--muted); }

.bomb-log { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 1rem 2.4rem; color: var(--muted); font-size: 1.8rem; }

/* ---------- Bombas ---------- */
.bombs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.4rem; }
.bombs-list li { background: var(--bg-2); border-radius: 1.4rem; padding: 1.6rem 2.2rem; font-size: 2.6rem; display: flex; align-items: center; gap: 1.6rem; }
.bombs-list li em { color: var(--muted); animation: pulse 1.5s infinite; }
.bombs-list li .victim { color: var(--bad); font-weight: 700; }
.bombs-list .tagc { background: var(--c); color: var(--card-ink); border-radius: 0.8rem; padding: 0.2rem 0.9rem; font-size: 1.8rem; font-weight: 700; }

/* ---------- Final ---------- */
.final { align-items: center; }
.final .logo { font-size: 6rem; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 2.4rem; margin-top: 2rem; }
.step { width: 24rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; animation: popIn 0.6s cubic-bezier(.2,.9,.3,1.3) both; }
.step .who { font-size: 3rem; font-weight: 700; }
.step .pts { font-size: 2.4rem; color: var(--muted); }
.step .block { width: 100%; border-radius: 1.6rem 1.6rem 0 0; display: grid; place-items: center; font-size: 6rem; }
.step.p1 .block { height: 22rem; background: var(--gold); }
.step.p2 .block { height: 15rem; background: #cfd8e6; }
.step.p3 .block { height: 10rem; background: #e3a26b; }
.step.p1 { animation-delay: 0.6s; } .step.p2 { animation-delay: 0.3s; }
.rest { display: flex; flex-wrap: wrap; gap: 1.2rem; justify-content: center; font-size: 2.2rem; color: var(--muted); }

@keyframes deal { from { opacity: 0; transform: translateY(-70vh) rotate(-25deg) scale(0.6); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.6); } }
@keyframes land { 0% { transform: scale(2.2); } 60% { transform: scale(0.9); } 100% { transform: scale(1); } }
@keyframes pulse { 50% { opacity: 0.45; } }
@keyframes fadeIn { from { opacity: 0; } }

/* Modo Kids: en lugar de la Carta Picante */
.picante.kids { background: var(--amarillo); color: var(--card-ink); box-shadow: 0 0.5rem 0 #b88a1a; }

/* Código de sala, fuera del lobby: abajo a la izquierda (los botones van a la derecha) */
#room-badge { position: fixed; bottom: 3.2rem; left: max(4rem, calc(50vw - 56rem)); z-index: 40; background: #000a; border-radius: 999px; padding: 0.7rem 2rem; font-size: 2.2rem; display: flex; align-items: baseline; gap: 1rem; }
#room-badge b { color: var(--gold); letter-spacing: 0.2em; font-size: 3rem; }
#room-badge small { color: var(--muted); font-size: 1.7rem; }
#room-badge[hidden] { display: none; }

.btn.danger { border-color: var(--bad); color: var(--bad); }

/* Reglas */
.lobby-actions { display: flex; gap: 1.6rem; align-items: center; margin-top: auto; }
.lobby-actions .btn.primary { margin-top: 0; }
.lobby-actions .btn.ghost { font-size: 2.2rem; }
.rules-panel { position: absolute; inset: 2rem; z-index: 30; background: var(--bg-2); border-radius: 2.4rem; padding: 2.4rem 3.2rem; display: flex; flex-direction: column; gap: 1.6rem; box-shadow: 0 2rem 6rem #000c; }
.rules-panel[hidden] { display: none; }
.rules-tabs { display: flex; gap: 1rem; align-items: center; }
.rules-tabs .seg-btn { border: 0; background: var(--bg-3); color: var(--muted); border-radius: 999px; padding: 0.8rem 2rem; font-size: 2rem; font-weight: 600; }
.rules-tabs .seg-btn.on { background: var(--ink); color: var(--card-ink); }
.rules-tabs .btn { margin-left: auto; font-size: 2rem; }
.rules-body { flex: 1; min-height: 0; overflow: hidden; column-count: 3; column-gap: 3.2rem; font-size: 1.65rem; line-height: 1.38; }
.rules-body h2 { column-span: all; margin: 0 0 1rem; font-size: 3.2rem; color: var(--gold); }
.rules-body h3 { margin: 1.2rem 0 0.4rem; font-size: 2rem; color: var(--gold); break-after: avoid; }
.rules-body p, .rules-body ul { margin: 0 0 0.8rem; }
.rules-body ul { padding-left: 2.2rem; }
.rules-body li { margin-bottom: 0.4rem; break-inside: avoid; }

/* Avatares y expulsar */
.players li { display: flex; align-items: center; gap: 1rem; }
.players li .kick { border: 0; background: none; color: var(--muted); font-size: 1.8rem; padding: 0.2rem 0.6rem; border-radius: 999px; opacity: 0.5; }
.players li .kick:focus, .players li .kick.danger { opacity: 1; color: var(--bad); }
.pchip .av { font-size: 1.6rem; }
.rn { gap: 0.8rem; }
.rn .av { font-size: 1.6rem; }
.rn span { overflow: hidden; text-overflow: ellipsis; }
.step .av-xl { font-size: 2.4rem; }
.rest .av { font-size: 1.6rem; }

/* Votación de Carta Picante */
.pic-vote-title { display: flex; flex-direction: column; align-items: center; text-align: center; }
.pic-vote-title b { font-size: 3.2rem; color: var(--picante); }
.pic-vote-title small { font-size: 1.8rem; color: var(--muted); }
.pic-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.pic-option { background: var(--picante); border-radius: 1.6rem; padding: 2rem; display: flex; flex-direction: column; gap: 0.8rem; align-items: center; text-align: center; box-shadow: 0 0.5rem 0 #b81f55; animation: popIn 0.5s cubic-bezier(.2,.9,.3,1.4) both; }
.pic-option:nth-child(2) { animation-delay: 0.15s; }
.pic-option:nth-child(3) { animation-delay: 0.3s; }
.pic-option .chili { font-size: 3.6rem; }
.pic-option b { font-size: 2.6rem; }
.pic-option small { font-size: 1.7rem; opacity: 0.9; }
.cats.small .card { aspect-ratio: auto; min-height: 11rem; font-size: 1.7rem; }
.card.long { font-size: 1.6rem; }
.card > span { min-width: 0; max-width: 100%; }

/* Celu como pantalla principal: aviso para girarlo y botón de pantalla completa */
#rotate { display: none; }
@media (orientation: portrait) and (pointer: coarse) {
  #rotate { display: flex; position: fixed; inset: 0; z-index: 200; background: var(--bg); flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; font-size: 20px; padding: 24px; }
  #rotate div { font-size: 72px; animation: tilt 1.6s ease-in-out infinite; }
  #rotate p { margin: 0; font-size: 26px; font-weight: 700; }
  #rotate small { color: var(--muted); }
}
@keyframes tilt { 50% { transform: rotate(-90deg); } }
#fs-btn { position: fixed; top: 1rem; right: 6.4rem; z-index: 60; width: 4.4rem; height: 4.4rem; min-width: 36px; min-height: 36px; border-radius: 50%; border: 0; background: #0006; color: var(--muted); font-size: 2.2rem; }
#fs-btn[hidden] { display: none; }
.lobby-actions { flex-wrap: wrap; }

#sound-btn { top: 1rem; right: 1rem; width: 4.4rem; height: 4.4rem; min-width: 36px; min-height: 36px; font-size: 2.2rem; }

/* Carta Picante de la ronda (modo estratégico): grande, dándose vuelta. */
.pic-reveal-tv {
  margin: 2rem auto; max-width: 70rem; background: var(--picante); border-radius: 3rem; padding: 4rem 5rem; text-align: center;
  display: flex; flex-direction: column; gap: 1rem; box-shadow: 0 2rem 6rem #0008; animation: picFlipTv 1.1s cubic-bezier(.2,1.4,.4,1) both;
}
.pic-reveal-tv .chili { font-size: 10rem; line-height: 1; }
.pic-reveal-tv small { font-size: 2.4rem; opacity: 0.85; }
.pic-reveal-tv b { font-size: 5.6rem; line-height: 1.1; }
.pic-reveal-tv p { font-size: 2.8rem; margin: 0; }
@keyframes picFlipTv { 0% { transform: perspective(1200px) rotateY(90deg) scale(0.5); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* Sabotajes: aviso arriba, sin decir quién lo tiró. */
#feed { position: fixed; top: 2rem; left: 50%; transform: translateX(-50%); z-index: 45; display: flex; flex-direction: column; gap: 1rem; align-items: center; pointer-events: none; }
.feed-pop { background: #000c; border: 0.3rem solid var(--picante); color: #fff; font-size: 3rem; font-weight: 700; padding: 1.2rem 3rem; border-radius: 999px; animation: fadeIn 0.3s ease-out; transition: opacity 0.6s, transform 0.6s; white-space: nowrap; }
.feed-pop.out { opacity: 0; transform: translateY(-1rem); }
