:root {
    color-scheme: dark;
    --ink: #f5f8ff;
    --muted: #b9c5d9;
    --dim: #8190aa;
    --night: #071021;
    --night-soft: #0c1930;
    --panel: rgba(10, 23, 44, 0.84);
    --panel-solid: #101f38;
    --line: rgba(196, 217, 255, 0.16);
    --line-strong: rgba(196, 217, 255, 0.28);
    --amber: #ffd37c;
    --amber-strong: #ffba4a;
    --teal: #68e2cf;
    --danger: #ff8c96;
    --success: #74e6ac;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
    --radius: 24px;
    --max-width: 1240px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 15% 0%, rgba(54, 111, 176, 0.22), transparent 30rem),
        var(--night);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
}

[hidden] {
    display: none !important;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    transform: translateY(-160%);
    border-radius: 8px;
    background: var(--ink);
    color: var(--night);
}

.skip-link:focus {
    transform: translateY(0);
}

.site-shell {
    width: min(calc(100% - 32px), var(--max-width));
    margin: 0 auto;
}

.topbar {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 88px;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid rgba(255, 211, 124, 0.48);
    border-radius: 13px;
    background: linear-gradient(145deg, rgba(255, 211, 124, 0.24), rgba(255, 186, 74, 0.06));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
    color: var(--amber);
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.08em;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.brand small {
    color: var(--dim);
    font-size: 0.72rem;
}

.topbar-actions,
.hero-actions,
.client-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.service-state {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.78rem;
}

.state-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--dim);
    box-shadow: 0 0 0 4px rgba(129, 144, 170, 0.12);
}

.service-state[data-state="online"] .state-dot {
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(116, 230, 172, 0.12);
}

.service-state[data-state="degraded"] .state-dot {
    background: var(--amber-strong);
    box-shadow: 0 0 0 4px rgba(255, 186, 74, 0.12);
}

.service-state[data-state="offline"] .state-dot {
    background: var(--danger);
    box-shadow: 0 0 0 4px rgba(255, 140, 150, 0.12);
}

.button,
.icon-button,
.dialog-close,
.link-button {
    border: 0;
    cursor: pointer;
}

.button {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 13px;
    font-weight: 760;
    text-decoration: none;
    transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:active:not(:disabled) {
    transform: translateY(0);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.button-primary {
    background: linear-gradient(180deg, #ffe09a, var(--amber-strong));
    box-shadow: 0 10px 30px rgba(255, 186, 74, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.62);
    color: #25180a;
}

.button-secondary,
.button-ghost,
.icon-button {
    border-color: var(--line);
    background: rgba(10, 24, 47, 0.58);
    color: var(--ink);
    backdrop-filter: blur(16px);
}

.button-secondary:hover:not(:disabled),
.button-ghost:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
    border-color: var(--line-strong);
    background: rgba(21, 42, 74, 0.78);
}

.button-small {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 0.82rem;
}

.button-wide {
    width: 100%;
}

.button:focus-visible,
.icon-button:focus-visible,
.dialog-close:focus-visible,
.link-button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(104, 226, 207, 0.78);
    outline-offset: 3px;
}

.hero {
    position: relative;
    display: grid;
    min-height: 680px;
    overflow: hidden;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    align-items: end;
    gap: clamp(36px, 7vw, 90px);
    padding: clamp(42px, 7vw, 86px);
    border: 1px solid var(--line);
    border-radius: 32px;
    box-shadow: var(--shadow);
    isolation: isolate;
}

.hero-backdrop,
.hero-shade {
    position: absolute;
    z-index: -2;
    inset: 0;
}

.hero-backdrop {
    background: #13274a url("./static/images/portal-hero.png") center / cover no-repeat;
    transform: scale(1.01);
}

.hero-shade {
    z-index: -1;
    background:
        linear-gradient(90deg, rgba(4, 11, 24, 0.94) 0%, rgba(5, 14, 29, 0.74) 43%, rgba(5, 14, 29, 0.28) 76%),
        linear-gradient(0deg, rgba(4, 11, 24, 0.92) 0%, transparent 54%);
}

.hero-copy {
    max-width: 650px;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--amber);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.hero h1 {
    max-width: 640px;
    margin: 0;
    font-size: clamp(3rem, 7vw, 6.4rem);
    font-weight: 820;
    letter-spacing: -0.065em;
    line-height: 0.92;
    text-wrap: balance;
}

.hero-summary {
    max-width: 620px;
    margin: 26px 0 28px;
    color: #d5deed;
    font-size: clamp(1rem, 1.5vw, 1.15rem);
}

.hero-note {
    margin: 16px 0 0;
    color: var(--dim);
    font-size: 0.8rem;
}

.release-card {
    padding: 24px;
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    background: rgba(7, 18, 35, 0.7);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
}

.release-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.release-card-header .eyebrow {
    margin-bottom: 3px;
}

.release-card h2 {
    margin: 0;
    font-size: 1.35rem;
}

.release-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 50%;
    background: rgba(104, 226, 207, 0.12);
    color: var(--teal);
    font-weight: 850;
}

