/* Fantasmita: noche violeta, fantasma blanco y menta. Con acentos lila y durazno para los avatares. */
:root {
  --noche: #1B1633;
  --noche-2: #2C2354;
  --noche-3: #3B3070;
  --borde: #4A3F86;
  --fantasma: #F4F1FF;
  --apagado: #B9B2E0;
  --suave: #CFC8F2;
  --menta: #7CF0C4;
  --menta-pres: #5CDDAE;
  --menta-sombra: #3FB88C;
  --lila: #C3A6FF;
  --durazno: #FFB38A;
  --error: #FF8A80;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--noche); color: var(--fantasma); font-family: var(--sans); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; background: radial-gradient(120% 45% at 50% 0%, #40337F 0, rgba(64, 51, 127, 0) 70%) no-repeat, var(--noche); }
button, input { font-family: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--menta); outline-offset: 3px; }
a { color: var(--menta); }

.app { max-width: 480px; min-height: 100dvh; margin: 0 auto; display: flex; flex-direction: column; overflow-x: hidden; position: relative; }
.pant { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.cuerpo { flex: 1; min-height: 0; padding: 16px 24px 8px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.pie { flex: none; padding: 12px 24px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.cab { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(18px + env(safe-area-inset-top)) 24px 0; }
.etiqueta { font-size: 13px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--apagado); }
.etiqueta.menta { color: var(--menta); }
.muted { color: var(--apagado); }
.chico { font-size: 14px; }
.centro { text-align: center; }
.t1 { margin: 0; font-family: var(--serif); font-weight: 900; font-size: 56px; line-height: 1; letter-spacing: -1.5px; }
.t2 { margin: 0; font-family: var(--serif); font-weight: 900; font-size: 34px; line-height: 1.05; letter-spacing: -0.8px; overflow-wrap: anywhere; }
.num { font-family: var(--serif); font-weight: 900; line-height: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Botones */
.btn { height: 60px; width: 100%; border: 2.5px solid var(--fantasma); border-radius: 20px; background: transparent; font-size: 20px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; color: var(--fantasma); }
.btn-p { background: var(--menta); border-color: var(--menta); color: var(--noche); box-shadow: 0 5px 0 var(--menta-sombra); }
.btn-p:active:not(:disabled) { background: var(--menta-pres); transform: translateY(5px); box-shadow: none; }
.btn-s:active:not(:disabled) { background: rgba(244, 241, 255, 0.1); }
.btn:disabled { background: var(--noche-2); color: #8C84C4; border-color: var(--noche-3); box-shadow: none; cursor: not-allowed; }
.btn-texto { height: 44px; border: 0; background: transparent; font-size: 16px; font-weight: 700; text-decoration: underline; color: var(--apagado); }
.btn-back { width: 48px; height: 48px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; margin-left: -12px; font-size: 26px; }
.btn-compartir { flex: none; width: 56px; height: 56px; border: 0; border-radius: 18px; background: var(--menta); display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 0 var(--menta-sombra); }
.btn-compartir:active { transform: translateY(4px); box-shadow: none; }
.btn-compartir svg { width: 26px; height: 26px; }

/* Campos */
.campo { width: 100%; height: 56px; border: 2px solid var(--borde); border-radius: 16px; background: var(--noche); padding: 0 16px; font-size: 19px; font-weight: 700; }
.campo:focus { outline: none; border-color: var(--fantasma); box-shadow: 0 0 0 4px rgba(124, 240, 196, 0.55); }
.campo::placeholder { color: var(--apagado); font-weight: 600; }
.campo-wrap { display: flex; flex-direction: column; gap: 6px; }
.codigo { display: flex; gap: 10px; }
.codigo input { width: 100%; min-width: 0; height: 84px; text-align: center; border: 2.5px solid var(--fantasma); border-radius: 18px; background: var(--noche-2); font-family: var(--serif); font-size: 48px; font-weight: 900; padding: 0; text-transform: uppercase; }
.codigo input:focus { outline: none; box-shadow: 0 0 0 4px rgba(124, 240, 196, 0.55); }
/* Opciones numeradas */
.opc { display: flex; align-items: center; gap: 12px; height: 60px; border: 2px solid var(--borde); border-radius: 18px; background: var(--noche-2); padding: 0 16px 0 12px; }
.opc:focus-within { border-color: var(--fantasma); box-shadow: 0 0 0 4px rgba(124, 240, 196, 0.55); }
.opc.lleno { border-color: var(--menta); }
.opc b { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--borde); color: var(--fantasma); font-size: 16px; display: flex; align-items: center; justify-content: center; }
.opc.lleno b { background: var(--menta); color: var(--noche); }
.opc input { flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; font-size: 20px; font-weight: 700; outline: none; }
.opc input::placeholder { color: var(--apagado); font-weight: 600; }
.opc svg { flex: none; width: 22px; height: 22px; display: none; }
.opc.lleno svg { display: block; }

/* Selectores */
.segmentado { display: flex; padding: 3px; border: 2px solid var(--borde); border-radius: 14px; background: var(--noche); }
.segmentado button { width: 52px; height: 36px; border: 0; border-radius: 10px; background: transparent; font-size: 17px; font-weight: 800; }
.segmentado button[aria-pressed="true"] { background: var(--fantasma); color: var(--noche); }
.fila-cfg { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fila-cfg b { font-size: 17px; font-weight: 800; }
.ctrl { display: flex; align-items: center; gap: 14px; }
.ctrl .n { min-width: 24px; text-align: center; font-size: 32px; }
.btn-mm { width: 44px; height: 44px; border: 2px solid var(--borde); border-radius: 14px; background: transparent; font-size: 24px; font-weight: 800; line-height: 1; }
.btn-mm:disabled { color: #6F66A8; cursor: not-allowed; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border: 2px solid var(--borde); border-radius: 999px; background: transparent; font-size: 16px; font-weight: 700; }
.chip[aria-pressed="true"] { background: var(--menta); border-color: var(--menta); color: var(--noche); font-weight: 800; }
.sep { height: 1px; background: var(--noche-3); }

/* Piezas */
.caja { padding: 14px 16px; border-radius: 22px; background: var(--noche-2); display: flex; flex-direction: column; gap: 12px; }
.caja-borde { border: 2px solid var(--noche-3); }
.caja-cod { flex-direction: row; align-items: center; justify-content: space-between; padding: 14px 16px 14px 22px; }
.sala-cod { font-family: var(--serif); font-weight: 900; font-size: 50px; letter-spacing: 0.14em; line-height: 1; }
.caja-tit { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.jugs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 8px; }
.jug { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.jug .nom { font-size: 14px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jug.yo .avatar { box-shadow: 0 0 0 3px var(--menta); }
.avatar { flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--c, var(--lila)); color: var(--noche); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 21px; position: relative; }
.avatar.apagado { opacity: 0.45; }
.insignia { position: absolute; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.insignia svg { width: 12px; height: 12px; }
.insignia.corona { top: -8px; right: 10px; background: #FFE08A; }
.insignia.ok { right: -3px; bottom: -3px; background: var(--menta); border: 2px solid var(--noche-2); width: 20px; height: 20px; }
.av-x { position: absolute; top: -6px; left: 6px; width: 26px; height: 26px; border: 2px solid var(--noche-2); border-radius: 50%; background: var(--borde); font-size: 15px; line-height: 1; color: var(--fantasma); padding: 0; }
.barra { height: 8px; border-radius: 4px; background: var(--noche); overflow: hidden; }
.barra i { display: block; height: 100%; background: var(--menta); border-radius: 4px; transition: width 0.25s; }
.pildora { align-self: flex-start; background: var(--noche-2); border: 2px solid var(--borde); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--lila); }
.espera { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--apagado); text-align: center; }
.puntos { display: inline-flex; gap: 3px; flex: none; }
.puntos i { width: 6px; height: 6px; border-radius: 50%; background: var(--menta); animation: latido 1.2s infinite; }
.puntos i:nth-child(2) { animation-delay: 0.2s; }
.puntos i:nth-child(3) { animation-delay: 0.4s; }
@keyframes latido { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.fantasma-ilu { display: block; }
.pasos { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.pasos li { display: flex; gap: 12px; align-items: flex-start; font-size: 17px; line-height: 1.35; }
.pasos b { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--fantasma); color: var(--noche); font-size: 15px; display: flex; align-items: center; justify-content: center; }

/* Inicio */
.hero { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 40px 28px 0; }
.hero p { margin: 0; text-align: center; font-size: 18px; line-height: 1.4; color: var(--suave); max-width: 300px; }
.halo { position: relative; width: 220px; height: 230px; display: flex; align-items: center; justify-content: center; }
.halo::before { content: ''; position: absolute; inset: 10px 10px 30px; border-radius: 50%; background: radial-gradient(circle, rgba(124, 240, 196, 0.35) 0, rgba(124, 240, 196, 0) 68%); }
.halo svg { position: relative; }
.estrella { position: absolute; border-radius: 50%; }
.mini-pasos { margin-top: 10px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; }
.mini-pasos div { background: var(--noche-2); border-radius: 16px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 13px; font-weight: 700; line-height: 1.25; }
.mini-pasos b { width: 26px; height: 26px; border-radius: 50%; color: var(--noche); font-size: 14px; display: flex; align-items: center; justify-content: center; }

/* El papel de cada jugador */
.papel { position: relative; overflow: hidden; flex: 1; min-height: 340px; width: 100%; border: 3px solid var(--menta); border-radius: 32px; background: linear-gradient(170deg, #4A3F96 0, var(--noche-2) 70%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 28px; text-align: center; box-shadow: 0 0 0 8px rgba(124, 240, 196, 0.12); color: var(--fantasma); }
.papel > * { position: relative; }
.papel .marca { position: absolute; right: -30px; bottom: -34px; opacity: 0.1; }
.papel.oculto { border: 3px dashed #7A6FC4; background: radial-gradient(90% 60% at 50% 40%, var(--noche-3) 0, var(--noche-2) 75%); box-shadow: none; gap: 16px; }
.papel.fantasmita { border: 0; background: linear-gradient(175deg, #FFFFFF 0, #E6E0FF 100%); color: var(--noche); gap: 14px; box-shadow: 0 0 0 8px rgba(244, 241, 255, 0.16), 0 0 60px rgba(124, 240, 196, 0.35); }
.papel .cat { background: var(--noche); border-radius: 999px; padding: 8px 18px; font-size: 14px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--lila); overflow-wrap: anywhere; }
.papel .pre { font-size: 15px; font-weight: 700; color: var(--apagado); }
.papel .palabra { font-family: var(--serif); font-weight: 900; font-size: 56px; line-height: 1.02; letter-spacing: -1.5px; overflow-wrap: anywhere; }
.papel.fantasmita .palabra { font-size: 44px; letter-spacing: -1px; }
.papel .titulo-oculto { font-family: var(--serif); font-weight: 900; font-size: 32px; line-height: 1.05; }
.papel .pista { font-size: 17px; line-height: 1.35; max-width: 270px; color: var(--suave); }
.papel.fantasmita .pista { color: var(--noche-3); }
.papel .aviso { display: flex; align-items: center; gap: 10px; background: rgba(27, 22, 51, 0.7); border-radius: 18px; padding: 12px 16px; font-size: 16px; line-height: 1.3; color: #E4DFFA; text-align: left; max-width: 290px; }
.papel .toque { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; color: var(--menta); }
.papel.fantasmita .toque { color: var(--noche-3); }
.papel.oculto .toque { background: var(--noche); border-radius: 999px; padding: 10px 18px; }
.papel .toque svg { width: 20px; height: 20px; }
.papel .brillo { position: absolute; border-radius: 50%; }

/* Fin de ronda */
.rev-palabra { position: relative; overflow: hidden; border-radius: 28px; border: 3px solid var(--menta); background: linear-gradient(170deg, #4A3F96 0, var(--noche-2) 75%); padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 10px; }
.rev-palabra .grande { font-family: var(--serif); font-weight: 900; font-size: 48px; line-height: 1.02; letter-spacing: -1.2px; overflow-wrap: anywhere; }
.rev-palabra .quien { display: flex; align-items: center; gap: 10px; margin-top: 4px; font-size: 16px; font-weight: 700; color: var(--suave); }
.rev-palabra .quien .avatar { width: 30px; height: 30px; font-size: 14px; }
.rev-fant { border-radius: 28px; background: linear-gradient(175deg, #FFFFFF 0, #E6E0FF 100%); color: var(--noche); padding: 20px 22px; display: flex; align-items: center; gap: 18px; box-shadow: 0 0 40px rgba(124, 240, 196, 0.28); }
.rev-fant .et { font-size: 13px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--borde); }
.rev-fant .grande { font-family: var(--serif); font-weight: 900; font-size: 40px; line-height: 1.02; letter-spacing: -1px; overflow-wrap: anywhere; }
.rev-fant .vos { display: inline-block; align-self: flex-start; margin-top: 4px; background: var(--lila); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 800; }
.rev-fant > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.error { color: var(--error); font-weight: 700; font-size: 15px; min-height: 20px; }
.error:empty { min-height: 0; }
#toasts { position: fixed; left: 0; right: 0; top: calc(12px + env(safe-area-inset-top)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 10; padding: 0 16px; }
.toast { padding: 12px 18px; border-radius: 999px; background: var(--fantasma); color: var(--noche); font-size: 15px; font-weight: 700; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); animation: entra 0.18s ease-out; }
.toast.error { background: var(--error); }
@keyframes entra { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.flota { animation: flota 3.2s ease-in-out infinite; }
@keyframes flota { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .puntos i, .toast, .flota { animation: none; } .barra i { transition: none; } }
