* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #2040b0;
    color: #fff;
    font-family: 'Press Start 2P', "Trebuchet MS", Tahoma, sans-serif;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
}

#game {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
}

#hud {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 15;
    display: flex;
    gap: 14px;
    padding: 8px 12px;
    background: rgba(20, 40, 100, 0.85);
    border: 2px solid rgba(255, 204, 0, 0.7);
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 13px;
    text-shadow: 2px 2px 0 #000;
}

#crosshair {
    position: fixed;
    left: 50%;
    top: 50%;
    width: 22px;
    height: 22px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 12;
}

#crosshair::before,
#crosshair::after {
    content: "";
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
}

#crosshair::before {
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    transform: translateX(-50%);
}

#crosshair::after {
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    transform: translateY(-50%);
}

#overlay,
#game-over {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-content: center;
    text-align: center;
    padding: 20px;
    gap: 12px;
    background: radial-gradient(circle at center, rgba(20, 40, 120, 0.6), rgba(0, 0, 0, 0.7));
}

#overlay h1,
#game-over h2 {
    margin: 0;
    letter-spacing: 0.08em;
    color: #ffcc00;
    text-shadow: 3px 3px 0 #000;
}

#overlay p,
#game-over p {
    margin: 0;
    max-width: 580px;
    color: #fff;
}

button {
    justify-self: center;
    margin-top: 6px;
    border: 2px solid #ffcc00;
    background: #cc3300;
    color: #fff;
    padding: 10px 18px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
    box-shadow: 0 3px 0 #882200;
    text-shadow: 1px 1px 0 #000;
}

button:hover {
    background: #ff4400;
}

.hidden {
    display: none !important;
}

@media (max-width: 700px) {
    #hud {
        flex-direction: column;
        gap: 6px;
        font-size: 11px;
    }
}

/* ---- LEADERBOARD ---- */
#leaderboard-panel {
    max-width: 800px;
    margin: 10px auto 0;
    border: 2px solid #ffcc00;
    background: rgba(20, 40, 100, 0.9);
    padding: 12px 16px;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 6px;
}

#leaderboard-panel h3 {
    font-size: 10px;
    color: #ffcc00;
    margin-bottom: 8px;
    text-align: center;
    text-shadow: 2px 2px 0 #000;
}

.leaderboard-list {
    font-size: 9px;
    color: #fff;
    line-height: 1.8;
}

.lb-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 4px;
}

.lb-row:nth-child(odd) {
    background: rgba(255, 255, 255, 0.08);
}

.lb-rank {
    color: #ffcc00;
    width: 30px;
}

.lb-name {
    flex: 1;
    color: #fff;
}

.lb-score {
    color: #fff;
    width: 80px;
    text-align: right;
}

.lb-you {
    color: #ff6644 !important;
}

.leaderboard-status {
    font-size: 8px;
    color: #aac;
    text-align: center;
    margin-top: 6px;
}

#name-prompt {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1a3080;
    border: 3px solid #ffcc00;
    padding: 20px 30px;
    text-align: center;
    z-index: 10000;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
}

#name-prompt p {
    font-size: 10px;
    color: #fff;
    margin-bottom: 12px;
}

#player-name-input {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    background: #0f2060;
    color: #ffcc00;
    border: 2px solid #ffcc00;
    padding: 8px 12px;
    text-align: center;
    text-transform: uppercase;
    width: 180px;
    outline: none;
    border-radius: 4px;
}

#player-name-input:focus {
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
}

#name-submit-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    background: #cc3300;
    color: #fff;
    border: 2px solid #ffcc00;
    padding: 8px 16px;
    margin-left: 8px;
    cursor: pointer;
    border-radius: 4px;
    box-shadow: 0 3px 0 #882200;
}

#name-submit-btn:hover {
    background: #ff4400;
}