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

html, body {
    height: 100%;
}

.bg-wallpaper {
    position: fixed;
    inset: 0;
    background-color: #05060f;
    z-index: -1;
}

body {
    width: 100vw;
    height: 100dvh;
    overflow: hidden;
    font-family: 'Segoe UI', Arial, sans-serif;
    color: #eafcff;
}

/* Bounded, centered play area: on wide desktop screens the game is capped
   to a tall/narrow strip instead of stretching across the full width;
   on narrow devices it simply fills the viewport. */
#game-shell {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 640px;
    margin: 0 auto;
    overflow: hidden;
}

canvas#game {
    display: block;
    width: 100%;
    height: 100%;
    /* flat fallback base -- the actual galaxy backdrop (nebula + parallax
       starfield) is drawn on the canvas every frame in script.js */
    background: #05060d;
    touch-action: none;
}

#side-panel {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 150px;
    padding: 12px;
    background: rgba(6, 10, 26, 0.7);
    border: 1px solid rgba(108, 243, 255, 0.25);
    border-radius: 10px;
    backdrop-filter: blur(2px);
}

.panel-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.panel-label {
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #9fb3c8;
}

.panel-score {
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(0, 200, 255, 0.6);
}

.panel-value {
    font-size: 15px;
    font-weight: bold;
    color: #6cf3ff;
}

.charge-bar {
    width: 100%;
    height: 9px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.charge-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff9f5c, #ffe45c);
    transition: width 0.15s linear;
}

.charge-fill.ready {
    background: linear-gradient(90deg, #6cffb0, #6cf3ff);
    box-shadow: 0 0 10px rgba(108, 255, 176, 0.7);
}

.panel-hint {
    font-size: 10px;
    color: #7a8ba0;
}

#side-panel button {
    margin-top: 0;
    padding: 6px 0;
    font-size: 12px;
}

#round-over,
#match-results,
#start-screen,
#versus-lobby,
#pause-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    background: rgba(2, 4, 16, 0.75);
    z-index: 10;
    text-align: center;
    overflow-y: auto;
}

#round-over.hidden,
#match-results.hidden,
#start-screen.hidden,
#versus-lobby.hidden,
#pause-overlay.hidden,
#side-panel.hidden,
#opponent-block.hidden,
#opponent-results-col.hidden,
#round-over-opponent.hidden,
#match-verdict.hidden,
#lobby-choice.hidden,
#lobby-room.hidden {
    display: none;
}

#pause-overlay h1 {
    color: #6cf3ff;
    font-size: 42px;
    text-shadow: 0 0 12px rgba(100, 220, 255, 0.7);
}

#round-over h1,
#match-results h1 {
    color: #ff5c5c;
    font-size: 48px;
    text-shadow: 0 0 12px rgba(255, 60, 60, 0.7);
}

#start-screen h1 {
    font-size: 48px;
    color: #6cf3ff;
    text-shadow: 0 0 12px rgba(100, 220, 255, 0.7);
}

#round-over-score,
#match-total,
#start-screen p {
    font-size: 18px;
}

#round-breakdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 15px;
    color: #9fb3c8;
}

#round-breakdown .winner {
    color: #6cffb0;
    font-weight: bold;
}

#results-columns {
    display: flex;
    gap: 24px;
}

.results-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

#match-verdict {
    font-size: 22px;
    font-weight: bold;
    color: #6cffb0;
    text-shadow: 0 0 10px rgba(108, 255, 176, 0.6);
}

#round-over-opponent {
    color: #c85cff;
}

#nickname-input {
    margin-top: 4px;
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 6px;
    border: 1px solid rgba(108, 243, 255, 0.3);
    background: rgba(255, 255, 255, 0.06);
    color: #eafcff;
    text-align: center;
    width: 220px;
}

#nickname-input::placeholder {
    color: #7a8ba0;
}

#mode-buttons {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

#versus-lobby h1 {
    font-size: 40px;
    color: #6cf3ff;
    text-shadow: 0 0 12px rgba(100, 220, 255, 0.7);
}