.release-facts {
    margin: 22px 0;
}

.release-facts div {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    gap: 16px;
}

.release-facts dt {
    color: var(--dim);
}

.release-facts dd {
    margin: 0;
    font-weight: 680;
}

.source-link {
    color: var(--teal);
    font-size: 0.88rem;
    font-weight: 720;
    text-underline-offset: 4px;
}

.client-section {
    margin: 84px 0 50px;
}

body[data-page="client"] .site-shell {
    width: 100%;
    height: 100%;
    margin: 0;
}

body[data-page="client"] .client-section {
    width: 100%;
    height: 100%;
    margin: 0;
}

body[data-page="client"] {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: #000;
}

body[data-page="client"] main {
    width: 100%;
    height: 100%;
}

body[data-page="client"] .skip-link,
body[data-page="client"] .section-heading,
body[data-page="client"] .privacy-note,
body[data-page="client"] footer {
    display: none;
}

body[data-page="client"] .topbar {
    position: fixed;
    z-index: 60;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    display: block;
    min-height: 0;
}

body[data-page="client"] .topbar .brand,
body[data-page="client"] .topbar .service-state {
    display: none;
}

body[data-page="client"] .compatibility-alert {
    position: fixed;
    z-index: 20;
    top: 12px;
    right: 12px;
    left: 12px;
    margin: 0 auto;
    max-width: 720px;
}

body[data-page="client"] .game-frame {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    aspect-ratio: auto;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: #000;
    box-shadow: none;
}

body[data-page="client"] #canvas {
    width: min(100vw, calc(100vh * 16 / 9));
    height: min(100vh, calc(100vw * 9 / 16));
    width: min(100vw, calc(100dvh * 16 / 9));
    height: min(100dvh, calc(100vw * 9 / 16));
}

/* Keep the first viewport entirely playable. Server information occupies
   normal document flow below it, rather than sitting over the game canvas. */
body[data-page="client"][data-homepage] {
    height: auto;
    min-height: 100dvh;
    overflow-x: clip;
    overflow-y: auto;
}

body[data-page="client"][data-homepage] .site-shell,
body[data-page="client"][data-homepage] main {
    height: auto;
}

body[data-page="client"][data-homepage] .client-section {
    height: 100vh;
    height: 100dvh;
}

.homepage-info-link {
    position: absolute;
    z-index: 61;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    display: inline-flex;
    align-items: center;
    gap: 14px;
    min-height: 36px;
    padding: 8px 13px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    background: rgba(10, 20, 32, 0.86);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 650;
    text-decoration: none;
}

.homepage-info-link:focus-visible {
    outline: 3px solid #ffbc63;
    outline-offset: 3px;
}

body[data-homepage] .topbar {
    right: max(174px, calc(162px + env(safe-area-inset-right)));
}

.server-information {
    position: relative;
    width: 100%;
    min-height: 40vh;
    padding: 48px 24px;
    background: #fbf7ee;
    color: #242c32;
    touch-action: pan-y;
}

body[data-homepage].mobile-touch-client {
    touch-action: pan-y;
}

body[data-homepage].mobile-touch-client .game-frame {
    touch-action: none;
}

/* Portrait players can read guides below the game without a viewport-wide
   orientation gate following them through the informational sections. */
body[data-homepage].mobile-touch-client .mobile-orientation-gate {
    position: absolute;
    bottom: auto;
    height: 100vh;
    height: 100dvh;
}

.homepage-portrait-info {
    display: block;
    margin-top: 20px;
    color: #ffc47c;
}

.mobile-controls,
.mobile-orientation-gate {
    display: none;
}

body.mobile-touch-client {
    overscroll-behavior: none;
    touch-action: none;
}

body.mobile-touch-client #canvas {
    cursor: default;
    touch-action: none;
}

.native-mobile-text-input {
    position: fixed;
    z-index: 30;
    min-width: 1px;
    min-height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    outline: 0;
    opacity: 0.01;
    background: transparent;
    color: transparent;
    caret-color: transparent;
    font-size: 16px;
    box-shadow: none;
}

