:root {
  --bg: #0b1020;
  --surface: rgba(255, 255, 255, .05); --surface2: rgba(255, 255, 255, .09); --surface3: rgba(255, 255, 255, .14);
  --border: rgba(255, 255, 255, .10); --border2: rgba(255, 255, 255, .22);
  --text: #f3f4ff; --muted: #9aa3c7; --soft: #c7cdf0;
  --p1: #a855f7; --p2: #ec4899; --cyan: #22d3ee; --lime: #a3e635; --orange: #fb923c; --red: #f43f5e; --yellow: #facc15;
  --grad: linear-gradient(135deg, #a855f7, #ec4899);
  --grad-hot: linear-gradient(135deg, #f43f5e, #fb923c);
  --radius: 18px;
  --display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--body); -webkit-text-size-adjust: 100%; }
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(45% 40% at 12% 8%, rgba(168, 85, 247, .38), transparent 65%),
    radial-gradient(38% 34% at 88% 12%, rgba(236, 72, 153, .30), transparent 65%),
    radial-gradient(50% 45% at 55% 100%, rgba(34, 211, 238, .18), transparent 65%),
    var(--bg);
}
a { color: var(--cyan); }
button { font: inherit; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0 0 12px; font-family: var(--display); font-weight: 600; letter-spacing: .2px; }
h1 { font-size: 26px; } h2 { font-size: 21px; }
h3 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; font-family: var(--body); font-weight: 800; }
p { margin: 8px 0; }
.muted { color: var(--muted); font-size: 14px; }
.ok { color: var(--lime); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* --- barra superior --- */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: rgba(11, 16, 32, .72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.topbar .logo { font-family: var(--display); font-weight: 700; font-size: 24px; text-decoration: none; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar .spacer { flex: 1; }
.topbar .pill { font-size: 12px; font-weight: 800; color: var(--soft); background: var(--surface2); border: 1px solid var(--border); padding: 4px 10px; border-radius: 999px; letter-spacing: .5px; }
.status { font-size: 13px; font-weight: 700; color: var(--yellow); }

main { max-width: 720px; margin: 0 auto; padding: 16px 16px 130px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: 0 12px 34px rgba(0, 0, 0, .28); }

/* --- portada --- */
.hero-home { text-align: center; padding: 22px 8px 10px; }
.hero-home .big { font-family: var(--display); font-size: 64px; font-weight: 700; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; animation: pop .6s cubic-bezier(.2, 1.4, .4, 1); }
.hero-home p { color: var(--soft); margin: 10px 0 0; font-size: 16px; }

/* --- formularios --- */
label { display: block; font-size: 12px; font-weight: 800; color: var(--muted); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .8px; }
label.check { display: flex; align-items: center; gap: 10px; font-size: 14px; margin-top: 16px; color: var(--soft); text-transform: none; letter-spacing: 0; font-weight: 600; }
input[type=text], input[type=number] { width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border2); background: rgba(0, 0, 0, .28); color: var(--text); font: 600 17px var(--body); outline: none; transition: border-color .15s, box-shadow .15s; }
input::placeholder { color: #6b7399; font-weight: 500; }
input:focus { border-color: var(--p1); box-shadow: 0 0 0 4px rgba(168, 85, 247, .25); }
input:disabled { opacity: .55; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--p2); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 999px; border: 1px solid var(--border2); background: var(--surface2); color: var(--text); cursor: pointer; font-weight: 800; text-decoration: none; white-space: nowrap; transition: transform .1s, filter .15s, background .15s; }
.btn:hover { background: var(--surface3); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--grad); color: #fff; border: 0; box-shadow: 0 8px 24px rgba(236, 72, 153, .35); }
.btn.primary:hover { filter: brightness(1.08); background: var(--grad); }
.btn.danger { background: var(--grad-hot); color: #fff; border: 0; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface2); }
.btn.block { width: 100%; }
.code { font-family: var(--display); font-size: 24px; letter-spacing: 4px; font-weight: 700; color: var(--cyan); }

/* --- chips de categorías --- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--border); font-size: 14px; font-weight: 700; cursor: pointer; user-select: none; transition: background .15s, transform .1s; }
.chip:hover { background: var(--surface3); }
.chip:active { transform: scale(.96); }
.chip.on { background: rgba(168, 85, 247, .22); border-color: rgba(168, 85, 247, .75); color: #ead9ff; }
.chip .x { opacity: .6; font-size: 11px; }

/* --- avatares y jugadores --- */
.av { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; font: 700 12px var(--display); color: #fff; background: hsl(var(--h) 70% 52%); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .22); flex: none; letter-spacing: .5px; }
.av.lg { width: 58px; height: 58px; font-size: 22px; }
.players { display: flex; flex-wrap: wrap; gap: 8px; }
.player { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--border); font-size: 14px; font-weight: 700; }
.player.off { opacity: .5; }
.player .score { color: var(--muted); font-weight: 600; }
.player .host { color: var(--yellow); font-size: 13px; }
.player .kick { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 2px; }
.player .kick:hover { color: var(--red); }

/* --- lista de mesas --- */
.tables .item { display: flex; align-items: center; gap: 12px; padding: 12px; margin-top: 8px; border-radius: 14px; background: rgba(0, 0, 0, .18); border: 1px solid var(--border); }
.tables .grow { flex: 1; min-width: 0; }
.tables .name { font-weight: 800; font-size: 16px; }

/* --- ronda (modo concentración) --- */
body.focus .head-card, body.focus #leave-btn { display: none; }
.hero { display: flex; align-items: center; gap: 20px; margin-bottom: 4px; }
.ring-wrap { position: relative; width: 136px; height: 136px; flex: none; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: rgba(255, 255, 255, .1); stroke-width: 8; }
.ring .prog { fill: none; stroke: url(#ringGrad); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 339.3; transition: stroke-dashoffset .25s linear; }
.ring .prog.low { stroke: var(--red); }
.letter { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 70px/1 var(--display); background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.letter.pop { animation: pop .55s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.hero-side .num { font: 700 46px/1 var(--display); font-variant-numeric: tabular-nums; }
.hero-side .small { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; font-weight: 800; }
.answers label { margin-top: 14px; color: var(--soft); }
.answers input { font-size: 18px; }
.progress { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.progress span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--soft); background: var(--surface2); border: 1px solid var(--border); padding: 3px 10px 3px 3px; border-radius: 999px; }
.progress .av { width: 22px; height: 22px; font-size: 10px; }

.bastabar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(11, 16, 32, .96) 40%); }
.bastabar .btn { display: flex; max-width: 688px; margin: 0 auto; font: 700 28px var(--display); padding: 18px; letter-spacing: 2px; position: relative; }
.bastabar .btn:not(:disabled) { box-shadow: 0 10px 30px rgba(244, 63, 94, .45); }
.bastabar .btn:not(:disabled)::after { content: ''; position: absolute; inset: -6px; border-radius: 999px; background: var(--grad-hot); filter: blur(16px); opacity: .45; z-index: -1; animation: glow 1.2s ease-in-out infinite alternate; }
@keyframes glow { from { opacity: .25; } to { opacity: .7; } }

.overlay { position: fixed; inset: 0; background: rgba(5, 8, 20, .88); display: flex; align-items: center; justify-content: center; flex-direction: column; z-index: 20; text-align: center; padding: 24px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.overlay .big { font: 700 88px/1 var(--display); background: var(--grad-hot); -webkit-background-clip: text; background-clip: text; color: transparent; animation: pop .6s cubic-bezier(.2, 1.4, .4, 1); }
.overlay .sub { font-size: 20px; font-weight: 800; margin-top: 10px; color: var(--text); }

.countdown { background: rgba(5, 8, 20, .92); }
.countdown .cd-round { font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; }
.countdown .cd-num { font: 700 180px/1 var(--display); background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; margin: 8px 0; min-width: 1ch; }
.countdown .cd-num.pop { animation: cdpop .95s ease-out both; }
@keyframes cdpop { 0% { transform: scale(2.2); opacity: 0; } 22% { transform: scale(1); opacity: 1; } 100% { transform: scale(.82); opacity: .75; } }

/* --- revisión --- */
.review .cat { background: rgba(0, 0, 0, .18); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
.review .cat h3 { color: #c4b5fd; margin-bottom: 4px; }
.review .r { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); }
.review .r:first-of-type { border-top: 0; }
.review .r.me { background: rgba(168, 85, 247, .08); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 10px; }
.review .r .who { font-size: 12px; color: var(--muted); display: block; font-weight: 700; }
.review .r .word { font-weight: 800; font-size: 16px; overflow-wrap: anywhere; }
.review .r .word.bad { text-decoration: line-through; color: var(--muted); font-weight: 600; }
.review .r .why { font-size: 12px; color: var(--red); display: block; font-weight: 700; }
.pts { font: 700 20px var(--display); min-width: 34px; text-align: right; }
.pts.p10 { color: var(--lime); } .pts.p5 { color: var(--yellow); } .pts.p0 { color: var(--muted); }
.vote { padding: 6px 11px; border-radius: 999px; border: 1px solid var(--border2); background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 800; white-space: nowrap; }
.vote:hover { background: var(--surface2); }
.vote.on { border-color: var(--red); color: #fda4af; background: rgba(244, 63, 94, .16); }

/* --- final --- */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 6px 0 18px; }
.podium .p { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 31%; min-width: 0; }
.podium .name { font-weight: 800; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .pts2 { color: var(--muted); font-size: 13px; font-weight: 700; }
.podium .block { width: 100%; border-radius: 12px 12px 0 0; background: var(--surface2); display: flex; align-items: flex-end; justify-content: center; font: 700 24px var(--display); padding-bottom: 8px; }
.podium .p1 .block { height: 96px; background: linear-gradient(180deg, rgba(250, 204, 21, .5), rgba(250, 204, 21, .12)); }
.podium .p2 .block { height: 70px; background: linear-gradient(180deg, rgba(203, 213, 225, .42), rgba(203, 213, 225, .1)); }
.podium .p3 .block { height: 54px; background: linear-gradient(180deg, rgba(205, 127, 50, .45), rgba(205, 127, 50, .1)); }
.ranking .r { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 17px; font-weight: 700; }
.ranking .pos { width: 28px; font: 700 20px var(--display); color: var(--muted); }
.ranking .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking .sc { font-family: var(--display); color: var(--cyan); }

/* --- chat --- */
.chat .log { max-height: 180px; overflow: auto; font-size: 14px; margin-bottom: 8px; }
.chat .log div { padding: 3px 0; overflow-wrap: anywhere; }
.chat .log b { color: #c4b5fd; font-weight: 800; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 100px; max-width: 90vw; background: #1a2240; border: 1px solid var(--border2); padding: 12px 18px; border-radius: 14px; z-index: 30; font-size: 14px; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }

@media (max-width: 480px) {
  main { padding: 12px 12px 130px; }
  .card { padding: 14px; }
  .hero-home .big { font-size: 54px; }
  .grid3 { gap: 6px; }
  .ring-wrap { width: 112px; height: 112px; }
  .letter { font-size: 58px; }
  .hero-side .num { font-size: 40px; }
  .review .r { grid-template-columns: 26px 1fr auto; gap: 8px; }
  .av { width: 26px; height: 26px; font-size: 11px; }
}
