:root {
    --bg-base: #0f0a1a;
    --panel-bg: #1a152e;
    --panel-border: #2c244c;
    --accent-main: #7657d5;
    --accent-fuchsia: #e028b1;
    --accent-green: #33d69f;
    --highlight-gradient: linear-gradient(135deg, #7657d5 0%, #e028b1 100%);
    --text-main: #ffffff;
    --text-muted: #b1a2e8;
    --font-family: 'Segoe UI', system-ui, sans-serif;
}

/* --- LAYOUT GLOBAL --- */
.bingo-public-layout {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-base);
    font-family: var(--font-family);
}

/* --- SIDEBAR MORADO (IZQUIERDA) --- */
.purple-sidebar {
    width: 240px;
    background-color: #120d21;
    border-right: 1px solid var(--panel-border);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 25px;
}

.brand-icon {
    background: var(--accent-main);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 20px;
    box-shadow: 0 4px 10px rgba(118, 87, 213, 0.4);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-audit {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 150px;
}

.audit-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0 0 10px 0;
    color: var(--accent-fuchsia);
    font-weight: 800;
}

.audit-scroller {
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 5px;
}

.audit-scroller::-webkit-scrollbar {
    width: 4px;
}

.audit-scroller::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.audit-scroller::-webkit-scrollbar-thumb {
    background: var(--accent-main);
    border-radius: 4px;
}

.sidebar-footer {
    margin-top: 20px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.sidebar-footer .dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-green);
}

/* --- TABLERO PRINCIPAL (DERECHA) --- */
.board-shell.bingo-purple-theme {
    flex-grow: 1;
    color: var(--text-main);
    padding: 20px 30px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow: hidden;
    min-width: 0;
}

/* 1. Cabecera */
.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.header-titles .subtitle {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
}

.header-titles h1 {
    font-size: 28px;
    font-weight: 800;
    margin: 4px 0 0 0;
    color: var(--text-main);
}

.header-stats {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.stat-pill {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 6px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
}

.stat-label {
    font-size: 9px;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 14px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 4px;
}

.stat-value.highlight-bg {
    background: var(--accent-main);
    color: #fff;
}

.stat-value.dark-bg {
    color: var(--text-main);
}

.btn-fullscreen {
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-fullscreen:hover {
    background: var(--panel-border);
    color: #fff;
}

/* 2. Franja Superior (Top Ribbon) */
.top-ribbon {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    display: flex;
    align-items: stretch;
    height: 120px;
    flex-shrink: 0;
}

.ribbon-left {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 35px;
    border-right: 1px solid var(--panel-border);
}

.vertical-text {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--accent-fuchsia);
    font-weight: 700;
}

/* =====================================================
   BOLILLA PRINCIPAL AZUL - GLASSMORPHISM 3D
===================================================== */

.highlight-ball {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;

    display: grid;
    place-items: center;

    overflow: hidden;
    flex-shrink: 0;

    font-weight: 900;
    color: #ffffff;
    line-height: 1;
    text-align: center;
    padding: 0;

    border: 1px solid rgba(174, 150, 255, 0.38);

    background:
        radial-gradient(
            circle at 30% 25%,
            rgba(255,255,255,0.48) 0%,
            rgba(255,255,255,0.15) 14%,
            rgba(255,255,255,0.03) 27%,
            transparent 38%
        ),
        radial-gradient(
            circle at 50% 38%,
            #A58AF8 0%,
            #8768E9 37%,
            #6F50CD 68%,
            #49348C 100%
        );

    box-shadow:
        inset 0 9px 16px rgba(255,255,255,0.13),
        inset 0 -15px 22px rgba(32, 20, 70, 0.48),
        0 8px 20px rgba(111, 80, 205, 0.30),
        0 0 16px rgba(135, 104, 233, 0.22);

    text-shadow:
        0 2px 5px rgba(0,0,0,0.55);
}

.highlight-ball::before {
    content: '';
    position: absolute;

    top: 14%;
    left: 18%;

    width: 30%;
    height: 18%;

    border-radius: 50%;

    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0.70),
        rgba(255,255,255,0.10)
    );

    transform: rotate(-20deg);
    filter: blur(1px);
}

.highlight-ball::after {
    content: none;
}

.highlight-ball.small {
    width: 86px;
    height: 86px;
    font-size: 37px;
}

.highlight-ball.giant {
    width: 138px;
    height: 138px;
    font-size: 56px;
    margin: 12px auto;
}

.highlight-ball.small span,
.highlight-ball.giant span {
    position: relative;
    z-index: 2;
}

.highlight-ball.small {
    width: 88px;
    height: 88px;
    font-size: 38px;
}

.highlight-ball.giant {
    width: 146px;
    height: 146px;
    font-size: 62px;
    margin: 15px auto;
}

