/* CSS Variables & Theme Definitions */
:root {
    --bg-dark: #070c18;
    --bg-darker: #04070f;
    --bg-panel: rgba(15, 23, 42, 0.6);
    --bg-panel-solid: #0d1527;
    --primary: #ffffff;
    --secondary: #94a3b8;
    
    /* Brand Colors based on Logo */
    --brand-navy: #0a2240;
    --brand-orange: #ff4500;
    --brand-yellow: #facc15;
    
    /* Status & Accents */
    --accent-blue: #3b82f6;
    --accent-gold: #fbbf24;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(250, 204, 21, 0.4);
    
    /* Fonts */
    --font-primary: 'Poppins', sans-serif;
    --font-display: 'Montserrat', sans-serif;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.6);
    --shadow-glow: 0 0 15px rgba(250, 204, 21, 0.35);

    /* Dynamic Sizing */
    --drum-size: min(230px, 30vh);
    --ball-size: min(150px, 20vh);
}

/* Ball-specific theme colors */
.ball-color-b { background: radial-gradient(circle at 35% 35%, #3b82f6, #1d4ed8); color: white; box-shadow: inset -5px -5px 12px rgba(0,0,0,0.4), 0 0 10px rgba(59, 130, 246, 0.5); }
.ball-color-i { background: radial-gradient(circle at 35% 35%, #ef4444, #b91c1c); color: white; box-shadow: inset -5px -5px 12px rgba(0,0,0,0.4), 0 0 10px rgba(239, 68, 68, 0.5); }
.ball-color-n { background: radial-gradient(circle at 35% 35%, #f1f5f9, #cbd5e1); color: #0f172a; box-shadow: inset -5px -5px 12px rgba(0,0,0,0.4), 0 0 10px rgba(241, 245, 249, 0.5); }
.ball-color-g { background: radial-gradient(circle at 35% 35%, #10b981, #047857); color: white; box-shadow: inset -5px -5px 12px rgba(0,0,0,0.4), 0 0 10px rgba(16, 185, 129, 0.5); }
.ball-color-o { background: radial-gradient(circle at 35% 35%, #f59e0b, #b45309); color: white; box-shadow: inset -5px -5px 12px rgba(0,0,0,0.4), 0 0 10px rgba(245, 158, 11, 0.5); }
.ball-color-default { background: radial-gradient(circle at 35% 35%, #ff5722, #d84315); color: white; box-shadow: inset -5px -5px 12px rgba(0,0,0,0.4), 0 0 10px rgba(255, 87, 34, 0.5); }

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-darker);
    background-image: 
        radial-gradient(at 0% 0%, rgba(10, 34, 64, 0.3) 0px, transparent 50%),
        radial-gradient(at 50% 0%, rgba(255, 69, 0, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(250, 204, 21, 0.05) 0px, transparent 50%);
    color: var(--primary);
    font-family: var(--font-primary);
    min-height: 100vh;
    padding: min(20px, 2.5vh);
    overflow-x: hidden;
}

/* Glass Panels */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

/* App Container Layout */
.app-container {
    max-width: 1500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: min(20px, 2vh);
}

/* Header Styles */
.app-header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: min(12px, 1.5vh) 75px min(12px, 1.5vh) min(30px, 3vw);
    background: rgba(10, 34, 64, 0.5);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.app-logo {
    height: min(50px, 7vh);
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

.logo-fallback {
    font-family: var(--font-display);
    font-size: min(1.8rem, 4vh);
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--brand-yellow) 50%, var(--brand-orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-label {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--secondary);
}

/* Toggle Buttons (Game Mode) */
.game-type-selector {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
}

.btn-toggle {
    background: transparent;
    border: none;
    color: var(--secondary);
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-toggle.active {
    background: linear-gradient(135deg, var(--brand-orange) 0%, #d84315 100%);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(255, 69, 0, 0.4);
}

.btn-toggle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main Grid Layout */
.main-grid {
    display: grid;
    grid-template-columns: 320px 320px 1fr;
    gap: 15px;
}

@media (min-width: 1024px) {
    body {
        height: 100vh;
        overflow: hidden;
        padding: 1.5vh 20px;
    }
    
    body:has(.printable-cards-area:not(:empty)) {
        height: auto;
        overflow-y: auto;
    }

    .app-container {
        height: 100%;
        max-width: 100%;
    }
    
    .app-container:has(.printable-cards-area:not(:empty)) {
        height: auto;
        min-height: 100%;
    }

    .main-grid {
        display: grid;
        grid-template-columns: minmax(260px, 1.1fr) minmax(260px, 1fr) minmax(360px, 2fr);
        gap: 15px;
        height: calc(100vh - 320px);
        min-height: 460px;
    }
    
    body:not(:has(.printable-cards-area:not(:empty))) .main-grid {
        height: auto;
        flex-grow: 1;
        min-height: 0;
    }

    .visual-panel, .display-panel, .board-panel {
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 0;
    }
}

@media (max-width: 1023px) {
    .main-grid {
        grid-template-columns: 1fr 1fr;
        height: auto;
    }
    .board-panel {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    .board-panel {
        grid-column: span 1;
    }
}

/* Panel Header */
.panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.board-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px 16px;
}

.panel-header h2, .board-header h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--brand-yellow);
    text-transform: uppercase;
    margin: 0;
}

/* Raffle Drum (Tómbola) Visuals */
.drum-outer-wrapper {
    position: relative;
    width: 100%;
    height: calc(var(--drum-size) + 70px);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 5px 0;
}

.drum-sphere-container {
    position: relative;
    width: var(--drum-size);
    height: var(--drum-size);
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.02) 60%, rgba(0, 0, 0, 0.5) 100%);
    box-shadow: 
        inset 0 0 30px rgba(255, 255, 255, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    z-index: 2;
}

#drum-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.drum-glass-reflection {
    position: absolute;
    top: 5%;
    left: 10%;
    width: 80%;
    height: 40%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 50% / 100% 100% 0 0;
    pointer-events: none;
}

.drum-stand-left, .drum-stand-right {
    position: absolute;
    bottom: calc(35px - var(--drum-size) * 0.05);
    width: 12px;
    height: calc(var(--drum-size) * 0.64);
    background: linear-gradient(90deg, #64748b 0%, #475569 50%, #334155 100%);
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.drum-stand-left { 
    left: calc(50% - var(--drum-size) / 2 + 10px); 
    transform: rotate(-15deg); 
}
.drum-stand-right { 
    right: calc(50% - var(--drum-size) / 2 + 10px); 
    transform: rotate(15deg); 
}

.drum-chute {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(var(--drum-size) * 0.24);
    height: calc(var(--drum-size) * 0.24);
    background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.15) 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top: none;
    border-radius: 0 0 30px 30px;
    z-index: 1;
}

.chute-exit {
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(var(--drum-size) * 0.18);
    height: calc(var(--drum-size) * 0.18);
    background: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.9);
}

/* Action Controls Area */
.action-controls {
    display: flex;
    flex-direction: column;
    gap: min(10px, 1.2vh);
    padding: 10px 15px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 12px;
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: min(0.9rem, 2vh);
    padding: min(11px, 1.6vh) 20px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-yellow) 0%, #d97706 100%);
    color: #0f172a;
    box-shadow: 0 4px 15px rgba(250, 204, 21, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(250, 204, 21, 0.5);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-secondary.active {
    background: linear-gradient(135deg, var(--accent-green) 0%, #047857 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-red) 0%, #b91c1c 100%);
    color: white;
}

.btn-danger:hover {
    filter: brightness(1.15);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-accent {
    background: linear-gradient(135deg, var(--brand-orange) 0%, #d84315 100%);
    color: white;
}

.btn-accent:hover {
    filter: brightness(1.15);
    box-shadow: 0 4px 15px rgba(255, 69, 0, 0.45);
}

.btn-print {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #1d4ed8 100%);
    color: white;
}

.btn-print:hover:not(:disabled) {
    filter: brightness(1.15);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-print:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.auto-play-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.speed-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
}

.speed-label {
    font-size: clamp(0.75rem, 1.2vw, 0.85rem);
    font-weight: 600;
    color: var(--secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.speed-label span {
    color: var(--brand-yellow);
    font-weight: 800;
    font-family: var(--font-display);
    background: rgba(250, 204, 21, 0.12);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid rgba(250, 204, 21, 0.25);
}

/* Custom styling for range inputs (speed slider & volume slider) */
.speed-control input[type="range"],
.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    transition: background 0.2s ease;
    margin: 4px 0;
}

.speed-control input[type="range"]:hover,
.volume-slider:hover {
    background: rgba(255, 255, 255, 0.25);
}

.speed-control input[type="range"]::-webkit-slider-thumb,
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--brand-yellow);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.6);
    transition: transform 0.15s ease, background 0.15s ease;
}

.speed-control input[type="range"]::-webkit-slider-thumb:hover,
.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #ffe066;
}

.speed-control input[type="range"]::-moz-range-thumb,
.volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: var(--brand-yellow);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.6);
    transition: transform 0.15s ease, background 0.15s ease;
}

/* Big Ball Viewport */
.big-ball-viewport {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: min(20px, 2.5vh);
    flex: 1;
    min-height: 0;
}

.big-ball-container-empty {
    width: var(--ball-size);
    height: var(--ball-size);
    border-radius: 50%;
    border: 4px dashed rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.2);
    font-size: calc(var(--ball-size) * 0.28);
    font-family: var(--font-display);
    font-weight: 800;
    background: rgba(0,0,0,0.2);
}

.big-ball-container-active {
    width: var(--ball-size);
    height: var(--ball-size);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: ballReveal 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.big-ball-reflection {
    position: absolute;
    top: 6%;
    left: 12%;
    width: 76%;
    height: 35%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 50% / 100% 100% 0 0;
    pointer-events: none;
}

.big-ball-value {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: var(--font-display);
    z-index: 2;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 12%;
    pointer-events: none;
    user-select: none;
}

.big-ball-letter {
    font-size: calc(var(--ball-size) * 0.22);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.88);
    line-height: 0.95;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    display: block;
    text-align: center;
    width: 100%;
    margin-bottom: 2px;
}

.big-ball-number {
    font-size: calc(var(--ball-size) * 0.38);
    font-weight: 800;
    color: #ffffff;
    line-height: 0.95;
    letter-spacing: -0.01em;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
    display: block;
    text-align: center;
    width: 100%;
}

.big-ball-number-single {
    font-size: calc(var(--ball-size) * 0.46);
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
    letter-spacing: -0.01em;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
    display: block;
    text-align: center;
    width: 100%;
}

/* Color overrides for white ball text in big ball */
.big-ball-container-active.ball-color-n .big-ball-letter,
.big-ball-container-active.ball-color-n .big-ball-number,
.big-ball-container-active.ball-color-n .big-ball-number-single {
    color: #000000;
    text-shadow: none;
}

.big-ball-subtext {
    margin-top: min(10px, 1.2vh);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--secondary);
    text-transform: uppercase;
}

/* Ball Animation */
@keyframes ballReveal {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* History List */
.history-container {
    padding: 0 15px min(15px, 2vh);
}

.history-container h3 {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.history-balls-list {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    align-items: center;
    min-height: 44px;
}

.history-empty-msg {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.25);
    font-style: italic;
}

.history-ball {
    width: min(44px, 6vh);
    height: min(44px, 6vh);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: var(--font-display);
    position: relative;
    animation: historyPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
    cursor: default;
    line-height: 1;
    white-space: nowrap;
    box-sizing: border-box;
    padding: 3px;
    overflow: hidden;
}

.history-ball .hist-letter {
    font-size: calc(min(44px, 6vh) * 0.25);
    font-weight: 700;
    opacity: 0.9;
    line-height: 0.95;
    text-transform: uppercase;
    text-align: center;
    width: 100%;
    display: block;
}

.history-ball .hist-number {
    font-size: calc(min(44px, 6vh) * 0.38);
    font-weight: 800;
    line-height: 0.95;
    text-align: center;
    width: 100%;
    display: block;
}

.history-ball .hist-number-single {
    font-size: calc(min(44px, 6vh) * 0.45);
    font-weight: 800;
    line-height: 1;
    text-align: center;
    width: 100%;
    display: block;
}

@keyframes historyPop {
    0% { transform: scale(0) translateY(10px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Tablero de Control / Grid Board */
.board-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    min-height: 0;
}

.board-stats {
    display: flex;
    gap: clamp(10px, 1.8vw, 20px);
    align-items: center;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-num {
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    font-weight: 700;
    color: var(--brand-orange);
    line-height: 1.1;
}

.stat-lbl {
    font-size: clamp(0.65rem, 1.1vw, 0.75rem);
    color: var(--secondary);
}

.board-grid-scroll {
    padding: 12px min(16px, 2vw);
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: auto;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Custom Scrollbar for premium feel */
.board-grid-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.board-grid-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}
.board-grid-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
.board-grid-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.board-grid {
    display: grid;
    gap: clamp(3px, 0.8vw, 8px);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.grid-90 {
    grid-template-columns: repeat(10, minmax(0, 1fr));
    width: 100%;
}

.grid-75 {
    grid-template-columns: repeat(16, minmax(0, 1fr));
    width: 100%;
}

.board-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: clamp(3px, 0.8vw, 8px);
    font-family: var(--font-display);
    font-size: clamp(0.62rem, 1.3vw + 0.3rem, 1.05rem);
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    min-width: 0;
    min-height: 0;
    padding: 0;
    touch-action: manipulation;
}

.board-cell:hover {
    border-color: rgba(250, 204, 21, 0.4);
    background: rgba(255,255,255,0.05);
}

.board-cell.called {
    background: radial-gradient(circle at 35% 35%, var(--brand-orange) 0%, #c23b00 100%);
    border-color: var(--brand-orange);
    color: white;
    box-shadow: 0 0 10px rgba(255, 69, 0, 0.5), inset 0 2px 4px rgba(255,255,255,0.3);
    font-weight: 800;
    animation: cellHighlight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
}

@keyframes cellHighlight {
    0% { transform: scale(0.8); filter: brightness(1.8); }
    100% { transform: scale(1); filter: brightness(1); }
}

/* 75-Ball Board specific decoration */
.board-column-header-row {
    grid-column: span 15;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: clamp(3px, 0.8vw, 8px);
    margin-bottom: 6px;
    text-align: center;
}

.board-col-hdr {
    background: rgba(10, 34, 64, 0.6);
    border: 1px solid rgba(250, 204, 21, 0.2);
    border-radius: clamp(3px, 0.8vw, 8px);
    font-family: var(--font-display);
    font-size: clamp(0.7rem, 1.5vw + 0.3rem, 1.2rem);
    font-weight: 800;
    color: var(--brand-yellow);
    padding: 4px 0;
    letter-spacing: 0.05em;
}

.board-cell.board-col-hdr {
    cursor: default;
    pointer-events: none;
    background: rgba(10, 34, 64, 0.7);
    border-color: rgba(250, 204, 21, 0.3);
    color: var(--brand-yellow);
    font-size: clamp(0.7rem, 1.5vw + 0.3rem, 1.2rem);
}

/* Footer / Reset Button Section */
.app-footer {
    padding: 6px 15px;
    margin-top: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    border: none;
    box-shadow: none;
}

.footer-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.footer-layout .btn-action {
    width: auto;
    min-width: 140px;
    max-width: 190px;
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
    opacity: 0.9;
    transition: all 0.2s ease;
}

.footer-layout .btn-action:hover {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.45);
}

.settings-block h3, .card-generator-block h3 {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--brand-yellow);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: center;
}

.col-span-2 {
    grid-column: span 2;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--secondary);
}

.setting-icon {
    font-size: 1rem;
}

/* Switch Styles */
.switch-container {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
    flex-shrink: 0;
}

.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255,255,255,0.1);
    transition: .3s;
    border-radius: 34px;
    border: 1px solid var(--border-color);
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .switch-slider {
    background-color: var(--accent-green);
    border-color: transparent;
}

input:checked + .switch-slider:before {
    transform: translateX(22px);
}

.volume-slider {
    flex-grow: 1;
    -webkit-appearance: none;
    background: rgba(255,255,255,0.1);
    height: 6px;
    border-radius: 3px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--brand-yellow);
    cursor: pointer;
}

/* Voice Selector */
.voice-selector-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}

.voice-select-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--secondary);
}

.voice-select {
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--primary);
    font-family: var(--font-primary);
    font-size: 0.8rem;
    padding: 6px 10px;
    outline: none;
    width: 100%;
}

.voice-select:focus {
    border-color: var(--brand-yellow);
}

/* Reset Block */
.reset-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 10px;
}

.reset-help-text {
    font-size: 0.75rem;
    color: var(--secondary);
    max-width: 180px;
}

/* Card Generator UI */
.generator-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.quantity-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.quantity-input-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--secondary);
}

