:root {
    /* Global Colors */
    --bg-color: #f9f9f9;
    --text-color: #333;
    --container-bg: #ffffff;
    --border-color: #ccc;
    --light-border: #eee;
    --header-bg: #333;
    --header-text: #ffffff;
    --header-hover: #555;
    
    /* Buttons & Links */
    --btn-bg: #007bff;
    --btn-hover: #0056b3;
    --btn-text: #ffffff;
    --link-color: #007bff;
    --link-hover: #0056b3;
    
    /* Alerts & Status */
    --alert-color: #d9534f;
    --alert-bg: #fde8e8;
    --success-color: #28a745;
    --muted-text: #888;
    
    /* UI Elements */
    --modal-bg: #fefefe;
    --shadow-color: rgba(0,0,0,0.1);
    --input-bg: #ffffff;
    --input-text: #000000;
    --card-bg: #ffffff;
    --subtitle-color: #7f8c8d;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --container-bg: #1e1e1e;
    --border-color: #444;
    --light-border: #333;
    --header-bg: #2c2c2c;
    --header-text: #e0e0e0;
    --header-hover: #444;
    --btn-bg: #0d6efd;
    --btn-hover: #0b5ed7;
    --btn-text: #ffffff;
    --link-color: #6ea8fe;
    --link-hover: #8bb9fe;
    --alert-color: #ff6b6b;
    --alert-bg: #4c1d1d;
    --success-color: #75b798;
    --muted-text: #aaa;
    --modal-bg: #1e1e1e;
    --shadow-color: rgba(0,0,0,0.5);
    --input-bg: #2c2c2c;
    --input-text: #e0e0e0;
    --card-bg: #1e1e1e;
    --subtitle-color: #aaa;
}

/* Reset Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
}

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    margin: 0; 
    padding: 20px; /* Restore padding */
    background-color: var(--bg-color); 
    color: var(--text-color); 
    min-height: 100vh; 
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
}

/* --- LANDING PAGE (Index) --- */
/* Wrapper handles centering, isolating it from body styles */
.landing-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh; /* Vertical centering */
    width: 100%;
}

.landing-container {
    text-align: center;
    background: var(--card-bg);
    padding: 50px; /* Desktop padding */
    border-radius: 15px;
    box-shadow: 0 10px 25px var(--shadow-color);
    max-width: 500px;
    width: 100%; 
    margin: 0 auto;
    position: relative;
    transition: background-color 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}
h1 { margin-bottom: 10px; font-size: 2.2em; margin-top: 0; }
p { color: var(--subtitle-color); margin-bottom: 40px; font-size: 1.1em; }

.menu { display: grid; gap: 20px; }

.menu-item { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    padding: 18px 25px; 
    color: white; 
    text-decoration: none; 
    border-radius: 10px; 
    font-weight: bold; 
    font-size: 1.2em; 
    transition: transform 0.2s, box-shadow 0.2s; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.menu-item:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 6px 12px rgba(0,0,0,0.2); 
}

