:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --accent-color: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.5);
    
    --ball-yellow: #f59e0b;
    --ball-blue: #0ea5e9;
    --ball-red: #ef4444;
    --ball-gray: #64748b;
    --ball-green: #22c55e;
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top, #1e293b 0%, #0f172a 100%);
}

.container {
    width: 100%;
    max-width: 600px;
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin: 1rem;
}

header {
    text-align: center;
}

header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

header p {
    color: #94a3b8;
    font-size: 1.1rem;
}

.balls-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    min-height: 80px;
    align-items: center;
    flex-wrap: wrap;
}

.placeholder {
    color: #64748b;
    font-size: 1.2rem;
    font-weight: 300;
}

.ball {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), inset 0 -3px 5px rgba(0,0,0,0.2), inset 0 3px 5px rgba(255,255,255,0.3);
    opacity: 0;
    transform: scale(0.5) translateY(20px) rotate(-15deg);
    animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    to {
        opacity: 1;
        transform: scale(1) translateY(0) rotate(0);
    }
}

.controls {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.primary-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 9999px;
    cursor: pointer;
    box-shadow: 0 4px 14px 0 var(--accent-glow);
    transition: all 0.3s ease;
    font-family: inherit;
    outline: none;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(59, 130, 246, 0.6);
}

.primary-btn:active {
    transform: translateY(1px);
}

.primary-btn:disabled {
    cursor: not-allowed;
}

.history-section {
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.5rem;
}

.history-section h2 {
    font-size: 1.1rem;
    color: #94a3b8;
    margin-bottom: 1rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 10px;
}

#history-list::-webkit-scrollbar {
    width: 6px;
}

#history-list::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.02);
    border-radius: 10px;
}

#history-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

#history-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

.history-item {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    animation: fadeIn 0.4s ease forwards;
    transition: background 0.2s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

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

.history-ball {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: white;
    box-shadow: inset 0 -2px 3px rgba(0,0,0,0.2), inset 0 2px 3px rgba(255,255,255,0.2);
}

/* Colors for balls */
.color-yellow { background-color: var(--ball-yellow); text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }
.color-blue { background-color: var(--ball-blue); text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }
.color-red { background-color: var(--ball-red); text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }
.color-gray { background-color: var(--ball-gray); text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }
.color-green { background-color: var(--ball-green); text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }

@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
    }
    header h1 {
        font-size: 2.2rem;
    }
    .ball {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    .history-ball {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }
}