.quantity-input-group input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--primary);
    font-family: var(--font-display);
    font-weight: bold;
    font-size: 0.9rem;
    padding: 8px 12px;
    width: 70px;
    text-align: center;
}

.quantity-input-group input:focus {
    border-color: var(--brand-yellow);
    outline: none;
}

.generator-controls .btn-action {
    width: auto;
    font-size: 0.8rem;
    padding: 10px 16px;
    border-radius: 8px;
}

/* Modal Overlay Styles */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    max-width: 450px;
    width: 90%;
    padding: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: modalBounce 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
}

@keyframes modalBounce {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-content h2 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--brand-yellow);
}

.modal-content p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--secondary);
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-actions .btn-action {
    width: auto;
    min-width: 120px;
}

/* Configuration Modal Content Styles */
.config-modal-content {
    max-width: 650px;
    width: 95%;
    max-height: 90vh;
    padding: 30px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 5px;
}

.modal-header-container h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--brand-yellow);
    margin: 0;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--secondary);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.btn-close:hover {
    color: var(--accent-red);
}

.config-modal-body {
    display: flex;
    flex-direction: column;
    gap: 25px;
    overflow-y: auto;
    padding-right: 5px;
}

.settings-block-modal, .card-generator-block-modal {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.settings-block-modal h3, .card-generator-block-modal h3 {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--brand-yellow);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 5px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
    padding-bottom: 6px;
}

