/* ================================================
   CONFIGURADOR (diseño 2026) — maquetación propia de los configuradores (demo.php; después play.php).
   Los componentes (botones, tarjetas, opciones, desplegable, deslizador…) están en assets/css/brand.css
   y la miniatura del tablero en assets/css/components/board-preview.css. Aquí solo va lo específico.
   Boceto: mockups/configurador-rediseno-2026.html
   ================================================ */

body:has(.cfg) {
    --header-edge-fill: var(--b-bg);
    background: var(--b-bg);
}

.cfg {
    width: var(--b-max);
    margin: 0 auto;
    padding: 8px 0 64px;
}

/* ---------- Cabecera de la página ---------- */
.cfg-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}
.cfg-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
}
.cfg-title {
    font-size: var(--b-fs-h1, clamp(34px, 4.4vw, 52px));
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.cfg-lead {
    color: var(--b-muted);
    font-size: var(--b-fs-lead, 20px);
    margin-top: 6px;
}
.cfg-images-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--b-surface);
    border: 2px solid var(--b-line);
    color: var(--b-text);
    text-decoration: none;
    font-weight: 700;
    font-size: 17px;
}
.cfg-images-link:hover { border-color: var(--b-blue); }
.cfg-images-link .ico {
    width: 30px; height: 30px;
    border-radius: 9px;
    background: var(--b-gradient);
    display: grid; place-items: center;
    color: var(--b-on-accent);
    font-size: 15px;
}

.cfg-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 28px;
    align-items: start;
}
.cfg-steps { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ---------- Paso: modo ---------- */
.cfg-modes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.cfg-mode {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 20px;
}
.cfg-mode-badge {
    width: 84px; height: 84px;
    flex-shrink: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 38px;
    font-weight: 800;
    color: var(--b-on-accent);
    background: linear-gradient(135deg, var(--b-blue), var(--b-blue-dark));
    box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.12);
}
.cfg-mode[data-modo="75"] .cfg-mode-badge {
    background: linear-gradient(135deg, var(--b-pink), var(--b-pink-dark));
}
.cfg-mode-text strong {
    display: block;
    font-size: var(--b-fs-h3, 24px);
    font-weight: 800;
    line-height: 1.15;
}
.cfg-mode-text span {
    color: var(--b-muted);
    font-size: 17px;
    font-weight: 600;
}

/* ---------- Paso: tema (selector compacto: boceto de colores + nombre) ---------- */
.cfg-themes {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}
.cfg-theme { padding: 8px 8px 10px; border-radius: 18px; }
.cfg-theme.is-extra { display: none; }
.cfg-themes.show-all .cfg-theme.is-extra { display: block; }
.cfg-theme-name {
    display: block;
    margin-top: 8px;
    padding: 0 4px;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    overflow-wrap: anywhere;
}

/* Boceto del tablero: casillas a la izquierda (algunas «cantadas»), panel con bola a la derecha */
.cfg-sketch {
    display: grid;
    grid-template-columns: 1fr 30%;
    gap: 6%;
    aspect-ratio: 16 / 10;
    padding: 9%;
    border-radius: 12px;
    background: var(--sk-bg);
    box-shadow: inset 0 0 0 1px rgba(26, 26, 46, 0.10);
}
.cfg-sketch .sk-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12%;
    align-content: center;
}
.cfg-sketch .sk-board i {
    aspect-ratio: 1;
    border-radius: 28%;
    background: var(--sk-surface);
    box-shadow: inset 0 0 0 1px rgba(26, 26, 46, 0.08);
}
.cfg-sketch .sk-board i:nth-child(2),
.cfg-sketch .sk-board i:nth-child(9),
.cfg-sketch .sk-board i:nth-child(13) { background: var(--sk-a); box-shadow: none; }
.cfg-sketch .sk-board i:nth-child(5),
.cfg-sketch .sk-board i:nth-child(11) { background: var(--sk-b); box-shadow: none; }
.cfg-sketch .sk-board i:nth-child(7) { background: var(--sk-c); box-shadow: none; }
.cfg-sketch .sk-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10%;
    align-content: center;
    justify-items: center;
}
.cfg-sketch .sk-panel b {
    grid-column: 1 / -1;
    width: 92%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--sk-surface);
    box-shadow: inset 0 0 0 4px var(--sk-a);
}
.cfg-sketch .sk-panel i {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--sk-b);
}
.cfg-sketch .sk-panel i:nth-of-type(2) { background: var(--sk-c); }
.cfg-sketch .sk-panel i:nth-of-type(3) { background: var(--sk-a); }
.cfg-more {
    margin-top: 16px;
    display: flex;
    justify-content: center;
}

