/* ==========================================================================
   1. VARIABLES GLOBALES Y TEMAS DE JUEGO (Paletas Oficiales Maxiloto)
   ========================================================================= */

:root {
    --colorBoleto1: #034225;
    --colorBoleto2: #05864a;
    --colorBoleto3: #9bc1af;
    --colorBoleto4: #cde7db;
    --colorBoleto5: #e3ebe7;
    --colorBoleto6: #cde7db;

    --blancoBoleto: #ffffff;
    --grisBoleto: #d1d5db;

    --color-primary-trans: #03422540; 
    --color-primary: var(--colorBoleto1);
    --color-primary-light: var(--colorBoleto5);
    --color-accent: var(--colorBoleto2);

    --color-text-dark: #1f2937;
    --color-text-light: #6b7280;
    --color-light: var(--blancoBoleto);
    --color-border: var(--grisBoleto);
    --color-bg: #f3f4f6;
    --color-danger: #ef4444;
    --color-warning-bg: #fffbeb;
    --color-warning-border: #f59e0b;

    --color-success-bg: var(--colorBoleto4);
    --color-success-border: var(--colorBoleto3);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 10px 15px -3px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 20px 25px -5px rgba(0, 0, 0, 0.04);
    --border-radius-lg: 12px;
    --border-radius: 6px;
    --color-popover-bg: #ffffff;

    /* BOLETOS ESCRITORIO */
    --cg_num_size: 26px;
    --cg_num_fs: 0.82rem;
    --cg_num_gap: 1px;
    --cg_num_radius: 2px;
    --cg_ticket_width_5: 173px;
    --cg_ticket_width_6: 209px;
    --cg_reintegro_size: 30px;
    --cg_estrella_size: 34px; 

    /* BARRA SUPERIOR DEL BOLETO */
    --cg_actionbar_h: 36px; 
    --cg_actionbar_icon: 20px;

    /* FILTROS (Globales base) */
    --cg_filter_box_pad_y: 0.5rem;
    --cg_filter_box_pad_x: 0.7rem;
    --cg_filter_gap: 0.5rem;
    --cg_filter_chip_fs: 0.78rem;
    --cg_filter_title_fs: 0.85rem;
}

body.theme-bonoloto {
    --colorBoleto1: #536417; --colorBoleto2: #6e851e; --colorBoleto3: #9eae69; --colorBoleto4: #cfd6b4; --colorBoleto5: #e2e7d2;
    --color-primary-trans: #53641740; --color-primary: var(--colorBoleto1); --color-primary-light: var(--colorBoleto5);
    --color-accent: var(--colorBoleto2); --color-success-bg: var(--colorBoleto4); --color-success-border: var(--colorBoleto3);
}

body.theme-euromillones {
    --color-primary-trans: #0d213640; --color-primary: #0d2136; --color-primary-light: #e8ecf0;
    --color-accent: #4e6f93; --color-success-bg: #d8e3ec; --color-success-border: #476789;
}

body.theme-gordo {
    --colorBoleto1: #992c32; --colorBoleto2: #db3f47; --colorBoleto3: #e2656c; --colorBoleto4: #edd3d3; --colorBoleto5: #f4ebec;
    --color-primary-trans: #992c3240; --color-primary: var(--colorBoleto1); --color-primary-light: var(--colorBoleto5);
    --color-accent: var(--colorBoleto2); --color-success-bg: var(--colorBoleto4); --color-success-border: var(--colorBoleto3);
}

body.theme-eurodreams {
    --color-primary-trans: #40265e40; --color-primary: #40265e; --color-primary-light: #f3eff7;
    --color-accent: #7a59a6; --color-success-bg: #e3d7f4; --color-success-border: #6b3e98;
}

/* ==========================================================================
   2. RESET Y ESTILOS GENERALES
   ========================================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Rubik', sans-serif; }

/* COMPORTAMIENTO BASE (Para cuando lo abres directo en el navegador) */
html, body { 
    background-color: var(--color-bg); 
    color: var(--color-text-dark); 
    line-height: 1.5; 
    font-smoothing: antialiased; 
    -webkit-font-smoothing: antialiased; 
    padding-bottom: 20px; 
    overflow-y: auto;
}

/* CLASE DINÁMICA (Solo se activará si está dentro de tu landing mediante app.js) */
html.is-iframe, html.is-iframe body {
    overflow: hidden !important; 
    height: auto !important;
    touch-action: pan-y;
}