.generator-controls-modal {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
}

.generator-actions-modal {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.generator-actions-modal .btn-action {
    width: 100%;
    text-align: center;
    font-size: 0.85rem;
    padding: 10px 16px;
    border-radius: 8px;
    justify-content: center;
}

/* Printable Cards Section (On-screen visualization) */
.printable-cards-area {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 10px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    border: 1px dashed var(--border-color);
}

/* When empty, we style it less prominently */
.printable-cards-area:empty {
    display: none;
}

/* Bingo Card Base */
.bingo-card {
    background: #ffffff;
    color: #000000;
    border: 3px solid var(--brand-navy);
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--shadow-md);
    page-break-inside: avoid;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--brand-navy);
    padding-bottom: 6px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--brand-navy);
}

.card-id {
    font-size: 0.75rem;
    font-weight: bold;
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 4px;
}

/* 75-Ball Card: 5x5 grid */
.card-grid-75 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

.card-hdr-cell {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.1rem;
    text-align: center;
    background: var(--brand-navy);
    color: #ffffff;
    padding: 4px 0;
    border-radius: 4px;
}

.card-num-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 4px;
}

.card-num-cell.free-space {
    background: #fef08a; /* Soft yellow */
    font-size: 0.75rem;
    font-weight: bold;
    text-align: center;
    color: #b45309;
}