/* ---------- Paso: voz ---------- */
.cfg-voice-grid {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}
.cfg-voices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
}
.cfg-voice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    min-height: 72px;
}
.cfg-voice-avatar {
    width: 48px; height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    display: grid;
    place-items: center;
    color: var(--b-on-accent);
    font-weight: 800;
    font-size: 20px;
}
.cfg-voice-name {
    flex: 1;
    min-width: 0;
    font-weight: 800;
    font-size: 19px;
    line-height: 1.15;
    overflow-wrap: break-word;   /* parte solo entre palabras (no «Marcel·a») */
    hyphens: manual;
}
/* Última casilla cuando hay más voces que 3 filas: mismo tamaño que una voz, abre la ventana con todas. */
.cfg-voice-more {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    min-height: 72px;
    font-family: var(--b-font);
    color: var(--b-blue-ink);
    border-style: dashed;
    border-color: var(--b-line-strong);
    background: var(--b-blue-soft);
}
.cfg-voice-more:hover { border-color: var(--b-blue); }
.cfg-voice-more:focus-visible { outline: 3px solid var(--b-focus); outline-offset: 3px; }
.cfg-voice-more-ico { background: var(--b-blue); }
.cfg-voice-more-ico svg { width: 26px; height: 26px; fill: var(--b-on-accent); }

/* Ventana con todas las voces (<dialog>) */
.cfg-modal {
    width: min(920px, calc(100% - 32px));
    max-height: calc(100dvh - 48px);
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: var(--b-radius-lg);
    background: var(--b-surface);
    color: var(--b-text);
    font-family: var(--b-font);
    box-shadow: 0 24px 64px rgba(26, 26, 46, 0.28);
    overflow: hidden;
}
.cfg-modal[open] { display: flex; animation: cfg-modal-in 0.2s ease-out; }
.cfg-modal::backdrop { background: rgba(26, 26, 46, 0.55); }
.cfg-modal-box {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: calc(100dvh - 48px);
    padding: 22px 26px 26px;
}
.cfg-modal-head {
    display: flex;
    align-items: center;
    gap: 14px;
}
.cfg-modal-title {
    flex: 1;
    font-size: var(--b-fs-h2, 26px);
    font-weight: 800;
    line-height: 1.15;
}
.cfg-modal-close svg { width: 22px; height: 22px; }
.cfg-modal-hint {
    margin: 4px 0 16px;
    color: var(--b-muted);
    font-size: 16px;
    font-weight: 600;
}
.cfg-voices--all {
    overflow-y: auto;
    padding: 12px 12px 4px;   /* hueco para el check de la esquina */
    margin: -12px -12px 0;
}
html.cfg-modal-open { overflow: hidden; }
@keyframes cfg-modal-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

/* ---------- Paso: ritmo ---------- */
.cfg-paces {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.cfg-pace {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
}
.cfg-pace-icon {
    width: 52px; height: 52px;
    flex-shrink: 0;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--b-surface-2);
    font-size: 26px;
}
.cfg-pace[aria-checked="true"] .cfg-pace-icon { background: var(--b-surface); }
.cfg-pace-text strong { display: block; font-size: 21px; font-weight: 800; line-height: 1.15; }
.cfg-pace-text span { color: var(--b-muted); font-size: 16px; font-weight: 600; line-height: 1.3; }