/* Ocultar barras de scroll fantasma */
html {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

@media (max-width: 605px) { 
    html:not(.is-iframe) body { padding-bottom: 90px; }
    html.is-iframe body { padding-bottom: 0; } 
}

/* ==========================================================================
   3. LAYOUT Y CONTENEDORES
   ========================================================================= */
.container { display: grid; grid-template-columns: 1fr; gap: 0.7rem; padding: 0.7rem; max-width: 1300px; margin: 0 auto; }
@media (min-width: 768px) { .container { padding: 0.9rem; gap: 0.9rem; } }

@media (min-width: 992px) {
    .container { grid-template-columns: minmax(255px, 290px) minmax(600px, 1fr); justify-content: center; align-items: stretch; grid-template-areas: "selection filters" "summary summary"; gap: 0.85rem; }
    .selection-column { grid-area: selection; } .filters-column { grid-area: filters; } .summary-column { grid-area: summary; }
    .selection-column, .filters-column, .summary-column { min-width: 0; }
    .selection-column .panel, .filters-column .panel { height: 100%; display: flex; flex-direction: column;}
    .selection-column .panel-body { padding: 0.8rem 0.7rem; flex: 1;}
    .filters-column .panel-body { padding: 0.6rem 0.85rem; display: flex; flex-direction: column; justify-content: flex-start; gap: 0.3rem; flex: 1; }
    .filter-grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; align-items: start; margin-bottom: 0.6rem; }
    .filter-group { margin-bottom: 0; }
    .filter-grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; align-items: start; margin-bottom: 0.4rem; }
    .filters-column .filter-group-boxed { padding: 0.4rem 0.6rem; max-width: none; margin-left: 0; margin-right: 0; }
    .filter-group h3 { font-size: 0.82rem; margin-bottom: 0.25rem; font-weight: 700; letter-spacing: 0.15px; }
    .range-slider-container { height: 18px; }
    .range-values { margin-top: 1px; }
    .range-values span { font-size: 0.75rem; padding: 1px 6px; }
    .info-icon { width: 16px; height: 16px; font-size: 0.65rem; margin-left: 5px; }
}
.desktop-button-container { 
        margin-top: 0 !important; 
        margin-bottom: 1.5rem; 
    }

.panel { background: var(--color-primary-light); border: 1px solid rgba(0, 0, 0, 0.04); border-radius: var(--border-radius-lg); box-shadow: var(--shadow); overflow: visible !important; transition: box-shadow 0.3s ease; }
.panel-header { display: flex; justify-content: space-between; align-items: center; padding: 0.72rem 1rem; border-bottom: 1px solid rgba(0, 0, 0, 0.06); background-color: #ffffff; min-height: 46px; gap: 10px; }
.panel-header h2 { margin: 0; font-size: 1rem; color: var(--color-primary); font-weight: 700; letter-spacing: -0.15px; }
.panel-body { padding: 0.95rem; }
body.theme-euromillones .panel { border-color: #d8e3ec; }
body.theme-gordo .panel { border-color: var(--colorBoleto4); }

/* ==========================================================================
   4. COMPONENTES DEL BOLETO Y STEPPER DE AZAR
   ========================================================================= */

/* UNIFICACIÓN DE ANCHOS */
.stepper-azar-wrap,
.boleto-actions,
.boleto-grid,
.reintegro-section,
.reintegros-grid,
.estrellas-grid {
    width: 100% !important;
    max-width: var(--cg_ticket_width_5) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

body.theme-gordo .stepper-azar-wrap,
body.theme-gordo .boleto-actions,
body.theme-gordo .boleto-grid,
body.theme-gordo .reintegro-section,
body.theme-gordo .reintegros-grid,
body.theme-euromillones .stepper-azar-wrap,
body.theme-euromillones .boleto-actions,
body.theme-euromillones .boleto-grid,
body.theme-euromillones .reintegro-section,
body.theme-euromillones .estrellas-grid {
    max-width: var(--cg_ticket_width_6) !important;
}

/* STEPPER COMPACTO Y ELEGANTE */
.stepper-azar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px !important;
}

.stepper-azar-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-primary);
    text-align: center;
    width: 100%;
}

.stepper-azar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%; 
    background: #ffffff;
    border-radius: 50px;
    padding: 4px 6px;
    border: 1px solid var(--color-border);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}

.stepper-azar-controls button {
    width: 32px; 
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--color-primary);
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: transform 0.1s ease, background 0.2s;
    padding: 0; margin: 0;
}

.stepper-azar-controls button .material-icons-outlined { font-size: 18px; }

.stepper-azar-controls #azar-val {
    font-weight: 800;
    color: var(--color-primary);
    font-size: 1.05rem;
    text-align: center;
    flex-grow: 1;
}