/* 90-Ball Card: 3 rows x 9 columns */
.card-grid-90 {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 4px;
}

.card-grid-90 .card-num-cell {
    font-size: 1.1rem;
    height: 42px;
}

.card-num-cell.empty-cell {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

/* Print CSS Styles */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .app-container {
        display: none !important;
    }
    
    #printable-cards-area {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 30px !important;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
    
    .bingo-card {
        border: 4px solid #000000 !important;
        box-shadow: none !important;
        page-break-inside: avoid !important;
        margin-bottom: 20px !important;
    }
    
    .card-hdr-cell {
        background: #000000 !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .card-num-cell {
        border: 2px solid #000000 !important;
        background: #ffffff !important;
        color: #000000 !important;
    }
    
    .card-num-cell.free-space {
        background: #e2e8f0 !important;
        color: #000000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .card-num-cell.empty-cell {
        background: #e2e8f0 !important;
        border: 1px solid #cbd5e1 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

@media (max-width: 600px) {
    .app-header {
        flex-direction: column;
        gap: 12px;
        align-items: center;
        text-align: center;
        padding: 10px 15px;
    }
    .header-controls {
        flex-direction: column;
        gap: 8px;
    }
    .action-controls {
        padding: 8px 10px;
        gap: 8px;
    }
    .auto-play-container {
        padding: 10px 12px;
        gap: 8px;
    }
    .btn-action {
        font-size: clamp(0.78rem, 3.2vw, 0.9rem);
        padding: 10px 14px;
    }
}

@media (max-width: 768px) {
    .grid-75 {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        grid-template-rows: repeat(16, minmax(0, 1fr));
        grid-auto-flow: column;
        max-width: 100%;
        margin: 0 auto;
    }
    .grid-90 {
        grid-template-columns: repeat(10, minmax(0, 1fr));
        max-width: 100%;
        margin: 0 auto;
    }
}

@media (max-width: 540px) {
    .board-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 14px;
    }
    .board-stats {
        width: 100%;
        justify-content: space-around;
        background: rgba(0, 0, 0, 0.25);
        padding: 8px 12px;
        border-radius: 8px;
        box-sizing: border-box;
    }
    .stat-item {
        align-items: center;
        text-align: center;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    .settings-grid {
        grid-template-columns: 1fr;
    }
    .col-span-2 {
        grid-column: span 1;
    }
    .board-grid-scroll {
        padding: 8px 6px;
    }
    .board-grid {
        gap: 3px;
    }
    .board-cell {
        border-radius: 4px;
        font-size: clamp(0.58rem, 2.6vw, 0.85rem);
    }
    .board-column-header-row {
        gap: 3px;
    }
    .board-col-hdr {
        font-size: clamp(0.65rem, 2.8vw, 0.9rem);
        border-radius: 4px;
        padding: 3px 0;
    }
    .speed-label {
        font-size: 0.78rem;
    }
}

/* Rights Reserved Footer Styling */
.app-rights {
    text-align: center;
    font-size: 0.78rem;
    color: var(--secondary);
    margin: 4px 0 8px;
    opacity: 0.85;
}

.app-rights p {
    font-family: var(--font-primary);
}

.app-rights a {
    color: var(--brand-yellow);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.app-rights a:hover {
    color: var(--brand-orange);
    text-decoration: underline;
}

/* Config Button Icon Styles */
.btn-config-icon {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%) scale(1);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--primary);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    padding: 0;
    z-index: 10;
}

.btn-config-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 0 15px rgba(250, 204, 21, 0.25);
}

