:root {
    --bg-color: #0f172a;
    --accent-color: #8b5cf6;
    --accent-glow: #a78bfa;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --ball-gradient-1: linear-gradient(135deg, #facc15, #ca8a04);
    --ball-gradient-2: linear-gradient(135deg, #38bdf8, #0284c7);
    --ball-gradient-3: linear-gradient(135deg, #f472b6, #db2777);
    --ball-gradient-4: linear-gradient(135deg, #a3e635, #65a30d);
    --ball-gradient-5: linear-gradient(135deg, #fbbf24, #d97706);
    /* Default gradient for balls/spheres */
    --ball-default: linear-gradient(145deg, #ffffff, #e2e8f0);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Atmospheric Background */
.background-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, rgba(15, 23, 42, 0) 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    filter: blur(80px);
    animation: pulse 8s infinite alternate;
}

@keyframes pulse {
    0% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(0.8);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* Glass Container */
.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
}

/* Numbers Area */
.numbers-container {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.lotto-row {
    display: flex;
    gap: 1rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50px;
    animation: fadeIn 0.5s ease-out forwards;
    opacity: 0;
}

.lotto-row:nth-child(1) {
    animation-delay: 0s;
}

.lotto-row:nth-child(2) {
    animation-delay: 0.1s;
}

.lotto-row:nth-child(3) {
    animation-delay: 0.2s;
}

.lotto-row:nth-child(4) {
    animation-delay: 0.3s;
}

.lotto-row:nth-child(5) {
    animation-delay: 0.4s;
}

.lotto-row:nth-child(6) {
    animation-delay: 0.5s;
}

.placeholder-text {
    color: var(--text-secondary);
    font-size: 1.2rem;
    opacity: 0.7;
    animation: fadeIn 1s ease;
}

.lotto-ball {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--ball-default);
    color: #1e293b;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 700;
    box-shadow:
        inset -5px -5px 10px rgba(0, 0, 0, 0.1),
        inset 5px 5px 10px rgba(255, 255, 255, 0.4),
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
    position: relative;
    opacity: 0;
    transform: translateY(10px) scale(0.8);
    animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Controls & Slider */
.controls {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-weight: 500;
}

#range-value {
    color: var(--accent-glow);
    font-weight: 700;
}

.premium-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
}

.premium-slider:hover {
    opacity: 1;
}

.premium-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-color);
    transition: transform 0.1s;
}

.premium-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}


/* Dynamic Colors based on Number Range (Correct Korean Lotto Colors) */
.lotto-ball[data-range="1"] {
    background: radial-gradient(circle at 30% 30%, #facc15, #eab308);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 1-10 Yellow */
.lotto-ball[data-range="2"] {
    background: radial-gradient(circle at 30% 30%, #38bdf8, #0ea5e9);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 11-20 Blue */
.lotto-ball[data-range="3"] {
    background: radial-gradient(circle at 30% 30%, #ef4444, #dc2626);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 21-30 Red */
.lotto-ball[data-range="4"] {
    background: radial-gradient(circle at 30% 30%, #a3a3a3, #737373);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 31-40 Gray */
.lotto-ball[data-range="5"] {
    background: radial-gradient(circle at 30% 30%, #4ade80, #16a34a);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 41-45 Green */

@keyframes popIn {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 0.7;
    }
}

/* Button Styling */
.generate-btn {
    position: relative;
    padding: 1rem 2.5rem;
    font-size: 1.25rem;
    font-weight: 500;
    color: white;
    background: transparent;
    border: none;
    cursor: pointer;
    overflow: hidden;
    border-radius: 9999px;
    align-self: center;
    transition: transform 0.2s;
    font-family: inherit;
}

.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, #6366f1, #a855f7, #ec4899);
    z-index: -2;
    transition: opacity 0.3s;
}

.generate-btn::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: #0f172a;
    /* Match container darker shade if needed, actually transparent is nicer for gradient button */
    background: rgba(15, 23, 42, 0.3);
    border-radius: 9999px;
    z-index: -1;
    transition: background 0.3s;
}

/* Make it a full gradient button */
.generate-btn::after {
    display: none;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(168, 85, 247, 0.5);
}

.generate-btn:active {
    transform: translateY(1px);
}

.btn-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.5s, transform 0.5s;
    pointer-events: none;
}

.generate-btn:hover .btn-glow {
    opacity: 1;
    transform: scale(1);
    transition: 0s;
}

/* Responsive */
@media (max-width: 600px) {
    .glass-container {
        padding: 1.5rem 1rem;
        width: 100%;
        border-radius: 0;
        border: none;
        height: 100vh;
        justify-content: center;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .lotto-row {
        gap: 0.3rem;
        padding: 0.3rem;
        flex-wrap: nowrap;
        /* Prevent wrapping */
        width: 100%;
        justify-content: center;
    }

    .lotto-ball {
        width: 38px;
        height: 38px;
        font-size: 1rem;
        box-shadow:
            inset -3px -3px 5px rgba(0, 0, 0, 0.1),
            inset 3px 3px 5px rgba(255, 255, 255, 0.4);
    }

    .numbers-container {
        gap: 0.8rem;
    }

    .background-glow {
        width: 300px;
        height: 300px;
    }
}