body.mobile-touch-client .mobile-controls {
    position: absolute;
    z-index: 20;
    top: 50%;
    left: 50%;
    display: block;
    width: min(100vw, calc(100dvh * 16 / 9));
    height: min(100dvh, calc(100vw * 9 / 16));
    padding:
        max(10px, env(safe-area-inset-top))
        max(10px, env(safe-area-inset-right))
        max(10px, env(safe-area-inset-bottom))
        max(10px, env(safe-area-inset-left));
    transform: translate(-50%, -50%);
    pointer-events: none;
    touch-action: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.mobile-interface-mode {
    display: none;
}

body.mobile-touch-client.mobile-interface-open .mobile-dpad,
body.mobile-touch-client.mobile-interface-open .mobile-hotkeys,
body.mobile-touch-client.mobile-interface-open .mobile-settings-toggle {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

body.mobile-touch-client.mobile-interface-open .mobile-interface-mode {
    position: absolute;
    top: max(10px, env(safe-area-inset-top));
    left: 50%;
    display: grid;
    min-width: min(380px, 62vw);
    padding: 6px 16px 7px;
    transform: translateX(-50%);
    border: 2px solid #3b5364;
    border-radius: 6px;
    background: linear-gradient(#f9f7ec, #ddd8c6);
    color: #253846;
    box-shadow: inset 0 0 0 1px #fff, 0 3px 8px rgba(0, 0, 0, 0.36);
    text-align: center;
    text-shadow: none;
}

.mobile-interface-mode strong {
    color: #1d6d91;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mobile-interface-mode span {
    font-size: 0.62rem;
}

.mobile-interface-close {
    pointer-events: auto;
    min-height: 34px;
    margin-top: 5px;
    padding: 5px 16px;
    border: 2px solid #7d4e25;
    border-radius: 6px;
    background: linear-gradient(#fff2b6, #e3ad48);
    color: #543014;
    font-size: 0.7rem;
    font-weight: 800;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.mobile-interface-close:active {
    transform: translateY(1px);
    background: linear-gradient(#f2cf75, #ce8e31);
}

.mobile-settings-toggle,
.mobile-control {
    pointer-events: auto;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

body.mobile-touch-client #canvas:focus,
.mobile-settings-toggle:focus,
.mobile-interface-close:focus,
.mobile-control:focus {
    outline: none;
}

.mobile-settings-toggle,
.mobile-control {
    border: 2px solid #304654;
    color: #263b48;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.82),
        inset 0 -3px 0 rgba(74, 82, 79, 0.16),
        0 3px 8px rgba(0, 0, 0, 0.38);
    text-shadow: none;
}

.mobile-settings-toggle {
    position: absolute;
    top: max(10px, env(safe-area-inset-top));
    left: 50%;
    min-width: 112px;
    min-height: 36px;
    padding: 6px 12px;
    transform: translateX(-50%);
    border-radius: 7px;
    background: linear-gradient(#fffdf3, #d9d3bf);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.mobile-dpad {
    --mobile-move-size: clamp(48px, 11dvh, 72px);
    position: absolute;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    display: grid;
    grid-template-columns: repeat(3, var(--mobile-move-size));
    grid-template-rows: repeat(3, var(--mobile-move-size));
    gap: 3px;
    pointer-events: none;
}

.mobile-control {
    display: grid;
    min-width: 48px;
    min-height: 48px;
    place-items: center;
    padding: 0;
    border-radius: 11px;
    background: linear-gradient(rgba(255, 253, 242, 0.92), rgba(199, 192, 169, 0.92));
    font-weight: 900;
    line-height: 1;
    touch-action: none;
}

.mobile-control.is-pressed {
    transform: scale(0.92);
    border-color: #976d17;
    background: linear-gradient(#ffd867, #d89a20);
    box-shadow: inset 0 0 0 1px #fff1a8, 0 0 12px rgba(255, 199, 56, 0.58);
}

.mobile-up {
    grid-column: 2;
    grid-row: 1;
}

.mobile-left {
    grid-column: 1;
    grid-row: 2;
}

.mobile-down {
    grid-column: 2;
    grid-row: 3;
}

.mobile-right {
    grid-column: 3;
    grid-row: 2;
}

.mobile-hotkeys {
    position: absolute;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(3, clamp(52px, 12dvh, 76px));
    gap: clamp(5px, 1.4dvh, 10px);
    align-items: end;
}

.mobile-hotkey {
    width: clamp(52px, 12dvh, 76px);
    height: clamp(52px, 12dvh, 76px);
    border-color: #243f54;
    background: linear-gradient(rgba(70, 137, 176, 0.94), rgba(32, 79, 111, 0.94));
    color: #fff;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.52),
        inset 0 -4px 0 rgba(11, 37, 55, 0.28),
        0 3px 8px rgba(0, 0, 0, 0.42);
    text-shadow: 0 1px 1px #173043;
}

.mobile-hotkey:nth-child(1),
.mobile-hotkey:nth-child(2) {
    transform: translateY(-16%);
}

.mobile-hotkey:nth-child(4) {
    grid-column: 2;
}

.mobile-hotkey.is-pressed {
    transform: scale(0.92);
}

.mobile-hotkey canvas,
.mobile-hotkey span {
    pointer-events: none;
}

.mobile-hotkey canvas {
    display: none;
    width: clamp(32px, 7.5dvh, 46px);
    height: clamp(32px, 7.5dvh, 46px);
    object-fit: contain;
    image-rendering: pixelated;
}

.mobile-hotkey.has-binding-icon canvas {
    display: block;
}

.mobile-hotkey span {
    color: rgba(255, 255, 255, 0.72);
    font-size: clamp(1.35rem, 5dvh, 2rem);
    line-height: 1;
}

body.mobile-touch-client .mobile-orientation-gate {
    position: fixed;
    z-index: 100;
    inset: 0;
    padding:
        max(24px, env(safe-area-inset-top))
        max(24px, env(safe-area-inset-right))
        max(24px, env(safe-area-inset-bottom))
        max(24px, env(safe-area-inset-left));
    place-items: center;
    background:
        radial-gradient(circle at 50% 35%, rgba(104, 226, 207, 0.18), transparent 36%),
        #040b16;
    text-align: center;
}

.mobile-orientation-gate > div {
    max-width: 360px;
}

.mobile-orientation-gate h2 {
    margin: 8px 0 6px;
    font-size: clamp(1.7rem, 8vw, 2.5rem);
}

.mobile-orientation-gate p {
    margin: 0 0 18px;
    color: var(--muted);
}

.mobile-rotate-icon {
    display: inline-grid;
    width: 64px;
    height: 64px;
    place-items: center;
    border: 1px solid rgba(104, 226, 207, 0.38);
    border-radius: 20px;
    color: var(--teal);
    font-size: 2.25rem;
}

@media (orientation: portrait) {
    body.mobile-touch-client .mobile-orientation-gate {
        display: grid;
    }

    body.mobile-touch-client .mobile-controls {
        display: none;
    }
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.section-heading .eyebrow {
    margin-bottom: 4px;
}

.section-heading h2 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.25rem);
    letter-spacing: -0.045em;
}

.icon-button {
    min-height: 40px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 720;
}

.compatibility-alert,
.form-message,
.noscript-warning {
    padding: 13px 15px;
    border: 1px solid rgba(255, 140, 150, 0.35);
    border-radius: 12px;
    background: rgba(115, 30, 43, 0.28);
    color: #ffd7da;
}

.compatibility-alert {
    margin-bottom: 16px;
}

.game-frame {
    position: relative;
    display: grid;
    width: min(100%, 1280px);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    margin: 0 auto;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #02060c;
    box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

#canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
    background: #000;
    cursor: none;
    image-rendering: pixelated;
    object-fit: contain;
}

#canvas:focus {
    outline: 4px solid rgba(104, 226, 207, 0.88);
    outline-offset: -4px;
}

.runtime-stats {
    position: absolute;
    z-index: 40;
    top: max(8px, env(safe-area-inset-top));
    left: max(8px, env(safe-area-inset-left));
    display: flex;
    gap: 6px;
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.68);
    color: #fff;
    font: 700 12px/1.2 ui-monospace, "Cascadia Mono", Consolas, monospace;
    text-shadow: 0 1px 2px #000;
    pointer-events: none;
    user-select: none;
}

.client-diagnostics-fab {
    position: absolute;
    z-index: 45;
    top: max(58px, calc(env(safe-area-inset-top) + 46px));
    right: max(8px, env(safe-area-inset-right));
    min-height: 28px;
    padding: 4px 9px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.68);
    color: rgba(255, 255, 255, 0.82);
    font: 700 11px/1 ui-monospace, "Cascadia Mono", Consolas, monospace;
}

/* Avoid a pre-script flash and keep crash reporting out of normal client UI. */
[data-open-diagnostics][hidden] {
    display: none !important;
}

.game-frame:fullscreen .client-diagnostics-fab {
    top: max(8px, env(safe-area-inset-top));
}

.client-diagnostics-fab[data-report-ready="true"] {
    border-color: rgba(255, 185, 73, 0.8);
    background: rgba(71, 39, 6, 0.88);
    color: #ffe0a3;
}

/* Keep the fixed 1280x720 game framebuffer fully visible in fullscreen. */
.game-frame:fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
    background: #000;
}

.game-frame:fullscreen #canvas {
    width: min(100vw, calc(100vh * 16 / 9));
    height: min(100vh, calc(100vw * 9 / 16));
}

.client-overlay {
    position: absolute;
    z-index: 30;
    display: grid;
    inset: 0;
    align-content: center;
    justify-items: center;
    padding: 28px;
    background: radial-gradient(circle, rgba(19, 42, 74, 0.9), rgba(3, 9, 19, 0.97));
    text-align: center;
}

.client-overlay[data-state="error"] {
    background: radial-gradient(circle, rgba(82, 28, 42, 0.92), rgba(17, 5, 12, 0.98));
}

.client-overlay[data-state="recovering"] {
    isolation: isolate;
    background: linear-gradient(180deg, rgba(4, 14, 24, 0.08), rgba(4, 14, 24, 0.42));
    color: #fff9e8;
    text-shadow: 0 2px 3px rgba(35, 21, 8, 0.78);
}

.client-overlay[data-state="recovering"]::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(3, 20, 38, 0.12), transparent 22%, transparent 78%, rgba(3, 20, 38, 0.12)),
        linear-gradient(0deg, rgba(8, 24, 35, 0.24), transparent 42%);
    content: "";
}

.client-overlay[data-state="reconnecting"] {
    isolation: isolate;
    align-content: end;
    padding-bottom: clamp(24px, 6vh, 54px);
    background: linear-gradient(180deg, rgba(4, 14, 24, 0.04), rgba(4, 14, 24, 0.34));
    color: #f8fbff;
}

.client-overlay[data-state="reconnecting"]::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    background: radial-gradient(circle at center, transparent 42%, rgba(3, 13, 23, 0.16) 100%);
    content: "";
}

