* {
    box-sizing: border-box;
}

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

body {
    display: grid;
    place-items: center;
}

#app {
    width: min(94vw, 900px);
    position: relative;
}

h1 {
    margin: 0 0 10px;
    text-align: center;
    letter-spacing: 0.08em;
    color: #ffcc00;
    text-shadow: 3px 3px 0 #000;
}

#hud {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    padding: 10px 14px;
    border: 2px solid #ffcc00;
    border-radius: 8px;
    background: rgba(20, 40, 100, 0.85);
    font-weight: 700;
    text-shadow: 2px 2px 0 #000;
}

#game {
    width: 100%;
    height: auto;
    display: block;
    border: 4px solid #ffcc00;
    border-radius: 10px;
    background: #1a1a2e;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.overlay {
    position: absolute;
    inset: 78px 0 0;
    display: grid;
    place-items: center;
    font-size: clamp(18px, 3vw, 30px);
    font-weight: 700;
    letter-spacing: 0.07em;
    color: #ffcc00;
    text-shadow: 3px 3px 0 #000;
    text-align: center;
    pointer-events: none;
}

.overlay.hidden {
    display: none;
}

#controls {
    text-align: center;
    margin: 10px 0 0;
    opacity: 0.9;
    color: #aaddff;
}

/* ---- LEADERBOARD ---- */
#leaderboard-panel {
    max-width: 840px;
    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;
}