:root {
    --bg-dark: #07140e;
    --bg-card: #0f2a1b;
    --primary: #f2c94c;
    /* Gold */
    --primary-glow: rgba(242, 201, 76, 0.55);
    --secondary: #14b86a;
    /* Brasil green */
    --accent: #1d4ed8;
    /* Brasil blue */
    --text-main: #f8fafc;
    --text-muted: #b8c7b7;
    --success: #22c55e;
    --border: #1c3a2a;
    --bingo-b: #ef4444;
    --bingo-i: #1d4ed8;
    --bingo-n: #14b86a;
    --bingo-g: #f2c94c;
    --bingo-o: #0ea5e9;

    --font-main: 'Bricolage Grotesque', sans-serif;

    --glass: rgba(15, 42, 27, 0.7);
    --glass-border: rgba(242, 201, 76, 0.2);
}

/* Light Theme */
body.theme-light {
    --bg-dark: #f4fbf6;
    --bg-card: #ffffff;
    --primary: #0f8a3a;
    --primary-glow: rgba(15, 138, 58, 0.35);
    --secondary: #f2c94c;
    --accent: #1d4ed8;
    --text-main: #0b1f14;
    --text-muted: #556b5e;
    --border: #cbded2;
    --bingo-b: #dc2626;
    --bingo-i: #1d4ed8;
    --bingo-n: #16a34a;
    --bingo-g: #f59e0b;
    --bingo-o: #0284c7;
    --glass: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(15, 138, 58, 0.12);
}

/* Classic Theme (Red) */
body.theme-classic {
    --bg-dark: #7f1d1d;
    --bg-card: #991b1b;
    --primary: #fbbf24;
    --primary-glow: rgba(251, 191, 36, 0.4);
    --secondary: #ffffff;
    --text-main: #ffffff;
    --text-muted: #fecaca;
    --border: #b91c1c;
    --bingo-b: #ffffff;
    --bingo-i: #fde68a;
    --bingo-n: #fca5a5;
    --bingo-g: #fbbf24;
    --bingo-o: #fee2e2;
    --glass: rgba(153, 27, 27, 0.9);
    --glass-border: rgba(255, 255, 255, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
    /* Prevent scrolling on fullscreen app */
    background-image:
        radial-gradient(circle at 12% 18%, rgba(20, 184, 106, 0.2) 0%, transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(29, 78, 216, 0.18) 0%, transparent 45%),
        linear-gradient(135deg, rgba(242, 201, 76, 0.12) 0%, rgba(7, 20, 14, 0) 55%);
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--glass);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    margin-bottom: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.controls-top {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-select {
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

.theme-select option {
    background: var(--bg-card);
    color: var(--text-main);
}

.separator-v {
    width: 1px;
    height: 24px;
    background: var(--border);
}

h1 {
    font-weight: 900;
    font-size: 2rem;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.highlight {
    color: var(--primary);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Slots premium (luxo minimalista) */
.slots-card {
    background: linear-gradient(180deg, rgba(6, 8, 8, 0.92) 0%, rgba(10, 14, 14, 0.92) 100%);
    border: 1px solid rgba(212, 175, 55, 0.25);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    position: relative;
    overflow: hidden;
}

.slots-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.08) 0%, transparent 35%, transparent 100%);
    pointer-events: none;
}

.slots-title {
    font-size: 1.1rem;
    margin-bottom: 12px;
    text-align: center;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 3px;
    font-weight: 800;
}

.slots-stage {
    width: 100%;
    height: 300px;
    border-radius: 18px;
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 30% 15%, rgba(242, 201, 76, 0.12), transparent 55%),
        linear-gradient(135deg, #0b0f10 0%, #12181a 60%, #0a0e10 100%);
    border: 1px solid rgba(212, 175, 55, 0.35);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), inset 0 2px 18px rgba(0, 0, 0, 0.75);
}

.slots-stage::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 40%);
    pointer-events: none;
}

.slots-stage::after {
    content: '';
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 14px;
    z-index: 2;
    pointer-events: none;
}

.slots-stage canvas {
    position: relative;
    z-index: 1;
}