.client-overlay[data-state="reconnecting"] > .loading-orbit,
.client-overlay[data-state="reconnecting"] > .overlay-title,
.client-overlay[data-state="reconnecting"] > .overlay-detail,
.client-overlay[data-state="reconnecting"] > #load-progress {
    display: none;
}

.client-overlay[data-state="recovering"] .loading-orbit {
    position: relative;
    width: 46px;
    height: 46px;
    margin-bottom: 14px;
    border: 3px solid #7b431c;
    border-radius: 72% 12% 72% 30%;
    background: linear-gradient(145deg, #ffc94f 8%, #ef7f26 58%, #bc431e);
    box-shadow:
        inset 3px 3px 0 rgba(255, 244, 153, 0.45),
        0 3px 0 #4c2b17,
        0 0 0 6px rgba(255, 238, 177, 0.16),
        0 8px 24px rgba(31, 21, 8, 0.4);
    animation: recovery-leaf 1.45s ease-in-out infinite;
}

.client-overlay[data-state="recovering"] .loading-orbit::after {
    position: absolute;
    right: -9px;
    bottom: -5px;
    width: 19px;
    height: 5px;
    transform: rotate(44deg);
    border: 2px solid #6c3717;
    border-radius: 999px;
    background: #9a5727;
    content: "";
}

.loading-orbit {
    width: 54px;
    height: 54px;
    margin-bottom: 18px;
    border: 2px solid rgba(104, 226, 207, 0.18);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: orbit 900ms linear infinite;
}

.overlay-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 780;
}

