/* =====================================================================
   Garabatazo — «Fondo»: el mapa elegido tiñe todo el sitio (tema luna).
   La paleta (papel, tarjetas, tinta, acento, resaltador) la pone temas/tema.js como variables CSS en <html>
   antes del primer pintado (html[data-fondo="…"]). Aquí van: la ilustración del mapa como fondo de la página
   (velada para que todo se lea), el selector con miniaturas y el botón Ranked bloqueado.
   ===================================================================== */
.sr-solo { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Fondo de la página: el mapa, abajo, cubierto por un velo del color del papel (arriba casi opaco) */
html[data-theme="luna"] body {
  background-image:
    linear-gradient(180deg, color-mix(in srgb, var(--xerox) 94%, transparent) 0%, color-mix(in srgb, var(--xerox) 80%, transparent) 55%, color-mix(in srgb, var(--xerox) 58%, transparent) 100%),
    var(--fondo-img, none);
  background-size: cover, cover;
  background-position: center, center bottom;
  background-repeat: no-repeat;
  background-attachment: fixed, fixed;
}
html[data-theme="luna"] body[data-pantalla="pantalla-pelea"] { background-image: none; }
html[data-theme="luna"][data-fondo] .stats-card, html[data-theme="luna"][data-fondo] .skins-beta, html[data-theme="luna"][data-fondo] .mis-personajes { background-color: var(--papel); }
/* cuaderno: renglones azules suaves en el papel */
html[data-theme="luna"][data-fondo="garabato"] body {
  background-image:
    linear-gradient(90deg, transparent 58px, rgba(232,68,58,.35) 58px, rgba(232,68,58,.35) 60px, transparent 60px),
    repeating-linear-gradient(180deg, transparent 0 25px, rgba(80,110,170,.22) 25px 26px),
    linear-gradient(180deg, color-mix(in srgb, var(--xerox) 92%, transparent), color-mix(in srgb, var(--xerox) 70%, transparent)),
    var(--fondo-img, none);
  background-size: auto, auto, cover, cover;
  background-attachment: scroll, scroll, fixed, fixed;
}

/* ---------- Sección «Fondo» ---------- */
html[data-theme="luna"] .fondo-sec {
  position: relative; display: block; margin: 6px 0; padding: 10px 12px 12px; background: var(--papel);
  border: 3px solid var(--toner); box-shadow: 5px 5px 0 rgba(0,0,0,.45); transform: rotate(-.3deg);
}
html[data-theme="luna"] .fondo-cab { margin: 0 0 6px; font-size: 14px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
html[data-theme="luna"] .fondo-actual { font: 400 12px var(--f-mono); background: var(--fluor); color: var(--toner); padding: 1px 6px; transform: rotate(-1.5deg); }
html[data-theme="luna"] .fondo-desc { margin: 2px 0 8px; font: 400 12px/1.35 var(--f-mono); }
html[data-theme="luna"] .fondo-nota { display: block; margin-top: 6px; font: 400 11px/1.3 var(--f-mono); color: var(--gris); }
html[data-theme="luna"] .fondo-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 9px; margin: 0; }
html[data-theme="luna"] .fondo-th {
  position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 3px 3px 4px; margin: 0;
  background: #fff; color: var(--toner); border: 2px solid var(--toner); box-shadow: 2px 2px 0 rgba(0,0,0,.4); cursor: pointer;
  font: 400 10px var(--f-mono); text-align: center; transition: transform .08s;
}
html[data-theme="luna"] .fondo-th:hover { transform: translateY(-2px) rotate(-1deg); }
html[data-theme="luna"] .fondo-th canvas { width: 100%; height: auto; aspect-ratio: 2 / 1; display: block; }
html[data-theme="luna"] .fondo-th.activa { background: var(--fluor); outline: 3px solid var(--rosa); outline-offset: 1px; box-shadow: 4px 4px 0 var(--toner); }
html[data-theme="luna"] .fondo-th.activa::after {
  content: "✓"; position: absolute; top: -9px; right: -7px; width: 22px; height: 22px; line-height: 22px; border-radius: 50%;
  background: var(--rosa); color: #fff; font: 400 13px var(--f-bloque); box-shadow: 1px 1px 0 var(--toner);
}
html[data-theme="luna"] .fondo-muestras { display: flex; height: 7px; border: 1px solid var(--toner); }
html[data-theme="luna"] .fondo-muestras i { flex: 1; }
html[data-theme="luna"] .fondo-nombre { line-height: 1.15; min-height: 2.3em; display: flex; align-items: center; justify-content: center; }
html[data-theme="luna"] .fondo-rival { display: flex; align-items: center; gap: 8px; margin-top: 8px; font: 400 12px var(--f-mono); cursor: pointer; min-height: 32px; }
html[data-theme="luna"] .fondo-rival input { width: 20px; height: 20px; accent-color: var(--rosa); margin: 0; }
html[data-theme="luna"] body.movil .panel-col[data-mtab="mapas"] > .fondo-sec { display: block; }

/* ---------- Ranked bloqueado («Próximamente») ---------- */
html[data-theme="luna"] .secundario.bloqueado, html[data-theme="luna"] .secundario.bloqueado:disabled {
  opacity: 1; cursor: not-allowed; position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 6px;
  background: repeating-linear-gradient(-45deg, var(--toner) 0 8px, color-mix(in srgb, var(--toner) 78%, var(--papel)) 8px 16px);
  color: color-mix(in srgb, #f2f2f2 80%, transparent); box-shadow: 3px 3px 0 rgba(0,0,0,.35);
}
html[data-theme="luna"] .secundario.bloqueado:active { transform: none; }
html[data-theme="luna"] .secundario.bloqueado .pronto {
  flex-basis: 100%; font: 400 10px var(--f-mono); letter-spacing: .04em; text-transform: none; color: var(--toner);
  background: var(--fluor); padding: 0 5px; margin: 0 auto; width: max-content; transform: rotate(-2deg);
}
html[data-theme="luna"] .secundario.bloqueado .candado { font-size: .9em; }

/* ---------- Presentación VS: de quién es el fondo ---------- */
html[data-theme="luna"] .vs-fondo {
  margin: 4px 0 0; font: 400 clamp(10px, 1.5vw, 14px) var(--f-mono); text-align: center; background: var(--toner); color: var(--fluor);
  padding: 2px 10px; transform: rotate(-1deg); box-shadow: 3px 3px 0 var(--rosa);
}
@media (prefers-reduced-motion: reduce) { html[data-theme="luna"] .fondo-th { transition: none; } html[data-theme="luna"] .fondo-th:hover { transform: none; } }
/* celular: Ranked más bajo (la barra de acciones fija no crece de más) */
@media (max-width: 700px), (orientation: landscape) and (max-height: 520px) {
  html[data-theme="luna"] .acciones-fila .secundario.bloqueado { min-height: 36px; padding: 2px 4px; font-size: 11px; gap: 0 4px; min-width: 0; }
  html[data-theme="luna"] .secundario.bloqueado .pronto { font-size: 9px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
}
