:root {
  --bg: #140b33;
  --bg2: #1f1150;
  --card: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .14);
  --text: #fff;
  --muted: #c9bff0;
  --pink: #ff3d8b;
  --yellow: #ffd23f;
  --green: #2be08f;
  --blue: #4cc9f0;
  --purple: #8b5cff;
  --orange: #ff7a3d;
  --red: #ff4757;
  --r: 22px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(120% 80% at 50% 0%, #2a1470 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 700;
  overflow-x: hidden;
  user-select: none; -webkit-user-select: none;
}
h1, h2, h3, .display { font-family: "Fredoka", "Nunito", system-ui, sans-serif; margin: 0; letter-spacing: .2px; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input { font: inherit; }

/* Fondo animado */
.blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blobs i { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(80px); opacity: .35; animation: float 18s ease-in-out infinite alternate; }
.blobs i:nth-child(1) { background: var(--pink); left: -25vmax; top: -20vmax; }
.blobs i:nth-child(2) { background: var(--purple); right: -30vmax; top: 20vh; animation-delay: -6s; }
.blobs i:nth-child(3) { background: #00b4d8; left: -10vmax; bottom: -35vmax; animation-delay: -12s; opacity: .25; }
@keyframes float { to { transform: translate(8vmax, 6vmax) scale(1.15); } }

#app { width: 100%; max-width: 560px; margin: 0 auto; padding: calc(14px + var(--safe-t)) 16px calc(28px + var(--safe-b)); min-height: 100vh; display: flex; flex-direction: column; }
.screen { animation: enter .35s cubic-bezier(.2, .9, .3, 1.2); flex: 1; display: flex; flex-direction: column; }
@keyframes enter { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* Barra superior */
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.top h2 { font-size: 22px; flex: 1; text-align: center; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.icon-btn:active { transform: scale(.92); }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px 22px; border-radius: 18px; font-family: "Fredoka", sans-serif; font-size: 19px; font-weight: 600;
  background: var(--pink); color: #fff; box-shadow: 0 5px 0 rgba(0, 0, 0, .3); transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
.btn.block { width: 100%; }
.btn.big { padding: 20px 24px; font-size: 23px; border-radius: 22px; }
.btn.yellow { background: var(--yellow); color: #2a1460; }
.btn.green { background: var(--green); color: #063b24; }
.btn.blue { background: var(--blue); color: #08324a; }
.btn.purple { background: var(--purple); }
.btn.orange { background: var(--orange); }
.btn.ghost { background: var(--card); border: 1px solid var(--line); box-shadow: none; }
.btn:disabled { opacity: .4; pointer-events: none; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.row > .btn:not(.big) { padding: 15px 10px; font-size: 17px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; min-height: 16px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* Inicio */
.hero { text-align: center; padding: 6px 0 18px; }
.hero img { width: 128px; height: 128px; border-radius: 32px; box-shadow: 0 14px 44px rgba(255, 61, 139, .5); animation: wobble 2.6s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(-7deg); } 25% { transform: rotate(5deg) scale(1.06); } 50% { transform: rotate(-3deg) scale(.98); } 75% { transform: rotate(7deg) scale(1.04); } }
.logo-text { font-size: clamp(40px, 11.5vw, 58px); font-weight: 700; margin: 14px 0 0; line-height: 1.1; letter-spacing: 1px; white-space: nowrap; }
.logo-text span { display: inline-block; color: var(--c); text-shadow: 0 3px 0 #fff, 0 7px 0 #2a1460, 0 12px 18px rgba(0, 0, 0, .35); transform: rotate(var(--t)); animation: hop 1.8s cubic-bezier(.3, 1.6, .5, 1) infinite; animation-delay: calc(var(--i) * .09s); }
.logo-text span:nth-child(5n+1) { --c: #ffd23f; --t: -8deg; }
.logo-text span:nth-child(5n+2) { --c: #ff3d8b; --t: 6deg; }
.logo-text span:nth-child(5n+3) { --c: #4cf0ff; --t: -4deg; }
.logo-text span:nth-child(5n+4) { --c: #2be08f; --t: 9deg; }
.logo-text span:nth-child(5n+5) { --c: #ff7a3d; --t: -6deg; }
@keyframes hop { 0%, 60%, 100% { transform: rotate(var(--t)) translateY(0); } 30% { transform: rotate(calc(var(--t) * -1)) translateY(-10px) scale(1.08); } }
.hero p { margin: 8px 0 0; color: var(--muted); font-size: 16px; }

.players-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); margin-bottom: 16px; }
.players-bar .faces { display: flex; flex: 1; min-width: 0; overflow: hidden; }
.players-bar .faces .av { margin-left: -8px; border: 2px solid var(--bg2); }
.players-bar .faces .av:first-child { margin-left: 0; }
.players-bar .label { flex: 1; font-size: 15px; color: var(--muted); }

.av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.av.lg { width: 64px; height: 64px; font-size: 34px; }
.av.xl { width: 96px; height: 96px; font-size: 52px; }

.featured {
  position: relative; overflow: hidden; display: block; width: 100%; text-align: left;
  border-radius: 26px; padding: 22px; margin-bottom: 16px; min-height: 130px;
  background: linear-gradient(135deg, #ff3d8b, #ff7a3d 55%, #ffd23f); box-shadow: 0 14px 40px rgba(255, 61, 139, .35);
}
.featured h3 { font-size: 28px; }
.featured p { margin: 6px 0 0; font-size: 15px; max-width: 70%; opacity: .95; }
.featured .emoji { position: absolute; right: 12px; bottom: -6px; font-size: 86px; transform: rotate(12deg); animation: bob 2.4s ease-in-out infinite; }
.featured .go { display: inline-block; margin-top: 12px; background: #fff; color: #c2185b; padding: 7px 14px; border-radius: 999px; font-family: "Fredoka"; font-size: 15px; }
@keyframes bob { 50% { transform: rotate(4deg) translateY(-8px); } }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile {
  position: relative; overflow: hidden; border-radius: 22px; padding: 16px 14px 14px; min-height: 138px; text-align: left;
  display: flex; flex-direction: column; justify-content: flex-end; box-shadow: 0 6px 0 rgba(0, 0, 0, .25);
  transition: transform .1s;
}
.tile:active { transform: scale(.96); }
.tile .emoji { position: absolute; top: 10px; right: 10px; font-size: 42px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .25)); }
.tile h3 { font-size: 19px; line-height: 1.1; overflow-wrap: anywhere; }
.tile p { margin: 4px 0 0; font-size: 12.5px; opacity: .9; line-height: 1.25; }
.tile .badge { position: absolute; top: 12px; left: 12px; font-size: 11px; background: rgba(0, 0, 0, .25); padding: 3px 8px; border-radius: 999px; }
.section-title { font-family: "Fredoka"; font-size: 18px; margin: 4px 2px 10px; color: var(--muted); }
.footer-links { display: flex; gap: 10px; margin-top: 18px; }
.footer-links .btn { flex: 1; font-size: 16px; padding: 13px; }

/* Jugadores */
.player-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); animation: enter .25s; }
.player-row input { flex: 1; min-width: 0; background: transparent; border: 0; color: #fff; font-size: 18px; outline: none; font-weight: 800; }
.player-row .av { cursor: pointer; }
.add-row { display: flex; gap: 10px; margin: 6px 0 14px; }
.add-row input { flex: 1; min-width: 0; padding: 14px 16px; border-radius: 16px; border: 2px dashed var(--line); background: rgba(0, 0, 0, .2); color: #fff; font-size: 17px; outline: none; }
.add-row input:focus { border-color: var(--pink); }
.add-row .btn { padding: 14px 18px; }

/* Cartas */
.card {
  position: relative; border-radius: 28px; padding: 26px 22px; min-height: 230px;
  display: flex; flex-direction: column; justify-content: center; text-align: center;
  background: linear-gradient(160deg, #3a1f8f, #251062); border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35); animation: flip .5s cubic-bezier(.2, .9, .3, 1.25);
}
@keyframes flip { from { transform: perspective(900px) rotateY(80deg) scale(.9); opacity: 0; } }
.card .tag { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); font-family: "Fredoka"; font-size: 13px; letter-spacing: 2px; padding: 5px 12px; border-radius: 999px; background: rgba(255, 255, 255, .18); white-space: nowrap; }
.card .who { font-size: 15px; color: rgba(255, 255, 255, .85); margin: 18px 0 8px; }
.card .text { font-family: "Fredoka"; font-size: clamp(22px, 6vw, 29px); line-height: 1.25; font-weight: 600; }
.card.verdad { background: linear-gradient(160deg, #2196f3, #3d2bd1); }
.card.reto { background: linear-gradient(160deg, #ff3d8b, #b5179e); }
.card.yonunca { background: linear-gradient(160deg, #8b5cff, #5a189a); }
.card.probable { background: linear-gradient(160deg, #ff9f1c, #e8590c); }
.card.prefieres { background: linear-gradient(160deg, #06d6a0, #118ab2); }
.card.castigo { background: linear-gradient(160deg, #ff4757, #c0392b); }
.card.relampago { background: linear-gradient(160deg, #ffd23f, #ff7a3d); color: #2a1460; }
.card.relampago .tag { background: rgba(0, 0, 0, .12); }
.card.relampago .who { color: rgba(42, 20, 96, .8); }
.card.regla { background: linear-gradient(160deg, #3a3a5c, #15152b); border-color: var(--yellow); }
.card.trabalenguas { background: linear-gradient(160deg, #2be08f, #0c7a6a); }
.card .big-emoji { font-size: 60px; margin-bottom: 6px; }

/* Turno */
.turn { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 4px 0 18px; }
.turn .name { font-family: "Fredoka"; font-size: 30px; }
.turn small { display: block; font-size: 14px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { padding: 9px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 15px; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: #fff; color: #2a1460; border-color: #fff; }
.chip .n { background: var(--pink); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; }
.chip.locked { opacity: .55; }

/* Botellita */
.bottle-stage.many .av { width: 30px; height: 30px; font-size: 16px; }
.bottle-stage.many .seat span { font-size: 10px; }
.bottle-stage { --rad: min(33vw, 165px); position: relative; width: calc(var(--rad) * 2 + 90px); height: calc(var(--rad) * 2 + 90px); margin: 4px auto 6px; }
.bottle-stage::before { content: ""; position: absolute; inset: 40px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .08), transparent 70%); border: 2px dashed rgba(255, 255, 255, .15); }
.seat { position: absolute; left: 50%; top: 50%; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 74px; transition: transform .3s; }
.seat span { font-size: 12px; max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: rgba(0, 0, 0, .35); padding: 1px 7px; border-radius: 999px; }
.seat.hit .av { box-shadow: 0 0 0 4px #fff, 0 0 30px 10px var(--yellow); animation: pulse .6s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.18); } }
.bottle { position: absolute; left: 50%; top: 50%; width: calc(var(--rad) * .4); height: calc(var(--rad) * 1.25); margin: calc(var(--rad) * -.625) 0 0 calc(var(--rad) * -.2); cursor: pointer; transition: transform 4.2s cubic-bezier(.12, .7, .14, 1); filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .5)); }
.bottle svg { width: 100%; height: 100%; }
.hint { text-align: center; color: var(--muted); margin: 6px 0 14px; font-size: 16px; }

/* Bomba */
.bomb-wrap { text-align: center; margin: 10px auto; width: 240px; height: 220px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle, rgba(255, 210, 63, .45), rgba(255, 122, 61, .18) 45%, transparent 70%); }
.bomb { font-size: 140px; display: inline-block; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .5)); }
.bomb.ticking { animation: shake var(--spd, 1s) ease-in-out infinite; }
@keyframes shake { 0%, 100% { transform: rotate(-6deg) scale(1); } 50% { transform: rotate(6deg) scale(1.08); } }
.category { font-family: "Fredoka"; font-size: 32px; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 18px; }
.boom-screen { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: radial-gradient(circle, #ffd23f, #ff7a3d 35%, #ff3d00 70%); animation: boomIn .5s ease-out; pointer-events: none; }
.boom-screen div { font-family: "Fredoka"; font-size: 90px; color: #fff; text-shadow: 0 6px 0 #a10000; animation: boomText .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes boomIn { from { opacity: 0; } 30% { opacity: 1; } }
@keyframes boomText { from { transform: scale(.2) rotate(-20deg); } }
.shake-screen { animation: screenShake .5s; }
@keyframes screenShake { 20% { transform: translate(-10px, 6px); } 40% { transform: translate(10px, -8px); } 60% { transform: translate(-8px, -4px); } 80% { transform: translate(6px, 8px); } }

/* Impostor */
.reveal-box { border-radius: 28px; min-height: 260px; display: grid; place-items: center; text-align: center; padding: 24px; background: repeating-linear-gradient(45deg, #2a1460, #2a1460 16px, #31187a 16px, #31187a 32px); border: 2px dashed var(--line); touch-action: none; }
.reveal-box.shown { background: linear-gradient(160deg, #06d6a0, #118ab2); border-style: solid; }
.reveal-box.shown.imp { background: linear-gradient(160deg, #ff4757, #6a0572); }
.reveal-box .word { font-family: "Fredoka"; font-size: 40px; }
.timer { font-family: "Fredoka"; font-size: 64px; text-align: center; font-variant-numeric: tabular-nums; }

/* En la frente */
.frente-play { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: linear-gradient(160deg, #8b5cff, #3d2bd1); padding: 20px; }
.frente-play.ok { background: linear-gradient(160deg, #2be08f, #0c9a5c); }
.frente-play.pass { background: linear-gradient(160deg, #ff7a3d, #ff3d00); }
.frente-play .word { font-family: "Fredoka"; font-size: clamp(42px, 13vw, 90px); line-height: 1.05; font-weight: 700; padding: 0 10px; }
.frente-play .clock { position: absolute; top: calc(18px + var(--safe-t)); font-family: "Fredoka"; font-size: 30px; }
.frente-play .score { position: absolute; top: calc(18px + var(--safe-t)); right: 22px; font-family: "Fredoka"; font-size: 22px; }
.frente-play .zones { position: absolute; inset: 0; display: flex; }
.frente-play .zones button { flex: 1; display: flex; align-items: flex-end; justify-content: center; padding-bottom: calc(26px + var(--safe-b)); font-family: "Fredoka"; font-size: 17px; opacity: .85; }
.frente-play .x { position: absolute; top: calc(14px + var(--safe-t)); left: 14px; z-index: 2; }
.result-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0; }
.result-list span { padding: 6px 12px; border-radius: 999px; font-size: 15px; }
.result-list .y { background: rgba(43, 224, 143, .25); color: #9dffd1; }
.result-list .n { background: rgba(255, 71, 87, .2); color: #ffb3ba; text-decoration: line-through; }

/* Qué prefieres */
.versus { display: flex; flex-direction: column; gap: 0; flex: 1; min-height: 420px; border-radius: 28px; overflow: hidden; position: relative; box-shadow: 0 18px 50px rgba(0, 0, 0, .35); }
.versus button { flex: 1; padding: 22px; font-family: "Fredoka"; font-size: clamp(21px, 5.6vw, 27px); font-weight: 600; line-height: 1.2; transition: flex .35s, filter .3s; }
.versus .a { background: linear-gradient(160deg, #ff3d8b, #c2185b); }
.versus .b { background: linear-gradient(160deg, #4cc9f0, #3d2bd1); }
.versus .or { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 62px; height: 62px; border-radius: 50%; background: #fff; color: #2a1460; display: grid; place-items: center; font-family: "Fredoka"; font-size: 20px; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); pointer-events: none; }
.versus.picked-a .a, .versus.picked-b .b { flex: 2.2; }
.versus.picked-a .b, .versus.picked-b .a { filter: grayscale(.8) brightness(.6); }

/* Ruleta */
.wheel-wrap { position: relative; width: min(84vw, 360px); aspect-ratio: 1; margin: 6px auto 16px; }
.wheel-wrap canvas { width: 100%; height: 100%; transition: transform 5s cubic-bezier(.1, .75, .12, 1); border-radius: 50%; box-shadow: 0 0 0 8px #fff, 0 0 0 14px var(--pink), 0 20px 50px rgba(0, 0, 0, .45); }
.wheel-wrap .pointer { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: 44px; z-index: 2; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .4)); }
.wheel-wrap .hub { position: absolute; inset: 41%; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 30px; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); cursor: pointer; }

/* Marcador y ajustes */
.rank { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.rank .pos { font-family: "Fredoka"; font-size: 22px; width: 30px; text-align: center; }
.rank .nm { flex: 1; font-size: 18px; }
.rank .pts { font-family: "Fredoka"; font-size: 24px; color: var(--yellow); }
.rank .sub { font-size: 12px; color: var(--muted); }
.setting { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.setting .t { flex: 1; }
.setting .t small { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.switch { width: 56px; height: 32px; border-radius: 999px; background: rgba(255, 255, 255, .2); position: relative; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(24px); }
.note { font-size: 14px; color: var(--muted); font-weight: 500; line-height: 1.5; background: var(--card); border-radius: 18px; padding: 16px; border: 1px solid var(--line); }

/* Modal */
.modal-bg { position: fixed; inset: 0; z-index: 40; background: rgba(8, 4, 24, .7); backdrop-filter: blur(6px); display: grid; place-items: end center; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 560px; background: var(--bg2); border-radius: 28px 28px 0 0; padding: 24px 18px calc(22px + var(--safe-b)); border-top: 1px solid var(--line); animation: up .3s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes up { from { transform: translateY(100%); } }
.modal h3 { font-size: 24px; margin-bottom: 8px; text-align: center; }
.modal p { color: var(--muted); text-align: center; margin: 0 0 18px; font-weight: 500; }

.countdown { position: fixed; inset: 0; z-index: 35; display: grid; place-items: center; pointer-events: none; }
.countdown div { font-family: "Fredoka"; font-size: 160px; text-shadow: 0 8px 0 rgba(0, 0, 0, .3); animation: cd .9s ease-out forwards; }
@keyframes cd { from { transform: scale(2.2); opacity: 0; } 30% { transform: scale(1); opacity: 1; } to { transform: scale(.8); opacity: 0; } }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
#toast { position: fixed; left: 50%; bottom: calc(26px + var(--safe-b)); transform: translate(-50%, 140%); opacity: 0; visibility: hidden; background: #fff; color: #2a1460; padding: 12px 18px; border-radius: 999px; font-weight: 800; z-index: 60; transition: transform .3s cubic-bezier(.2, .9, .3, 1.2); box-shadow: 0 10px 30px rgba(0, 0, 0, .3); max-width: 90vw; text-align: center; }
#toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

@media (min-width: 520px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; } }