.overlay-detail {
    max-width: 480px;
    margin: 8px 0 18px;
    color: var(--muted);
    font-size: 0.9rem;
}

.client-overlay[data-state="recovering"] .overlay-title {
    font-size: clamp(1.35rem, 3vw, 1.8rem);
    font-weight: 900;
    letter-spacing: 0.015em;
}

.client-overlay[data-state="recovering"] .overlay-detail {
    max-width: 590px;
    margin-top: 5px;
    color: #fff4cf;
    font-weight: 650;
}

.recovery-dashboard {
    width: min(660px, 92%);
    margin: 0 0 18px;
    padding: 18px 21px 17px;
    border: 3px solid #6d4527;
    border-radius: 18px;
    background:
        radial-gradient(circle at 18% 5%, rgba(255, 255, 255, 0.55), transparent 30%),
        linear-gradient(180deg, rgba(255, 249, 219, 0.98), rgba(226, 190, 132, 0.98));
    box-shadow:
        inset 0 0 0 2px #fff1c4,
        inset 0 -6px 0 rgba(151, 95, 42, 0.17),
        0 4px 0 #3d2919,
        0 18px 48px rgba(18, 22, 17, 0.42);
    color: #49331f;
    text-align: left;
    text-shadow: none;
}

.recovery-heading,
.recovery-attempt-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.recovery-heading span {
    color: #76512f;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.recovery-heading strong {
    color: #28784b;
    font-variant-numeric: tabular-nums;
    font-size: 1.45rem;
    line-height: 1;
    text-shadow: 0 1px 0 #fff4c8;
}

