/* ================================================
   BINGU — Sistema de diseño 2026 (web + motor de partida)
   Fuente de marca: Baloo 2. Colores: los del tema bingu-oficial (assets/game/themes/bingu-oficial/).

   Cómo usarlo en una página:
   1. Cargar este archivo (y la fuente Baloo 2) después de global.css.
   2. Poner la clase .b-ui en el contenedor de la página (normalmente <main>).
   3. Usar los componentes .b-* de aquí; en el CSS de la página solo va la maquetación propia.
   Componentes extra: components/board-preview.css (miniatura del tablero de un tema).
   Boceto de referencia: mockups/configurador-rediseno-2026.html
   ================================================ */

/* ===== TOKENS ===== */
:root {
    --b-blue: #1abcf5;
    --b-blue-dark: #0ea5db;
    --b-blue-ink: #06739c;      /* azul para texto sobre blanco (contraste AA) */
    --b-blue-soft: #e6f8fe;
    --b-pink: #ff1dba;
    --b-pink-dark: #d10b95;     /* hover del botón principal: blanco encima con contraste AA */
    --b-pink-ink: #b0087f;      /* rosa para texto sobre blanco (contraste AA) */
    --b-pink-soft: #fff0fa;
    --b-gradient: linear-gradient(135deg, #1abcf5 0%, #ff1dba 100%);
    --b-text: #1a1a2e;
    --b-muted: #5b6474;
    --b-line: #e3e8ef;
    --b-line-strong: #c9d3df;
    --b-surface: #ffffff;
    --b-surface-2: #f5f7fa;
    --b-bg: #eef3f8;            /* el mismo color que rodea el tablero en la partida */
    --b-focus: #1a1a2e;
    --b-green: #16a34a;
    --b-green-ink: #11723a;
    --b-green-soft: #e8f7ee;
    --b-on-accent: #ffffff;     /* texto e iconos sobre rosa o sobre --b-text */

    --b-font: 'Baloo 2', system-ui, sans-serif;
    --b-radius-sm: 14px;
    --b-radius: 20px;           /* botones: igual que .btn del motor */
    --b-radius-lg: 28px;        /* tarjetas */
    --b-shadow: 0 1px 2px rgba(26, 26, 46, 0.04), 0 8px 24px rgba(26, 26, 46, 0.06);
    --b-shadow-hover: 0 2px 4px rgba(26, 26, 46, 0.05), 0 14px 32px rgba(26, 26, 46, 0.10);

    --b-max: var(--guide-max, min(85vw, 1500px));   /* mismo ancho que el resto de la web */
}

@media (max-width: 1023px) {
    :root { --b-max: min(100% - 28px, 1500px); }
}
@media (max-width: 640px) {
    :root { --b-max: calc(100% - 32px); }
}

/* ===== TAMAÑOS DE TEXTO EN MÓVIL (≤640 px): AQUÍ SE CAMBIAN PARA TODA LA WEB =====
   Las páginas escriben `font-size: var(--b-fs-h1, <su tamaño de ordenador>)`. En ordenador y tableta estas
   variables no existen y manda el valor de cada página; en móvil mandan estas. Página nueva: usar los mismos roles. */
@media (max-width: 640px) {
    :root {
        --b-fs-h1: 29px;     /* título de la página */
        --b-fs-h2: 25px;     /* título de sección */
        --b-fs-h3: 20px;     /* título de tarjeta o bloque */
        --b-fs-lead: 17px;   /* subtítulo / entradilla bajo un título */
        --b-fs-body: 17px;   /* texto normal */
    }
}

/* ===== BASE (dentro de .b-ui) =====
   Con :where() estas reglas no pesan nada: cualquier clase de componente o de página las pisa.
   (Sin :where(), «.b-ui button { color: inherit }» ganaba al color blanco de los botones.) */
:where(.b-ui) {
    font-family: var(--b-font);
    font-size: 19px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--b-text);
}
:where(.b-ui) :where(*, *::before, *::after) { box-sizing: border-box; }
:where(.b-ui) :where(h1, h2, h3, p, ul, ol) { margin: 0; }
:where(.b-ui) :where(h1, h2, h3) { font-family: var(--b-font); color: var(--b-text); }
:where(.b-ui) :where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(.b-ui) :where(button) { cursor: pointer; }
:where(.b-ui) :where(img) { display: block; max-width: 100%; }
:where(.b-ui) :where(:focus) { outline: none; }
:where(.b-ui) :where(:focus-visible) {
    outline: 4px solid var(--b-focus);
    outline-offset: 4px;
}
.b-ui [hidden] { display: none !important; }

/* ===== BOTONES (familia del motor: planos, grandes, borde 3px) ===== */
.b-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    padding: 8px 24px;
    border-radius: var(--b-radius);
    border: 3px solid var(--b-line);
    background: var(--b-surface);
    color: var(--b-text);
    font-family: var(--b-font);
    font-weight: 700;
    font-size: 18px;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.b-btn:hover { border-color: var(--b-line-strong); }
.b-btn:active { transform: scale(0.97); }
.b-btn svg { width: 1.2em; height: 1.2em; flex-shrink: 0; fill: currentColor; }
.b-btn--primary {
    background: var(--b-pink);
    border-color: var(--b-pink);
    color: var(--b-on-accent);
}
.b-btn--primary:hover { background: var(--b-pink-dark); border-color: var(--b-pink-dark); }
.b-btn--xl {
    width: 100%;
    min-height: 76px;
    font-size: 26px;
    font-weight: 800;
    border-radius: 24px;
}

