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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #07090f;
    color: #eaf0f8;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

#app {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

#game {
    background: #0a0d1a;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
    display: block;
    max-width: 100%;
    height: auto;
}

/* ============================================================
   Overlay
   ============================================================ */

#overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    padding: 20px;
}

#overlay.hidden { display: none; }

.card {
    background: #131b2a;
    padding: 32px;
    border-radius: 16px;
    border: 1px solid #263447;
    width: min(360px, 92vw);
    text-align: center;
}

.card h1 {
    margin-bottom: 12px;
    font-size: 24px;
}

.card p {
    margin-bottom: 22px;
    color: #9ba9bb;
}

.card input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #354458;
    background: #0a0f15;
    color: #fff;
    margin-bottom: 10px;
    font-size: 16px;
    outline: none;
}

.card input:focus { border-color: #f97316; }

.card button {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 0;
    background: #f97316;
    color: #1a0f05;
    font-weight: 700;
    font-size: 15px;
    margin-top: 4px;
    cursor: pointer;
    transition: filter .15s;
}

.card button:hover { filter: brightness(1.08); }
.card button:disabled { opacity: .55; cursor: wait; }

.card button.secondary {
    background: transparent;
    border: 1px solid #354458;
    color: #dfe8f3;
    margin-top: 8px;
}

#error-msg {
    color: #ff8c8c;
    font-size: 13px;
    min-height: 18px;
    margin: 4px 0 8px;
}

/* ============================================================
   Leaderboard
   ============================================================ */

#leaderboard {
    background: #0f1621;
    border: 1px solid #263447;
    border-radius: 12px;
    padding: 20px;
    width: 280px;
}

#leaderboard h2 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #9ba9bb;
    letter-spacing: .3px;
}

#leaderboard ol { list-style: none; }

#leaderboard li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid #1c2637;
    font-size: 14px;
}

#leaderboard li:last-child { border-bottom: 0; }

#leaderboard li .rank {
    color: #5f7190;
    width: 24px;
    flex-shrink: 0;
}

#leaderboard li .name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#leaderboard li .score {
    color: #4ade80;
    font-weight: 700;
}

@media (max-width: 900px) {
    #app { flex-direction: column; align-items: center; }
    #leaderboard { width: min(480px, 100%); }
}