.recovery-meter {
    height: 5px;
    margin: 12px 0 17px;
    overflow: hidden;
    border: 1px solid #9b6b38;
    border-radius: 999px;
    background: #8b5a2f;
    box-shadow: inset 0 2px 3px rgba(49, 25, 8, 0.3);
}

.recovery-meter span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ef7f26, #ffd35a 48%, #56a85f);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52);
    transition: width 300ms linear;
}

.recovery-stages {
    display: grid;
    margin: 0 0 16px;
    grid-template-columns: repeat(4, 1fr);
}

.recovery-stages span {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 6px;
    color: #947451;
    font-size: 0.68rem;
    font-weight: 760;
    letter-spacing: 0.04em;
}

.recovery-stages b {
    font: inherit;
}

.recovery-stages span::before {
    position: absolute;
    z-index: 0;
    top: 5px;
    right: 50%;
    width: 100%;
    height: 1px;
    background: rgba(105, 70, 35, 0.28);
    content: "";
}

.recovery-stages span:first-child::before {
    display: none;
}

.recovery-stages i {
    z-index: 1;
    width: 11px;
    height: 11px;
    border: 2px solid #9a754e;
    border-radius: 50%;
    background: #f4deb2;
}

.recovery-stages span[data-state="complete"],
.recovery-stages span[data-state="active"] {
    color: #49331f;
}

.recovery-stages span[data-state="complete"]::before,
.recovery-stages span[data-state="active"]::before {
    background: rgba(57, 133, 77, 0.62);
}

.recovery-stages span[data-state="complete"] i {
    border-color: #2f8150;
    background: #58aa63;
}

.recovery-stages span[data-state="active"] i {
    border-color: #b65a20;
    background: #f39a32;
    box-shadow: 0 0 0 5px rgba(239, 126, 38, 0.16), 0 0 14px rgba(181, 87, 25, 0.3);
    animation: recovery-pulse 1.2s ease-in-out infinite;
}

.recovery-attempt-line strong {
    color: #a54a1f;
    font-size: 0.76rem;
    white-space: nowrap;
}

.recovery-attempt-line span {
    color: #65482e;
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.recovery-state-note {
    margin: 11px 0 0;
    padding-top: 11px;
    border-top: 1px solid rgba(112, 72, 34, 0.24);
    color: #73563a;
    font-size: 0.7rem;
    line-height: 1.45;
}

.reconnect-bubble {
    display: grid;
    width: min(720px, 94%);
    padding: 18px 20px;
    align-items: center;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 30px;
    background: rgba(247, 251, 255, 0.91);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.96),
        0 20px 70px rgba(4, 17, 31, 0.35),
        0 3px 10px rgba(4, 17, 31, 0.18);
    color: #17314a;
    text-align: left;
    text-shadow: none;
    backdrop-filter: blur(18px) saturate(1.18);
}

.reconnect-beacon {
    position: relative;
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(145deg, #e9f5ff, #c8e7ff);
    box-shadow: inset 0 0 0 1px rgba(41, 121, 180, 0.18);
}

.reconnect-beacon::before,
.reconnect-beacon::after {
    position: absolute;
    width: 24px;
    height: 24px;
    border: 2px solid rgba(43, 133, 197, 0.5);
    border-radius: 50%;
    content: "";
    animation: reconnect-ring 1.8s ease-out infinite;
}

.reconnect-beacon::after {
    animation-delay: 900ms;
}

.reconnect-beacon i {
    z-index: 1;
    width: 12px;
    height: 12px;
    border: 3px solid #eaf7ff;
    border-radius: 50%;
    background: #2f91d1;
    box-shadow: 0 3px 10px rgba(31, 116, 176, 0.4);
}

.reconnect-bubble[data-state="checking"] .reconnect-beacon i {
    animation: reconnect-core 700ms ease-in-out infinite alternate;
}

.reconnect-bubble[data-state="ready"] .reconnect-beacon {
    background: linear-gradient(145deg, #e7faef, #c8efd7);
}

.reconnect-bubble[data-state="ready"] .reconnect-beacon::before,
.reconnect-bubble[data-state="ready"] .reconnect-beacon::after {
    display: none;
}

.reconnect-bubble[data-state="ready"] .reconnect-beacon i {
    border-color: #eafff1;
    background: #32a864;
}

.reconnect-copy {
    min-width: 0;
}

.reconnect-heading,
.reconnect-meta {
    display: flex;
    align-items: center;
}

.reconnect-heading {
    gap: 9px;
}

.reconnect-heading strong {
    overflow: hidden;
    font-size: 0.98rem;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reconnect-chip {
    padding: 3px 8px;
    border: 1px solid rgba(43, 133, 197, 0.22);
    border-radius: 999px;
    background: rgba(48, 145, 209, 0.1);
    color: #247db8;
    font-size: 0.64rem;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.reconnect-bubble[data-state="ready"] .reconnect-chip {
    border-color: rgba(35, 141, 81, 0.22);
    background: rgba(45, 167, 96, 0.1);
    color: #238d51;
}

.reconnect-copy p {
    margin: 4px 0 8px;
    color: #47637c;
    font-size: 0.8rem;
}

.reconnect-meta {
    gap: 12px;
    color: #71869a;
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
}

.reconnect-meta span + span::before {
    margin-right: 12px;
    color: #a9bac8;
    content: "•";
}

#load-progress {
    width: min(320px, 80%);
    height: 6px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
}

#load-progress::-webkit-progress-bar {
    background: rgba(255, 255, 255, 0.1);
}

#load-progress::-webkit-progress-value {
    background: linear-gradient(90deg, var(--teal), var(--amber));
}

#load-progress::-moz-progress-bar {
    background: linear-gradient(90deg, var(--teal), var(--amber));
}