.ribbon-center {
    flex-grow: 1;
    padding: 15px 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.ribbon-label {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    font-weight: 700;
    margin-bottom: 12px;
    text-align: left;
}

.draw-history {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    align-items: center;
    padding-bottom: 8px;
}

.draw-history::-webkit-scrollbar {
    height: 6px;
}

.draw-history::-webkit-scrollbar-track {
    background: transparent;
}

.draw-history::-webkit-scrollbar-thumb {
    background: var(--accent-main);
    border-radius: 10px;
}

/* =====================================================
   ÚLTIMOS NÚMEROS - GLASSMORPHISM
===================================================== */

.draw-history > * {
    position: relative;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    isolation: isolate;

    font-size: 20px;
    font-weight: 800;
    color: rgba(255,255,255,0.86);
    text-shadow: 0 1px 3px rgba(0,0,0,0.35);

    border: 1px solid rgba(255,255,255,0.08);

    background:
        radial-gradient(circle at 30% 28%, rgba(255,255,255,0.24) 0%, rgba(255,255,255,0.08) 18%, rgba(255,255,255,0.02) 28%, rgba(255,255,255,0) 40%),
        linear-gradient(160deg, rgba(110, 95, 200, 0.18), rgba(58, 46, 115, 0.12)),
        rgba(255,255,255,0.03);

    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    box-shadow:
        inset 0 6px 12px rgba(255,255,255,0.08),
        inset 0 -8px 14px rgba(0,0,0,0.16),
        0 4px 10px rgba(0,0,0,0.18);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.draw-history > *::before {
    content: '';
    position: absolute;
    top: 14%;
    left: 21%;
    width: 22%;
    height: 16%;
    border-radius: 50%;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0.55),
        rgba(255,255,255,0.10)
    );
    transform: rotate(-20deg);
}

/* =====================================================
   ÚLTIMO NÚMERO DESTACADO - AZUL
===================================================== */

.draw-history > *:first-child {
    color: #ffffff;

    border: 1px solid rgba(174, 150, 255, 0.34);

    background:
        radial-gradient(
            circle at 30% 25%,
            rgba(255,255,255,0.40) 0%,
            rgba(255,255,255,0.11) 15%,
            transparent 32%
        ),
        radial-gradient(
            circle at 50% 38%,
            #9A7CF5 0%,
            #8768E9 38%,
            #6F50CD 70%,
            #49348C 100%
        );

    box-shadow:
        inset 0 7px 13px rgba(255,255,255,0.10),
        inset 0 -10px 16px rgba(33,20,73,0.44),
        0 4px 12px rgba(111,80,205,0.25);
}

.ribbon-right {
    padding: 0 35px;
    display: flex;
    align-items: center;
}

.live-indicator {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
}

.live-indicator .dot.fuchsia {
    width: 10px;
    height: 10px;
    background: var(--accent-fuchsia);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-fuchsia);
}

/* 3. Contenido Principal */
.board-main-content {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    flex-grow: 1;
    min-height: 0;
}

.board-grid-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 25px;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 10px;
}

.panel-header .subtitle {
    font-size: 10px;
    color: var(--accent-fuchsia);
    letter-spacing: 2px;
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
}

.panel-header h2 {
    font-size: 20px;
    margin: 0;
    font-weight: 700;
}

.legend {
    display: flex;
    gap: 15px;
    font-size: 11px;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-item .dot.muted {
    background: rgba(255, 255, 255, 0.1);
}

.legend-item .dot.active {
    background: var(--accent-main);
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    gap: 8px;
    flex-grow: 1;
    align-content: start;
    overflow-y: auto;
    padding-right: 5px;
}

.number-grid::-webkit-scrollbar {
    width: 4px;
}

.number-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.number-grid::-webkit-scrollbar-thumb {
    background: var(--accent-main);
    border-radius: 4px;
}

/* =====================================================
   BOLILLAS DEL TABLERO - GLASSMORPHISM 3D
===================================================== */

.board-number {
    position: relative;
    aspect-ratio: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    isolation: isolate;
    user-select: none;
    min-width: 0;

    font-weight: 800;
    font-size: 14px;
    color: rgba(255,255,255,0.88);
    text-shadow: 0 1px 3px rgba(0,0,0,0.35);

    border: 1px solid rgba(255,255,255,0.10);

    background:
        radial-gradient(circle at 30% 28%, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0.10) 16%, rgba(255,255,255,0.03) 28%, rgba(255,255,255,0) 38%),
        linear-gradient(160deg, rgba(125, 110, 220, 0.22), rgba(72, 58, 130, 0.16)),
        rgba(255,255,255,0.03);

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    box-shadow:
        inset 0 8px 14px rgba(255,255,255,0.10),
        inset 0 -10px 14px rgba(0,0,0,0.18),
        0 4px 12px rgba(0,0,0,0.20);

    transition:
        transform 0.22s ease,
        box-shadow 0.22s ease,
        border-color 0.22s ease,
        background 0.22s ease;
}

.board-number::before {
    content: '';
    position: absolute;
    top: 13%;
    left: 20%;
    width: 24%;
    height: 18%;
    border-radius: 50%;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0.58),
        rgba(255,255,255,0.12)
    );
    transform: rotate(-20deg);
    filter: blur(0.5px);
    z-index: 1;
}