@media (hover: hover) and (pointer: fine) {
    .stepper-azar-controls button:hover { transform: scale(1.05); }
    .stepper-azar-controls button:active { transform: scale(0.95); }
}

/* CABECERA OSCURA DEL BOLETO (2 ACCIONES PERFECTAMENTE ALINEADAS) */
.boleto-actions {
    display: flex !important;
    justify-content: space-between !important; 
    align-items: center !important;
    min-height: 36px !important;
    margin-bottom: 2px !important;
    background-color: var(--colorBoleto3) !important;
    border: none !important;
    border-radius: 4px 4px 0 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
}

/* Colores corporativos específicos para la botonera oscura */
body.theme-euromillones .boleto-actions {
    background-color: #19416b !important;
}

body.theme-gordo .boleto-actions {
    background-color: #e2656c !important;
}

body.theme-eurodreams .boleto-actions {
    background-color: #6b3e98 !important;
}

.boleto-actions button {
    height: 36px !important; 
    width: 36px !important; 
    background: transparent !important;
    border: none !important; 
    box-shadow: none !important; 
    display: flex !important;
    align-items: center !important; 
    justify-content: center !important; 
    padding: 0 !important;
    margin: 0 !important; 
    border-radius: 0 !important; 
    cursor: pointer !important;
    color: #ffffff !important;
}

.boleto-actions #btn-limpiar-boleto { border-right: none !important; border-top-left-radius: 4px !important; }
.boleto-actions #btn-azar { border-left: none !important; border-top-right-radius: 4px !important; }
.boleto-actions .material-icons-outlined { font-size: 20px !important; }

@media (hover: hover) and (pointer: fine) { .boleto-actions button:hover { background-color: rgba(255, 255, 255, 0.15) !important; } }

/* REJILLA DEL BOLETO */
.boleto-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--cg_num_gap); margin-bottom: 4px !important; }
.boleto-column { display: flex; flex-direction: column; gap: var(--cg_num_gap); }
.num-button-placeholder { width: 100%; height: var(--cg_num_size); visibility: hidden; }

@keyframes selectSpin { 0% { transform: rotateY(0deg) scale(1); } 100% { transform: rotateY(360deg) scale(1.03); } }

.num-button {
    width: 100%; height: var(--cg_num_size); min-height: var(--cg_num_size); padding: 0; line-height: 1;
    font-size: var(--cg_num_fs); font-weight: 500; border-radius: var(--cg_num_radius);
    border: 1px solid #c9c9c9; background: #ffffff; color: var(--color-accent); cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
    display: flex; align-items: center; justify-content: center; user-select: none; box-shadow: none;
    -webkit-tap-highlight-color: transparent; letter-spacing: -0.01em;
}

