/* Las elecciones para niños: colores alegres, letra grande y animaciones sencillas.
   Los partidos son frutas inventadas con colores que no se parecen a los de los partidos reales. */
.ninos { --amarillo: #f2c200; font-size: 1.05rem; }
.ninos .n-portada { margin-bottom: 18px; }
.ninos h1 small { display: block; }
.n-indice { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.n-indice a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px;
  background: var(--tarjeta); border: 2px solid var(--linea); color: var(--tinta); text-decoration: none; font-weight: 700; font-size: .95rem; }
.n-indice a:hover { border-color: var(--amarillo); }
.n-indice span { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--amarillo); color: #1d1d1f; font-size: .9rem; }

.n-paso { border-top: 6px solid var(--amarillo); scroll-margin-top: 12px; }
.n-paso h2 { display: flex; align-items: center; gap: 12px; font-size: 1.45rem; }
.n-num { display: inline-grid; place-items: center; min-width: 44px; height: 44px; border-radius: 50%; background: var(--amarillo); color: #1d1d1f; font-size: 1.3rem; font-weight: 800; }
.n-paso p { line-height: 1.65; }
.n-pregunta { font-weight: 800; font-size: 1.1rem; margin-top: 18px; }
.n-ganador { font-weight: 800; font-size: 1.15rem; min-height: 1.6em; }

.n-boton { font: inherit; font-weight: 800; font-size: 1.05rem; padding: 12px 20px; border-radius: 14px; border: 0; cursor: pointer;
  background: var(--amarillo); color: #1d1d1f; box-shadow: 0 4px 0 #b58f00; transition: transform .1s; }
.n-boton:active { transform: translateY(3px); box-shadow: 0 1px 0 #b58f00; }
.n-boton:disabled { opacity: .5; cursor: default; }
.n-secundario { background: var(--raya); box-shadow: 0 4px 0 var(--linea); color: var(--tinta); }

/* 1. Excursión */
.n-excursion { display: flex; gap: 14px; flex-wrap: wrap; margin: 10px 0 14px; }
.n-boton-voto { font: inherit; font-weight: 800; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 24px;
  border-radius: 18px; border: 3px solid var(--linea); background: var(--tarjeta); color: var(--tinta); cursor: pointer; min-width: 150px; }
.n-boton-voto span { font-size: 2.6rem; transition: transform .2s; }
.n-boton-voto:hover { border-color: var(--amarillo); }
.n-boton-voto.salta span { transform: scale(1.35) rotate(-8deg); }
.n-marcador > div { display: grid; grid-template-columns: 120px 1fr 40px; gap: 10px; align-items: center; margin: 6px 0; font-weight: 700; }
.n-barra { height: 22px; background: var(--raya); border-radius: 11px; overflow: hidden; }
.n-barra i { display: block; height: 100%; width: 0; background: var(--amarillo); border-radius: 11px; transition: width .4s cubic-bezier(.3,1.6,.6,1); }
#n-b-monte { background: #7cb87c; }

/* 2. Partidos */
.n-frutas { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 14px 0; }
.n-fruta { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 16px 12px; border-radius: 18px;
  background: color-mix(in srgb, var(--f) 16%, var(--tarjeta)); border: 3px solid var(--f); }
.n-fruta span { font-size: .95rem; }
.n-emoji { font-size: 3rem !important; animation: n-bota 2.4s ease-in-out infinite; }
.n-fruta:nth-child(2) .n-emoji { animation-delay: .3s; }
.n-fruta:nth-child(3) .n-emoji { animation-delay: .6s; }
.n-fruta:nth-child(4) .n-emoji { animation-delay: .9s; }
@keyframes n-bota { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* 3. La urna */
.n-papeletas { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0 4px; }
.n-papeletas button { font-size: 2.2rem; width: 76px; height: 92px; border-radius: 8px; cursor: pointer; background: #fff;
  border: 3px solid var(--f); box-shadow: 0 3px 0 var(--f); transition: transform .15s; }
.n-papeletas button:hover { transform: translateY(-4px) rotate(-3deg); }
.n-papeletas button:disabled { opacity: .5; cursor: default; transform: none; }
.n-escena { position: relative; height: 290px; max-width: 420px; margin: 10px auto 0; }
.n-sobre { position: absolute; left: 50%; top: 0; width: 96px; height: 64px; margin-left: -48px; background: #fff; border: 3px solid #c9b48a;
  border-radius: 6px; display: grid; place-items: center; font-size: 1.6rem; opacity: 0; z-index: 2;
  transition: transform .7s cubic-bezier(.5,0,.5,1), opacity .3s; }
.n-sobre::before { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, transparent 49%, #c9b48a 50%, transparent 52%),
  linear-gradient(20deg, transparent 49%, #c9b48a 50%, transparent 52%); opacity: .6; }
.n-sobre.visible { opacity: 1; }
.n-sobre.cae { transform: translateY(150px) scale(.55); opacity: 0; transition: transform .8s cubic-bezier(.6,0,.9,.6), opacity .2s .65s; }
.n-urnacaja { position: absolute; left: 50%; bottom: 0; width: 240px; height: 160px; margin-left: -120px; border-radius: 10px;
  background: rgba(160, 205, 235, .28); border: 4px solid #7fb3d5; overflow: hidden; }
.n-ranura { position: absolute; top: -4px; left: 50%; width: 110px; height: 12px; margin-left: -55px; background: #4f7f9f; border-radius: 0 0 6px 6px; }
.n-dentro { position: absolute; inset: auto 6px 4px 6px; display: flex; flex-wrap: wrap-reverse; gap: 2px; justify-content: center; }
.n-dentro i { display: block; width: 26px; height: 17px; background: #fff; border: 2px solid #c9b48a; border-radius: 3px; transform: rotate(var(--r)); }
.n-contador { text-align: center; font-weight: 700; }

/* 4. Recuento */
.n-tablero > div { display: grid; grid-template-columns: 44px 1fr 44px; gap: 10px; align-items: center; margin: 8px 0; font-size: 1.6rem; }
.n-tablero b { font-size: 1.3rem; text-align: right; }
.n-palotes { display: flex; flex-wrap: wrap; gap: 3px; min-height: 30px; padding: 4px; border-radius: 8px; background: var(--raya); }
.n-palotes i { display: block; width: 18px; height: 22px; border-radius: 4px; background: var(--f); animation: n-aparece .3s ease-out; }
@keyframes n-aparece { from { transform: scale(0) translateY(-20px); } to { transform: scale(1) translateY(0); } }

/* 5. d'Hondt */
.n-dhondt td, .n-dhondt th { font-size: 1rem; }
.n-dhondt td.n { font-variant-numeric: tabular-nums; transition: background .3s; }
.n-dhondt td.gana { background: var(--amarillo); color: #1d1d1f; font-weight: 800; border-radius: 6px; animation: n-pulso .6s; }
.n-dhondt td.siguiente { outline: 3px dashed var(--amarillo); outline-offset: -3px; }
.n-asientos { display: flex; gap: 4px; min-height: 30px; }
.n-asientos i { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--f); font-style: normal; font-size: 1rem;
  animation: n-vuela .6s cubic-bezier(.3,1.5,.6,1); }
@keyframes n-vuela { from { transform: translate(-120px, -40px) scale(.2); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes n-pulso { 50% { transform: scale(1.15); } }
.n-explica { background: color-mix(in srgb, var(--amarillo) 18%, var(--tarjeta)); border-radius: 12px; padding: 12px 16px; font-weight: 600; }

/* 6. Congreso */
.n-congreso { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: center; }
.h-ninos { width: 100%; height: auto; display: block; }
.h-ninos circle { fill: var(--linea); }
.n-hemiciclo.lleno .h-ninos circle { animation: n-escano .25s ease-out both; animation-delay: calc(var(--i) * 6ms); }
@keyframes n-escano { from { fill: var(--linea); transform: scale(0); transform-origin: center; transform-box: fill-box; } to { fill: var(--amarillo); } }
.n-hemiciclo.lleno .h-ninos circle { fill: var(--amarillo); }
@media (max-width: 700px) { .n-congreso { grid-template-columns: 1fr; } }

/* Juego */
.n-juego-filas { display: grid; gap: 10px; margin: 14px 0; }
.n-jfila { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px; border-radius: 14px;
  background: color-mix(in srgb, var(--f) 14%, var(--tarjeta)); border: 2px solid var(--f); }
.n-jfila .n-emoji2 { font-size: 2rem; text-align: center; }
.n-jfila input[type=text] { font: inherit; font-weight: 700; width: 100%; padding: 8px 10px; border: 1px solid var(--linea); border-radius: 8px; background: var(--tarjeta); color: var(--tinta); }
.n-cuenta { display: flex; align-items: center; gap: 6px; }
.n-cuenta button { font: inherit; font-size: 1.4rem; font-weight: 800; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; background: var(--f); color: #1d1d1f; }
.n-cuenta input { font: inherit; font-weight: 800; font-size: 1.2rem; width: 3.2em; text-align: center; padding: 6px 2px; border: 1px solid var(--linea); border-radius: 8px; background: var(--tarjeta); color: var(--tinta); }
.n-juego-escanos { font-weight: 700; display: inline-flex; gap: 8px; align-items: center; }
.n-juego-escanos select { font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--linea); background: var(--tarjeta); color: var(--tinta); }
.n-juego-res { margin-top: 16px; }
.n-boton-grande { font-size: 1.15rem; padding: 14px 24px; }
.n-pasos-juego { padding-left: 1.4em; font-weight: 700; }
.n-pasos-juego li { margin: 8px 0; }
.n-res-tabla { margin: 10px 0 16px; }
.n-juego-res .n-res-fila { display: grid; grid-template-columns: minmax(0, 190px) minmax(0, 1fr) auto; gap: 6px 12px; align-items: center;
  margin: 8px 0; font-weight: 700; padding-bottom: 8px; border-bottom: 1px solid var(--linea); }
.n-res-fila .n-asientos { grid-column: 2 / -1; flex-wrap: wrap; }
.n-res-barra { height: 22px; background: var(--raya); border-radius: 11px; overflow: hidden; }
.n-res-barra i { display: block; height: 100%; background: var(--f); border-radius: 11px; transition: width .4s; }
.n-res-num { white-space: nowrap; font-weight: 400; }
.n-res-hemi { max-width: 460px; margin: 0 auto; }
.n-hemi-juego { width: 100%; height: auto; display: block; }
.n-imprimible { display: none; }
.n-profes { border-left: 6px solid var(--amarillo); }

@media (max-width: 520px) {
  .n-paso h2 { font-size: 1.2rem; }
  .n-num { min-width: 36px; height: 36px; font-size: 1.05rem; }
  .n-marcador > div { grid-template-columns: 100px 1fr 32px; }
  .n-jfila { grid-template-columns: 40px minmax(0, 1fr); }
  .n-jfila .n-cuenta { grid-column: 1 / -1; justify-content: flex-end; }
  .n-juego-res .n-res-fila { grid-template-columns: minmax(0, 1fr) auto; }
  .n-res-fila .n-res-barra { grid-column: 1 / -1; grid-row: 2; }
}
@media (prefers-reduced-motion: reduce) {
  .ninos *, .ninos *::before { animation: none !important; transition: none !important; }
}

/* Impresión: solo se imprime la zona #n-imprimible (papeletas o resultados) */
@media print {
  body.imprimiendo > *:not(.n-imprimible) { display: none !important; }
  body.imprimiendo { background: #fff !important; color: #000; padding: 0; }
  body.imprimiendo .n-imprimible { display: block; color: #000; font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif; }
  .n-imprimible * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { margin: 12mm; }
  /* Papeletas: 6 por hoja A4, para recortar */
  .p-hoja { display: grid; grid-template-columns: 1fr 1fr; }
  .p-papeleta { border: 2px dashed #888; padding: 5mm 6mm; height: 84mm; box-sizing: border-box; break-inside: avoid; display: flex; flex-direction: column; }
  .p-cab { font-weight: 800; font-size: 13pt; text-align: center; border-bottom: 2px solid #000; padding-bottom: 2mm; }
  .p-instr { text-align: center; font-size: 10pt; margin: 2mm 0 3mm; }
  .p-op { display: flex; align-items: center; gap: 3mm; font-size: 13pt; font-weight: 700; margin: 1.6mm 0; }
  .p-caja { width: 7mm; height: 7mm; border: 2px solid #000; border-radius: 1mm; flex: none; }
  .p-emoji { font-size: 15pt; }
  .p-pie { margin-top: auto; text-align: center; font-size: 7.5pt; color: #666; }
  .p-recorta { text-align: center; font-size: 9pt; color: #666; margin-top: 3mm; }
  /* Resultados */
  .r-hoja h1 { font-size: 20pt; margin: 0 0 1mm; }
  .r-fecha { color: #555; margin: 0 0 6mm; }
  .r-hoja h3 { display: none; }
  .r-hoja .n-ganador { font-size: 15pt; font-weight: 800; }
  .r-hoja .n-res-fila { display: grid; grid-template-columns: 55mm 1fr 38mm; gap: 2mm 4mm; align-items: center; margin: 3mm 0;
    padding-bottom: 3mm; border-bottom: 1px solid #ccc; font-weight: 700; font-size: 12pt; }
  .r-hoja .n-res-fila .n-asientos { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 1.5mm; }
  .r-hoja .n-res-barra { height: 6mm; background: #eee; border-radius: 3mm; overflow: hidden; }
  .r-hoja .n-res-barra i { display: block; height: 100%; background: var(--f); }
  .r-hoja .n-res-num { font-weight: 400; white-space: nowrap; }
  .r-hoja .n-asientos i { display: inline-grid; place-items: center; width: 8mm; height: 8mm; border-radius: 50%; font-style: normal; font-size: 10pt; animation: none; }
  .r-hoja .n-res-hemi { width: 120mm; margin: 6mm auto 0; break-inside: avoid; }
  .r-hoja .n-hemi-juego { width: 100%; }
  .r-hoja .nota, .r-pie { color: #555; font-size: 9pt; }
  .r-pie { margin-top: 8mm; }
}