.board-number::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.06);
    z-index: 1;
}

.board-number:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow:
        inset 0 8px 16px rgba(255,255,255,0.12),
        inset 0 -12px 18px rgba(0,0,0,0.22),
        0 8px 18px rgba(118, 87, 213, 0.26);
}

/* =====================================================
   BOLILLAS ACTIVAS - VIOLETA DEL LOGO "B"
===================================================== */

.board-number.called,
.board-number[data-called="true"],
.board-number.active {
    color: #ffffff !important;

    border: 1px solid rgba(174, 150, 255, 0.36) !important;

    background:
        radial-gradient(
            circle at 30% 25%,
            rgba(255,255,255,0.38) 0%,
            rgba(255,255,255,0.12) 14%,
            rgba(255,255,255,0.02) 27%,
            transparent 38%
        ),
        radial-gradient(
            circle at 50% 38%,
            #9A7CF5 0%,
            #8768E9 38%,
            #6F50CD 70%,
            #49348C 100%
        ) !important;

    box-shadow:
        inset 0 8px 15px rgba(255,255,255,0.12),
        inset 0 -14px 22px rgba(33, 20, 73, 0.45),
        0 5px 14px rgba(111, 80, 205, 0.28),
        0 0 12px rgba(135, 104, 233, 0.22) !important;

    text-shadow:
        0 2px 4px rgba(0,0,0,0.55);

    transform: scale(1.03);
}

.board-number.called::after,
.board-number[data-called="true"]::after,
.board-number.active::after {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
}

/* 4. Paneles Laterales (Premios y Bola) */
.sidebar-panels {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
    min-height: 0;
}

.side-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.center-content {
    text-align: center;
    align-items: center;
    flex-shrink: 0;
}

.side-panel .subtitle {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 2px;
    font-weight: 700;
    text-transform: uppercase;
}

.side-panel .subtitle-bottom {
    font-size: 11px;
    color: var(--accent-fuchsia);
    letter-spacing: 1px;
    font-weight: 600;
    margin-top: 5px;
}

.side-panel h2 {
    font-size: 16px;
    margin: 5px 0 15px 0;
    font-weight: 700;
    flex-shrink: 0;
}

/* CONTENEDOR DE PREMIOS (Límite en normal, dinámico en pantalla completa) */
.prizes-container {
    flex-grow: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.prizes-scroller {
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 5px;
    max-height: 370px;
    /* Límite para mostrar 4 premios sin scroll en modo normal */
}

.prizes-scroller::-webkit-scrollbar {
    width: 6px;
}

.prizes-scroller::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.prizes-scroller::-webkit-scrollbar-thumb {
    background: var(--accent-main);
    border-radius: 4px;
}

.prizes-scroller::-webkit-scrollbar-thumb:hover {
    background: var(--accent-fuchsia);
}

.prize-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.prize-card.won {
    border-color: rgba(51, 214, 159, 0.4);
    background: rgba(51, 214, 159, 0.08);
}

.prize-content-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
}

.prize-avatar-badge {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.prize-card.won .prize-avatar-badge {
    background: rgba(51, 214, 159, 0.15);
    border-color: rgba(51, 214, 159, 0.4);
}

.prize-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.prize-number-bubble {
    position: absolute;
    bottom: -2px;
    right: -4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-main);
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    border: 2px solid #1a152e;
}

.prize-card.won .prize-number-bubble {
    background: var(--accent-green);
    color: #0a2e1f;
    border-color: #11221e;
}

.prize-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.prize-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prize-subinfo {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.prize-req {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-muted);
}

.prize-card.won .prize-req {
    background: rgba(51, 214, 159, 0.2);
    color: var(--accent-green);
}

.prize-amount {
    font-size: 14px;
    color: var(--accent-fuchsia);
    font-weight: 700;
    flex-shrink: 0;
}

.prize-card.won .prize-amount {
    color: var(--accent-green);
}

.prize-winner {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    padding-top: 8px;
}

.prize-winner strong {
    color: var(--accent-green);
    font-size: 12px;
    display: block;
    margin-top: 2px;
}

/* =====================================================
   ICONOS BOTÓN PANTALLA COMPLETA
===================================================== */

.btn-fullscreen .fullscreen-icon {
    width: 21px;
    height: 21px;
    display: block;
    pointer-events: none;
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

/* Por defecto mostramos "expandir" */
.btn-fullscreen .fullscreen-expand-icon {
    display: block;
}

/* Por defecto ocultamos "contraer" */
.btn-fullscreen .fullscreen-collapse-icon {
    display: none;
}

/* Cuando estamos en pantalla completa */
.btn-fullscreen.is-active .fullscreen-expand-icon {
    display: none;
}

.btn-fullscreen.is-active .fullscreen-collapse-icon {
    display: block;
}

/* Pequeño efecto visual */
.btn-fullscreen:hover .fullscreen-icon {
    transform: scale(1.08);
}