:root {
    --bg-color: #0d0d14;
    --canvas-bg: #151520;
    --primary-neon: #00ff88;
    --secondary-neon: #aa00ff;
    --danger-neon: #ff0055;
    --text-color: #f0f0f5;
    --glass-bg: rgba(21, 21, 32, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    /* Subtle background grid pattern */
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* Header & Score Area */
.score-board {
    display: flex;
    width: 100%;
    max-width: 600px;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 20px;
}

.score-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.score-card.high-score {
    border-color: rgba(170, 0, 255, 0.3);
    box-shadow: 0 0 15px rgba(170, 0, 255, 0.1);
}

.label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: #a0a0b5;
}

.value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary-neon);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.game-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 4px;
    line-height: 1.1;
    background: linear-gradient(to right, var(--primary-neon), var(--secondary-neon));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 8px rgba(170, 0, 255, 0.3));
}

/* Game Canvas & Container */
.game-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.canvas-container {
    position: relative;
    width: 400px;
    height: 400px;
    border-radius: 16px;
    background: var(--canvas-bg);
    box-shadow: 
        0 0 40px rgba(0, 0, 0, 0.8),
        inset 0 0 20px rgba(0, 0, 0, 0.5),
        0 0 0 1px var(--glass-border);
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    /* Pixelated for true retro feel, or smooth depending on drawing style. We will use smooth rendering */
    image-rendering: auto;
}

/* Overlays */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.overlay.active {
    opacity: 1;
    pointer-events: all;
}

.glass {
    background: rgba(13, 13, 20, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.overlay-content {
    text-align: center;
    padding: 30px;
    border-radius: 16px;
    background: rgba(30, 30, 45, 0.8);
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.overlay.active .overlay-content {
    transform: translateY(0);
}

.overlay h2 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 10px;
    color: white;
}

#start-overlay h2 {
    color: var(--primary-neon);
    text-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

#game-over-overlay h2 {
    color: var(--danger-neon);
    text-shadow: 0 0 15px rgba(255, 0, 85, 0.4);
}

.overlay p {
    color: #a0a0b5;
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.highlight {
    color: var(--primary-neon);
    font-weight: 800;
    font-size: 1.5rem;
}

/* Neon Button */
.neon-btn {
    appearance: none;
    background: transparent;
    border: 2px solid var(--text-color);
    color: var(--text-color);
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

.neon-btn.primary {
    border-color: var(--primary-neon);
    color: var(--primary-neon);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2), inset 0 0 10px rgba(0, 255, 136, 0.1);
}

.neon-btn:hover {
    background: var(--text-color);
    color: var(--bg-color);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

.neon-btn.primary:hover {
    background: var(--primary-neon);
    color: var(--bg-color);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.6), 0 0 40px rgba(0, 255, 136, 0.3);
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    width: 100%;
}

.d-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.d-pad-row {
    display: flex;
    gap: 15px;
    align-items: center;
}

.d-pad-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.1s ease;
}

.d-pad-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
    border-color: var(--primary-neon);
}

.d-pad-btn svg {
    width: 30px;
    height: 30px;
    fill: var(--text-color);
}

.d-pad-btn.down svg {
    transform: rotate(180deg);
}

/* Responsive constraints */
@media (max-width: 600px) {
    .canvas-container {
        width: 90vw;
        height: 90vw;
        max-width: 400px;
        max-height: 400px;
    }
    
    .mobile-controls {
        display: block;
    }
    
    .score-board {
        margin-bottom: 10px;
    }
    
    .game-title {
        font-size: 1.2rem;
    }
}

/* Difficulty Selector */
.difficulty-selector {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.difficulty-selector label {
    font-size: 0.9rem;
    color: #a0a0b5;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.neon-select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(30, 30, 45, 0.9);
    border: 1px solid var(--primary-neon);
    color: var(--text-color);
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 10px 30px;
    padding-right: 40px; /* Space for custom arrow */
    border-radius: 8px;
    cursor: pointer;
    outline: none;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    /* Custom simple down arrow using background image */
    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%2300ff88%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, repeat;
    background-position: right 15px top 50%, 0 0;
    background-size: 12px auto, 100%;
}

.neon-select:focus, .neon-select:hover {
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
    border-color: #fff;
}

.neon-select option {
    background: var(--bg-color);
    color: var(--text-color);
    font-weight: 500;
}

/* Creator Credit */
.creator-credit {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #a0a0b5;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