.btn-config-icon:active {
    transform: translateY(-50%) scale(0.95);
}

.btn-config-icon svg.icon-gear {
    width: 22px;
    height: 22px;
    stroke: var(--brand-yellow);
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-config-icon:hover svg.icon-gear {
    transform: rotate(180deg);
}

/* Mobile responsive adjustments for config button */
@media (max-width: 600px) {
    .btn-config-icon {
        top: 15px;
        right: 15px;
        transform: scale(1);
    }
    .btn-config-icon:hover {
        transform: scale(1.08);
    }
    .btn-config-icon:active {
        transform: scale(0.95);
    }
}

/* Real-time Sync Section in Config Modal */
.sync-section-modal {
    border-top: 1px dashed rgba(255, 255, 255, 0.15);
    padding-top: 15px;
    margin-top: 10px;
}

.sync-section-modal .setting-text-desc {
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: var(--secondary);
    opacity: 0.8;
}

.sync-controls-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.sync-controls-wrapper #btn-open-viewer {
    width: auto;
    min-width: 250px;
}

.share-link-group {
    display: flex;
    flex-grow: 1;
    min-width: 280px;
    gap: 8px;
}

.share-link-group input.sync-url-input {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--primary);
    padding: 8px 12px;
    font-size: 0.85rem;
    outline: none;
}

