body {
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: #f0f2f5;
    color: #333;
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth theme transition */
}

.container {
    background-color: #fff;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 800px; /* Increased max-width for multiple sets */
    width: 100%;
    position: relative; /* For absolute positioning of toggle */
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

h1 {
    color: #0056b3;
    margin-bottom: 30px;
    font-size: 2.2em;
    transition: color 0.3s ease;
}

#generateBtn {
    background: linear-gradient(180deg, #007bff, #0056b3); /* Gradient for depth */
    color: white;
    border: none;
    padding: 15px 30px; /* Slightly larger padding */
    font-size: 1.2em; /* Slightly larger font */
    border-radius: 10px; /* More rounded corners */
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 30px;
    /* 3D box-shadow effect */
    box-shadow: 
        0 4px 0 0 #004085, /* Darker bottom shadow (depth) */
        0 6px 12px rgba(0, 0, 0, 0.3); /* General soft shadow */
    position: relative; /* Needed for :active pseudo-element transform */
}

#generateBtn:hover {
    background: linear-gradient(180deg, #0056b3, #003d7a); /* Darker gradient on hover */
    transform: translateY(-2px); /* Lift effect */
    box-shadow: 
        0 6px 0 0 #004085,
        0 8px 16px rgba(0, 0, 0, 0.4);
}

#generateBtn:active {
    transform: translateY(2px); /* Pressing effect */
    box-shadow: 
        0 2px 0 0 #004085,
        0 3px 6px rgba(0, 0, 0, 0.2);
}

.lotto-recommendations-container {
    display: flex;
    flex-direction: column; /* Stack recommendations vertically */
    gap: 25px; /* Space between each lotto recommendation set */
    margin-top: 20px;
}

.lotto-recommendation {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 20px; /* Adjusted: Space between main numbers group and bonus number group */
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background-color: #fdfdfd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.numbers-display {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px; /* Space between main balls */
}

.bonus-display {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: 10px; /* Adjusted: Space between main numbers and bonus */
    position: relative;
    /* Ensure the + sign doesn't push it too far */
    padding-left: 20px; /* To make space for the + sign */
}

.bonus-display::before {
    content: '+';
    position: absolute;
    left: 0px; /* Adjusted: Align with the start of the bonus-display padding */
    font-size: 1.8em; /* Slightly larger + sign */
    color: #666;
    top: 50%;
    transform: translateY(-50%);
    transition: color 0.3s ease;
}

.lotto-ball {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
    font-weight: bold;
    /* Enhanced 3D shadow for spherical look */
    box-shadow: 
        inset 0 -3px 3px rgba(0,0,0,0.3), /* Bottom inner shadow */
        inset 0 3px 3px rgba(255,255,255,0.3), /* Top inner highlight */
        0 4px 8px rgba(0, 0, 0, 0.4); /* Outer shadow */
    transition: transform 0.2s ease, box-shadow 0.2s ease; /* Removed filter from transition */
    border: 2px solid; /* Generic border, color determined by specific ball color class or bonus */
    overflow: hidden; /* Hide overflowing numbers during spin */
    position: relative; /* For animation positioning */
}

.lotto-ball:hover {
    transform: translateY(-5px) scale(1.05); /* More pronounced hover effect */
    box-shadow: 
        inset 0 -4px 4px rgba(0,0,0,0.4),
        inset 0 4px 4px rgba(255,255,255,0.4),
        0 6px 12px rgba(0, 0, 0, 0.5);
}

.lotto-ball.spinning {
    /* No blur effect */
    transform: scale(1.1); /* Slight scale to make it feel more active */
    /* No animation here, as JS will handle content changes */
}