.privacy-note {
    margin: 14px auto 0;
    color: var(--dim);
    font-size: 0.78rem;
    text-align: center;
}

.trust-strip {
    display: grid;
    margin: 92px 0;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.trust-strip article {
    padding: 34px clamp(18px, 3vw, 38px);
    border-right: 1px solid var(--line);
}

.trust-strip article:last-child {
    border-right: 0;
}

.trust-strip span {
    color: var(--teal);
    font-size: 0.7rem;
    font-weight: 850;
    letter-spacing: 0.15em;
}

.trust-strip h2 {
    margin: 12px 0 8px;
    font-size: 1.05rem;
}

.trust-strip p {
    margin: 0;
    color: var(--dim);
    font-size: 0.86rem;
}

footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    padding: 0 0 36px;
    color: var(--dim);
    font-size: 0.76rem;
}

footer p {
    max-width: 690px;
    margin: 0;
}

footer nav {
    display: flex;
    gap: 18px;
    white-space: nowrap;
}

footer a,
.link-button {
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.link-button {
    padding: 0;
    background: transparent;
}

dialog {
    width: min(calc(100% - 32px), 520px);
    max-height: min(88vh, 820px);
    overflow: auto;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 22px;
    background: var(--panel-solid);
    box-shadow: 0 36px 120px rgba(0, 0, 0, 0.72);
    color: var(--ink);
}

dialog::backdrop {
    background: rgba(2, 7, 15, 0.76);
    backdrop-filter: blur(8px);
}

.account-dialog form,
.diagnostics-dialog > div {
    position: relative;
    padding: clamp(26px, 6vw, 42px);
}

.account-dialog h2,
.diagnostics-dialog h2 {
    margin: 0;
    font-size: clamp(1.7rem, 5vw, 2.35rem);
    letter-spacing: -0.04em;
}

.dialog-intro {
    margin: 12px 0 24px;
    color: var(--muted);
}

.dialog-close {
    position: absolute;
    top: 18px;
    right: 18px;
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    color: var(--muted);
    font-size: 1.35rem;
}

.account-dialog label:not(.checkbox-row) {
    display: block;
    margin: 17px 0 7px;
    color: #dce6f5;
    font-size: 0.82rem;
    font-weight: 720;
}

.account-dialog input[type="text"],
.account-dialog input[type="email"],
.account-dialog input[type="password"] {
    width: 100%;
    height: 48px;
    padding: 0 13px;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    outline: 0;
    background: rgba(3, 11, 24, 0.62);
    color: var(--ink);
}

.account-dialog input:user-invalid {
    border-color: rgba(255, 140, 150, 0.62);
}

.field-hint {
    margin: 6px 0 0;
    color: var(--dim);
    font-size: 0.73rem;
}

.checkbox-row {
    display: flex;
    align-items: start;
    gap: 10px;
    margin: 22px 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.checkbox-row input {
    margin-top: 3px;
    accent-color: var(--teal);
}

.form-message {
    margin-top: 20px;
    font-size: 0.82rem;
}

.form-message[data-state="info"] {
    border-color: rgba(95, 211, 199, 0.28);
    background: rgba(21, 91, 94, 0.24);
    color: #c9fbf4;
}

.form-message[data-state="success"] {
    border-color: rgba(116, 230, 172, 0.35);
    background: rgba(23, 100, 67, 0.26);
    color: #caffdf;
}

#diagnostics-list {
    margin: 24px 0 0;
}

.diagnostics-report-label {
    display: block;
    margin-bottom: 7px;
    color: var(--dim);
    font-size: 0.78rem;
    font-weight: 720;
}

#diagnostics-report {
    width: 100%;
    min-height: 190px;
    resize: vertical;
    padding: 12px;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    outline: 0;
    background: rgba(3, 11, 24, 0.72);
    color: #dce6f5;
    font: 0.72rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.diagnostics-actions {
    display: flex;
    min-height: 42px;
    margin-top: 12px;
    align-items: center;
    gap: 12px;
}

#diagnostics-copy-status {
    color: var(--muted);
    font-size: 0.76rem;
}