.share-link-group input.sync-url-input:focus {
    border-color: var(--brand-yellow);
}

.share-link-group #btn-copy-sync {
    width: auto;
    padding: 8px 15px;
    font-size: 0.85rem;
    border-radius: 8px;
    white-space: nowrap;
}

.sync-help-note {
    font-size: 0.75rem;
    color: var(--secondary);
    margin-top: 5px;
    opacity: 0.7;
}

/* Screen Lock Overlay */
.lock-overlay-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #0f1c3f 0%, #04070f 100%);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(20px);
}

.lock-card {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(250, 204, 21, 0.15);
    text-align: center;
    animation: fadeInLock 0.5s ease-out;
}

@keyframes fadeInLock {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.lock-logo-placeholder {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 5px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--brand-yellow) 50%, var(--brand-orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}

.lock-subtitle {
    font-size: 0.9rem;
    color: var(--secondary);
    margin-bottom: 25px;
}

.lock-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 25px;
}

.lock-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--secondary);
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lock-tab-btn.active {
    background: var(--brand-orange);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 69, 0, 0.4);
}

.lock-form {
    display: none;
    flex-direction: column;
    gap: 15px;
    text-align: left;
}

.lock-form.active {
    display: flex;
}

.lock-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lock-form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--secondary);
}