.boleto-grid button.num-button.selected { animation: selectSpin 0.18s ease-out; background-color: var(--color-primary); color: #ffffff; border-color: var(--color-primary); box-shadow: none; }
.boleto-grid button.num-button.fixed { background-color: #ffcc00; color: #000; border-color: #d4a900; box-shadow: none; }
@media (hover: hover) and (pointer: fine) { .num-button:hover { background-color: #f7f7f7; border-color: #bdbdbd; transform: none; } }
.num-button:active { transform: scale(0.97); }

body.theme-gordo .boleto-grid, body.theme-euromillones .boleto-grid { grid-template-columns: repeat(6, 1fr); }

/* BLOQUE INFERIOR */
.reintegro-section { padding: 0; border: none; box-shadow: none; border-radius: 0; background: transparent; }
.reintegro-title { display: block; width: 100%; margin: 0 0 3px 0; padding: 5px 6px; background: #eef4f0; background: color-mix(in srgb, var(--color-accent) 18%, white); color: var(--color-accent); text-align: center; font-size: 0.68rem; line-height: 1.1; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.reintegro-title span { display: inline-flex; align-items: center; gap: 2px; opacity: 0.9; font-weight: 600; }
.reintegros-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--cg_num_gap); justify-content: center; }

.reintegro-button {
    width: 100%; height: var(--cg_reintegro_size); font-size: 0.84rem; font-weight: 500; border-radius: 2px;
    border: 1px solid #c9c9c9; background: #ffffff; color: var(--color-accent); cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
    display: flex; align-items: center; justify-content: center; user-select: none; box-shadow: none; -webkit-tap-highlight-color: transparent;
}
.reintegros-grid button.reintegro-button.selected { animation: selectSpin 0.18s ease-out; background-color: var(--color-primary); color: #ffffff; border-color: var(--color-primary); transform: none; box-shadow: none; }
@media (hover: hover) and (pointer: fine) { .reintegro-button:hover { background-color: #f7f7f7; border-color: #bdbdbd; transform: none; } }

/* EUROMILLONES - ESTRELLAS */
.theme-euromillones .estrellas-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; justify-content: center; padding-top: 1px; }
.theme-euromillones .estrella-button {
    width: 100%; height: var(--cg_estrella_size); font-size: 0.88rem; font-weight: 500; background: #ffffff; color: var(--color-accent); cursor: pointer; transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
    display: flex; align-items: center; justify-content: center; user-select: none; margin: 0 auto; border: none;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); position: relative; isolation: isolate; -webkit-tap-highlight-color: transparent;
}
.theme-euromillones .estrella-button::before { content: ""; position: absolute; inset: 0; background: #ffffff; clip-path: inherit; z-index: -1; }
body.theme-euromillones .estrellas-grid button.estrella-button.selected { animation: selectSpin 0.18s ease-out; background: #ffcc00 !important; color: #000 !important; filter: none; box-shadow: none; }
body.theme-euromillones .estrellas-grid button.estrella-button.selected::before { background: #ffcc00 !important; }
@media (hover: hover) and (pointer: fine) { .theme-euromillones .estrella-button:hover { background: #eef2f6; } .theme-euromillones .estrella-button:hover::before { background: #eef2f6; } }

/* EURODREAMS */
.theme-eurodreams .reintegros-grid { grid-template-columns: repeat(5, 1fr); gap: var(--cg_num_gap); }
.theme-eurodreams .reintegro-button { width: 100%; height: var(--cg_reintegro_size); font-size: 0.86rem; font-weight: 500; border-radius: 2px; background-color: #ffffff; color: var(--color-accent); border: 1px solid #c9c9c9; }
body.theme-eurodreams .reintegros-grid button.reintegro-button.selected { animation: selectSpin 0.18s ease-out; background-color: var(--color-primary); color: #ffffff; border-color: var(--color-primary); box-shadow: none; }

/* ==========================================================================
   5. BOTONES DE ACCIÓN E INTERFAZ GENERAL
   ========================================================================= */
.btn {
    padding: 0.6rem 1rem; font-size: 0.9rem; font-weight: 600; border: none; border-radius: var(--border-radius);
    cursor: pointer; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); text-align: center; flex: 1;
    display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(0) scale(0.98); box-shadow: var(--shadow-sm); }
.btn:focus-visible, .num-button:focus-visible, .reintegro-button:focus-visible, .estrella-button:focus-visible, .info-icon:focus-visible, .popover-close:focus-visible, .filter-options label:focus-visible { outline: 3px solid rgba(5, 134, 74, 0.3); outline-offset: 2px; }

.btn-primary { background-color: var(--color-accent); border-color: var(--color-accent); color: #ffffff; box-shadow: var(--shadow); }
.btn-secondary { background-color: var(--color-primary); border-color: var(--color-primary); color: #ffffff; box-shadow: var(--shadow); }
.btn-primary .btn-price, .btn-secondary .btn-price { color: #ffffff; opacity: 0.9; }

.btn-probable { background-color: var(--color-success-bg); border: 1px solid var(--color-success-border); color: var(--color-primary); box-shadow: var(--shadow-sm); }
.btn-probable .material-icons-outlined { color: inherit; margin-right: 4px; }
.btn-light { background-color: #ffffff; border: 1px solid var(--color-border); color: var(--color-text-light); box-shadow: var(--shadow-sm); }

.btn-icon { width: 42px; height: 42px; padding: 0; flex: 0 0 42px; border-radius: var(--border-radius); background-color: #ffffff; border: 1px solid var(--color-accent); color: var(--color-accent); box-shadow: var(--shadow-sm); display: flex; align-items: center; justify-content: center; }
.btn-icon .material-icons-outlined { font-size: 22px; color: inherit; }
/* Prevenir que se lean las palabras de los iconos si la carga va lenta */
.material-icons-outlined {
    overflow: hidden;
    white-space: nowrap;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    width: 1em;
    height: 1em;
    line-height: 1;
}

.btn-danger { background-color: #ffffff; border: 1px solid var(--color-danger); color: var(--color-danger); }
.btn-danger .material-icons-outlined { color: inherit; }

@media (hover: hover) and (pointer: fine) {
    .btn:not(.boleto-actions button):not(.stepper-azar-controls button):hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
    .btn-primary:hover { background-color: var(--color-primary); border-color: var(--color-primary); }
    .btn-secondary:hover { background-color: var(--color-text-dark); border-color: var(--color-text-dark); }
    .btn-probable:hover { background-color: var(--color-primary); color: #ffffff; border-color: var(--color-primary); }
    .btn-light:hover { background-color: var(--color-border); color: var(--color-text-dark); }
    .btn-icon:hover { background-color: var(--color-success-bg); }
    .btn-danger:not(.boleto-actions button):hover { background-color: var(--color-danger); color: #ffffff; }

    .theme-gordo .btn-primary:hover, .theme-gordo .btn-secondary:hover { background-color: var(--color-primary); border-color: var(--color-primary); }
    .theme-euromillones .btn-primary:hover { background-color: #bacddd; border-color: #0d2136; color: #0d2136; }
    .theme-eurodreams .btn-primary:hover { background-color: #d1bfe3; border-color: #40265e; color: #40265e; }
    .theme-eurodreams .btn-secondary:hover { background-color: #40265e; }
}

.theme-gordo .btn-primary, .theme-gordo .btn-secondary { background-color: var(--color-accent); border-color: var(--color-accent); color: #ffffff; }
.theme-euromillones .btn-primary { background-color: #d8e3ec; border-color: #0d2136; color: #0d2136; }
.theme-eurodreams .btn-primary { background-color: #e6ddf2; border-color: #6b3e98; color: #40265e; }

body .btn:disabled { background-color: var(--grisBoleto); color: #fff; border-color: transparent; cursor: not-allowed; transform: none; box-shadow: none; opacity: 0.7; }

.filters-header-actions { display: flex; gap: 0.45rem; align-items: stretch; flex: 0 0 auto; height: 32px; }
.btn-sm { padding: 0 0.7rem; font-size: 0.78rem; line-height: 1; height: 100%; margin: 0; }
.panel-header-filters { min-height: 44px; }
.desktop-button-container { display: none; gap: 1rem; margin-top: 1.15rem; max-width: 600px; margin-left: auto; margin-right: auto; }
@media (min-width: 606px) { .desktop-button-container { display: flex; } }

.btn-text-wrapper { display: flex; flex-direction: column; align-items: center; line-height: 1.1; text-align: center; }
.btn .btn-text { font-weight: 700; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px; }
.btn .btn-price { font-size: 0.8rem; font-weight: 700; color: inherit; opacity: 0.9; margin-top: 2px; }

/* ==========================================================================
   6. ELEMENTOS DE FILTROS Y SLIDERS (VERSIÓN COMPACTA)
   ========================================================================= */

/* DISTANCIA Y PADDING REDUCIDOS PARA COMPACTAR */
.filter-group-boxed { 
    padding: 0.45rem 0.65rem;
    border: 1px solid rgba(0, 0, 0, 0.04); 
    box-shadow: var(--shadow-sm); 
    border-radius: var(--border-radius-lg); 
    margin-bottom: 0.4rem;
    background: #ffffff; 
    transition: box-shadow 0.2s ease; 
    overflow: visible !important; 
}
@media (hover: hover) and (pointer: fine) { .filter-group-boxed:hover { box-shadow: var(--shadow); } }

.filter-group { margin-bottom: 0; position: relative; }
.filter-group-boxed .filter-group { margin-bottom: 0; }
.filter-group:last-child { margin-bottom: 0; }

/* TÍTULOS MÁS COMPACTOS */
.filter-group h3 { 
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
    display: flex; 
    align-items: center; 
    font-weight: 700; 
    color: var(--color-text-dark); 
}

/* SLIDERS COMPACTADOS */
.range-slider-container { position: relative; width: 100%; height: 24px; display: flex; align-items: center; }
.range-slider-track { position: absolute; width: 100%; height: 4px; background-color: var(--color-border); border-radius: 999px; opacity: 0.45; }
.range-slider-progress { position: absolute; height: 4px; background-color: var(--color-primary); border-radius: 999px; }
.range-slider-container input[type="range"] { position: absolute; width: 100%; -webkit-appearance: none; appearance: none; background: transparent; pointer-events: none; margin: 0; box-sizing: border-box; }
.range-slider-container input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; background-color: var(--color-primary); border-radius: 50%; cursor: pointer; pointer-events: auto; border: 2px solid #ffffff; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18); transition: transform 0.1s ease; }
.range-slider-container input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; background-color: var(--color-primary); border-radius: 50%; cursor: pointer; pointer-events: auto; border: 2px solid #ffffff; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18); transition: transform 0.1s ease; }
@media (hover: hover) and (pointer: fine) { .range-slider-container input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.1); } .range-slider-container input[type="range"]::-moz-range-thumb:hover { transform: scale(1.1); } }

.range-values { display: flex; justify-content: space-between; margin-top: 1px; }
.range-values span { font-size: 0.72rem; font-weight: 700; color: var(--color-primary); padding: 1px 5px; background: var(--color-primary-light); border-radius: 4px; }

/* CUADRÍCULA ESTABLE PARA QUE LOS LAYOUTS INLINE DE CADA JUEGO FUNCIONEN IGUAL EN TODOS LOS BREAKPOINTS */
.filter-options { 
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 4px;
    align-items: stretch;
    width: 100%;
}
.filter-options input[type="checkbox"] { display: none; }
.filter-options label {
    width: 100%;
    display: flex; align-items: center; justify-content: center; 
    min-height: 26px;
    padding: 0.2rem;
    font-size: 0.71rem;
    line-height: 1.1; font-weight: 600; color: var(--color-text-light);
    border: 1px solid rgba(0, 0, 0, 0.08); border-radius: 4px; background-color: #fafafa; cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1); user-select: none; text-align: center;
    white-space: nowrap; 
    word-break: normal; 
    letter-spacing: -0.3px; 
    hyphens: none;
}

.filter-options input[type="checkbox"]:checked + label { background-color: var(--color-primary); color: var(--color-light); border-color: var(--color-primary); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); }
@media (hover: hover) and (pointer: fine) { .filter-options label:hover { background-color: var(--color-primary-light); color: var(--color-primary); border-color: var(--color-accent); } }

/* ==========================================================================
   FILTROS DINÁMICOS · MISMO ESTILO VISUAL QUE QUINIELA
   ========================================================================== */

.filter-options input[type="checkbox"]:disabled + label,
.filter-options label.is-disabled {
    color: #94a3b8 !important;
    border-color: #e2e8f0 !important;
    background: repeating-linear-gradient(
        45deg,
        #f8fafc,
        #f8fafc 4px,
        #e2e8f0 4px,
        #e2e8f0 8px
    ) !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
    opacity: 0.85 !important;
    transform: none !important;
    filter: none !important;
}

.filter-options input[type="checkbox"]:disabled:checked + label {
    color: #94a3b8 !important;
    border-color: #e2e8f0 !important;
    background: repeating-linear-gradient(
        45deg,
        #f8fafc,
        #f8fafc 4px,
        #e2e8f0 4px,
        #e2e8f0 8px
    ) !important;
    box-shadow: none !important;
}

.filter-options input[type="checkbox"]:disabled + label::after,
.filter-options label.is-disabled::after {
    content: none !important;
    display: none !important;
}

@media (hover: hover) and (pointer: fine) {
    .filter-options input[type="checkbox"]:disabled + label:hover,
    .filter-options label.is-disabled:hover {
        color: #94a3b8 !important;
        border-color: #e2e8f0 !important;
        background: repeating-linear-gradient(
            45deg,
            #f8fafc,
            #f8fafc 4px,
            #e2e8f0 4px,
            #e2e8f0 8px
        ) !important;
        box-shadow: none !important;
        cursor: not-allowed !important;
        opacity: 0.85 !important;
        transform: none !important;
    }
}

/* ==========================================================================
   7. RESUMEN, ALERTAS Y POPOVERS
   ========================================================================= */
.summary-column .panel-body { padding: 1rem; }
@media (min-width: 992px) { .summary-column .panel-body { padding: 1.15rem; } }

/* --- SEPARADOR ELEGANTE PARA EL RESUMEN --- */
.summary-overline {
    display: flex;
    align-items: center;
    margin: 2rem 0 1.2rem 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Creamos las líneas laterales */
.summary-overline::before,
.summary-overline::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.summary-overline::before { margin-right: 1rem; }
.summary-overline::after { margin-left: 1rem; }

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

@media (min-width: 768px) { 
    .summary-grid { grid-template-columns: repeat(4, 1fr); } 
    .summary-grid .summary-card:nth-child(4) { 
        border: 1px solid var(--color-primary); 
        background-color: #f0fdf4;
    }
}
.summary-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius);
    padding: 0.75rem 0.6rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .summary-card:hover { box-shadow: var(--shadow); }
}

.summary-card strong {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    line-height: 1.2;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-card span:not(#summary-count) {
    display: block;
    font-size: 0.96rem;
    color: var(--color-primary);
    font-weight: 700;
    word-break: break-word;
}

.summary-card.full-width {
    grid-column: 1 / -1;
}

.summary-card.full-width > span {
    display: inline-block;
    width: 100%;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.32rem 0.48rem;
    border-radius: var(--border-radius);
    font-size: 0.74rem;
    line-height: 1.28;
    font-weight: 400;
    color: var(--color-primary);
    margin-top: 4px;
}

.summary-card-selection .summary-title-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    white-space: nowrap;
    max-width: 100%;
    margin-bottom: 0.2rem;
}

@media (min-width: 768px) {
    .summary-card.full-width {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 0.8rem 1rem;
    }

    .summary-card.full-width strong {
        margin-bottom: 0;
    }

    .summary-card.full-width strong::after {
        content: "";
    }
}

/* --- CAJA DE AVISOS Y RESULTADOS (CENTRADA) --- */
.status-box {
    display: none;
    margin: 0 auto 1.5rem auto;
    max-width: 600px;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.85rem 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    text-align: center;
}.status-box.show { display: block; animation: fadeIn 0.3s ease-out; }
.status-box.warning { color: #92400e; background: var(--color-warning-bg); border: 1px solid var(--color-warning-border); border-left: 4px solid var(--color-warning-border); }
.status-box.error { color: var(--color-danger); background: #fef2f2; border: 1px solid #fca5a5; border-left: 4px solid var(--color-danger); }
.status-box.success { color: #166534; background: var(--color-success-bg); border: 1px solid var(--color-success-border); border-left: 4px solid var(--color-accent); }

.info-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid #d1d5db; background: #f3f4f6; color: #6b7280; font-weight: 700; font-size: 0.7rem; cursor: pointer; margin-left: 6px; padding: 0; vertical-align: middle; transition: all 0.2s ease; }
@media (hover: hover) and (pointer: fine) { .info-icon:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); } }

.info-icon[aria-expanded="true"] { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.filter-popover[aria-hidden="false"] { display: block; opacity: 1; transform: translateY(0); pointer-events: auto; }
.status-box[role="status"] { min-height: 1.25rem; }

.filter-popover { 
    display: none; 
    position: absolute; 
    z-index: 1000; 
    width: 280px; 
    max-width: min(280px, calc(100vw - 30px)); 
    background-color: var(--color-popover-bg); 
    color: var(--color-text-dark); 
    border: 2px solid var(--color-primary); 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); 
    border-radius: var(--border-radius-lg); 
    padding: 1.25rem; 
    top: 30px; 
    left: 0; 
    opacity: 0; 
    transform: translateY(-8px); 
    transition: opacity 0.2s ease-out, transform 0.2s ease-out; 
    pointer-events: none; 
}
.filter-popover.show { display: block; opacity: 1; transform: translateY(0); pointer-events: auto; }
.filter-popover > strong { color: var(--color-primary); font-size: 1rem; display: block; margin-bottom: 0.5rem; font-weight: 700; }
.filter-popover p strong { display: inline; margin: 0; color: var(--color-primary); }
.filter-popover p { font-size: 0.85rem; line-height: 1.4; margin: 0.4rem 0 0 0; color: var(--color-text-light); }
.popover-close { position: absolute; top: 10px; right: 12px; background: none; border: none; font-size: 1.5rem; color: #9ca3af; cursor: pointer; padding: 0; line-height: 1; transition: color 0.2s ease; }
@media (hover: hover) and (pointer: fine) { .popover-close:hover { color: var(--color-danger); } }

.loading-spinner { display: none; width: 18px; height: 18px; border: 2px solid rgba(0, 0, 0, 0.15); border-top: 2px solid var(--color-primary); border-radius: 50%; animation: spin 1s linear infinite; }
.footer-summary-mobile .btn-secondary .loading-spinner { border-color: rgba(255, 255, 255, 0.25); border-top-color: #ffffff; }
.btn.calculating .btn-text, .btn.calculating .btn-text-wrapper { display: none; }
.btn.calculating .material-icons-outlined { display: none; }
.btn.calculating .loading-spinner { display: inline-block; }

.live-note {
    margin-top: 0;
    padding: 0.85rem 1rem;
    border-radius: var(--border-radius);
    background: var(--color-primary-light);
    border: 1px solid var(--color-success-bg);
    color: var(--color-text-dark);
    font-size: 0.85rem;
    line-height: 1.45;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
}
.live-note strong { color: var(--color-primary); font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes fadeIn { 0% { opacity: 0; transform: translateY(-5px); } 100% { opacity: 1; transform: translateY(0); } }

/* ==========================================================================
   8. MEDIA QUERIES (MOBILE)
   ========================================================================= */
.footer-summary-mobile { display: none; }
html.is-iframe .footer-summary-mobile { display: none !important; }

@media (max-width: 605px) {
    :root {
        --cg_num_size: 32px; 
        --cg_num_fs: 0.96rem;
        --cg_ticket_width_5: 200px; 
        --cg_ticket_width_6: 240px; 
        --cg_reintegro_size: 35px;
        --cg_estrella_size: 41px; 
        --cg_actionbar_h: 44px; 
    }
/* --- REPARACIÓN: CABECERA DE FILTROS EN MÓVIL --- */
    .panel-header-filters {
        flex-wrap: wrap !important;
        padding-bottom: 0.8rem !important;
    }
    .filters-header-actions {
        width: 100% !important;
        height: 38px !important;
        margin-top: 4px;
    }
    .filters-header-actions .btn-sm {
        flex: 1 !important;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .boleto-grid { margin-bottom: 5px !important; }
    .reintegro-title { margin-bottom: 3px; padding: 6px 8px; font-size: 0.75rem; }

    .reintegro-button {
        font-size: 0.95rem;
    }

    .theme-eurodreams .reintegro-button {
        font-size: 0.96rem;
    }

    .theme-euromillones .estrella-button {
        font-size: 1rem;
    }

    /* BARRA INFERIOR MÓVIL */
    html:not(.is-iframe) .footer-summary-mobile {
        display: flex;
        position: fixed !important;
        bottom: 0 !important;
        left: 0;
        margin: 0 !important;
        width: 100% !important;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom)) 10px;
        height: auto !important;
        min-height: 60px !important;
        background: var(--color-primary-trans) !important;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 9999;
        align-items: center;
        gap: 0.75rem;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    }

    html.is-iframe .footer-summary-mobile { display: none !important; }
    
    .footer-summary-mobile .btn { 
        flex-grow: 1; 
        flex-basis: 0; 
        height: 40px !important; 
        min-height: 40px !important; 
    }

    /* COMPACTACIÓN DE FILTROS EN MÓVIL */
    .filter-group-boxed { 
        padding: 0.4rem 0.6rem !important;
        margin-bottom: 0.4rem !important;
    }

    .filter-group h3 { 
        font-size: 0.82rem !important; 
        margin-bottom: 0.25rem !important;
    }

    .filter-options { 
        grid-template-columns: repeat(auto-fit, minmax(65px, 1fr)) !important; 
        gap: 4px !important; 
    }
    
    .filter-options label { 
        min-height: 30px !important;
        font-size: 0.72rem !important; 
        padding: 0.2rem !important;
    }

    /* Sliders en móvil */
    .range-slider-container { height: 20px !important; }
    .range-values { margin-top: 0 !important; }
    .range-values span { font-size: 0.7rem !important; padding: 1px 4px !important; }
}

/* --- REDISEÑO DEL RESUMEN EN MÓVIL (4 CAJAS + 2 ANCHAS) --- */
@media (max-width: 767px) {
    .summary-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .summary-grid .summary-card:nth-child(1) { order: 1; }
    .summary-grid .summary-card:nth-child(3) { order: 2; }
    .summary-grid .summary-card:nth-child(2) { order: 3; opacity: 0.7; }
    .summary-grid .summary-card:nth-child(4) { 
        order: 4; 
        border: 1px solid var(--color-primary); 
        background-color: #f0fdf4;
    }

    .summary-grid .summary-card.full-width { order: 5; }
}

/* --- ESTILO PARA EL CONTADOR INTEGRADO (ETIQUETA) --- */
#summary-count {
    display: inline-block !important;
    font-size: 0.8rem !important; 
    background-color: var(--color-primary) !important; 
    color: #ffffff !important; 
    padding: 2px 8px !important;
    border-radius: 4px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    margin-left: 6px !important;
}
@media (max-width: 605px) {
    .summary-card.full-width > span {
        font-size: 0.72rem;
        line-height: 1.24;
        padding: 0.3rem 0.45rem;
    }
}

/* ==========================================================================
   OPTIMIZACIÓN MÓVIL: EDGE-TO-EDGE (Maximizar espacio útil)
   ========================================================================== */
@media (max-width: 768px) {
    main.container {
        padding-left: 0 !important;
        padding-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden;
    }

    .panel {
        border-left: none !important;
        border-right: none !important;
        border-radius: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-shadow: none !important;
        border-bottom: 2px solid var(--color-primary-light);
    }

    .panel-body {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    .panel-header {
        padding-left: 10px !important;
        padding-right: 10px !important;
        border-radius: 0 !important;
    }

    .filter-grid-2col,
    .summary-grid {
        gap: 8px !important;
    }

    .boleto-grid {
        gap: var(--cg_num_gap) !important;
    }

    .boleto-column {
        gap: var(--cg_num_gap) !important;
    }
}