/* PuraNota · estilos de la app.
   Los colores, tipografías y componentes vienen del sistema de diseño (design/tokens.css y
   design/components.css). Aquí va solo lo que necesita el sitio en funcionamiento: formularios,
   contenido de las preguntas, paneles, animaciones y las pantallas que no están en el prototipo. */

/* ---------- Base ---------- */
@supports (min-height: 100dvh) {
  .screen { min-height: 100dvh; }
}
[hidden] { display: none !important; }
button { font-family: inherit; -webkit-tap-highlight-color: transparent; }
a { -webkit-tap-highlight-color: transparent; }
button.btn, button.opt, button.chip, button.iconbtn { line-height: inherit; cursor: pointer; }
button.chip, button.iconbtn { border: 0; }
button.iconbtn { font-size: 20px; font-weight: 800; padding: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn:disabled { cursor: not-allowed; }
.btn:disabled:active { transform: none; }
.cargando { margin-top: 38vh; }
.enlace { appearance: none; border: 0; background: none; padding: 8px 4px; font-weight: 800; font-size: 14px; color: var(--muted); text-decoration: underline; cursor: pointer; }

.screen { animation: entra .22s ease-out both; }
.screen.quieta { animation: none; }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes aparece { from { opacity: 0; } to { opacity: 1; } }
@keyframes sube { from { transform: translateY(100%); } to { transform: none; } }
@keyframes rebote { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes sacude { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes cae { from { transform: translateY(-8vh) rotate(0); } to { transform: translateY(108vh) rotate(var(--giro, 360deg)); } }
@keyframes flota { 0% { transform: translate(-50%, 0) scale(.5); opacity: 0; } 15% { transform: translate(-50%, -30px) scale(1.15); opacity: 1; } 100% { transform: translate(-50%, -46vh) scale(1); opacity: 0; } }
@keyframes late { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }

/* ---------- Ingreso ---------- */
.portada { padding: 22px 0 6px; }
.marca { font-size: 54px; font-weight: 700; color: var(--primary); letter-spacing: .5px; text-shadow: 0 3px 0 rgba(14, 159, 110, .16); margin: 4px 0 2px; }
.campo { width: 100%; min-height: 60px; padding: 12px 16px; border-radius: var(--r-btn); border: 2px solid var(--line); background: var(--surface); color: var(--ink); font-family: var(--font-display); font-weight: 500; font-size: 22px; text-align: center; outline: none; box-shadow: inset 0 2px 0 rgba(31, 41, 55, .04); }
.campo:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(20, 184, 196, .18); }
.campo::placeholder { color: #B5AE9F; font-weight: 400; }
.error-campo { color: #B91C1C; }
.nombre-grande { font-size: 24px; margin-top: 12px; overflow-wrap: anywhere; }
.rejilla-avatares { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.rejilla-avatares button { aspect-ratio: 1; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); font-size: 26px; line-height: 1; padding: 0; cursor: pointer; }
.rejilla-avatares button.sel { border-color: var(--primary); background: var(--ok-soft); box-shadow: 0 3px 0 var(--primary); }
.rejilla-colores { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.rejilla-colores button { aspect-ratio: 1; border-radius: 50%; border: 0; background: var(--sw); box-shadow: 0 0 0 2px var(--line); padding: 0; cursor: pointer; }
.rejilla-colores button.sel { box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--primary); }

/* ---------- Inicio y región ---------- */
.topbar .grow > .row { gap: 8px; }
.topbar .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .level { flex: none; white-space: nowrap; }
.pin { -webkit-tap-highlight-color: transparent; }
.pin:active .dot { transform: translateY(2px); }
.pendiente { padding: 12px 14px; gap: 8px; }
.chip.revancha { align-self: center; background: #FFE8CC; color: #9A3412; box-shadow: 0 2px 0 #F5CC99; }
.chip.revancha.sel { box-shadow: 0 2px 0 #F5CC99, 0 0 0 3px var(--gold); }
button.node { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
button.node:active .dot { transform: translateY(3px); }
.node .t { overflow-wrap: anywhere; }

/* Selector de opciones (cantidad de preguntas, modo de juego…) */
.segmento { display: grid; gap: 6px; padding: 6px; border-radius: 18px; background: #F5EEDD; }
.segmento button { min-height: 46px; padding: 6px 8px; border: 0; border-radius: 13px; background: transparent; color: var(--muted); font-family: var(--font-display); font-weight: 600; font-size: 16px; line-height: 1.15; cursor: pointer; }
.segmento button.sel { background: var(--primary); color: var(--on-primary); box-shadow: 0 3px 0 var(--primary-press); }
.arena .segmento { background: rgba(255, 255, 255, .06); box-shadow: 0 0 0 1px var(--line); }

/* ---------- Contenido de las preguntas ---------- */
.q-text { overflow-wrap: anywhere; }
.q-text.media { font-size: 20px; }
.q-text.larga { font-size: 18px; line-height: 1.38; }
.q-text img { max-width: 100%; height: auto; }
.lectura { padding: 14px 16px; }
.contenido { font-size: 17px; line-height: 1.6; overflow-wrap: anywhere; }
.contenido p { margin: 0 0 .7em; }
.contenido p:last-child { margin-bottom: 0; }
.contenido img { max-width: 100%; height: auto; vertical-align: middle; border-radius: 10px; }
.contenido table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: .5em 0 .9em; }
.contenido td, .contenido th { border: 1px solid #CBD5E1; padding: .35em .7em; }
.contenido td p { margin: 0; }
.contenido .tc { text-align: center; }
.contenido ul, .contenido ol { margin: 0 0 .7em 1.4em; padding: 0; }
.contenido sup, .contenido sub, .opt sup, .opt sub, .answer sup, .answer sub, .q-text sup, .q-text sub { line-height: 0; }
.diagrama svg { display: block; width: 100%; max-width: 24rem; height: auto; margin: 12px auto; }
.diagrama svg.max-w-xs { max-width: 20rem; }
.arena .contenido img, .arena .diagrama { background: #fff; border-radius: 12px; }
.arena .diagrama { padding: 4px 8px; margin-top: 8px; }
.arena .contenido td, .arena .contenido th { border-color: var(--line); }
.lectura.plegada .contenido { max-height: 4.9em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 35%, transparent); mask-image: linear-gradient(#000 35%, transparent); }
.lectura.plegada .diagrama { display: none; }
.plegar { appearance: none; display: block; width: 100%; min-height: 40px; margin-top: 6px; padding: 6px 0 0; border: 0; border-top: 2px solid var(--line); background: none; color: var(--primary); font-weight: 800; font-size: 14px; cursor: pointer; }

.opt { cursor: pointer; transition: transform .08s, box-shadow .08s; }
.opt .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.opt img { max-width: 100%; height: auto; vertical-align: middle; }
.opt:not(:disabled):active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.opt:disabled { cursor: default; }
.opt.sacude { animation: sacude .32s; }
.opt .mark { animation: rebote .3s; }

.sheet { max-height: 78vh; overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
.sheet.entra { animation: sube .26s cubic-bezier(.2, .8, .2, 1); }
.tabbar { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 5; }

/* ---------- Capas: panel con velo, avisos y confeti ---------- */
.velo { position: fixed; inset: 0; z-index: 40; background: rgba(31, 41, 55, .46); animation: aparece .16s; }
.arena .velo { background: rgba(5, 6, 20, .66); }
.sheet.modal { z-index: 41; animation: sube .24s cubic-bezier(.2, .8, .2, 1); }
.arena .sheet { box-shadow: 0 -10px 40px rgba(0, 0, 0, .5), 0 0 0 1px var(--line); }
.aviso { position: fixed; left: 50%; bottom: 100px; z-index: 60; transform: translateX(-50%); width: max-content; max-width: min(92vw, 398px); padding: 10px 16px; border-radius: 14px; background: #1F2937; color: #fff; font-weight: 800; font-size: 14px; text-align: center; box-shadow: 0 10px 26px rgba(0, 0, 0, .28); animation: aparece .18s; }
.arena .aviso { background: #F5F7FF; color: #0F1020; }
.lluvia { position: fixed; inset: 0; z-index: 55; pointer-events: none; overflow: hidden; }
.lluvia i { position: absolute; top: 0; width: 10px; height: 16px; border-radius: 3px; animation: cae 1.5s cubic-bezier(.3, .2, .6, 1) both; }

/* ---------- Ayuda: recorrido guiado y pantalla «¿Cómo funciona?» ---------- */
button.pere { border: 0; padding: 0; cursor: pointer; font-family: inherit; }
.pere .duda { position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-2); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 14px; line-height: 1; box-shadow: 0 0 0 2px var(--surface); }
.tour-velo { position: fixed; inset: 0; z-index: 70; touch-action: none; }
.tour-foco { position: fixed; z-index: 71; border-radius: 20px; pointer-events: none; box-shadow: 0 0 0 4px var(--gold), 0 0 0 9999px rgba(31, 41, 55, .68); transition: top .25s, left .25s, width .25s, height .25s; }
.tour-foco.sin-objetivo { box-shadow: 0 0 0 9999px rgba(31, 41, 55, .68); }
.tour-globo { position: fixed; z-index: 72; left: 50%; transform: translateX(-50%); width: min(406px, calc(100vw - 24px)); padding: 14px; border-radius: 22px; background: #fff; color: #1F2937; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 16px 36px rgba(0, 0, 0, .32); transition: top .25s; animation: aparece .2s; }
.tour-globo h3 { font-size: 20px; margin-bottom: 2px; }
.tour-globo p { font-weight: 700; }
.tour-globo .enlace { color: #6B7280; }

.ayuda { padding: 0; }
.ayuda summary { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 14px; cursor: pointer; list-style: none; font-family: var(--font-display); font-weight: 600; font-size: 18px; line-height: 1.2; }
.ayuda summary::-webkit-details-marker { display: none; }
.ayuda summary .ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; line-height: 1; background: #FFF3C4; }
.ayuda summary::after { content: "▾"; flex: none; color: var(--muted); font-size: 18px; transition: transform .15s; }
.ayuda[open] summary::after { transform: rotate(180deg); }
.ayuda .cuerpo { padding: 0 14px 14px; font-size: 16px; }
.ayuda .cuerpo p { margin: 0 0 8px; }
.ayuda .cuerpo p:last-child { margin-bottom: 0; }
.tabla-ayuda { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 8px 12px; margin: 0 0 10px; }
.tabla-ayuda > b { font-family: var(--font-display); font-weight: 600; color: #B45309; white-space: nowrap; }
.tabla-ayuda .stars { font-size: 18px; }
.emoji-ayuda { font-size: 22px; line-height: 1.2; }
.niveles-ayuda { display: flex; flex-wrap: wrap; gap: 6px; }
.niveles-ayuda .chip { background: #FFF3C4; color: #7A5200; box-shadow: none; font-size: 13px; }

/* ---------- Simulación (Jefe final) ---------- */
.chip.reloj { font-variant-numeric: tabular-nums; }
.chip.reloj.apuro { background: var(--bad-soft); color: #B91C1C; box-shadow: 0 2px 0 #F5B5B3; }
.barra-sim { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; max-width: 430px; margin: 0 auto; display: grid; grid-template-columns: 62px 1fr minmax(62px, auto); gap: 10px; padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 2px solid var(--line); }
.barra-sim .btn { min-height: 54px; padding: 10px 14px; font-size: 18px; }
.sim-nav { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.sim-nav button { aspect-ratio: 1; padding: 0; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--muted); font-family: var(--font-display); font-weight: 600; font-size: 15px; cursor: pointer; }
.sim-nav button.hecha { background: var(--primary); border-color: var(--primary); color: #fff; }
.sim-nav button.actual { box-shadow: 0 0 0 3px var(--gold); }

/* ---------- Resultado y revisión ---------- */
.hero { text-align: center; padding: 22px 16px 18px; background: linear-gradient(180deg, #FFFDF6, #FFF1CC); }
.hero .score { font-family: var(--font-display); font-weight: 700; font-size: 56px; line-height: 1; color: var(--primary); }
.hero .stars { animation: rebote .5s .1s both; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 12px; border-radius: 18px; background: var(--surface); box-shadow: 0 2px 0 var(--line); text-align: center; }
.stat b { display: block; font-family: var(--font-display); font-weight: 600; font-size: 24px; }
.stat span { font-size: 12px; font-weight: 800; color: var(--muted); }
.badge > span:last-child { min-width: 0; }
.revision .q-text { font-size: 19px; }
.revision .opt { min-height: 48px; padding: 8px 12px; font-size: 16px; box-shadow: none; cursor: default; }
.revision .opt .key { width: 30px; height: 30px; }
.porque { padding: 10px 12px; border-radius: 14px; background: var(--ok-soft); color: #065F46; font-weight: 700; font-size: 15px; }

/* ---------- Perfil ---------- */
.titulo-seccion { font-size: 18px; }
.avatar-boton { position: relative; appearance: none; border: 0; background: none; padding: 6px; margin: 0 auto; cursor: pointer; }
.avatar-boton .lapiz { position: absolute; right: 0; bottom: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; background: var(--surface); box-shadow: 0 2px 0 var(--line), 0 0 0 2px var(--line); }
.insignias { display: grid; gap: 10px; }
.badge.bloqueada { background: var(--surface); box-shadow: 0 2px 0 var(--line); color: var(--muted); }
.badge.bloqueada .medal { background: #F3F4F6; box-shadow: inset 0 0 0 3px #E5E7EB; filter: grayscale(1); }
.fila { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; color: var(--ink); }
.fila .punto { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; background: var(--c); box-shadow: 0 0 0 3px #fff, 0 3px 0 3px rgba(31, 41, 55, .14); }
.estrellas-fila { flex: none; font-family: var(--font-display); font-weight: 600; color: #B7791F; }
.historial { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.historial .row + .row { padding-top: 12px; border-top: 2px solid var(--line); }
.ajustes { padding: 4px 14px; }
.ajuste { appearance: none; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 0; border: 0; background: none; color: var(--ink); font-size: 16px; text-align: left; cursor: pointer; }
.ajuste + .ajuste { border-top: 2px solid var(--line); }
.palanca { flex: none; position: relative; width: 52px; height: 30px; border-radius: 999px; background: #D8D2C4; transition: background .15s; }
.palanca::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.palanca.on { background: var(--primary); }
.palanca.on::after { transform: translateX(22px); }

/* ---------- Arena ---------- */
.big { min-height: 96px; font-size: 24px; flex-direction: column; gap: 2px; }
.big small { font-family: var(--font-body); font-size: 13px; font-weight: 800; opacity: .8; }
.last { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: rgba(255, 255, 255, .06); box-shadow: 0 0 0 1px var(--line); font-weight: 800; font-size: 14px; }
.chip-jugador { max-width: 62%; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
.arena .enlace { color: var(--muted); }

.fichas { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ficha { appearance: none; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 6px; min-height: 86px; padding: 12px 14px; border: 0; border-radius: 20px; background: var(--c); color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 19px; line-height: 1.15; text-align: left; box-shadow: 0 5px 0 rgba(0, 0, 0, .38); cursor: pointer; opacity: .62; transition: opacity .12s, transform .08s; }
.ficha .ico { font-size: 26px; line-height: 1; }
.ficha small { font-family: var(--font-body); font-size: 12px; font-weight: 800; opacity: .9; }
.ficha.sel { opacity: 1; outline: 4px solid #fff; outline-offset: 2px; }
.ficha:active { transform: translateY(3px); }
.ficha.sorpresa { grid-column: 1 / -1; min-height: 64px; flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; background: linear-gradient(100deg, #7C3AED, #FF4FD8); }
.ficha.sorpresa small { margin-left: auto; }

.code-entrada { position: relative; cursor: text; }
.code-entrada input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; font-size: 16px; text-transform: uppercase; }
.code b.vacia { background: rgba(255, 255, 255, .07); box-shadow: 0 0 0 1px var(--line); }
.code b.activa { box-shadow: 0 0 0 3px var(--primary), 0 0 26px rgba(34, 211, 238, .45); }

.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dots::after { content: "…"; }
.slot { position: relative; }
.slot .name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.ausente .avatar { opacity: .45; }
.slot .sacar { position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .08); color: var(--muted); font-size: 15px; font-weight: 900; cursor: pointer; }
.qr { appearance: none; flex: none; width: 64px; height: 64px; padding: 0; border: 0; border-radius: 12px; background: #fff; box-shadow: 0 0 0 4px #fff; overflow: hidden; cursor: pointer; }
.qr img { display: block; width: 100%; height: 100%; }
.qr-grande { display: block; width: min(72vw, 300px); height: auto; margin: 0 auto; border-radius: 16px; background: #fff; }

.cuenta { align-items: center; justify-content: center; gap: 28px; text-align: center; }
.cuenta .numero { min-height: 190px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 150px; line-height: 1; color: #fff; text-shadow: 0 0 14px #22D3EE, 0 0 40px #22D3EE, 0 0 80px #7C3AED; }
.cuenta .numero.salta { animation: rebote .45s; }

.answer { cursor: pointer; overflow-wrap: anywhere; transition: transform .08s, box-shadow .08s, opacity .15s; }
.answer > span:not(.shape):not(.tag) { max-width: 100%; }
.answer:not(:disabled):active { transform: translateY(5px); box-shadow: 0 0 0 rgba(0, 0, 0, .38); }
.answer:disabled, div.answer { cursor: default; }
.answer.is-dim.mia { opacity: .62; filter: none; outline: 3px dashed rgba(255, 255, 255, .75); outline-offset: 2px; }
.answer.is-correct { animation: rebote .4s; }
.player { min-width: 0; }
.player .name { max-width: 100%; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .pts { animation: rebote .4s; }
.rank .who { min-width: 0; }
.rank .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .bar i { transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.rank .total { text-align: right; }
.rank.sin-puesto .line { grid-template-columns: 44px 1fr auto; }
.podium .who { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .col { min-width: 0; animation: rebote .5s both; }
.podium .p2 { animation-delay: .15s; }
.podium .p3 { animation-delay: .3s; }

.reactions button { width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; font-size: 24px; background: rgba(255, 255, 255, .08); box-shadow: 0 0 0 1px var(--line); cursor: pointer; transition: transform .08s; }
.reactions button:active { transform: scale(1.25); }
.vuela { position: fixed; bottom: 150px; z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 2px; pointer-events: none; animation: flota 1.6s ease-out both; }
.vuela span { font-size: 40px; line-height: 1; }
.vuela small { padding: 2px 8px; border-radius: 999px; background: rgba(15, 16, 32, .8); color: #F5F7FF; font-size: 11px; font-weight: 800; white-space: nowrap; }
.btn.late { animation: late 1s ease-in-out infinite; }

.icono-lamina { font-size: 64px; line-height: 1.1; }
.puntos-lamina { display: flex; justify-content: center; gap: 6px; margin-top: 4px; }
.puntos-lamina i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.puntos-lamina i.on { width: 22px; border-radius: 999px; background: var(--primary); }

/* ---------- Computadora: lectura a la izquierda y pregunta a la derecha ---------- */
@media (min-width: 900px) {
  .screen.con-lectura { max-width: 980px; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); column-gap: 24px; row-gap: 16px; align-content: start; }
  .screen.con-lectura > header, .screen.con-lectura > .row { grid-column: 1 / -1; }
  .screen.con-lectura > .lectura { grid-column: 1; grid-row: span 3; align-self: start; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
  .screen.con-lectura > .q-text, .screen.con-lectura > .stack { grid-column: 2; }
  .screen.con-lectura .plegar { display: none; }
  .screen.con-lectura ~ .sheet, .screen.con-lectura ~ .barra-sim { max-width: 980px; }
}

@media (prefers-reduced-motion: reduce) {
  .lluvia, .vuela { display: none; }
}