/* Color ranges for lotto balls */
.ball-color-10 {
    background: linear-gradient(135deg, #FFD700, #FFA500); /* Yellow/Orange */
    border-color: #FFBF00;
    color: #333; /* Darker text for yellow */
}

.ball-color-20 {
    background: linear-gradient(135deg, #ADD8E6, #87CEEB); /* Light Blue */
    border-color: #6495ED;
    color: white;
}

.ball-color-30 {
    background: linear-gradient(135deg, #FF6347, #FF4500); /* Red-Orange */
    border-color: #DC143C;
    color: white;
}

.ball-color-40 {
    background: linear-gradient(135deg, #90EE90, #3CB371); /* Light Green */
    border-color: #2E8B57;
    color: white;
}

.ball-color-45 {
    background: linear-gradient(135deg, #DA70D6, #9932CC); /* Orchid/Dark Orchid */
    border-color: #8A2BE2;
    color: white;
}

/* Specific styling for main and bonus balls */
.main-ball {
    /* Background and border color will be set by .ball-color-X */
    color: white; /* All main numbers are white font */
}

.bonus-ball {
    background: linear-gradient(135deg, #FF69B4, #FF1493); /* Pink gradient for bonus */
    border-color: #C71585; /* Darker pink border */
    color: black; /* Black text for bonus balls */
}


/* Dark Mode Toggle Switch */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    position: absolute;
    top: 20px;
    right: 20px;
}

.theme-switch em {
    margin-left: 10px;
    font-size: 0.9em;
    color: #666;
    transition: color 0.3s ease;
}

.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: 0.4s;
}

.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 26px;
    left: 4px;
    position: absolute;
    transition: 0.4s;
    width: 26px;
}

input:checked + .slider {
    background-color: #6200ee; /* Primary color for dark mode toggle */
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}


/* Dark Mode Styles */
body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}

body.dark-mode .container {
    background-color: #1e1e1e;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

body.dark-mode h1 {
    color: #bb86fc; /* Lighter purple for dark mode heading */
}

body.dark-mode #generateBtn {
    background: linear-gradient(180deg, #bb86fc, #3700b3); /* Dark mode button gradient */
    box-shadow: 
        0 4px 0 0 #3700b3, 
        0 6px 12px rgba(0, 0, 0, 0.5);
}

body.dark-mode #generateBtn:hover {
    background: linear-gradient(180deg, #3700b3, #1f006e);
    box-shadow: 
        0 6px 0 0 #3700b3,
        0 8px 16px rgba(0, 0, 0, 0.6);
}

body.dark-mode #generateBtn:active {
    box-shadow: 
        0 2px 0 0 #3700b3,
        0 3px 6px rgba(0, 0, 0, 0.3);
}

body.dark-mode .lotto-recommendation {
    background-color: #2c2c2c;
    border-color: #444;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.dark-mode .bonus-display::before {
    color: #aaa;
}

body.dark-mode .theme-switch em {
    color: #e0e0e0;
}


/* --- Responsive Design --- */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        max-width: 95%;
    }

    h1 {
        font-size: 1.8em;
    }

    #generateBtn {
        padding: 12px 25px;
        font-size: 1em;
    }

    .lotto-ball {
        width: 45px;
        height: 45px;
        font-size: 1.3em;
    }

    .lotto-recommendation {
        flex-direction: column; /* Stack numbers and bonus vertically on smaller screens */
        gap: 15px;
    }

    .bonus-display {
        margin-left: 0;
        margin-top: 10px; /* Add space when stacked */
        padding-left: 0; /* Remove padding as + is not positioned absolutely relative to this anymore */
    }

    .bonus-display::before {
        position: static; /* Make it flow with content */
        transform: none;
        margin-right: 5px; /* Space between + and ball */
    }

    .theme-switch-wrapper {
        top: 10px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5em;
    }

    #generateBtn {
        font-size: 0.9em;
        padding: 10px 20px;
    }

    .lotto-ball {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }

    .lotto-recommendation {
        padding: 10px;
        gap: 10px;
    }

    .numbers-display {
        gap: 8px;
    }

    .bonus-display {
        margin-top: 5px;
    }
    
    .theme-switch em {
        display: none; /* Hide '다크 모드' text on very small screens */
    }
}