/* Botón redondo de icono (▶ escuchar, etc.) */
.b-icon-btn {
    width: 44px; height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 0;
    background: var(--b-text);
    color: var(--b-on-accent);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform 0.12s ease, background-color 0.15s ease;
}
.b-icon-btn:active { transform: scale(0.94); }
.b-icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.b-icon-btn.is-active { background: var(--b-pink); }

/* ===== TARJETAS Y PASOS ===== */
.b-card {
    background: var(--b-surface);
    border-radius: var(--b-radius-lg);
    box-shadow: var(--b-shadow);
    padding: 24px 28px 28px;
}
.b-step-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}
.b-step-num {
    width: 40px; height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--b-text);
    color: var(--b-on-accent);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 20px;
}
.b-step-title {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.1;
}
.b-step-hint {
    margin-left: auto;
    color: var(--b-muted);
    font-size: 16px;
    font-weight: 600;
}

/* ===== OPCIÓN ELEGIBLE (radio visual): seleccionada = borde azul + fondo suave + check ===== */
.b-pick {
    position: relative;
    display: block;
    width: 100%;
    text-align: left;
    border: 3px solid var(--b-line);
    border-radius: 22px;
    background: var(--b-surface);
    padding: 16px;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.b-pick:hover { border-color: var(--b-line-strong); box-shadow: var(--b-shadow-hover); }
.b-pick:active { transform: scale(0.98); }
.b-pick[aria-checked="true"] {
    border-color: var(--b-blue);
    background: var(--b-blue-soft);
}
/* Check en la esquina, por fuera del contenido: no tapa nada */
.b-check {
    position: absolute;
    top: -10px; right: -10px;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--b-blue);
    border: 3px solid var(--b-surface);
    color: var(--b-text);
    display: grid;
    place-items: center;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 2;
    pointer-events: none;
}
.b-check svg { width: 16px; height: 16px; }
.b-pick[aria-checked="true"] .b-check { opacity: 1; transform: scale(1); }

/* ===== ETIQUETAS, TEXTO ===== */
.b-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 14px;
    border-radius: 999px;
    background: var(--b-pink-soft);
    color: var(--b-pink-ink);
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
}
.b-badge--green { background: var(--b-green-soft); color: var(--b-green-ink); }
.b-tag {
    display: inline-block;
    padding: 0 8px;
    border-radius: 999px;
    background: #fff4c7;
    color: #7a5600;
    font-size: 13px;
    font-weight: 800;
}
.b-gradient-text {
    background: var(--b-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.b-label {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--b-muted);
    margin-bottom: 8px;
}
.b-label small { font-size: inherit; font-weight: 600; }
.b-kbd {
    min-width: 40px;
    padding: 2px 10px;
    border-radius: 10px;
    border: 2px solid var(--b-line);
    border-bottom-width: 4px;
    background: var(--b-surface);
    font-family: inherit;
    font-weight: 800;
    font-size: 16px;
    text-align: center;
    white-space: nowrap;
}

/* Aviso suave (rosa por defecto, verde para «todo bien») */
.b-note {
    border-radius: 18px;
    padding: 14px 16px;
    background: var(--b-pink-soft);
    font-size: 17px;
    line-height: 1.35;
}
.b-note--green { background: var(--b-green-soft); }
.b-note strong { display: block; font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.b-note ul { list-style: none; padding: 0; display: grid; gap: 2px; }
.b-note li::before { content: '✓'; color: var(--b-green); font-weight: 800; margin-right: 8px; }
.b-note a { color: var(--b-pink-ink); font-weight: 800; }

/* ===== DESPLEGABLE (con bandera o icono) ===== */
.b-select { position: relative; }
.b-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    padding: 8px 16px;
    border: 3px solid var(--b-line);
    border-radius: var(--b-radius);
    background: var(--b-surface);
    font-weight: 700;
    font-size: 20px;
    text-align: left;
    cursor: pointer;
}
.b-select-trigger:hover { border-color: var(--b-line-strong); }
.b-select-trigger[aria-expanded="true"] { border-color: var(--b-blue); }
.b-select-trigger .chev { margin-left: auto; width: 22px; height: 22px; flex-shrink: 0; transition: transform 0.15s ease; }
.b-select-trigger[aria-expanded="true"] .chev { transform: rotate(180deg); }
.b-select-trigger img, .b-select-option img {
    width: 30px; height: 22px;
    object-fit: cover;
    border-radius: 5px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.b-select-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    z-index: 20;
    max-height: 340px;
    overflow: auto;
    background: var(--b-surface);
    border-radius: var(--b-radius);
    box-shadow: 0 16px 40px rgba(26, 26, 46, 0.18);
    padding: 6px;
    list-style: none;
}
.b-select-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    font-weight: 700;
    font-size: 18px;
    text-align: left;
    cursor: pointer;
}
.b-select-option:hover, .b-select-option[aria-selected="true"] { background: var(--b-blue-soft); }

/* ===== DESLIZADOR ===== */
.b-range {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--b-blue) var(--fill, 20%), var(--b-line) var(--fill, 20%));
}
.b-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--b-surface);
    border: 4px solid var(--b-text);
    cursor: pointer;
}
.b-range::-moz-range-thumb {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--b-surface);
    border: 4px solid var(--b-text);
    cursor: pointer;
}

@media (max-width: 640px) {
    :where(.b-ui) { font-size: var(--b-fs-body); }
    .b-card { padding: 18px 16px 20px; border-radius: 22px; }
    .b-step-title { font-size: var(--b-fs-h3); }
    .b-btn--xl { min-height: 64px; font-size: 21px; border-radius: 20px; }
    .b-step-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .b-ui *, .b-ui *::before, .b-ui *::after { transition: none !important; }
}