#lobby-choice,
#lobby-room {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.lobby-join-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.lobby-join-row input {
    padding: 10px 12px;
    font-size: 18px;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-align: center;
    width: 130px;
    border-radius: 6px;
    border: 1px solid rgba(108, 243, 255, 0.3);
    background: rgba(255, 255, 255, 0.06);
    color: #eafcff;
}

#room-code-display {
    font-size: 40px;
    font-weight: bold;
    letter-spacing: 6px;
    color: #6cf3ff;
    text-shadow: 0 0 14px rgba(100, 220, 255, 0.7);
}

#lobby-players {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 15px;
    color: #9fb3c8;
}

#lobby-players .me {
    color: #6cf3ff;
    font-weight: bold;
}

#lobby-players .ready {
    color: #6cffb0;
}

#plane-picker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.plane-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: 380px;
}

.plane-option {
    margin: 0;
    padding: 8px;
    width: 66px;
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(108, 243, 255, 0.25);
    border-radius: 10px;
}

.plane-option:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: none;
}

.plane-option img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* fighter's source art points diagonally; rotate the thumbnail to match
   the nose-up correction applied to it in-game */
.plane-option[data-plane="fighter"] img {
    transform: rotate(-45deg);
}

.plane-option.selected {
    border-color: #6cf3ff;
    box-shadow: 0 0 12px rgba(108, 243, 255, 0.6);
    background: rgba(108, 243, 255, 0.15);
}

button {
    margin-top: 8px;
    padding: 10px 28px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    background: #6cf3ff;
    color: #05060f;
    cursor: pointer;
    transition: transform 0.1s ease, background 0.2s ease;
}

button:hover {
    background: #94f7ff;
    transform: scale(1.05);
}

.secondary-btn {
    background: transparent;
    color: #9fb3c8;
    border: 1px solid rgba(159, 179, 200, 0.4);
    box-shadow: none;
}

.secondary-btn:hover {
    background: rgba(159, 179, 200, 0.12);
    color: #eafcff;
    transform: scale(1.05);
}

.hint {
    margin-top: 16px;
    font-size: 13px;
    color: #9fb3c8;
}

/* ---- responsive tweaks for narrow / short viewports ---- */
@media (max-width: 480px) {
    #side-panel {
        width: 118px;
        padding: 8px;
        gap: 6px;
        top: 8px;
        right: 8px;
    }

    .panel-label {
        font-size: 8px;
    }

    .panel-score {
        font-size: 19px;
    }

    .panel-value {
        font-size: 12px;
    }

    #side-panel button {
        font-size: 10px;
        padding: 5px 0;
    }

    #start-screen h1,
    #round-over h1,
    #match-results h1,
    #versus-lobby h1 {
        font-size: 32px;
    }

    #pause-overlay h1 {
        font-size: 30px;
    }

    #round-over-score,
    #match-total,
    #start-screen p {
        font-size: 14px;
    }

    #round-breakdown,
    #opponent-breakdown {
        font-size: 13px;
    }

    #results-columns {
        gap: 14px;
    }

    #room-code-display {
        font-size: 30px;
        letter-spacing: 4px;
    }

    #nickname-input {
        width: 180px;
        font-size: 13px;
    }

    #mode-buttons {
        flex-direction: column;
        width: 100%;
        align-items: center;
    }

    .plane-option {
        width: 52px;
        height: 52px;
        padding: 5px;
    }

    .plane-options {
        gap: 8px;
        max-width: 300px;
    }

    .hint {
        font-size: 11px;
        margin-top: 10px;
    }

    button {
        padding: 8px 20px;
        font-size: 14px;
    }
}

@media (max-height: 480px) {
    #start-screen,
    #round-over,
    #match-results,
    #versus-lobby,
    #pause-overlay {
        gap: 6px;
        padding: 10px;
    }

    #start-screen h1,
    #round-over h1,
    #match-results h1,
    #versus-lobby h1 {
        font-size: 28px;
    }

    .hint {
        margin-top: 6px;
    }

    #plane-picker {
        gap: 4px;
    }

    .plane-option {
        width: 42px;
        height: 42px;
    }

    .plane-options {
        max-width: 260px;
    }
}
