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

body {
    background: #111;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    margin: 0;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#game-wrapper {
    position: relative;
    width: 400px;
    height: 600px;
    transform-origin: center center;
}

canvas {
    display: block;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    border-radius: 12px;
    z-index: 10;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    padding: 20px 0;
}

.overlay.hidden {
    display: none;
}

.overlay h1 {
    color: #000;
    font-size: 2.4rem;
    text-align: center;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.7), 0 1px 3px rgba(255, 255, 255, 0.5);
    margin-bottom: 14px;
    line-height: 1.2;
}

/* Welcome message */
.welcome-msg {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
}

/* Name Input */
.name-input-row {
    margin-bottom: 14px;
}

#player-name {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #333;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    width: 220px;
    color: #111;
    outline: none;
    transition: border-color 0.2s ease;
}

#player-name:focus {
    border-color: #000;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

#player-name::placeholder,
#player-email::placeholder {
    color: #999;
    font-weight: 400;
}

#player-email {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #333;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    width: 220px;
    color: #111;
    outline: none;
    transition: border-color 0.2s ease;
}

#player-email:focus {
    border-color: #000;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

.email-hint {
    color: #f5c542;
    font-size: 0.8rem;
    margin-top: 6px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.5px;
}

.instruction {
    color: #ddd;
    font-size: 0.95rem;
    margin-bottom: 16px;
    text-align: center;
}

.score-display {
    text-align: center;
    margin-bottom: 12px;
}

.score-display p {
    color: #fff;
    font-size: 1.3rem;
    margin: 5px 0;
}

.score-display span {
    color: #fff;
    font-weight: bold;
}

/* Leaderboard */
#leaderboard,
#gameover-leaderboard {
    width: 80%;
    max-width: 280px;
    margin-bottom: 12px;
}

#leaderboard h2,
#gameover-leaderboard h2 {
    color: #fff;
    font-size: 1rem;
    text-align: center;
    margin-bottom: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#leaderboard-list,
#gameover-leaderboard-list {
    list-style: none;
    padding: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    max-height: 200px;
    overflow-y: auto;
}

#leaderboard-list li,
#gameover-leaderboard-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 14px;
    color: #eee;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#leaderboard-list li:last-child,
#gameover-leaderboard-list li:last-child {
    border-bottom: none;
}

#leaderboard-list li .rank,
#gameover-leaderboard-list li .rank {
    font-weight: 700;
    min-width: 24px;
    color: #ccc;
}

#leaderboard-list li .name,
#gameover-leaderboard-list li .name {
    flex: 1;
    margin: 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#leaderboard-list li .pts,
#gameover-leaderboard-list li .pts {
    font-weight: 700;
    color: #fff;
}

#leaderboard-list li.highlight,
#gameover-leaderboard-list li.highlight {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.no-scores {
    color: #999;
    text-align: center;
    padding: 12px;
    font-size: 0.85rem;
    font-style: italic;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, #333, #111);
    color: #fff;
    border: 2px solid #555;
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    margin: 6px 0;
}

.btn:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #444, #222);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.btn:active {
    transform: scale(0.97);
}

.gameover-buttons {
    display: flex;
    gap: 10px;
}

.btn-play {
    background: linear-gradient(135deg, #2ecc40, #1a9c2a);
    border-color: #3ddf50;
    color: #fff;
    font-size: 1.4rem;
    padding: 16px 48px;
    margin-bottom: 18px;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 4px 20px rgba(46, 204, 64, 0.4);
}

.btn-play:hover {
    background: linear-gradient(135deg, #3ddf50, #2ecc40);
    box-shadow: 0 6px 28px rgba(46, 204, 64, 0.6);
}

.btn-share {
    background: linear-gradient(135deg, #1a3a5c, #0f2840);
    border-color: #2a5a8a;
}

/* HUD */
#hud {
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 5;
    pointer-events: none;
}

#hud.hidden {
    display: none;
}

#score {
    color: #fff;
    font-size: 3rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.6);
}

