/* ===== DARK MODE (default) ===== */
:root,
[data-theme="dark"] {
    --bg-color: #0f172a;
    --bg-gradient-1: rgba(99, 102, 241, 0.15);
    --bg-gradient-2: rgba(168, 85, 247, 0.15);
    --card-bg: rgba(30, 41, 59, 0.75);
    --card-border: rgba(255, 255, 255, 0.1);
    --row-bg: rgba(255, 255, 255, 0.03);
    --row-border: rgba(255, 255, 255, 0.05);
    --primary-glow: #6366f1;
    --secondary-glow: #a855f7;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --toggle-bg: rgba(255, 255, 255, 0.08);
    --toggle-border: rgba(255, 255, 255, 0.15);
    --toggle-hover: rgba(255, 255, 255, 0.15);
    --shadow-color: rgba(0, 0, 0, 0.5);
    --h1-gradient: linear-gradient(to bottom right, #fff, #94a3b8);
}

/* ===== LIGHT MODE ===== */
[data-theme="light"] {
    --bg-color: #f0f4ff;
    --bg-gradient-1: rgba(99, 102, 241, 0.08);
    --bg-gradient-2: rgba(168, 85, 247, 0.08);
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(0, 0, 0, 0.08);
    --row-bg: rgba(0, 0, 0, 0.03);
    --row-border: rgba(0, 0, 0, 0.06);
    --primary-glow: #6366f1;
    --secondary-glow: #a855f7;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --toggle-bg: rgba(0, 0, 0, 0.06);
    --toggle-border: rgba(0, 0, 0, 0.12);
    --toggle-hover: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(99, 102, 241, 0.15);
    --h1-gradient: linear-gradient(to bottom right, #1e293b, #6366f1);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, var(--bg-gradient-1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, var(--bg-gradient-2) 0px, transparent 50%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-main);
    padding: 2rem 0;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* ===== THEME SWITCH ===== */
.theme-switch-wrapper {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 999;
}

.switch-icon {
    font-size: 1.1rem;
    line-height: 1;
    user-select: none;
}

.theme-switch {
    position: relative;
    width: 48px;
    height: 26px;
    border-radius: 13px;
    border: none;
    background: var(--primary-glow);
    cursor: pointer;
    transition: background 0.3s ease;
    flex-shrink: 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .theme-switch {
    background: #f59e0b;
}

.switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 라이트 모드일 때 thumb을 오른쪽으로 이동 */
[data-theme="light"] .switch-thumb {
    transform: translateX(22px);
}



/* ===== CONTAINER ===== */
.container {
    width: 95%;
    max-width: 800px;
    padding: 3rem;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 2rem;
    text-align: center;
    box-shadow: 0 25px 50px -12px var(--shadow-color);
    animation: fadeIn 0.8s ease-out;
    transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* ===== HEADING ===== */
h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: var(--h1-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.025em;
    transition: background 0.4s ease;
}

p.subtitle {
    color: var(--text-muted);
    margin-bottom: 3rem;
    font-size: 1.1rem;
    font-weight: 300;
    transition: color 0.4s ease;
}

/* ===== LOTTO GRID ===== */
.lotto-display {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-bottom: 3rem;
}

.game-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
    background: var(--row-bg);
    border-radius: 1.5rem;
    border: 1px solid var(--row-border);
    animation: slideIn 0.5s ease-out forwards;
    opacity: 0;
    transition: background 0.4s ease, border-color 0.4s ease;
    position: relative;
}

/* ===== COPY BUTTON ===== */
.copy-btn {
    margin-left: auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid var(--toggle-border);
    background: var(--toggle-bg);
    color: var(--text-muted);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.copy-btn:hover {
    background: var(--toggle-hover);
    color: var(--primary-glow);
    transform: scale(1.15);
}

.copy-btn.copied {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

/* ===== COPY TOAST ===== */
.copy-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #10b981;
    color: white;
    padding: 0.7rem 1.5rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.copy-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.game-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--secondary-glow);
    width: 70px;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== BALLS ===== */
.ball {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), inset 0 -4px 6px rgba(0, 0, 0, 0.2);
    transform: scale(0);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ball.show {
    transform: scale(1);
}

/* Ball Color Classes (standard lotto colors) */
.color-1 {
    background: linear-gradient(135deg, #fbbf24, #d97706);
}

/* 1~10  : Yellow */
.color-2 {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

/* 11~20 : Blue   */
.color-3 {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* 21~30 : Red    */
.color-4 {
    background: linear-gradient(135deg, #64748b, #475569);
}

/* 31~40 : Gray   */
.color-5 {
    background: linear-gradient(135deg, #10b981, #059669);
}

/* 41~45 : Green  */

/* ===== GENERATE BUTTON ===== */
.generate-btn {
    background: linear-gradient(135deg, var(--primary-glow), var(--secondary-glow));
    color: white;
    border: none;
    padding: 1.2rem 3rem;
    font-size: 1.25rem;
    font-weight: 600;
    border-radius: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
    position: relative;
    overflow: hidden;
}

.generate-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.generate-btn:hover::after {
    left: 100%;
}

.generate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 30px -10px rgba(99, 102, 241, 0.5);
    filter: brightness(1.1);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===== FOOTER ===== */
footer {
    margin-top: 3rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: color 0.4s ease;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .container {
        padding: 2rem 1rem;
    }

    h1 {
        font-size: 2.2rem;
    }

    .ball {
        width: 42px;
        height: 42px;
        font-size: 1rem;
    }

    .game-row {
        gap: 0.4rem;
        padding: 0.8rem;
    }

    .game-label {
        width: 50px;
        font-size: 0.6rem;
    }

    .theme-switch-wrapper {
        top: 1rem;
        right: 1rem;
        padding: 0.3rem 0.6rem;
        gap: 0.3rem;
    }

    .switch-icon {
        font-size: 0.9rem;
    }

    .theme-switch {
        width: 40px;
        height: 22px;
    }

    .switch-thumb {
        width: 16px;
        height: 16px;
    }

    [data-theme="light"] .switch-thumb {
        transform: translateX(18px);
    }
}