/* CSS STYLES */
body {
    margin: 0;
    padding: 0;
    background-color: #222;
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden; /* Prevent scrolling */
    touch-action: none; /* Prevent browser zoom/swipe behaviors */
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Top 2/3 - Game Area */
#game-container {
    flex: 2; /* Takes 2/3 space */
    position: relative;
    background: linear-gradient(to bottom, #000000, #1a1a2e);
    border-bottom: 3px solid #444;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* UI Overlays */
#score-board {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 24px;
    font-weight: bold;
    z-index: 10;
    text-shadow: 2px 2px 0 #000;
}

#lives-board {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    font-weight: bold;
    z-index: 10;
    text-shadow: 2px 2px 0 #000;
}

#score-change {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 40px;
    font-weight: bold;
    text-shadow: 2px 2px 4px #000;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
    z-index: 10;
}

#life-change {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 40px;
    font-weight: bold;
    text-shadow: 2px 2px 4px #000;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
    z-index: 10;
}

/* Bottom 1/3 - Controls */
#controls-container {
    flex: 1; /* Takes 1/3 space */
    background-color: #333;
    display: flex;
    flex-direction: row;
}

/* Left Side: Slider */
#slider-area {
    flex: 2; /* Wider area for slider */
    background-color: #2a2a2a;
    display: flex;
    justify-content: center;
    align-items: center;
    border-right: 2px solid #555;
    position: relative;
}

.slider-track {
    width: 80%;
    height: 10px;
    background-color: #555;
    border-radius: 5px;
    position: relative;
    top: -40px; /* Move up */
}

.slider-thumb {
    width: 50px;
    height: 50px;
    background-color: #fff;
    border-radius: 50%;
    position: absolute;
    top: calc(50% - 40px); /* Move up */
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    pointer-events: none; /* Let touch pass through to container */
}

.control-label {
    position: absolute;
    bottom: 10px;
    color: #888;
    font-size: 12px;
    text-transform: uppercase;
}

/* Right Side: Fire Button */
#fire-area {
    flex: 1;
    background-color: #2a2a2a;
    display: flex;
    justify-content: center;
    align-items: center;
}

#fire-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #ff4757;
    border: 4px solid #fff;
    color: white;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
    user-select: none;
    position: relative;
    top: -40px; /* Move up */
}

#fire-btn:active {
    transform: scale(0.95);
    background-color: #ff6b81;
}

/* Screens */
#start-screen, #game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#game-over-screen p {
    font-size: 24px;
    margin: 10px 0;
}

.hidden {
    display: none !important;
}

h1 { margin-bottom: 20px; text-align: center; color: #ff4757; text-shadow: 2px 2px 0 #fff; }
h2 { color: #ccc; font-size: 16px; margin-top: 10px; }

.char-select-btn {
    background: #fff;
    color: #000;
    border: none;
    padding: 15px 30px;
    margin: 10px;
    font-size: 20px;
    border-radius: 10px;
    cursor: pointer;
    width: 80%;
    max-width: 300px;
    transition: transform 0.1s;
}

.char-select-btn:hover { background: #eee; transform: scale(1.05); }

/* Highscore Specific Styles */
#highscore-input-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 10px 0;
    width: 100%;
}

#player-name {
    padding: 10px;
    font-size: 18px;
    text-align: center;
    border-radius: 5px;
    border: none;
    margin-bottom: 10px;
    width: 200px;
}

.small-btn {
    padding: 10px 20px;
    font-size: 16px;
    background-color: #2ed573;
    color: #fff;
    width: auto;
}

.marquee-container {
    width: 90%;
    max-width: 600px;
    background: #111;
    border: 2px solid #444;
    border-radius: 5px;
    overflow: hidden;
    white-space: nowrap;
    margin: 20px 0;
    padding: 10px 0;
    position: relative;
}

.marquee-content {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 15s linear infinite;
    font-family: monospace;
    font-size: 18px;
    color: #2ed573;
}

@keyframes marquee {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}