:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --accent: #bb86fc;
    --border: #333333;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    user-select: none;
}

#app {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 30px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--border);
    transition: transform 0.3s ease;
}

header {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(45deg, #ff5252, #e040fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

#stats {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0 10px;
    font-size: 1rem;
    color: var(--text-secondary);
}

#game-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    width: 100%;
    flex-wrap: wrap;
}

.color-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.1);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.color-btn:hover {
    transform: scale(1.15);
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.color-btn:active {
    transform: scale(0.95);
}

#actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    align-items: center;
    width: 100%;
    margin-top: 10px;
}

button, select {
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #333;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

button:hover, select:hover {
    background: #444;
}

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

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
    padding-right: 30px;
}

label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-secondary);
}

input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

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

#app {
    animation: fadeIn 0.5s ease-out;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #app {
        padding: 15px;
        width: 100%;
        height: 100vh;
        border-radius: 0;
        justify-content: center;
        border: none;
    }

    h1 {
        font-size: 1.5rem;
    }

    .color-btn {
        width: 40px;
        height: 40px;
    }

    #controls {
        gap: 8px;
    }

    #actions {
        gap: 8px;
    }

    button, select {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}