.lock-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--primary);
    padding: 12px 15px;
    font-size: 0.95rem;
    outline: none;
    font-family: var(--font-primary);
    transition: all 0.3s ease;
}

.lock-input:focus {
    border-color: var(--brand-yellow);
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.2);
}

.lock-error {
    color: var(--accent-red);
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 5px;
    display: none;
}

.lock-btn {
    background: linear-gradient(135deg, var(--brand-orange) 0%, #d84315 100%);
    border: none;
    color: white;
    padding: 14px;
    border-radius: 8px;
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 69, 0, 0.3);
    text-align: center;
}

.lock-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 69, 0, 0.4);
}

.lock-btn:active {
    transform: translateY(0);
}

/* Link Generator block in Config Modal */
.config-block-access {
    border-top: 1px dashed rgba(255, 255, 255, 0.15);
    padding-top: 20px;
    margin-top: 20px;
}

.config-block-access h3 {
    margin-bottom: 10px;
    color: var(--brand-yellow);
    font-size: 0.95rem;
}

.access-generator-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.access-duration-select {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--primary);
    padding: 10px 15px;
    font-size: 0.9rem;
    outline: none;
    font-family: var(--font-primary);
    cursor: pointer;
}

.access-duration-select option {
    background: var(--bg-darker);
    color: var(--primary);
}

.access-buttons-row {
    display: flex;
    gap: 10px;
}

.access-buttons-row .btn-action {
    flex: 1;
}

.btn-admin-logout {
    margin-top: 10px;
    width: 100%;
}

/* Responsividad para el Panel de Configuración */
@media (max-width: 600px) {
    .config-modal-content {
        padding: 20px 15px;
        gap: 15px;
        width: 98%;
        max-height: 95vh;
    }
    
    .modal-header-container {
        padding-bottom: 10px;
        margin-bottom: 0;
    }
    
    .settings-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }
    
    .col-span-2 {
        grid-column: span 1 !important;
    }
    
    .sync-controls-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .sync-controls-wrapper #btn-open-viewer {
        width: 100%;
        min-width: 0;
    }
    
    .share-link-group {
        min-width: 0;
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }
    
    .share-link-group input.sync-url-input {
        width: 100%;
        box-sizing: border-box;
    }
    
    .share-link-group button {
        width: 100% !important;
    }
    
    .access-generator-wrapper {
        gap: 10px;
    }
    
    .access-buttons-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .access-buttons-row .btn-action {
        width: 100%;
    }
}

/* Floating WhatsApp Button */
.whatsapp-float-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: #25d366;
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-family: 'Poppins', 'Montserrat', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.whatsapp-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.whatsapp-float-btn:hover {
    transform: translateY(-5px) scale(1.03);
    background-color: #20ba5a;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

@media (max-width: 768px) {
    .whatsapp-float-btn {
        bottom: 16px;
        right: 16px;
        padding: 10px 16px;
        font-size: 0.85rem;
    }
}

