:root {
    /* Dark Mode (Default) */
    --bg-color: #121212;
    --text-color: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.08);
    --card-border: rgba(255, 255, 255, 0.1);
    --subtitle-color: rgba(255, 255, 255, 0.7);
    --placeholder-color: rgba(255, 255, 255, 0.4);
    --history-bg: rgba(0, 0, 0, 0.2);
    --history-text: rgba(255, 255, 255, 0.8);
    --history-border: rgba(255, 255, 255, 0.05);
    --primary-color: #ffd700;
    --ball-size: 60px;
}

body.light-mode {
    /* Light Mode Overrides */
    --bg-color: #f5f7fa;
    --text-color: #2d3436;
    --card-bg: #ffffff;
    --card-border: rgba(0, 0, 0, 0.1);
    --subtitle-color: #636e72;
    --placeholder-color: #b2bec3;
    --history-bg: #f1f2f6;
    --history-text: #2d3436;
    --history-border: rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
}

#theme-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    border: 1px solid var(--card-border);
}

#theme-btn:hover {
    transform: rotate(15deg) scale(1.1);
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a2a6c 0%, #b21f1f 50%, #fdbb2d 100%);
    opacity: 0.15;
    z-index: -1;
}

body.light-mode .background-overlay {
    background: radial-gradient(circle at center, #e0eafc 0%, #cfdef3 100%);
    opacity: 0.5;
}

.container {
    width: 95%;
    max-width: 600px;
    padding: 2rem;
    text-align: center;
}

header {
    margin-bottom: 3rem;
}

.logo-icon {
    font-size: 3.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
}

header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--subtitle-color);
}

.lotto-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

.lotto-numbers {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 3rem;
    min-height: var(--ball-size);
    flex-wrap: wrap;
}

.placeholder-text {
    color: var(--placeholder-color);
    font-size: 1.1rem;
    font-weight: 300;
}

.lotto-ball {
    width: var(--ball-size);
    height: var(--ball-size);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Poppins', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3), inset 0 -4px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(30px);
    opacity: 0;
    animation: ballDrop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

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

.main-btn {
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    background: linear-gradient(45deg, #ffd700, #ff8c00);
    color: #000;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(255, 215, 0, 0.3);
}

.main-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 25px rgba(255, 215, 0, 0.4);
}

.history-section {
    text-align: left;
    background: var(--history-bg);
    padding: 1.5rem;
    border-radius: 16px;
    transition: background-color 0.4s ease;
}

.history-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--subtitle-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-list {
    list-style: none;
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--history-border);
    font-size: 0.9rem;
    color: var(--history-text);
}

.history-balls {
    display: flex;
    gap: 4px;
}

.mini-ball {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.7rem;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    color: #fff;
}

footer {
    margin-top: 3rem;
    font-size: 0.8rem;
    color: var(--placeholder-color);
}

@media (max-width: 480px) {
    :root {
        --ball-size: 45px;
    }
    .container { padding: 1rem; }
    header h1 { font-size: 2.2rem; }
    .lotto-ball { font-size: 1.1rem; }
    .theme-toggle { top: 10px; right: 10px; }
}
