:root {
    --bg-color: #0f172a;
    --container-bg: rgba(255, 255, 255, 0.03);
    --container-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Noto Sans KR', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #020617 0%, #1e1b4b 100%);
    overflow: hidden;
    position: relative;
}

/* Animated background blob */
.blob {
    position: absolute;
    width: 800px;
    height: 800px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.4), rgba(139, 92, 246, 0.4));
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.5;
    animation: moveBlob 25s infinite alternate ease-in-out;
    z-index: 0;
}

@keyframes moveBlob {
    0% { transform: translate(-30%, -30%) scale(1); }
    50% { transform: translate(30%, 30%) scale(1.1); }
    100% { transform: translate(10%, -40%) scale(0.9); }
}

.container {
    position: relative;
    z-index: 1;
    background: var(--container-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--container-border);
    border-radius: 32px;
    padding: 4rem 3rem;
    width: 90%;
    max-width: 850px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
}

.container:hover {
    transform: translateY(-8px);
    box-shadow: 0 35px 60px -15px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255,255,255,0.1);
}

h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #93c5fd, #c084fc, #f9a8d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
    line-height: 1.2;
}

p.subtitle {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: 3.5rem;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.balls-container {
    display: flex;
    justify-content: center;
    gap: 1.8rem;
    margin-bottom: 3.5rem;
    min-height: 100px;
    flex-wrap: wrap;
    perspective: 1000px;
}

.ball {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.6), -1px -1px 2px rgba(255,255,255,0.5);
    box-shadow: 
        inset -15px -15px 25px rgba(0,0,0,0.6), 
        inset 10px 10px 20px rgba(255,255,255,0.9),
        inset -5px -5px 15px rgba(0,0,0,0.4),
        0 25px 35px -10px rgba(0,0,0,0.8);
    opacity: 0;
    transform: scale(0.3) rotateX(90deg) translateY(50px);
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

/* Highlight for 3D effect */
.ball::before {
    content: '';
    position: absolute;
    top: 8%;
    left: 12%;
    width: 45%;
    height: 45%;
    background: radial-gradient(circle, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.3) 40%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    z-index: 1;
    pointer-events: none;
    transform: rotate(-45deg);
}

/* Inner glow for extra realism */
.ball::after {
    content: '';
    position: absolute;
    bottom: 8%;
    right: 12%;
    width: 50%;
    height: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 60%);
    border-radius: 50%;
    z-index: 1;
    pointer-events: none;
}

.ball span {
    position: relative;
    z-index: 2;
}

.ball.show {
    opacity: 1;
    transform: scale(1) rotateX(0deg) translateY(0);
}

/* Ball Colors based on number range */
/* 1-10: Yellow */
.color-yellow { background: radial-gradient(circle at 35% 35%, #fef08a 0%, #eab308 40%, #a16207 80%, #422006 100%); }
/* 11-20: Blue */
.color-blue { background: radial-gradient(circle at 35% 35%, #93c5fd 0%, #3b82f6 40%, #1d4ed8 80%, #1e3a8a 100%); }
/* 21-30: Red */
.color-red { background: radial-gradient(circle at 35% 35%, #fca5a5 0%, #ef4444 40%, #b91c1c 80%, #7f1d1d 100%); }
/* 31-40: Gray */
.color-gray { background: radial-gradient(circle at 35% 35%, #f1f5f9 0%, #94a3b8 40%, #475569 80%, #0f172a 100%); }
/* 41-45: Green */
.color-green { background: radial-gradient(circle at 35% 35%, #86efac 0%, #22c55e 40%, #15803d 80%, #14532d 100%); }

.btn-draw {
    background: linear-gradient(135deg, #4f46e5, #ec4899);
    color: white;
    border: none;
    padding: 1.2rem 3.5rem;
    font-size: 1.3rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(236, 72, 153, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    outline: none;
    letter-spacing: 1px;
}

.btn-draw::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s ease;
}

.btn-draw:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 35px rgba(236, 72, 153, 0.6);
}

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

.btn-draw:active {
    transform: translateY(1px) scale(0.95);
}

.btn-draw:disabled {
    background: linear-gradient(135deg, #475569, #334155);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

/* Empty placeholder style */
.ball.placeholder {
    background: rgba(255,255,255,0.02);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.05);
    color: transparent;
    text-shadow: none;
}
.ball.placeholder::before {
    display: none;
}

@media (max-width: 768px) {
    .container {
        padding: 3rem 2rem;
    }
    .ball {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
    }
    .balls-container {
        gap: 1.2rem;
    }
    h1 {
        font-size: 2.8rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 2.5rem 1.5rem;
    }
    .ball {
        width: 55px;
        height: 55px;
        font-size: 1.4rem;
    }
    .balls-container {
        gap: 0.8rem;
    }
    h1 {
        font-size: 2.2rem;
    }
    .btn-draw {
        padding: 1rem 2.5rem;
        font-size: 1.1rem;
    }
}

.celebration-msg {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 3rem;
    font-weight: 800;
    color: #fbbf24;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.6), 2px 2px 4px rgba(0,0,0,0.8);
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
    pointer-events: none;
    white-space: nowrap;
}

.celebration-msg.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from { transform: translate(-50%, -50%) scale(1); }
    to { transform: translate(-50%, -50%) scale(1.1); }
}
