.orbita-page {
    --site-width: 1480px;
    --page-gutter: clamp(1.25rem, 3vw, 3.5rem);
}
.orbita-content {
    max-width: var(--site-width);
    margin: 0 auto;
    padding: 2rem var(--page-gutter) 5rem;
}

.orbita-intro {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.game-eyebrow {
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.orbita-intro h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.25rem);
    letter-spacing: -0.05em;
    line-height: 1.15;
}

.orbita-intro h1 span {
    display: inline-block;
    margin-left: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.5em;
    font-weight: 500;
    letter-spacing: -0.02em;
}

.orbita-intro p:last-child {
    margin-bottom: 0;
    color: var(--text-secondary);
}

.online-counter {
    display: flex;
    align-items: baseline;
    gap: 0.625rem;
    margin: 0;
}

.online-counter strong {
    color: var(--text-color);
    font-size: 2rem;
    font-variant-numeric: tabular-nums;
}

.online-counter span {
    font-size: 0.875rem;
}

.orbita-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 270px;
    align-items: start;
    gap: 2rem;
}

.game-column {
    min-width: 0;
}

.game-stage {
    position: relative;
    overflow: hidden;
    border: 1px solid #333b4c;
    border-radius: 12px;
    background: #080b13;
}

#orbita-canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 8 / 5;
    background: #080b13;
    outline-offset: -3px;
}

.game-launch {
    position: relative;
    min-height: 500px;
    display: grid;
    place-items: center;
    padding: 2rem;
    background: radial-gradient(ellipse at 50% 0%, #1c2945, #080b13 75%);
    color: #fff;
}

.launch-content {
    width: min(100%, 360px);
}

.launch-content .game-eyebrow {
    color: #b5bdd1;
}

.launch-content h2 {
    margin: 0 0 1.25rem;
    font-size: clamp(1.5rem, 3vw, 2rem);
    letter-spacing: -0.04em;
    line-height: 1.2;
}

.launch-content label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.launch-content input {
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 0.75rem;
    border: 1px solid #65718b;
    border-radius: 6px;
    background: #111827;
    border-color: #65718b;
    color: #fff;
}

#pilot-help, #password-help, #recovery-help, #account-best, #account-status {
    margin: 0.75rem 0 1.25rem;
    color: #b5bdd1;
    font-size: 0.875rem;
    line-height: 1.5;
}

#start-game, #submit-account {
    width: 100%;
    justify-content: center;
    background: #fff;
    border-color: #fff;
    color: #0a0a0a;
}

.game-stage:has(.game-launch:not([hidden])) #orbita-canvas { display: none; }
.launch-content [hidden], .game-launch[hidden], .recovery-notice[hidden] { display: none; }
#confirm-field, #recovery-field { margin: 1rem 0; }
.account-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; margin: 1rem 0; }
.account-links button, .guest-button {
    border: 0;
    padding: 0.5rem 0;
    background: transparent;
    color: #c9d3e8;
    font: inherit;
    font-size: 0.875rem;
    text-decoration: underline;
    text-underline-offset: 4px;
    cursor: pointer;
}
.guest-button { width: 100%; margin-top: 0.5rem; }
.launch-content button:disabled { opacity: 0.6; cursor: wait; }
.launch-content :focus-visible { outline: 2px solid #b7ceff; outline-offset: 3px; }
.recovery-notice { margin-bottom: 1rem; padding: 1rem; border: 1px solid var(--border-color); border-radius: 8px; }
.recovery-notice p { margin: 0.5rem 0; color: var(--text-secondary); }
#recovery-value { display: block; padding: 0.5rem 0; overflow-wrap: anywhere; user-select: all; }

#start-game:disabled {
    opacity: 0.65;
    cursor: wait;
}

.game-toolbar {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: 0.75rem;
}

#game-status {
    flex: 1 1 300px;
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.game-text-button {
    padding: 0.5rem 0;
    border: 0;
    background: transparent;
    color: var(--text-color);
    font-size: 0.875rem;
    text-decoration: underline;
    text-underline-offset: 4px;
    cursor: pointer;
}

.screen-controls {
    padding: 0.75rem 1rem;
    border-top: 1px solid #333b4c;
    color: #e5e7eb;
    font-size: 0.875rem;
}

.screen-controls summary, .game-instructions summary {
    padding: 0.25rem 0;
    cursor: pointer;
    font-weight: 600;
}

.gamepad {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 560px;
    margin: 1rem auto 0.75rem;
}