.slots-spin-btn {
    height: 46px;
    font-size: 1.05rem;
    width: 100%;
    font-weight: 900;
    letter-spacing: 1.5px;
    background: linear-gradient(135deg, #d4af37 0%, #f2c94c 45%, #b88700 100%);
    color: #1b1302;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.slots-spin-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.slots-spin-btn:active {
    transform: translateY(1px);
    filter: brightness(0.95);
}

.slots-msg {
    min-height: 20px;
    text-align: center;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.slots-card--pirate {
    border-color: rgba(212, 175, 55, 0.35);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.slots-card--halloween {
    border-color: rgba(255, 138, 0, 0.35);
    box-shadow: 0 12px 34px rgba(8, 4, 16, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.slots-card--halloween::before {
    background: linear-gradient(135deg, rgba(255, 138, 0, 0.12) 0%, transparent 35%, transparent 100%);
}

.slots-title--pirate {
    color: #f2c94c;
    text-shadow: 0 0 10px rgba(242, 201, 76, 0.35);
}

.slots-title--halloween {
    color: #ff8a00;
    text-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
}

.slots-stage--pirate {
    background: radial-gradient(circle at 30% 15%, rgba(242, 201, 76, 0.14), transparent 55%),
        linear-gradient(135deg, #0b0f10 0%, #131b1c 60%, #0a0e10 100%);
    border-color: rgba(212, 175, 55, 0.45);
}

.slots-stage--halloween {
    background: radial-gradient(circle at 30% 20%, rgba(255, 138, 0, 0.12), transparent 55%),
        linear-gradient(135deg, #120918 0%, #1a0f24 55%, #0f0a16 100%);
    border-color: rgba(255, 138, 0, 0.45);
}

.slots-stage--pirate::after {
    border-color: rgba(212, 175, 55, 0.25);
}

.slots-stage--halloween::after {
    border-color: rgba(255, 138, 0, 0.3);
}

.slots-card--halloween .slots-spin-btn {
    background: linear-gradient(135deg, #ff8a00 0%, #f97316 45%, #7c3aed 100%);
    color: #1b0b0b;
}

.slots-card--halloween .slots-msg {
    color: rgba(255, 236, 214, 0.75);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
    /* Important for scroll within grid */
}

/* Left Side: Display */
.display-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--glass);
    border-radius: 24px;
    padding: 2rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.display-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    opacity: 0.1;
    pointer-events: none;
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.current-number-container {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.number-display-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.current-letter {
    font-size: 8rem;
    font-weight: 900;
    color: var(--primary);
    text-shadow: 0 0 30px var(--primary-glow);
    line-height: 1;
}

.current-number {
    font-size: 12rem;
    font-weight: 900;
    line-height: 1;
    color: var(--text-main);
    text-shadow: 0 0 40px var(--primary-glow);
    font-variant-numeric: tabular-nums;
    transition: all 0.1s;
}

/* Animation for popping visual */
.pop-in {
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    70% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.current-number-label {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 300px;
    z-index: 10;
}

.btn {
    border: none;
    border-radius: 12px;
    padding: 1.2rem 2rem;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #d97706 100%);
    color: #fff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:active {
    transform: translateY(2px);
    box-shadow: 0 2px 10px var(--primary-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px var(--primary-glow);
    filter: brightness(1.1);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-muted);
}

.btn-secondary:hover {
    border-color: var(--text-main);
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* Prize Section */
.prize-section {
    margin-top: 1.5rem;
    width: 100%;
    max-width: 300px;
}

.prize-section label {
    display: block;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.prize-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--primary);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.1);
}

.currency-symbol {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

#prize-value {
    background: transparent;
    border: none;
    color: #fff;
    font-family: var(--font-main);
    font-size: 1.5rem;
    font-weight: 700;
    width: 100%;
    outline: none;
}

#prize-value::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

/* Auto Play Controls */
.auto-play-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    width: 100%;
    max-width: 300px;
    border: 1px solid var(--border);
}

.auto-play-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.timer-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#auto-timer {
    width: 50px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 4px 8px;
    border-radius: 6px;
    text-align: center;
    font-family: var(--font-main);
}

.btn-auto {
    width: 100%;
    padding: 0.8rem;
    font-size: 0.9rem;
    background: transparent;
    border: 1px dashed var(--secondary);
    color: var(--secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-weight: 700;
}

.btn-auto:hover {
    background: rgba(59, 130, 246, 0.1);
}

.btn-auto.active {
    background: rgba(239, 68, 68, 0.1);
    /* Red tint */
    border-color: #ef4444;
    color: #ef4444;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* History */
.history-preview {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.history-preview span:first-child {
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
}

#history-list {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 85px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.15) 35%, rgba(0, 0, 0, 0.25) 70%),
        linear-gradient(145deg, var(--ball-color, var(--bg-card)) 0%, var(--bg-dark) 100%);
    border: 3px solid var(--ball-color, var(--border));
    color: var(--text-main);
    font-weight: 800;
    font-size: 2rem;
    box-shadow:
        0 10px 18px rgba(0, 0, 0, 0.35),
        inset 0 6px 12px rgba(255, 255, 255, 0.2),
        inset 0 -8px 14px rgba(0, 0, 0, 0.35);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.history-item::before {
    content: '';
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.history-item::after {
    content: attr(data-letter);
    position: absolute;
    top: -6px;
    right: -6px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: var(--ball-color, var(--primary));
    color: var(--bg-dark);
    font-weight: 900;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-dark);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.history-item:hover {
    transform: translateY(-5px);
    border-color: var(--ball-color, var(--primary));
    box-shadow: 0 10px 25px var(--primary-glow);
}

.history-item.bingo-b {
    --ball-color: var(--bingo-b);
}

.history-item.bingo-i {
    --ball-color: var(--bingo-i);
}

.history-item.bingo-n {
    --ball-color: var(--bingo-n);
}

.history-item.bingo-g {
    --ball-color: var(--bingo-g);
}

.history-item.bingo-o {
    --ball-color: var(--bingo-o);
}

/* Right Side: Board */
.board-section {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.board-header h2 {
    font-size: 1.25rem;
    color: var(--text-main);
}

.stats {
    display: flex;
    gap: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.bingo-header-row {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    /* Default 1-75 is 15x5 approx, usually BINGO is 5 cols. Let's do standard 1-75 layout */
    /* Wait, standard bingo is 1-15 B, 16-30 I, etc. So 5 rows, 15 numbers each? No, 5 cols (B-I-N-G-O) and 15 numbers per col. */
    /* To display nicely on screen, often a 15x5 grid or 5 rows of 15 is valid. Let's do 5 rows (letters) x 15 columns. */
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.col-header {
    display: none;
    /* We will use row-based layout mostly for BINGO */
}

/* We will actually use a grid that is 15 columns wide and 5 rows high */
/* Or B-I-N-G-O letters on the left (5 rows) */

.bingo-board {
    display: grid;
    grid-template-columns: auto repeat(15, 1fr);
    gap: 6px;
    flex: 1;
    overflow-y: auto;
}

.letter-col {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.5rem;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
    padding-right: 1rem;
}

.number-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
}

.number-cell.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px var(--primary-glow);
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
    z-index: 2;
    font-weight: 900;
}

.number-cell.recent {
    animation: flash 1s infinite alternate;
}

@keyframes flash {
    from {
        filter: brightness(1);
    }

    to {
        filter: brightness(1.3);
    }
}

.footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .current-number {
        font-size: 8rem;
    }

    .bingo-board {
        gap: 4px;
    }

    .number-cell {
        font-size: 0.8rem;
    }
}

@media (max-width: 600px) {
    body {
        overflow-y: auto;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .bingo-header-row {
        gap: 2px;
    }

    .current-number {
        font-size: 6rem;
    }

    .slots-stage {
        height: 240px;
    }

    .slots-title {
        font-size: 1rem;
        letter-spacing: 2px;
    }

    .slots-spin-btn {
        height: 44px;
        font-size: 1rem;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    opacity: 1;
    transition: opacity 0.3s;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--text-main);
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: #ef4444;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body p {
    color: var(--text-muted);
    margin-bottom: 0.8rem;
}

#check-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 1rem;
    resize: none;
    margin-bottom: 1rem;
}

#check-input:focus {
    border-color: var(--primary);
    outline: none;
}

.check-result {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 700;
    text-align: center;
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.check-result.success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid #10b981;
    color: #10b981;
}

.check-result.fail {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #ef4444;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.btn-check {
    background: transparent;
    border: 2px dashed var(--success);
    color: var(--success);
    margin-top: 5px;
}

.btn-check:hover {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

/* Generator Styles */
.modal-large {
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
}

.modal-large .modal-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.generator-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

#card-quantity {
    width: 70px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem;
    color: var(--text-main);
    text-align: center;
}

.cards-preview-container {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.bingo-card {
    background: #fff;
    color: #000;
    padding: 1rem;
    border-radius: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    border: 2px solid #000;
}

.bingo-card-header {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    margin-bottom: 5px;
}

.bingo-card-header div {
    font-weight: 900;
    font-size: 2rem;
    text-align: center;
    color: #000;
}

.bingo-card-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border-top: 2px solid #000;
    border-left: 2px solid #000;
}

.bingo-card-cell {
    aspect-ratio: 1;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
}

.bingo-card-cell.free {
    font-size: 0.8rem;
    background: #eee;
    text-transform: uppercase;
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
        overflow: visible;
    }

    .app-container,
    .modal-overlay,
    .modal-header,
    .generator-controls,
    .close-btn {
        display: none !important;
    }

    #generator-modal {
        position: static;
        display: block !important;
        background: white;
        width: 100%;
        height: auto;
        opacity: 1;
    }

    .modal-content {
        box-shadow: none;
        border: none;
        width: 100%;
        max-width: none;
        background: white;
        animation: none;
    }

    .modal-body {
        padding: 0;
        overflow: visible;
    }

    .cards-preview-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        background: white;
        overflow: visible;
    }

    .bingo-card {
        box-shadow: none;
        break-inside: avoid;
        border: 2px solid #000;
    }
}

.slots-card--premium {
    border-color: rgba(255, 215, 0, 0.35); /* Gold */
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.slots-card--premium::before {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.12) 0%, transparent 35%, transparent 100%);
}

.slots-title--premium {
    color: #ffd700;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

.slots-stage--premium {
    background: radial-gradient(circle at 30% 20%, rgba(255, 215, 0, 0.1), transparent 55%),
        linear-gradient(135deg, #050505 0%, #1a1a1a 100%);
    border-color: rgba(255, 215, 0, 0.5);
}

.slots-stage--premium::after {
    border-color: rgba(255, 215, 0, 0.3);
}

.slots-card--premium .slots-spin-btn {
    background: linear-gradient(135deg, #ffd700 0%, #d4af37 100%);
    color: #000;
    font-weight: 800;
}

.slots-card--premium .slots-msg {
    color: rgba(255, 215, 0, 0.9);
}

/* TV host layout inspired by classic keno panels */
.tv-layout {
    max-width: 1920px;
    padding: 0.7rem;
    gap: 0.7rem;
}

body.host-tv-page {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

body.host-tv-page .app-container.tv-layout {
    height: auto;
    min-height: 100vh;
}

.tv-layout .tv-header {
    display: grid;
    grid-template-columns: minmax(280px, 1.4fr) minmax(380px, 1fr) auto;
    gap: 0.65rem;
    align-items: stretch;
    padding: 0.65rem;
    margin-bottom: 0.7rem;
    border-radius: 12px;
    border: 1px solid #1f557a;
    background:
        linear-gradient(180deg, rgba(13, 67, 103, 0.94) 0%, rgba(8, 44, 72, 0.92) 100%),
        linear-gradient(120deg, rgba(255, 255, 255, 0.08), transparent);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    animation: tv-rise 360ms ease;
}

.tv-layout .tv-brand-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.18rem;
    padding: 0.5rem 0.75rem;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(3, 19, 33, 0.45);
}

.tv-layout .tv-kicker {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #dbeafe;
    font-weight: 700;
}

.tv-layout .tv-subtitle {
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    color: #c7d2fe;
    text-transform: uppercase;
    opacity: 0.92;
}

.tv-layout .header h1 {
    font-size: clamp(1rem, 2.1vw, 1.55rem);
    line-height: 1.05;
}

.tv-layout .tv-jackpot-strip {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr 0.95fr;
    gap: 0.45rem;
}

.tv-layout .tv-pill {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 8px;
    padding: 0.45rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background:
        linear-gradient(180deg, rgba(249, 250, 251, 0.16) 0%, rgba(188, 206, 229, 0.05) 100%),
        rgba(3, 26, 42, 0.55);
}

.tv-layout .tv-pill span {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #cbd5e1;
    font-weight: 700;
}

.tv-layout .tv-pill strong {
    font-size: clamp(1rem, 2.2vw, 1.65rem);
    color: #f8fafc;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.03em;
    margin-top: 0.2rem;
}

.tv-layout .tv-pill b {
    color: #22d3ee;
    font-weight: 900;
}

.tv-layout .tv-pill-prize strong {
    color: #fca5a5;
}

.tv-layout .tv-controls-top {
    gap: 0.35rem;
    padding: 0.35rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(2, 18, 31, 0.5);
}

.tv-layout .theme-select {
    min-width: 120px;
    font-size: 0.75rem;
    padding: 6px 8px;
}

.tv-layout .icon-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.tv-layout .icon-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

.tv-layout .tv-main-content {
    grid-template-columns: minmax(250px, 1fr) minmax(340px, 0.95fr) minmax(360px, 1.12fr);
    gap: 0.7rem;
}

.tv-layout .tv-tickets-panel,
.tv-layout .tv-center-panel,
.tv-layout .tv-board-section {
    min-height: 0;
    border-radius: 12px;
    border: 1px solid #1f557a;
    background: linear-gradient(180deg, rgba(10, 49, 77, 0.9) 0%, rgba(7, 31, 53, 0.92) 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 8px 20px rgba(0, 0, 0, 0.35);
    animation: tv-rise 460ms ease;
}

.tv-layout .tv-tickets-panel {
    justify-content: flex-start;
    align-items: stretch;
    padding: 0.6rem;
    gap: 0.5rem;
}

.tv-layout .tv-ticket-head {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 0.3rem;
    align-items: center;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
    color: #0f172a;
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tv-layout .tv-ticket-head b {
    color: #0369a1;
}

.tv-layout .tv-ticket-list {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: grid;
    gap: 2px;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.85) rgba(15, 23, 42, 0.35);
}

.tv-layout .tv-ticket-list::-webkit-scrollbar {
    width: 8px;
}

.tv-layout .tv-ticket-list::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.35);
    border-radius: 999px;
}

.tv-layout .tv-ticket-list::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.85);
    border-radius: 999px;
}

.tv-layout .tv-ticket-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 0.32rem;
    align-items: center;
    padding: 0.37rem 0.42rem;
    border-radius: 6px;
    background: rgba(241, 245, 249, 0.92);
    color: #1e293b;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.15;
}

.tv-layout .tv-ticket-row-empty {
    opacity: 0.72;
}

.tv-layout .tv-ticket-row span:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-layout .tv-ticket-row .tv-ticket-status,
.tv-layout .tv-ticket-row .tv-ticket-kind {
    min-width: 52px;
    text-align: center;
    border-radius: 999px;
    padding: 0.08rem 0.42rem;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.tv-layout .tv-ticket-row .tv-ticket-status {
    background: rgba(148, 163, 184, 0.22);
    color: #0f172a;
}

.tv-layout .tv-ticket-row .tv-ticket-kind {
    background: rgba(59, 130, 246, 0.16);
    color: #1e3a8a;
}

.tv-layout .tv-ticket-row.is-vip {
    border-left: 4px solid #f59e0b;
}

.tv-layout .tv-ticket-row.is-vip .tv-ticket-status {
    background: rgba(245, 158, 11, 0.22);
    color: #92400e;
}

.tv-layout .tv-ticket-row.is-bot .tv-ticket-kind {
    background: rgba(239, 68, 68, 0.2);
    color: #7f1d1d;
}

.tv-layout .tv-action-buttons {
    max-width: none;
    gap: 0.45rem;
}

.tv-layout .btn {
    border-radius: 8px;
    padding: 0.62rem 0.8rem;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    font-weight: 800;
}

.tv-layout .btn-primary {
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 55%, #15803d 100%);
    color: #f8fafc;
    box-shadow: 0 8px 18px rgba(21, 128, 61, 0.35);
}

.tv-layout .btn-secondary {
    border-color: rgba(255, 255, 255, 0.28);
    color: #d1d5db;
}

.tv-layout .btn-check {
    border-color: #60a5fa;
    color: #bfdbfe;
}

.tv-layout .tv-auto-play {
    max-width: none;
    margin-top: 0;
    background: rgba(3, 17, 29, 0.42);
    border-color: rgba(255, 255, 255, 0.15);
    padding: 0.65rem;
}

.tv-layout .tv-round-cards-badge {
    margin-bottom: 0.5rem;
    color: #bfdbfe;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tv-layout .tv-round-cards-badge b {
    color: #22d3ee;
    font-size: 1.05rem;
}

.tv-layout #auto-timer {
    background: rgba(15, 23, 42, 0.85);
}

.tv-layout .btn-auto {
    border-color: #f59e0b;
    color: #fbbf24;
}

.tv-layout .tv-center-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.7rem;
    gap: 0.7rem;
}

.tv-layout .tv-current-number-container {
    margin-bottom: 0;
    background: rgba(2, 15, 27, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 0.7rem 0.6rem;
}

.tv-layout .tv-number-shell {
    margin: 0.35rem auto 0;
    width: min(23vw, 235px);
    aspect-ratio: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 30% 25%, #ffffff 0%, #f8fafc 40%, #dbeafe 70%, #cbd5e1 100%);
    border: 7px solid rgba(250, 250, 250, 0.9);
    box-shadow: 0 20px 36px rgba(0, 0, 0, 0.38), inset 0 -10px 20px rgba(30, 64, 175, 0.18);
}

.tv-layout .tv-current-number-container .current-number {
    font-size: clamp(4.6rem, 10vw, 8.9rem);
    color: #111827;
    line-height: 0.9;
    text-shadow: none;
}

.tv-layout .tv-current-number-container .current-letter {
    margin-top: 0.38rem;
    display: inline-block;
    font-size: clamp(1.6rem, 3.2vw, 2.75rem);
    color: #34d399;
    text-shadow: 0 0 15px rgba(52, 211, 153, 0.42);
}

.tv-layout .tv-current-number-container .current-number-label {
    font-size: 0.82rem;
    letter-spacing: 0.1em;
    color: #bfdbfe;
    margin-top: 0;
}

.tv-layout .tv-remaining-box {
    margin-top: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #dbeafe;
    font-size: 0.75rem;
}

.tv-layout .tv-remaining-box b {
    color: #f59e0b;
    font-size: 1.15rem;
    vertical-align: middle;
}

.tv-layout .tv-history-preview {
    margin-top: 0;
    align-items: center;
    gap: 0.45rem;
    background: rgba(2, 15, 27, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 0.55rem;
}

.tv-layout .tv-history-preview span:first-child {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    color: #bfdbfe;
}

.tv-layout #history-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.38rem;
    min-height: 58px;
}

.tv-layout .history-item {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.45rem;
    font-weight: 900;
    color: #0f172a;
    border-width: 3px;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.36), inset 0 3px 8px rgba(255, 255, 255, 0.3);
}

.tv-layout .history-item::after {
    width: 20px;
    height: 20px;
    font-size: 0.6rem;
}

.tv-layout .tv-mini-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
}

.tv-layout .tv-mini-card {
    border-radius: 8px;
    padding: 0.45rem 0.48rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(180deg, rgba(8, 26, 44, 0.9) 0%, rgba(12, 39, 63, 0.76) 100%);
}

.tv-layout .tv-mini-card h3 {
    margin: 0;
    font-size: 0.63rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7dd3fc;
}

.tv-layout .tv-mini-card p {
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
    font-weight: 800;
    color: #f8fafc;
}

.tv-layout .tv-board-section {
    padding: 0.6rem;
    background:
        radial-gradient(circle at 20% 10%, rgba(34, 197, 94, 0.1), transparent 50%),
        linear-gradient(180deg, rgba(10, 36, 57, 0.92) 0%, rgba(5, 23, 39, 0.94) 100%);
}

.tv-layout .tv-board-header {
    margin-bottom: 0.55rem;
    padding-bottom: 0.55rem;
    border-color: rgba(255, 255, 255, 0.14);
}

.tv-layout .tv-board-header h2 {
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-size: 0.95rem;
    color: #bbf7d0;
}

.tv-layout .tv-board-header .stats {
    gap: 0.8rem;
}

.tv-layout .tv-board-header .stat-label {
    font-size: 0.62rem;
    color: #a5b4fc;
}

.tv-layout .tv-board-header .stat-value {
    font-size: 1rem;
}

.tv-layout .tv-bingo-header-row {
    margin-bottom: 0.3rem;
    gap: 3px;
}

.tv-layout .tv-bingo-header-row .col-header {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-weight: 700;
    border-radius: 4px;
    padding: 0.2rem 0;
    background: rgba(148, 163, 184, 0.22);
    color: #e2e8f0;
}

.tv-layout .bingo-board {
    grid-template-columns: 42px repeat(15, minmax(26px, 1fr));
    gap: 4px;
    overflow: auto;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(52, 211, 153, 0.8) rgba(2, 6, 23, 0.45);
}

.tv-layout .bingo-board::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.tv-layout .bingo-board::-webkit-scrollbar-track {
    background: rgba(2, 6, 23, 0.45);
    border-radius: 999px;
}

.tv-layout .bingo-board::-webkit-scrollbar-thumb {
    background: rgba(52, 211, 153, 0.8);
    border-radius: 999px;
}

.tv-layout .letter-col {
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 900;
    text-shadow: none;
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
}

.tv-layout .number-cell {
    min-height: 32px;
    border-radius: 4px;
    border: 1px solid rgba(100, 116, 139, 0.25);
    background: rgba(2, 6, 23, 0.85);
    color: #e2e8f0;
    font-size: 0.86rem;
    font-weight: 700;
}

.tv-layout .bingo-board > .number-cell:nth-child(n+2):nth-child(-n+16) {
    color: #fca5a5;
}

.tv-layout .bingo-board > .number-cell:nth-child(n+18):nth-child(-n+32) {
    color: #93c5fd;
}

.tv-layout .bingo-board > .number-cell:nth-child(n+34):nth-child(-n+48) {
    color: #86efac;
}

.tv-layout .bingo-board > .number-cell:nth-child(n+50):nth-child(-n+64) {
    color: #fcd34d;
}

.tv-layout .bingo-board > .number-cell:nth-child(n+66):nth-child(-n+80) {
    color: #67e8f9;
}

.tv-layout .number-cell.active {
    color: #0f172a;
    background: #22c55e;
    border-color: #4ade80;
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.75);
}

.tv-layout .number-cell.recent {
    animation: tv-blink 0.6s ease-in-out infinite alternate;
}

.tv-layout .tv-footer {
    margin-top: 0.35rem;
    padding: 0.3rem;
    font-size: 0.68rem;
    color: #93c5fd;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

@keyframes tv-rise {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes tv-blink {
    from {
        filter: brightness(1);
    }

    to {
        filter: brightness(1.25);
    }
}

@media (max-width: 1280px) {
    .tv-layout .tv-header {
        grid-template-columns: 1fr;
    }

    .tv-layout .tv-jackpot-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .tv-layout .tv-main-content {
        grid-template-columns: minmax(280px, 0.95fr) minmax(380px, 1.05fr);
        grid-template-areas:
            "left board"
            "center board";
    }

    .tv-layout .tv-tickets-panel {
        grid-area: left;
    }

    .tv-layout .tv-center-panel {
        grid-area: center;
    }

    .tv-layout .tv-board-section {
        grid-area: board;
    }
}

@media (max-width: 900px) {
    .tv-layout {
        height: auto;
        min-height: 100vh;
    }

    .tv-layout .tv-main-content {
        grid-template-columns: 1fr;
        grid-template-areas: none;
    }

    .tv-layout .tv-ticket-list {
        max-height: 220px;
    }

    .tv-layout .tv-jackpot-strip {
        grid-template-columns: 1fr;
    }

    .tv-layout .tv-number-shell {
        width: min(64vw, 250px);
    }

    .tv-layout .bingo-board {
        grid-template-columns: 36px repeat(15, minmax(22px, 1fr));
    }

    .tv-layout .number-cell {
        min-height: 28px;
        font-size: 0.72rem;
    }

    .tv-layout .tv-mini-grid {
        grid-template-columns: 1fr;
    }
}
