:root {
    --bg-color-start: #1e3c72;
    --bg-color-end: #2a5298;
    --card-bg: #fff;
    --text-color: #f0f0f0;
    --accent-color: #ffd700;
    --card-border-radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --btn-hover: rgba(255, 255, 255, 0.15);
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background: radial-gradient(circle at center, var(--bg-color-end), var(--bg-color-start));
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    touch-action: none;
    -webkit-font-smoothing: antialiased;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

#game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    z-index: 10;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats {
    display: flex;
    gap: 30px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
    margin-bottom: 2px;
}

.value {
    font-weight: 600;
    font-size: 1.3rem;
    font-variant-numeric: tabular-nums;
    color: var(--accent-color);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.controls {
    display: flex;
    gap: 12px;
}

.btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn:hover:not(:disabled) {
    background: var(--btn-hover);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: transparent;
}

.btn.primary {
    background: var(--accent-color);
    color: #1a1a1a;
    border: none;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.3);
}

.btn.primary:hover {
    background: #ffea00;
    box-shadow: 0 6px 15px rgba(255, 215, 0, 0.4);
}

#game-canvas {
    flex-grow: 1;
    width: 100%;
    height: 100%;
    display: block;
    cursor: default;
}

/* Win Overlay */
#win-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(5px);
}

#win-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: all;
}

.win-modal {
    background: white;
    color: #333;
    padding: 50px 60px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 300px;
}

#win-overlay:not(.hidden) .win-modal {
    transform: scale(1);
}

.win-modal h2 {
    font-size: 2.5rem;
    margin: 0 0 20px 0;
    background: linear-gradient(45deg, #1e3c72, #2a5298);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.win-modal p {
    font-size: 1.1rem;
    margin: 10px 0;
    color: #555;
}

.win-modal span {
    font-weight: bold;
    color: #1e3c72;
}

.win-modal .btn.primary {
    margin-top: 30px;
    padding: 12px 30px;
    font-size: 1.1rem;
}

.hidden {
    display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    #game-header {
        padding: 10px;
        flex-direction: column;
        gap: 10px;
    }

    .stats {
        width: 100%;
        justify-content: space-around;
        gap: 10px;
    }

    .controls {
        width: 100%;
        justify-content: center;
    }

    .label {
        font-size: 0.65rem;
    }

    .value {
        font-size: 1rem;
    }

    .btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}
