:root {
    --bg-color: #f0f2f5;
    --text-color: #1a1a1a;
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --accent-color: #ff7675;
    --card-bg: #ffffff;
    --overlay-bg: rgba(255, 255, 255, 0.9);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --radius: 12px;
}

[data-theme="dark"] {
    --bg-color: #1e1e1e;
    --text-color: #f0f2f5;
    --primary-color: #8c7ae6;
    --secondary-color: #4834d4;
    --accent-color: #fab1a0;
    --card-bg: #2d3436;
    --overlay-bg: rgba(30, 30, 30, 0.9);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#game-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 100%;
    max-height: 100%;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    z-index: 100;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 90%;
    width: 400px;
}

.title {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.8;
}

.stats-container {
    margin-bottom: 2rem;
    font-size: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stats-container.hidden {
    display: none;
}

.best-score {
    margin-top: 1rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.btn {
    padding: 12px 32px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.secondary-btn {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    margin-top: 1rem;
}

.secondary-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.hidden {
    display: none !important;
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 200;
}

.icon-btn {
    background: var(--card-bg);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s;
}

.icon-btn:hover {
    transform: rotate(15deg);
}

@media (max-width: 600px) {
    .title {
        font-size: 2rem;
    }
    .overlay-content {
        padding: 1.5rem;
    }
}
