@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

:root {
    /* Dark Mode (Default) Variables */
    --theme-bg: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    --container-bg: rgba(255, 255, 255, 0.05);
    --container-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --controls-bg: rgba(0, 0, 0, 0.25);
    --game-row-bg: rgba(0, 0, 0, 0.3);
    --game-label-color: #00c6ff;
    --plus-sign-color: rgba(255,255,255,0.7);
    --empty-message-color: rgba(255,255,255,0.6);
    --btn-bg: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
    --btn-shadow: rgba(0, 114, 255, 0.4);
    --btn-shadow-hover: rgba(0, 114, 255, 0.6);
    --container-shadow: rgba(0, 0, 0, 0.5);
    --ball-shadow: inset -2px -2px 8px rgba(0,0,0,0.4), 0 4px 8px rgba(0,0,0,0.3);
    --checkbox-border: #4facfe;
}

[data-theme="light"] {
    /* Light Mode Variables */
    --theme-bg: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    --container-bg: rgba(255, 255, 255, 0.5);
    --container-border: rgba(255, 255, 255, 0.6);
    --text-primary: #2d3436;
    --controls-bg: rgba(255, 255, 255, 0.6);
    --game-row-bg: rgba(255, 255, 255, 0.7);
    --game-label-color: #0984e3;
    --plus-sign-color: rgba(0,0,0,0.5);
    --empty-message-color: rgba(0,0,0,0.5);
    --btn-bg: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    --btn-shadow: rgba(108, 92, 231, 0.3);
    --btn-shadow-hover: rgba(108, 92, 231, 0.5);
    --container-shadow: rgba(0, 0, 0, 0.15);
    --ball-shadow: inset -2px -2px 6px rgba(0,0,0,0.2), 0 4px 6px rgba(0,0,0,0.1);
    --checkbox-border: #6c5ce7;
}

body {
    font-family: 'Pretendard', 'Apple SD Gothic Neo', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    background: var(--theme-bg);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background 0.5s ease, color 0.5s ease;
}

.container {
    background: var(--container-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--container-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 40px var(--container-shadow);
    text-align: center;
    max-width: 650px;
    width: 90%;
    transition: all 0.5s ease;
    position: relative;
}

h1 {
    margin-top: 0;
    font-size: 32px;
    font-weight: 800;
    text-shadow: 0 2px 5px rgba(0,0,0,0.1);
    letter-spacing: 1.5px;
    margin-bottom: 30px;
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 25px;
    right: 25px;
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: none;
    padding: 5px;
    transition: transform 0.3s ease;
}

.theme-toggle:hover {
    transform: rotate(20deg) scale(1.1);
    box-shadow: none;
}

.theme-toggle:active {
    transform: scale(0.9);
}

.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    background: var(--controls-bg);
    padding: 20px;
    border-radius: 16px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
    transition: background 0.5s ease;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    user-select: none;
    transition: color 0.2s;
}

.checkbox-label:hover {
    color: var(--checkbox-border);
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    width: 22px;
    height: 22px;
    margin-right: 10px;
    border: 2px solid var(--checkbox-border);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked {
    background: var(--checkbox-border);
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: '✔';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
}

button {
    padding: 14px 32px;
    font-size: 17px;
    font-weight: bold;
    color: white;
    background: var(--btn-bg);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--btn-shadow);
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--btn-shadow-hover);
}

button:active {
    transform: translateY(1px);
}

#result-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.game-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: var(--game-row-bg);
    padding: 15px 20px;
    border-radius: 16px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    animation: fadeIn 0.5s ease backwards;
    transition: background 0.5s ease;
}

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

.game-label {
    font-weight: 800;
    color: var(--game-label-color);
    width: 70px;
    text-align: left;
    font-size: 16px;
    transition: color 0.5s ease;
}

.balls-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ball {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    font-weight: 800;
    color: white;
    box-shadow: var(--ball-shadow);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
    transition: box-shadow 0.5s ease;
}

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

.plus-sign {
    font-size: 26px;
    font-weight: bold;
    color: var(--plus-sign-color);
    margin: 0 5px;
    animation: fadeIn 0.5s ease backwards;
    transition: color 0.5s ease;
}

.bonus-ball {
    border: 3px solid #ffde00;
    box-shadow: 0 0 15px rgba(255, 222, 0, 0.5), inset -2px -2px 8px rgba(0,0,0,0.4);
}

.empty-message {
    color: var(--empty-message-color);
    font-size: 15px;
    padding: 20px;
    transition: color 0.5s ease;
}

/* 동행복권 색상 그라데이션 적용 */
.color-1 { background: radial-gradient(circle at 30% 30%, #ffd94d, #d1a500); }
.color-2 { background: radial-gradient(circle at 30% 30%, #8ee1ff, #2991cd); }
.color-3 { background: radial-gradient(circle at 30% 30%, #ff9696, #cd3c3c); }
.color-4 { background: radial-gradient(circle at 30% 30%, #cccccc, #777777); }
.color-5 { background: radial-gradient(circle at 30% 30%, #cbe870, #88b11c); }

@media (max-width: 600px) {
    .game-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .game-label {
        width: auto;
    }
    .theme-toggle {
        top: 20px;
        right: 20px;
        font-size: 20px;
    }
}
