/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

/* ===== GAME WRAPPER ===== */
#game-wrapper {
    position: relative;
    width: 95vw;
    max-width: 1400px;
    height: 90vh;
    max-height: 800px;
    border: 3px solid #e94560;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(233, 69, 96, 0.3);
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #16213e;
    border-radius: 6px;
}

/* ===== OVERLAY SCREENS ===== */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(22, 33, 62, 0.92);
    border-radius: 6px;
    z-index: 10;
}

.overlay.hidden {
    display: none;
}

/* Game over overlay starts invisible — art shows through, then fades in */
#gameover-screen {
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: none;
}

#gameover-screen.gameover-fade-in {
    animation: fadeInOverlay 1s ease-in forwards;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#gameover-screen .overlay-content {
    background: rgba(22, 33, 62, 0.85);
    border-radius: 16px;
    padding: 25px 35px;
    backdrop-filter: blur(4px);
}

.overlay-content {
    text-align: center;
    color: #eee;
    padding: 30px;
    max-width: 450px;
}

.overlay-content h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    color: #f5c842;
    text-shadow: 0 0 20px rgba(245, 200, 66, 0.4);
}

.subtitle {
    color: #aaa;
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.final-score {
    font-size: 1.8rem;
    color: #f5c842;
    margin: 15px 0;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 12px 32px;
    margin: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s;
    background: #e94560;
    color: #fff;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.5);
}

.btn-secondary {
    background: #0f3460;
    color: #eee;
}

.btn-secondary:hover {
    background: #1a4a7a;
    box-shadow: 0 0 20px rgba(15, 52, 96, 0.5);
}

/* ===== NAME INPUT ===== */
.name-input-area {
    margin: 15px 0;
}

.name-input-area label {
    display: block;
    margin-bottom: 8px;
    color: #ccc;
}

.name-input-area input {
    padding: 10px 16px;
    font-size: 1.1rem;
    border: 2px solid #e94560;
    border-radius: 20px;
    background: #0f3460;
    color: #fff;
    text-align: center;
    outline: none;
    width: 200px;
}

.name-input-area input:focus {
    border-color: #f5c842;
    box-shadow: 0 0 15px rgba(245, 200, 66, 0.3);
}

/* ===== CONTROLS INFO ===== */
.controls-info {
    margin-top: 25px;
    padding: 12px;
    background: rgba(15, 52, 96, 0.6);
    border-radius: 10px;
    font-size: 0.9rem;
    color: #999;
}

.controls-info strong {
    color: #ddd;
}

/* ===== LEADERBOARD ===== */
#leaderboard-list {
    margin: 15px 0;
    max-height: 300px;
    overflow-y: auto;
}

#scoreList {
    list-style: none;
    padding: 0;
}

#scoreList li {
    display: flex;
    justify-content: space-between;
    padding: 8px 16px;
    margin: 4px 0;
    background: rgba(15, 52, 96, 0.6);
    border-radius: 8px;
    font-size: 1.05rem;
}

#scoreList li .rank {
    color: #f5c842;
    font-weight: bold;
    min-width: 30px;
}

#scoreList li .name {
    flex: 1;
    text-align: left;
    margin-left: 10px;
    color: #eee;
}

#scoreList li .score {
    color: #f5c842;
    font-weight: bold;
    min-width: 60px;
    text-align: right;
}

#scoreList li .date {
    color: #666;
    font-size: 0.8rem;
    margin-left: 10px;
    min-width: 50px;
    text-align: right;
}

#scoreList li:nth-child(1) {
    background: rgba(245, 200, 66, 0.2);
    border: 1px solid rgba(245, 200, 66, 0.3);
}

#scoreList li:nth-child(2) {
    background: rgba(192, 192, 192, 0.15);
    border: 1px solid rgba(192, 192, 192, 0.2);
}

#scoreList li:nth-child(3) {
    background: rgba(205, 127, 50, 0.15);
    border: 1px solid rgba(205, 127, 50, 0.2);
}

/* ===== HUD ===== */
#hud {
    position: absolute;
    top: 10px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    color: #fff;
    z-index: 5;
    pointer-events: none;
}

#hud.hidden {
    display: none;
}

#scoreDisplay, #timeDisplay {
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 14px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

/* ===== SCROLLBAR ===== */
#leaderboard-list::-webkit-scrollbar {
    width: 6px;
}

#leaderboard-list::-webkit-scrollbar-track {
    background: #0f3460;
    border-radius: 3px;
}

#leaderboard-list::-webkit-scrollbar-thumb {
    background: #e94560;
    border-radius: 3px;
}
