/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    background-color: #0f172a;
    /* Dark slate background */
    color: #f8fafc;
    font-family: 'Orbitron', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 800px;
    height: 400px;
}

canvas {
    display: block;
    background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
    border: 4px solid #4f46e5;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.5), inset 0 0 10px rgba(0, 0, 0, 0.5);
    outline: none;
}

/* UI Overlay Layer */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to canvas when playing */
}

/* Progress Display */
#progress-display {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 28px;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(255, 255, 255, 0.3);
    letter-spacing: 2px;
    z-index: 5;
}

/* Score Display */
#score-display,
#hi-score-display {
    position: absolute;
    top: 20px;
    font-size: 24px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 2px;
}

#score-display {
    left: 20px;
    color: #fff;
}

#hi-score-display {
    right: 20px;
    color: #fbbf24;
    font-size: 18px;
    top: 25px;
}

/* Pause Button */
#pause-btn {
    position: absolute;
    top: 60px;
    right: 20px;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: none;
    /* Hidden by default */
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    transition: all 0.2s;
    z-index: 5;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

#pause-btn::before,
#pause-btn::after {
    content: '';
    display: block;
    width: 5px;
    height: 18px;
    background-color: #fff;
    border-radius: 1px;
    margin: 0 3px;
    transition: all 0.2s;
}

#pause-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

.floating-btn {
    position: absolute;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    height: 40px;
    padding: 0 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    z-index: 5;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.floating-btn:hover {
    background: rgba(16, 185, 129, 0.5);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.8);
}

/* Screens (Start / Game Over / Pause) */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    border-radius: 8px;
    z-index: 10;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
    /* Re-enable clicks for buttons overlay */
}

h1 {
    font-size: 56px;
    font-weight: 900;
    margin-bottom: 20px;
    text-transform: uppercase;
    background: linear-gradient(to right, #4ade80, #3b82f6);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
    letter-spacing: 4px;
}

.screen p {
    font-size: 18px;
    color: #cbd5e1;
    letter-spacing: 1px;
    margin-bottom: 30px;
}

.stats {
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
}

.stats p {
    margin: 5px 0;
    font-size: 20px;
}

/* Button */
.btn {
    padding: 15px 40px;
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    background: #4f46e5;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 4px 0 #3730a3, 0 0 15px #4f46e5;
    transition: all 0.1s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn:hover {
    background: #6366f1;
    box-shadow: 0 4px 0 #4338ca, 0 0 20px #6366f1;
    transform: translateY(-2px);
}

.btn:active {
    box-shadow: 0 0px 0 #3730a3, 0 0 10px #4f46e5;
    transform: translateY(4px);
}

.level-select {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.level-btn {
    padding: 15px 30px;
    font-size: 16px;
    background: #10b981;
    /* Default emerald for easy */
    box-shadow: 0 4px 0 #047857, 0 0 15px rgba(16, 185, 129, 0.5);
}

.level-btn[data-level="2"] {
    background: #f43f5e;
    /* Rose/Red for hard */
    box-shadow: 0 4px 0 #be123c, 0 0 15px rgba(244, 63, 94, 0.5);
}

.level-btn:hover {
    background: #34d399;
    box-shadow: 0 4px 0 #059669, 0 0 20px rgba(52, 211, 153, 0.7);
}

.level-btn[data-level="2"]:hover {
    background: #fb7185;
    box-shadow: 0 4px 0 #e11d48, 0 0 20px rgba(251, 113, 133, 0.7);
}