.joystick-area { text-align: center; }
.joystick-area p { margin: 0.5rem 0 0; color: #b5bdd1; font-size: 0.75rem; }
.joystick {
    position: relative;
    display: grid;
    place-items: center;
    width: clamp(112px, 25vw, 150px);
    aspect-ratio: 1;
    border: 1px solid #65718b;
    border-radius: 50%;
    background: radial-gradient(circle, #25324b 0 32%, #151e30 33% 65%, #25324b 66%);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
}
.joystick[aria-disabled="true"] { opacity: 0.45; cursor: default; }
.joystick.is-held { cursor: grabbing; border-color: #bdd1ff; }
.joystick:focus-visible { outline: 2px solid #bdd1ff; outline-offset: 4px; }
.joystick-guides { font-size: 4rem; font-weight: 300; color: #526079; line-height: 1; }
.joystick-thumb {
    position: absolute;
    width: 34%;
    aspect-ratio: 1;
    border: 1px solid #acbddd;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 25%, #8b9fc6, #475c85);
    box-shadow: 0 4px 12px #0007;
    pointer-events: none;
    will-change: transform;
}
.gamepad-actions { display: flex; align-items: center; gap: clamp(0.5rem, 2vw, 1rem); }
.screen-controls .gamepad-actions button { border-radius: 50%; font-weight: 600; line-height: 1.2; }
.gamepad-actions .fire-button { width: clamp(72px, 18vw, 100px); aspect-ratio: 1; background: #304e7a; border-color: #92b4e8; }
.gamepad-actions .bomb-button { width: clamp(60px, 15vw, 80px); aspect-ratio: 1; background: #51372e; border-color: #ba9179; align-self: flex-start; }
#bomb-count { display: block; margin-top: 0.125rem; font-variant-numeric: tabular-nums; }

.gamepad-menu {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
}

.screen-controls button {
    min-height: 44px;
    padding: 0.5rem;
    border: 1px solid #526079;
    border-radius: 6px;
    background: #1b2434;
    color: #fff;
    font-size: 0.875rem;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.screen-controls button:active {
    background: #3c4a64;
}

.screen-controls button:disabled {
    opacity: 0.5;
}

.game-stage:has(.game-launch:not([hidden])) .screen-controls { display: none; }
.combat-status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.65rem 1rem; border-top: 1px solid #333b4c; color: #c9d3e8; font-size: 0.875rem; }
.combat-status strong { margin-left: 0.25rem; color: #fff; font-variant-numeric: tabular-nums; }
#ship-health[data-low="true"] { color: #ffad9f; }
.base-impact { margin: 0; padding: 0.75rem 1rem; border-top: 1px solid #d07866; background: #49261f; color: #ffddd3; font-size: 0.875rem; font-weight: 600; }

.game-instructions {
    margin-top: 1.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.game-instructions p {
    max-width: 70ch;
    color: var(--text-secondary);
}

.game-instructions dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.game-instructions dt {
    font-weight: 600;
}

.game-instructions dd {
    margin: 0.25rem 0 0;
    color: var(--text-secondary);
}

.community-panel {
    min-width: 0;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--card-bg);
}

.ranking-heading {
    margin-bottom: 1.25rem;
}

.ranking-heading .game-eyebrow {
    color: var(--text-secondary);
}

.ranking-heading h2 {
    margin: 0;
    font-size: 1.4rem;
    line-height: 1.3;
    letter-spacing: -0.03em;
}

.orbita-ranking {
    margin: 0;
    padding: 0;
    list-style-position: inside;
}

.orbita-ranking li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--border-color);
}

.orbita-ranking strong {
    display: block;
    overflow-wrap: anywhere;
    font-size: 1rem;
}

.orbita-ranking li div span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.ranking-score {
    font-size: 0.875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.orbita-ranking .ranking-empty {
    display: block;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.ranking-note, .community-status {
    margin: 1rem 0 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
}

.community-status {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.game-stage:fullscreen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
}

.game-stage:fullscreen #orbita-canvas {
    max-height: calc(100dvh - 340px);
    object-fit: contain;
}

@media (min-aspect-ratio: 4/3) {
    .game-stage:fullscreen { display: grid; grid-template-columns: minmax(0, 1fr) clamp(290px, 34vw, 340px); grid-template-rows: minmax(0, 1fr) auto auto; }
    .game-stage:fullscreen #orbita-canvas { grid-column: 1; grid-row: 1; width: 100%; height: 100%; max-height: 100%; min-height: 0; object-fit: contain; }
    .game-stage:fullscreen .combat-status { grid-column: 1; grid-row: 2; }
    .game-stage:fullscreen .base-impact { grid-column: 1; grid-row: 3; }
    .game-stage:fullscreen .screen-controls { grid-column: 2; grid-row: 1 / 4; max-height: 100dvh; overflow-y: auto; padding: 0.5rem 0.75rem; border-top: 0; border-left: 1px solid #333b4c; }
    .game-stage:fullscreen .joystick { width: 112px; }
    .game-stage:fullscreen .gamepad { gap: 0.5rem; }
    .game-stage:fullscreen .gamepad-actions { gap: 0.5rem; }
    .game-stage:fullscreen .fire-button { width: 72px; }
    .game-stage:fullscreen .bomb-button { width: 60px; }
    .game-stage:fullscreen .gamepad-menu { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1050px) {
    .orbita-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .community-panel {
        max-width: none;
    }

}
@media (max-width: 600px) {
    .orbita-content {
        padding-top: 1.5rem;
    }

    .orbita-intro {
        gap: 1rem;
    }

    .orbita-intro h1 span {
        display: block;
        margin: 0.25rem 0 0;
    }

    .game-launch {
        position: relative;
        min-height: 370px;
        padding: 1.5rem;
    }

    .game-stage:has(.game-launch:not([hidden])) #orbita-canvas {
        display: none;
    }

    .gamepad-menu { gap: 0.375rem; }
    .gamepad-menu button { padding: 0.5rem 0.25rem; font-size: 0.75rem; }

    .game-instructions dl {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 380px) {
    .screen-controls { padding: 0.75rem 0.5rem; }
    .gamepad { gap: 0.5rem; }
    .gamepad-actions { flex-direction: column; gap: 0.5rem; }
    .gamepad-actions .bomb-button { align-self: center; }
}
