:root {
    /* Dark Theme (Default) */
    --bg-gradient: linear-gradient(135deg, oklch(25% 0.05 250), oklch(15% 0.1 300));
    --glass-bg: rgba(30, 30, 30, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: oklch(98% 0.01 250);
    --text-secondary: oklch(80% 0.03 250);
    --set-bg: rgba(255, 255, 255, 0.05);
    --btn-bg: oklch(98% 0.01 250);
    --btn-text: oklch(25% 0.05 250);
    
    /* Lotto Ball Colors (Vibrant) */
    --color-1-10: oklch(85% 0.2 85);   /* Yellow-ish */
    --color-11-20: oklch(75% 0.15 230); /* Blue-ish */
    --color-21-30: oklch(65% 0.2 15);   /* Red-ish */
    --color-31-40: oklch(60% 0.05 250); /* Gray-ish */
    --color-41-45: oklch(80% 0.15 140); /* Green-ish */
    
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --shadow-inner: inset 0 0 15px rgba(255, 255, 255, 0.1);
    --transition-speed: 0.4s;
}

[data-theme="light"] {
    --bg-gradient: linear-gradient(135deg, oklch(95% 0.02 250), oklch(85% 0.05 300));
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.1);
    --text-primary: oklch(25% 0.05 250);
    --text-secondary: oklch(45% 0.05 250);
    --set-bg: rgba(0, 0, 0, 0.03);
    --btn-bg: oklch(45% 0.2 300);
    --btn-text: oklch(98% 0.01 250);
    --shadow-premium: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --shadow-inner: inset 0 0 10px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    background: var(--bg-gradient);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
    position: relative;
    transition: background var(--transition-speed) ease;
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 24px;
    right: 24px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-premium);
    transition: all var(--transition-speed) ease;
    z-index: 1001;
}

.theme-toggle:hover {
    transform: rotate(15deg) scale(1.1);
}

/* Noise Overlay */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.04;
    z-index: 1000;
    filter: url(#noiseFilter);
}

.container {
    width: 100%;
    max-width: 600px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow-premium);
    text-align: center;
    animation: fadeIn 0.8s ease-out;
    transition: background var(--transition-speed) ease, border var(--transition-speed) ease;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    transition: color var(--transition-speed) ease;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 32px;
    transition: color var(--transition-speed) ease;
}

.sets-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 40px;
}

.lotto-set {
    background: var(--set-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    justify-content: center;
    gap: 10px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background var(--transition-speed) ease;
    animation: slideUp 0.5s ease-out backwards;
}

.lotto-set:hover {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .lotto-set:hover {
    background: rgba(0, 0, 0, 0.05);
}

.lotto-ball {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2), var(--shadow-inner);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

/* Button Styling */
#generate-btn {
    background: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    padding: 18px 36px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 100px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

#generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
    opacity: 0.9;
}

#generate-btn:active {
    transform: translateY(0);
}

#generate-btn .btn-icon {
    font-size: 1.4rem;
}

/* Divider */
.divider {
    border: none;
    border-top: 1px solid var(--glass-border);
    margin: 40px 0;
    opacity: 0.5;
}

/* Stats Section */
.stats-section {
    text-align: left;
    margin-top: 20px;
}

.stats-section h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stats-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

/* Custom Scrollbar for stats */
.stats-container::-webkit-scrollbar {
    width: 6px;
}

.stats-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.stats-container::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.stat-item {
    background: var(--set-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideUp 0.4s ease-out backwards;
}

.stat-ball {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.stat-count {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-rank {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    80% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 24px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .lotto-ball {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }
    
    .lotto-set {
        gap: 6px;
        padding: 12px;
    }
}
