/* Semilla — estilos propios. Paleta: bosque, pergamino, terracota, dorado, oliva, azul lino. */
:root {
  --tinta: #1E2A22;
  --tinta-2: #2A3A2F;
  --tinta-3: #3B4F40;
  --crema: #F7F0DF;
  --crema-2: #E9DDBF;
  --coral: #B8502F;
  --ambar: #E0A93B;
  --turquesa: #8FB04A;
  --rosa: #3F6F94;
  --ok: #2BD576;
  --mal: #E07A5A;
  --radio: 18px;
  --sombra: 0 6px 0 rgba(0, 0, 0, .28);
  --f-titulo: 'Fraunces', Georgia, 'Times New Roman', 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% 8%, rgba(224, 169, 59, .16), transparent 38%), radial-gradient(circle at 90% 92%, rgba(143, 176, 74, .15), 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; }
.marca-samy { font-style: normal; font-weight: 700; font-size: .55em; letter-spacing: .14em; color: var(--ambar); margin-right: .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(184, 80, 47, .25); border: 2px solid var(--coral); border-radius: 12px; padding: .6em .9em; margin: 10px 0; }
.aviso { background: rgba(224, 169, 59, .16); 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: #1E2A22; }
.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; }
.enunciado-movil { font-family: var(--f-titulo); font-weight: 800; font-size: 1.35rem; line-height: 1.2; text-align: center; margin: 0; background: var(--crema); color: var(--tinta); border-radius: 16px; padding: .6em .8em; overflow-wrap: anywhere; box-shadow: var(--sombra); }
.enunciado-movil:empty { display: none; }
.grid-opciones .opcion { min-height: 96px; }
.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(3rem, 9.5vw, 8rem); letter-spacing: .04em; overflow-wrap: anywhere; 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: flex; justify-content: center; gap: 14px; align-items: flex-end; max-width: 900px; margin: 0 auto; width: 100%; }
.podio .puesto { text-align: center; flex: 1 1 0; max-width: 290px; min-width: 0; }
.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); }

.caja-ensenanza { background: var(--crema); color: var(--tinta); border-radius: 18px; padding: .9em 1.2em; box-shadow: var(--sombra); display: flex; gap: 14px; align-items: flex-start; }
.caja-ensenanza .libro { font-size: 2rem; line-height: 1; }
.caja-ensenanza .cita { font-family: var(--f-titulo); font-weight: 800; font-size: clamp(1.1rem, 2.4vw, 1.7rem); margin: 0 0 .15em; color: var(--coral); }
.caja-ensenanza .ens { margin: 0; font-size: clamp(1rem, 2vw, 1.45rem); line-height: 1.35; }
.ensenanza-movil { background: var(--crema); color: var(--tinta); border-radius: 16px; padding: .8em 1em; text-align: left; box-shadow: var(--sombra); width: 100%; }
.ensenanza-movil .cita { font-family: var(--f-titulo); font-weight: 800; color: var(--coral); margin: 0 0 .2em; }
.ensenanza-movil .ens { margin: 0; font-size: 1rem; }

.cuadricula > .tarjeta + .tarjeta { margin-top: 0; }
.portada { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 12px; margin: -4px 0 12px;
  background: linear-gradient(100deg, var(--tinta-3) 30%, #4d6453 50%, var(--tinta-3) 70%) 0 0 / 220% 100%; animation: brillo 1.6s linear infinite; }
@keyframes brillo { to { background-position: -220% 0; } }
@media (prefers-reduced-motion: reduce) { .portada { animation: none; } }

/* ---------- Catálogo de plantillas: filtros y tarjetas compactas ---------- */
.filtros { display: grid; gap: 10px; margin: 6px 0 14px; position: sticky; top: 0; z-index: 5; padding: 10px 0 8px; background: linear-gradient(var(--tinta) 78%, transparent); }
.buscador { width: 100%; font: inherit; color: var(--tinta); background: var(--crema); border: 3px solid transparent; border-radius: 12px; padding: .55em .9em; min-height: 46px; }
.buscador:focus-visible { outline: 3px solid var(--ambar); outline-offset: 2px; }
.chips-tema { display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip-filtro { flex: none; font: inherit; font-size: .92rem; font-weight: 600; color: var(--crema); background: var(--tinta-3); border: 2px solid transparent; border-radius: 99px; padding: .3em .9em; cursor: pointer; min-height: 38px; }
.chip-filtro:hover { background: #4a6050; }
.chip-filtro.activo { background: var(--ambar); color: var(--tinta); }
.chip-filtro:focus-visible { outline: 3px solid var(--crema); outline-offset: 2px; }
.cuenta-filtro { margin: 0; min-height: 1.2em; }
@media (min-width: 700px) {
  .filtros { position: static; background: none; padding: 0; }
  .chips-tema { flex-wrap: wrap; overflow: visible; }
}
.cuadricula-plantillas { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.cuadricula-plantillas .titulo-tema { grid-column: 1 / -1; margin: 18px 0 0; color: var(--ambar); font-size: 1.25rem; }
.tarjeta-plantilla { display: flex; flex-direction: column; padding: 14px; }
.tarjeta-plantilla .portada { aspect-ratio: 16 / 9; margin: 0 0 10px; }
.tarjeta-plantilla h2, .tarjeta-plantilla h3 { font-size: 1.25rem; line-height: 1.15; margin: 0 0 6px; }
.tarjeta-plantilla .desc { margin: 0 0 8px; font-size: .95rem; color: var(--crema-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tarjeta-plantilla .chips-linea { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.tarjeta-plantilla .chip { font-size: .82rem; padding: .1em .65em; }
.acciones-tarjeta { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.acciones-tarjeta > :first-child:not(:only-child) { grid-column: 1 / -1; }
.acciones-tarjeta > :only-child { grid-column: 1 / -1; }

/* Fondo con la imagen de la plantilla en la pantalla grande */
.escena.con-portada { position: relative; isolation: isolate; }
.escena.con-portada::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(rgba(30, 42, 34, .76), rgba(30, 42, 34, .9)), var(--portada) center / cover no-repeat; }

/* ---------- 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; } }
