: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;
}

.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%, 1000px);
    overflow: hidden;
    aspect-ratio: 4 / 3;
    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;
}

/* Keep the fixed 800x600 game framebuffer fully visible in widescreen fullscreen.
   Stretching it to the screen width makes the canvas taller than the viewport and
   crops the v83 status bar, which is rendered along the bottom edge. */
.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 * 4 / 3));
    height: min(100vh, calc(100vw * 3 / 4));
}

.client-overlay {
    position: absolute;
    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));
}

.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;
}

#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-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); }
}

.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;
    }

    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;
    }
}
