body {
    --viewport-height: 100vh;
    --game-width: min(100vw, calc(1.28 * var(--viewport-height)));
    --game-height: min(78.125vw, var(--viewport-height));
    min-height: var(--viewport-height);
    background: #070c13 !important;
    color-scheme: dark;
}
@supports (height: 100dvh) {
    body { --viewport-height: 100dvh; }
}
@supports (width: round(down, 50%, 1px)) {
    body {
        --game-width: max(1px, round(down, min(100vw, calc(1.28 * var(--viewport-height))), 1px));
        --game-height: max(1px, round(down, min(78.125vw, var(--viewport-height)), 1px));
    }
}
#infobox, #transfer { display: none !important; }
body.flight-active { touch-action: none; overscroll-behavior: none; }
#canvas.emscripten {
    width: var(--game-width) !important;
    height: var(--game-height) !important;
    top: calc((var(--viewport-height) - var(--game-height)) / 2);
    bottom: auto;
    margin: auto;
    background: #000;
    touch-action: none;
    -webkit-touch-callout: none;
}
#boot {
    position: fixed; inset: 0; z-index: 999999; display: grid; isolation: isolate;
    color: #f6f5ed; font: 16px/1.45 system-ui, sans-serif;
}
#boot { place-items: end start; background: #0d1c2b; text-align: left; }
#boot[hidden], #boot button[hidden], #fullscreenToggle[hidden] { display: none; }
#boot[data-started] { background: #070c13cf; }
#boot[data-started]::before, #boot[data-started] .boot-art,
#boot[data-started] h1, #boot[data-started] progress { display: none; }
.boot-art { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: 62% 43%; }
#boot::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(0deg, #06101aeb, transparent 55%), linear-gradient(60deg, #08131ddd, transparent 48%);
}
.boot-panel { width: min(85vw, 30rem); margin: clamp(1.25rem, 5vw, 5rem); }
.boot-panel h1 {
    margin: 0 0 1.25rem; font-size: clamp(1.65rem, min(5.4vw, 8vh), 4.5rem);
    font-weight: 800; line-height: .98; letter-spacing: -.045em; text-wrap: balance; color: inherit;
}
.boot-panel progress {
    display: block; appearance: none; width: min(100%, 24rem); height: .8rem;
    border: 1px solid #849db3; border-radius: 2px; background: #101d2d;
}
.boot-panel progress[hidden] { display: none; }
.boot-panel progress::-webkit-progress-bar { background: #101d2d; }
.boot-panel progress::-webkit-progress-value { background: #69d4ee; }
.boot-panel progress::-moz-progress-bar { background: #69d4ee; }
.boot-panel p { color: #e4e9eb; margin: .5rem 0 1rem; font-variant-numeric: tabular-nums; }
#boot button {
    font: inherit; font-weight: 700; min-width: 8rem; padding: .65rem 1.65rem;
    border: 1px solid #f4c28c; border-radius: .25rem; background: #f1b878; color: #17202a; cursor: pointer;
}
#boot button:hover { background: #ffce98; }
#boot button:focus-visible, #fullscreenToggle:focus-visible { outline: .16rem solid white; outline-offset: .22rem; }
#fullscreenToggle {
    --hud-unit: min(1px, calc((100vw - 2.25rem) / 336));
    --plate-art: url("fullscreen-plate.png");
    --plate-text: #ebf5fc;
    position: fixed; z-index: 1000000; top: 1.125rem; left: 1.125rem;
    display: flex; align-items: center; justify-content: center;
    gap: calc(var(--hud-unit) * 12);
    box-sizing: border-box;
    width: calc(var(--hud-unit) * 336); height: calc(var(--hud-unit) * 64);
    padding: 0 calc(var(--hud-unit) * 32); border: 0;
    background: var(--plate-art) center / 100% 100% no-repeat;
    color: var(--plate-text); cursor: pointer;
    font: 650 calc(var(--hud-unit) * 18) / 1.15 system-ui, sans-serif;
}
#boot[hidden] ~ #fullscreenToggle.daylight:not(:hover, :focus-visible) {
    --plate-art: url("fullscreen-plate-day.png");
    --plate-text: #122538;
}
#boot[hidden] ~ #fullscreenToggle {
    --hud-unit: calc(var(--game-width) / 1024);
    --hud-inset: calc(var(--hud-unit) * 18);
    top: calc((var(--viewport-height) - var(--game-height)) / 2 + var(--hud-inset));
    left: calc((100vw - var(--game-width)) / 2 + var(--hud-inset));
}
#fullscreenStatus {
    position: fixed; z-index: 1000001; left: 50%; bottom: 1.25rem;
    width: max-content; max-width: calc(100vw - 2.5rem); box-sizing: border-box;
    margin: 0; padding: .75rem 1rem; transform: translateX(-50%); pointer-events: none;
    background: #101f2dee; border: 1px solid #9db8cc; color: #ebf5fc;
    font: 500 .95rem/1.3 system-ui, sans-serif; text-align: center;
}
#fullscreenStatus:empty { padding: 0; border: 0; }
#musicUnlock {
    position: fixed; z-index: 1000000;
    left: calc((100vw - var(--game-width)) / 2 + .9rem);
    bottom: calc((var(--viewport-height) - var(--game-height)) / 2 + .9rem);
    padding: .4rem .65rem; color: #ebf5fc; background: #101f2dee;
    border: 1px solid #9db8cc; border-radius: .25rem; cursor: pointer;
    font: 600 .875rem/1.4 system-ui, sans-serif;
}
#musicUnlock[hidden] { display: none; }
#musicUnlock:focus-visible { outline: .15rem solid #fff; outline-offset: .15rem; }
#mobilePause {
    --field-left: calc((100vw - var(--game-width)) / 2);
    --field-top: calc((var(--viewport-height) - var(--game-height)) / 2);
    position: fixed; z-index: 1000000; display: grid; place-items: center;
    top: max(calc(env(safe-area-inset-top) + 8px), calc(var(--field-top) - 52px));
    right: max(calc(env(safe-area-inset-right) + 8px), calc(var(--field-left) + 8px));
    width: 44px; height: 44px; padding: 0; border-radius: 8px;
    border: 1px solid #9db8cc; color: #ebf5fc; background: #101f2dee;
    cursor: pointer; touch-action: manipulation;
}
@media (orientation: landscape) {
    #mobilePause {
        top: max(calc(env(safe-area-inset-top) + 8px), calc(var(--field-top) + var(--game-height) * .09));
        right: max(calc(env(safe-area-inset-right) + 8px), calc(var(--field-left) - 52px));
    }
}
#mobilePause[hidden], #mobilePause svg[hidden] { display: none; }
#mobilePause svg { width: 22px; height: 22px; }
#mobilePause:focus-visible { outline: .15rem solid #fff; outline-offset: .15rem; }
#fullscreenToggle.touch-control {
    width: auto; min-height: 44px; padding: 0 12px;
    border: 1px solid #9db8cc; border-radius: 8px;
    background: #101f2dee; color: #ebf5fc;
    font-size: .875rem; gap: 8px; touch-action: manipulation;
}
#boot[hidden] ~ #fullscreenToggle.touch-control {
    top: max(8px, calc((var(--viewport-height) - var(--game-height)) / 2 - 52px));
    left: calc((100vw - var(--game-width)) / 2 + 8px);
}
#fullscreenToggle.touch-control svg { width: 18px; height: 18px; }
#fullscreenToggle.touch-control kbd { display: none; }
@media (orientation: landscape) {
    #boot[hidden] ~ #fullscreenToggle.touch-control {
        top: calc((var(--viewport-height) - var(--game-height)) / 2 + 8px);
    }
}
#fullscreenToggle svg { flex: none; width: calc(var(--hud-unit) * 19); height: calc(var(--hud-unit) * 19); }
#fullscreenToggle .fullscreen-label { min-width: 0; overflow-wrap: anywhere; }
#fullscreenToggle kbd {
    flex: none;
    border: 1px solid currentColor;
    border-radius: .22em;
    padding: .24em .38em;
    font: 600 calc(var(--hud-unit) * 12) / 1 system-ui, sans-serif;
    white-space: nowrap;
}
#fullscreenToggle:not([aria-pressed="true"]) .contract, #fullscreenToggle[aria-pressed="true"] .expand { display: none; }