#diagnostics-button[data-report-ready="true"] {
    border-color: rgba(255, 185, 73, 0.65);
    color: #ffd991;
    box-shadow: 0 0 0 3px rgba(255, 173, 47, 0.1);
}

#diagnostics-list div {
    display: grid;
    padding: 11px 0;
    grid-template-columns: 1fr auto;
    gap: 20px;
    border-bottom: 1px solid var(--line);
}

#diagnostics-list dt {
    color: var(--dim);
}

#diagnostics-list dd {
    margin: 0;
    font-weight: 720;
}

#diagnostics-list dd[data-pass="true"] {
    color: var(--success);
}

#diagnostics-list dd[data-pass="false"] {
    color: var(--danger);
}

.noscript-warning {
    position: fixed;
    z-index: 200;
    right: 20px;
    bottom: 20px;
    left: 20px;
    text-align: center;
}

@keyframes orbit {
    to { transform: rotate(360deg); }
}

@keyframes recovery-pulse {
    0%, 100% {
        transform: scale(0.9);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.08);
        opacity: 1;
    }
}

@keyframes recovery-leaf {
    0%, 100% {
        transform: translateY(0) rotate(-42deg);
    }
    50% {
        transform: translateY(-5px) rotate(-49deg);
    }
}

@keyframes reconnect-ring {
    0% {
        transform: scale(0.45);
        opacity: 0.72;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

@keyframes reconnect-core {
    from {
        transform: scale(0.84);
    }
    to {
        transform: scale(1.08);
    }
}

.legal-page {
    display: grid;
    min-height: 100vh;
    padding: 28px;
    place-items: center;
}

.legal-page main {
    width: min(100%, 760px);
    padding: clamp(30px, 7vw, 68px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.legal-page h1 {
    margin: 0 0 20px;
    font-size: clamp(2.4rem, 8vw, 4.8rem);
    letter-spacing: -0.06em;
    line-height: 0.95;
}

.legal-page p,
.legal-page li {
    color: var(--muted);
}

.legal-page a {
    color: var(--teal);
    text-underline-offset: 4px;
}

.legal-page li + li {
    margin-top: 8px;
}

.legal-notice {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(104, 226, 207, 0.06);
}

@media (max-width: 880px) {
    .hero {
        min-height: 720px;
        grid-template-columns: 1fr;
        align-content: end;
        gap: 30px;
    }

    .hero-shade {
        background:
            linear-gradient(0deg, rgba(4, 11, 24, 0.97) 0%, rgba(5, 14, 29, 0.68) 62%, rgba(5, 14, 29, 0.22) 100%);
    }

    .release-card {
        max-width: 460px;
    }

    .trust-strip {
        grid-template-columns: 1fr;
    }

    .trust-strip article {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .trust-strip article:last-child {
        border-bottom: 0;
    }

    footer {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 620px) {
    .site-shell {
        width: min(calc(100% - 20px), var(--max-width));
    }

    .topbar {
        min-height: 76px;
    }

    .service-state {
        display: none;
    }

    .brand small {
        display: none;
    }

    .hero {
        min-height: 680px;
        padding: 26px 20px;
        border-radius: 22px;
    }

    .hero h1 {
        font-size: clamp(2.8rem, 16vw, 4.3rem);
    }

    .hero-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .release-card {
        display: none;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .client-controls {
        width: 100%;
        flex-wrap: wrap;
    }

    .icon-button {
        flex: 1;
    }

    .game-frame {
        border-radius: 14px;
    }

    .recovery-dashboard {
        width: 96%;
        padding: 14px;
    }

    .recovery-attempt-line {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .recovery-attempt-line span {
        text-align: left;
    }

    .reconnect-bubble {
        padding: 15px;
        grid-template-columns: auto minmax(0, 1fr);
        gap: 12px;
        border-radius: 24px;
    }

    footer nav {
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