.menu-item.instant { background: linear-gradient(135deg, #28a745, #218838); }
.menu-item.pulltab { background: linear-gradient(135deg, #17a2b8, #117a8b); }
.menu-item.draw { background: linear-gradient(135deg, #fd7e14, #e8590c); } /* Orange for Draw Games */
.menu-item.keno { background: linear-gradient(135deg, #e83e8c, #d63384); } /* Pink for Club Keno */
.menu-item.fast-cash { background: linear-gradient(135deg, #ffc107, #e0a800); color: #333; } /* Gold for Fast Cash */
.menu-item.stats { background: linear-gradient(135deg, #6610f2, #520dc2); }

.menu-item.admin { 
    background: transparent; 
    color: var(--subtitle-color); 
    box-shadow: none; 
    font-size: 0.95em; 
    padding: 10px; 
    margin-top: 15px; 
    text-decoration: underline;
}
.menu-item.admin:hover {
    color: var(--text-color);
    transform: none;
    background: rgba(0,0,0,0.05);
}
[data-theme="dark"] .menu-item.admin:hover { background: rgba(255,255,255,0.05); }


/* --- COMMON UI ELEMENTS --- */

/* Buttons */
.btn { display: inline-block; padding: 10px 20px; background: var(--btn-bg); color: var(--btn-text); text-decoration: none; border-radius: 5px; font-weight: bold; cursor: pointer; border: none;}
.btn:hover { background: var(--btn-hover); }

/* Theme Toggle */
#themeToggle {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 2000;
    background-color: var(--header-bg); /* Changed from transparent */
    border: 1px solid var(--light-border);
    font-size: 1.2em;
    color: var(--text-color);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: background 0.2s, color 0.2s, border 0.2s;
}
#themeToggle:hover {
    background-color: var(--header-hover);
}
[data-theme="dark"] #themeToggle:hover {
    background-color: var(--header-hover);
}

/* Remove landing-container specific override as it's now globally fixed */
/*
.landing-container #themeToggle {
    position: absolute;
    top: 20px;
    right: 20px;
    border: none;
    color: var(--text-color);
}
*/


/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--header-bg);
    padding: 10px 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px var(--shadow-color);
    color: var(--header-text);
    flex-wrap: wrap;
    gap: 10px;
    width: 100%; /* Ensure navbar takes full width */
}
.navbar a { color: var(--header-text); text-decoration: none; }
.navbar-brand-container { display: flex; flex-direction: column; }
.navbar-brand { font-size: 1.5em; font-weight: bold; color: var(--header-text); text-decoration: none; }
.navbar-subtitle { font-size: 0.8em; color: #aaa; }
.navbar-center { display: flex; align-items: center; gap: 10px; flex-grow: 1; justify-content: center; }
.navbar-right { display: flex; align-items: center; gap: 10px; }
.navbar .btn { padding: 0 15px; font-size: 0.95em; height: 38px; display: inline-flex; align-items: center; justify-content: center; color: white; }

/* Search */
.search-container { position: relative; width: 100%; max-width: 300px; margin: 0; }
#searchInput { width: 100%; max-width: 300px; padding: 10px; border: 1px solid var(--border-color); border-radius: 5px; font-size: 16px; background-color: var(--input-bg); color: var(--input-text); padding-right: 35px; box-sizing: border-box; }
.clear-search { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); cursor: pointer; font-weight: bold; color: var(--text-color); display: none; }

/* Tables */
.table-container { width: 100%; overflow-x: auto; box-shadow: 0 2px 5px var(--shadow-color); border-radius: 5px; background: var(--container-bg); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 15px; border-bottom: 1px solid var(--light-border); }
th { background-color: var(--header-bg); color: var(--header-text); cursor: pointer; user-select: none; white-space: nowrap; }
th:hover { background-color: var(--header-hover); }
th::after { content: ' \2195'; font-size: 0.8em; color: #aaa; margin-left: 5px;}
tr:hover { background-color: rgba(0,0,0,0.05); }

.price-tag { font-weight: bold; color: var(--success-color); }
.price-estimated { color: #fd7e14; cursor: help; font-weight: bold; }
.odds-cell { font-weight: bold; color: hsl(var(--odds-hue, 0), 100%, 35%); }
[data-theme="dark"] .odds-cell { color: hsl(var(--odds-hue, 0), 100%, 60%); }
.ev-cell { font-weight: bold; color: hsl(var(--ev-hue, 0), 100%, 35%); }
[data-theme="dark"] .ev-cell { color: hsl(var(--ev-hue, 0), 100%, 60%); }
.alert { color: var(--alert-color); font-weight: bold; background-color: var(--alert-bg); }
.game-id { color: var(--muted-text); font-size: 0.85em; margin-left: 5px; }
.game-link { color: var(--link-color); cursor: pointer; text-decoration: underline; font-weight: 600; }
.game-link:hover { color: var(--link-hover); }

/* Prevent wrapping */
td:nth-child(3), td:nth-child(7), td:nth-child(8) { white-space: nowrap; }
td:nth-child(4), td:nth-child(10) { text-align: center; }

/* Modals */
.modal { display: none; position: fixed; z-index: 3000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.7); backdrop-filter: blur(3px); }
.modal-content { background-color: var(--modal-bg); margin: 2% auto; padding: 20px; border: 1px solid var(--border-color); width: 95%; max-width: 600px; border-radius: 10px; text-align: center; box-shadow: 0 4px 8px var(--shadow-color); position: relative; color: var(--text-color); box-sizing: border-box; }
.close-btn { color: #aaa; float: right; font-size: 28px; font-weight: bold; position: absolute; top: 10px; right: 20px; cursor: pointer; }
.close-btn:hover { color: var(--text-color); }
#modalImage { max-width: 100%; max-height: 85vh; width: auto; height: auto; border-radius: 5px; margin-top: 10px; box-shadow: 0 2px 5px var(--shadow-color); }
#modalTitle { margin-top: 0; color: var(--text-color); font-size: 1.2em; word-wrap: break-word;}
.modal-stats { display: flex; justify-content: space-around; margin: 15px 0; padding: 10px; background-color: var(--bg-color); border-radius: 8px; flex-wrap: wrap; gap: 10px; }
.modal-stat-item { text-align: center; }
.modal-stat-label { font-size: 0.8em; color: var(--muted-text); text-transform: uppercase; }
.modal-stat-value { font-weight: bold; font-size: 1.1em; }
#modalPrizes th, #modalPrizes td { border: 1px solid var(--border-color); padding: 8px; text-align: left; }
#modalPrizes th { background-color: var(--header-bg); color: var(--header-text); }

/* Draw Cards & Recs */
.draw-card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px var(--shadow-color); }
    /* Collapsible Recommendations */
    .rec-card h3 {
        cursor: pointer; 
        display: flex; 
        justify-content: space-between; 
        align-items: center; 
        user-select: none;
        margin-bottom: 0; 
    }
    
    .rec-card h3::after {
        content: '▼'; 
        font-size: 0.8em; 
        transition: transform 0.3s;
        transform: rotate(-90deg); /* Default: Pointing right (Collapsed) */
    }
    
    .rec-card .rec-content {
        display: none; /* Default: Hidden */
        margin-top: 15px; 
    }
    
    /* When expanded class is present, show content and rotate arrow */
    .rec-card.expanded .rec-content {
        display: block; 
    }
    
    .rec-card.expanded h3::after {
        transform: rotate(0deg); /* Pointing down */
    }
    
    .badge-new { background-color: #e83e8c; color: white; padding: 1px 4px; border-radius: 4px; font-size: 0.6em; font-weight: bold; position: absolute; top: -8px; right: -22px; z-index: 10; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }

/* Stats Panels */
.panel { background: var(--container-bg); padding: 20px; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 2px 5px var(--shadow-color); border: 1px solid var(--border-color); }
.panel h3 { margin-top: 0; color: var(--text-color); }
.btn-range { background: #f0f0f0; border: 1px solid #ccc; padding: 2px 8px; cursor: pointer; font-size: 0.8em; border-radius: 3px; margin: 0 2px; color: #333; }
.btn-range:hover { background: #e0e0e0; }
[data-theme="dark"] .btn-range { background: #2c2c2c; border-color: #444; color: #e0e0e0; }
[data-theme="dark"] .btn-range:hover { background: #444; }

/* Image Preview */
#imagePreview { position: absolute; display: none; border: 1px solid var(--border-color); background: var(--container-bg); padding: 5px; z-index: 999; box-shadow: 0 0 10px var(--shadow-color); }
#imagePreview img { max-width: 200px; }

/* Pending Badge for Draw Games */
.pending-badge {
    padding: 5px 12px;
    background-color: #e2e6ea;
    color: #6c757d;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9em;
    border: 1px solid #dae0e5;
}

/* Footer */
.footer { text-align: center; padding: 20px; margin-top: 40px; border-top: 1px solid var(--border-color); font-size: 0.9em; color: var(--muted-text); width: 100%; clear: both; box-sizing: border-box; }
.footer a { color: var(--link-color); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* Clickable Table Rows */
.clickable-row {
    cursor: pointer;
    transition: background-color 0.2s;
}
.clickable-row:hover {
    background-color: rgba(0,0,0,0.05);
}
[data-theme="dark"] .clickable-row:hover {
    background-color: rgba(255,255,255,0.05);
}

/* Poker Lotto Cards */
.playing-card {
    width: 40px; height: 56px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    line-height: 1;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.playing-card .rank { font-weight: bold; font-size: 1.1em; }
.playing-card .suit { font-size: 1.2em; margin-top: 2px; }
.red-suit { color: #dc3545; border-color: #e6b3b3; }
.black-suit { color: #333; border-color: #ccc; }

/* --- MARQUEE (SHARED) --- */
.marquee-container {
    background: #ffc107;
    color: #333;
    padding: 0;
    height: 40px;
    overflow: hidden;
    white-space: nowrap;
    position: absolute;
    top: 0;
    left: 0;
    font-weight: bold;
    width: 100%; /* Changed from 100vw to prevent scrollbar induced overflow */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 1000;
}
.marquee-track { display: flex; width: max-content; animation: marquee-mobile 30s linear infinite; }
.marquee-content-group { display: flex; gap: 50px; padding-right: 50px; padding-left: 50px; line-height: 40px; }
@keyframes marquee-mobile { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.marquee-content-desktop { position: absolute; top: 0; white-space: nowrap; line-height: 40px; will-change: left; }

/* --- RESPONSIVE UTILS --- */
@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    body { padding: 10px; }
    th, td { padding: 10px 8px; font-size: 0.9em; }
    
    /* Reduced padding for landing container on mobile */
    .landing-container { padding: 20px; } 
    
    .navbar { flex-direction: column; text-align: center; gap: 15px; padding: 15px; }

    /* Hide Draw Games Banner on Mobile */
    .draw-games-container { display: none !important; }
}
@media (min-width: 769px) {
    .mobile-only { display: none !important; }
}