/* Chispazo — estilos propios. Paleta: tinta, crema, coral, ámbar, turquesa, rosa. */
:root {
  --tinta: #14213D;
  --tinta-2: #1D2F57;
  --tinta-3: #2A3F6D;
  --crema: #FFF6E5;
  --crema-2: #F4E7CC;
  --coral: #FF5A4F;
  --ambar: #FFB000;
  --turquesa: #10B5A5;
  --rosa: #E8458B;
  --ok: #2BD576;
  --mal: #FF5A4F;
  --radio: 18px;
  --sombra: 0 6px 0 rgba(0, 0, 0, .28);
  --f-titulo: 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  --f-texto: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--tinta); color: var(--crema); font-family: var(--f-texto); font-size: 17px; line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  background-image: radial-gradient(circle at 15% 10%, rgba(255, 90, 79, .16), transparent 38%), radial-gradient(circle at 90% 90%, rgba(16, 181, 165, .16), transparent 40%);
  background-attachment: fixed;
}
h1, h2, h3 { font-family: var(--f-titulo); line-height: 1.1; margin: 0 0 .4em; letter-spacing: .01em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); }
a { color: var(--ambar); }
[hidden] { display: none !important; }
.oculto-visual { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.contenedor { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.estrecho { max-width: 460px; }

/* Marca */
.marca { display: inline-flex; align-items: center; gap: .5rem; font-family: var(--f-titulo); font-weight: 800; font-size: 1.6rem; color: var(--crema); text-decoration: none; }
.marca svg { width: 2rem; height: 2rem; }
.marca-grande { font-size: clamp(2.6rem, 9vw, 4.4rem); }
.marca-grande svg { width: 1em; height: 1em; }
.lema { color: var(--crema-2); opacity: .85; margin-top: 0; }

.barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; flex-wrap: wrap; }
.barra nav { display: flex; gap: 8px; flex-wrap: wrap; }

/* Botones */
.btn {
  font-family: var(--f-titulo); font-weight: 700; font-size: 1.15rem; border: 0; border-radius: 14px; padding: .7em 1.3em; cursor: pointer;
  background: var(--ambar); color: var(--tinta); box-shadow: 0 4px 0 rgba(0, 0, 0, .3); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  transition: transform .08s, box-shadow .08s, filter .15s; min-height: 48px;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .opcion:focus-visible { outline: 3px solid var(--crema); outline-offset: 2px; }
.btn-coral { background: var(--coral); color: #fff; }
.btn-turquesa { background: var(--turquesa); color: var(--tinta); }
.btn-suave { background: var(--tinta-3); color: var(--crema); }
.btn-peque { font-size: .95rem; padding: .45em .9em; min-height: 38px; border-radius: 10px; box-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.btn-enorme { font-size: clamp(1.4rem, 3vw, 2rem); padding: .6em 1.6em; }
.btn-bloque { display: flex; width: 100%; }

/* Campos */
label { display: block; font-weight: 600; margin: 0 0 .3em; }
input[type=text], input[type=number], input[type=url], textarea, select {
  width: 100%; font: inherit; color: var(--tinta); background: var(--crema); border: 3px solid transparent; border-radius: 12px; padding: .65em .8em; min-height: 48px;
}
textarea { resize: vertical; min-height: 90px; }
input::placeholder, textarea::placeholder { color: #6b7490; }
.campo { margin-bottom: 14px; }
.ayuda { font-size: .9rem; color: var(--crema-2); opacity: .8; margin: .3em 0 0; }
.error { background: rgba(255, 90, 79, .18); border: 2px solid var(--coral); border-radius: 12px; padding: .6em .9em; margin: 10px 0; }
.aviso { background: rgba(255, 176, 0, .15); border: 2px solid var(--ambar); border-radius: 12px; padding: .6em .9em; margin: 10px 0; }

.tarjeta { background: var(--tinta-2); border-radius: var(--radio); padding: 20px; box-shadow: var(--sombra); }
.tarjeta + .tarjeta { margin-top: 16px; }
.fila { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.fila-sep { justify-content: space-between; }
.cuadricula { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.chip { display: inline-block; background: var(--tinta-3); border-radius: 99px; padding: .15em .8em; font-size: .9rem; }

/* Formas y colores de respuesta */
.forma { width: 1.6em; height: 1.6em; fill: currentColor; flex: none; }
.o0 { background: var(--coral); color: #fff; }
.o1 { background: var(--ambar); color: var(--tinta); }
.o2 { background: var(--turquesa); color: var(--tinta); }
.o3 { background: var(--rosa); color: #fff; }

.opcion {
  display: flex; align-items: center; gap: .7em; border: 0; border-radius: 16px; padding: .8em 1em; font: inherit; font-family: var(--f-titulo); font-weight: 700;
  font-size: clamp(1.1rem, 2.4vw, 1.7rem); text-align: left; cursor: pointer; box-shadow: 0 5px 0 rgba(0, 0, 0, .3); min-height: 64px; width: 100%;
}
.opcion .forma { width: 1.5em; height: 1.5em; }
.opcion span { overflow-wrap: anywhere; }
button.opcion:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.opcion.apagada { opacity: .28; filter: grayscale(.6); }
.opcion.correcta { outline: 5px solid var(--ok); outline-offset: 2px; }

/* Cuenta atrás */
.reloj { position: relative; width: 84px; height: 84px; flex: none; }
.reloj svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.reloj circle { fill: none; stroke-width: 10; }
.reloj .fondo { stroke: var(--tinta-3); }
.reloj .avance { stroke: var(--ambar); stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.reloj b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-titulo); font-size: 1.9rem; }
.barra-tiempo { height: 12px; background: var(--tinta-3); border-radius: 99px; overflow: hidden; }
.barra-tiempo i { display: block; height: 100%; background: var(--ambar); width: 100%; transition: width .25s linear; }

/* ---------- Jugador (móvil) ---------- */
.movil { min-height: 100dvh; display: flex; flex-direction: column; padding: 16px; max-width: 560px; margin: 0 auto; }
.movil main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.movil .centro { text-align: center; }
.pin-input { text-align: center; font-family: var(--f-titulo); font-size: 2.2rem; letter-spacing: .25em; font-weight: 800; }
.grid-opciones { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex: 1; align-content: stretch; }
.grid-opciones .opcion { flex-direction: column; justify-content: center; text-align: center; min-height: 120px; font-size: 1.15rem; }
.grid-opciones .opcion .forma { width: 2.6em; height: 2.6em; }
.grid-opciones.dos { grid-template-columns: 1fr; }
.estado-grande { font-family: var(--f-titulo); font-size: clamp(2rem, 9vw, 3rem); font-weight: 800; }
.resultado-ok { color: var(--ok); }
.resultado-mal { color: var(--coral); }
.puntos-pop { font-family: var(--f-titulo); font-size: 2.4rem; font-weight: 800; color: var(--ambar); }
.punto { animation: pulso 1.4s ease-in-out infinite; }
@keyframes pulso { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.cabecera-jug { display: flex; justify-content: space-between; align-items: center; padding: 4px 0 10px; font-weight: 700; gap: 10px; }
.cabecera-jug span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Pantalla grande (presentador) ---------- */
.escena { min-height: 100dvh; display: flex; flex-direction: column; padding: 20px clamp(16px, 4vw, 48px); }
.escena > main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.pin-gigante { font-family: var(--f-titulo); font-weight: 800; font-size: clamp(4rem, 14vw, 9.5rem); letter-spacing: .08em; line-height: 1; color: var(--ambar); text-shadow: 0 6px 0 rgba(0, 0, 0, .3); }
.sala { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(260px, 1.3fr); gap: 28px; align-items: center; }
.qr { background: var(--crema); border-radius: 22px; padding: 12px; width: min(100%, 340px); aspect-ratio: 1; display: grid; place-items: center; }
.qr img, .qr svg { width: 100%; height: 100%; display: block; }
.url-unirse { font-size: clamp(1.1rem, 2.4vw, 1.8rem); }
.url-unirse b { color: var(--crema); }
.jugadores { display: flex; flex-wrap: wrap; gap: 8px; max-height: 32vh; overflow: auto; padding: 4px; }
.jugador-chip { background: var(--tinta-3); padding: .35em .9em; border-radius: 99px; font-family: var(--f-titulo); font-weight: 700; font-size: 1.15rem; display: inline-flex; align-items: center; gap: .4em; animation: entra .3s ease-out; }
.jugador-chip.fuera { opacity: .45; }
.jugador-chip button { background: none; border: 0; color: var(--crema); cursor: pointer; font-size: 1rem; opacity: .6; padding: 0 2px; }
@keyframes entra { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.enunciado { font-family: var(--f-titulo); font-weight: 800; font-size: clamp(1.6rem, 4.2vw, 3.2rem); text-align: center; background: var(--crema); color: var(--tinta); border-radius: 22px; padding: .6em .9em; box-shadow: var(--sombra); overflow-wrap: anywhere; }
.imagen-pregunta { max-height: 34vh; max-width: 100%; margin: 0 auto; border-radius: 16px; display: block; object-fit: contain; }
.grid-host { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-host .opcion { min-height: 96px; cursor: default; }
.cabecera-pregunta { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.contador-resp { font-family: var(--f-titulo); font-size: 1.6rem; font-weight: 800; }
.barras { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: end; height: 26vh; min-height: 140px; }
.barras.n2 { grid-template-columns: repeat(2, 1fr); } .barras.n3 { grid-template-columns: repeat(3, 1fr); }
.barra-v { border-radius: 14px 14px 0 0; display: flex; align-items: flex-start; justify-content: center; min-height: 34px; font-family: var(--f-titulo); font-weight: 800; font-size: 1.8rem; padding-top: 4px; transition: height .5s; }
.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: pos; }
.ranking li { display: flex; align-items: center; gap: 14px; background: var(--tinta-2); border-radius: 16px; padding: .6em 1em; font-family: var(--f-titulo); font-weight: 700; font-size: clamp(1.2rem, 3vw, 2rem); box-shadow: var(--sombra); animation: entra .35s ease-out; }
.ranking .pos { width: 1.6em; text-align: center; color: var(--ambar); font-weight: 800; }
.ranking .nom { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking .delta { color: var(--ok); font-size: .7em; }
.podio { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; align-items: end; max-width: 900px; margin: 0 auto; width: 100%; }
.podio .puesto { text-align: center; }
.podio .nombre { font-family: var(--f-titulo); font-weight: 800; font-size: clamp(1.2rem, 3.4vw, 2.2rem); overflow-wrap: anywhere; }
.podio .pts { opacity: .85; font-weight: 600; margin-bottom: 6px; }
.podio .peana { border-radius: 16px 16px 0 0; display: grid; place-items: start center; padding-top: 10px; font-family: var(--f-titulo); font-weight: 800; font-size: 3rem; color: var(--tinta); }
.podio .p1 .peana { background: var(--ambar); height: 240px; } .podio .p2 .peana { background: #CDD5E5; height: 170px; } .podio .p3 .peana { background: #E0925B; height: 120px; }
.podio .p2 { order: 1; } .podio .p1 { order: 2; } .podio .p3 { order: 3; }
.confeti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confeti i { position: absolute; top: -20px; width: 10px; height: 16px; opacity: .9; animation: cae linear forwards; }
@keyframes cae { to { transform: translateY(110vh) rotate(720deg); } }
.pie-host { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 14px; }
.tabla { width: 100%; border-collapse: collapse; }
.tabla th, .tabla td { text-align: left; padding: .45em .6em; border-bottom: 1px solid var(--tinta-3); }
.tabla th { font-family: var(--f-titulo); color: var(--ambar); }

/* ---------- Editor ---------- */
.editor-pregunta { border-left: 8px solid var(--tinta-3); }
.editor-pregunta h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.num { background: var(--ambar); color: var(--tinta); border-radius: 10px; padding: 0 .55em; }
.fila-opcion { display: grid; grid-template-columns: 48px 1fr 48px; gap: 8px; align-items: center; margin-bottom: 8px; }
.fila-opcion .insignia { height: 48px; border-radius: 12px; display: grid; place-items: center; }
.fila-opcion .marca-ok { display: grid; place-items: center; height: 48px; cursor: pointer; background: var(--tinta-3); border-radius: 12px; border: 3px solid transparent; }
.fila-opcion .marca-ok input { width: 22px; height: 22px; accent-color: var(--ok); }
.fila-opcion .marca-ok:has(input:checked) { border-color: var(--ok); background: rgba(43, 213, 118, .22); }
.herramientas { display: flex; gap: 8px; flex-wrap: wrap; }
.modal { position: fixed; inset: 0; background: rgba(8, 14, 30, .82); display: grid; place-items: center; padding: 16px; z-index: 20; overflow: auto; }
.modal > div { width: min(100%, 900px); }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--crema); color: var(--tinta); padding: .7em 1.2em; border-radius: 99px; font-weight: 700; z-index: 30; box-shadow: var(--sombra); max-width: 92vw; }

@media (max-width: 760px) {
  .sala { grid-template-columns: 1fr; text-align: center; }
  .sala .qr { margin: 0 auto; }
  .jugadores { justify-content: center; }
  .grid-host { grid-template-columns: 1fr; }
  .podio .peana { font-size: 2rem; }
  .podio .p1 .peana { height: 150px; } .podio .p2 .peana { height: 110px; } .podio .p3 .peana { height: 80px; }
  .fila-opcion { grid-template-columns: 40px 1fr 44px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