.cfg-speeds {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.cfg-speed {
    text-align: center;
    padding: 14px 10px;
}
.cfg-speed-icon { display: block; font-size: 30px; line-height: 1; }
.cfg-speed-name { display: block; font-weight: 800; font-size: 21px; margin-top: 6px; }
.cfg-speed-secs { color: var(--b-muted); font-size: 16px; font-weight: 700; }
.cfg-speed-fine {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.cfg-speed-fine label { font-weight: 700; color: var(--b-muted); font-size: 16px; white-space: nowrap; }
.cfg-speed-fine output {
    min-width: 76px;
    text-align: center;
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--b-surface-2);
    font-weight: 800;
    font-size: 20px;
}

.cfg-manual {
    border-radius: 18px;
    background: var(--b-surface-2);
    padding: 16px 18px;
}
.cfg-manual strong { display: block; font-size: 19px; font-weight: 800; margin-bottom: 8px; }
.cfg-manual ul {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
    font-size: 17px;
    font-weight: 600;
}
.cfg-manual li { display: flex; align-items: center; gap: 10px; }
.cfg-manual p {
    margin-top: 10px;
    color: var(--b-muted);
    font-size: 16px;
    font-weight: 600;
}

/* ---------- Resumen lateral ---------- */
.cfg-summary {
    position: sticky;
    top: calc(var(--site-header-h, 0px) + 20px);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.cfg-summary-title {
    font-size: var(--b-fs-h3, 22px);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cfg-summary-title .live {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--b-green);
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.15);
}
.cfg-summary-preview {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(26, 26, 46, 0.08), 0 10px 24px rgba(26, 26, 46, 0.10);
}
.cfg-summary-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.cfg-summary-list li {
    background: var(--b-surface-2);
    border-radius: 14px;
    padding: 8px 12px;
    line-height: 1.2;
    min-width: 0;
}
.cfg-summary-list small {
    display: block;
    color: var(--b-muted);
    font-size: 14px;
    font-weight: 700;
}
.cfg-summary-list b {
    display: block;
    font-size: 18px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cfg-note-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 8px;
}
.cfg-summary-foot {
    text-align: center;
    color: var(--b-muted);
    font-size: 15px;
    font-weight: 600;
}

/* Barra fija inferior en móvil */
.cfg-mobile-cta { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .cfg-layout { grid-template-columns: minmax(0, 1fr) 360px; }
    .cfg-themes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .cfg-voice-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .cfg { padding-bottom: 120px; }
    .cfg-layout { grid-template-columns: 1fr; }
    .cfg-summary { position: static; order: -1; }
    .cfg-summary [data-cfg-start], .cfg-summary .cfg-summary-foot { display: none; }
    .cfg-summary-preview { max-width: 520px; }
    .cfg-mobile-cta {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 40;
        gap: 12px;
        align-items: center;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        background: var(--b-surface);
        box-shadow: 0 -8px 24px rgba(26, 26, 46, 0.10);
    }
    .cfg-mobile-cta .mc-info { line-height: 1.15; min-width: 0; }
    .cfg-mobile-cta .mc-info b { display: block; font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .cfg-mobile-cta .mc-info small { color: var(--b-muted); font-size: 14px; font-weight: 600; }
    .cfg-mobile-cta .b-btn { flex-shrink: 0; margin-left: auto; min-height: 60px; font-size: 20px; font-weight: 800; }
}
@media (max-width: 640px) {
    .cfg-modes { grid-template-columns: 1fr; gap: 10px; }
    .cfg-mode { padding: 12px 14px; }
    .cfg-mode-badge { width: 64px; height: 64px; font-size: 28px; }
    .cfg-themes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .cfg-theme-name { font-size: 14px; }
    .cfg-voices { grid-template-columns: 1fr; }
    .cfg-speeds { gap: 8px; }
    .cfg-speed-name { font-size: 18px; }
    .cfg-speed-fine { flex-wrap: wrap; }
    .cfg-speed-fine .b-range { order: 3; flex-basis: 100%; }
    .cfg-paces { grid-template-columns: 1fr; gap: 10px; }
    .cfg-manual ul { grid-template-columns: 1fr; }
}

/* ================================================
   BINGO DE IMÁGENES (demo-images.php, play-images.php)
   Bloques includes/configurator/image-*.php. Boceto: mockups/configurator-imagenes-2026.html
   ================================================ */

/* Tamaño del tablero: el de 36 en rosa, como el 75 del bingo de números */
.cfg-mode[data-modo="quick"] .cfg-mode-badge {
    background: linear-gradient(135deg, var(--b-pink), var(--b-pink-dark));
}

/* Packs de imágenes */
.cfg-packs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.cfg-pack { padding: 10px 10px 14px; }
.cfg-pack-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px;
    border-radius: 14px;
    background: var(--b-surface-2);
}
.cfg-pack[aria-checked="true"] .cfg-pack-strip { background: var(--b-surface); }
.cfg-pack-strip img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
}
.cfg-pack-name {
    display: block;
    margin-top: 10px;
    padding: 0 6px;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
}
.cfg-pack-count {
    display: block;
    padding: 0 6px;
    color: var(--b-muted);
    font-size: 16px;
    font-weight: 700;
}

/* Idioma de la voz + idioma de las palabras */
/* Bingo de imágenes: idioma de la voz y, debajo, el de las palabras (columna izquierda de .cfg-voice-grid). */
.cfg-lang-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
}
.cfg-lang-hint {
    display: block;
    margin-top: 6px;
    color: var(--b-muted);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}
.cfg-voice-empty {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    background: var(--b-surface-2);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.35;
}
.cfg-voice-empty .ico { font-size: 26px; flex-shrink: 0; }

/* Resumen: captura del tema + imágenes del pack elegido */
.cfg-summary-preview img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}
.cfg-summary-strip {
    display: flex;
    gap: 6px;
    margin-top: -6px;
}
.cfg-summary-strip img {
    flex: 1;
    min-width: 0;
    aspect-ratio: 1;
    object-fit: contain;
    padding: 3px;
    border-radius: 10px;
    background: var(--b-surface-2);
}

@media (max-width: 1100px) {
    .cfg-packs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .cfg-packs { gap: 10px; }
    .cfg-pack-name { font-size: 18px; }
}
