:root {
    color-scheme: dark;
    --ink: #080c16;
    --panel: #0d121f;
    --line: #ffffff14;
    --white: #edf4ff;
    --muted: #8c9ab1;
    --accent: #82eee3;
    font-family: Inter, system-ui, sans-serif;
    background: var(--ink);
    color: var(--white);
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
}
button,
a {
    -webkit-tap-highlight-color: transparent;
}
button {
    font: inherit;
    cursor: pointer;
    color: inherit;
}
a {
    color: inherit;
    text-decoration: none;
}
button:focus-visible,
a:focus-visible,
canvas:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 5px;
}
button:disabled {
    opacity: 0.3;
    cursor: default;
}
button {
    border: 0;
    background: none;
}
button[hidden],
[hidden] {
    display: none !important;
}
.arcade-shell {
    min-height: 100svh;
    display: grid;
    grid-template-columns: 244px minmax(0, 1fr);
    grid-template-rows: 86px 1fr;
    max-width: 2000px;
    margin: auto;
}
.topbar {
    grid-column: 1/-1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 34px;
    border-bottom: 1px solid var(--line);
}
.wordmark {
    font-weight: 900;
    font-size: 19px;
    letter-spacing: -0.9px;
    display: flex;
    align-items: center;
}
.wordmark > span:first-child {
    color: var(--accent);
}
.wordmark-divider {
    font-weight: 400;
    color: #576279;
    margin: 0 19px;
}
.arcade-word {
    font-size: 12px;
    letter-spacing: 3px;
    font-weight: 500;
}
.topbar-right {
    display: flex;
    gap: 32px;
    align-items: center;
}
.edition {
    font-size: 11px;
    letter-spacing: 1.8px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    color: #bdc9dc;
}
.live-dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px #82eee366;
}
.text-link {
    font-size: 12px;
    color: var(--muted);
}
.library {
    border-right: 1px solid var(--line);
    padding: 34px 18px 24px;
    display: flex;
    flex-direction: column;
}
.library-heading {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    letter-spacing: 1.6px;
    color: #95a3b7;
    margin: 0 12px 26px;
}
.game-card {
    width: 100%;
    text-align: left;
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 12px;
    align-items: center;
    padding: 19px 12px;
    border: 1px solid transparent;
    border-radius: 9px;
    margin-bottom: 6px;
    transition:
        background 0.2s,
        border-color 0.2s;
    position: relative;
}
.game-card:hover {
    background: #ffffff05;
}
.game-card[aria-current='true'] {
    background: #82eee308;
    border-color: #82eee329;
}
.game-card[aria-current='true']:before {
    content: '';
    position: absolute;
    left: -19px;
    width: 3px;
    height: 29px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}
.game-icon {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 29px;
    line-height: 1;
    color: var(--card-color);
    font-weight: 500;
}
.game-card strong {
    font-size: 13px;
    font-weight: 600;
    display: block;
    line-height: 1.5;
}
.game-card small {
    font-size: 10px;
    color: var(--muted);
    display: block;
    margin-top: 4px;
    letter-spacing: 0.3px;
}
.new-pill {
    color: var(--accent);
    font-size: 8px;
    letter-spacing: 1px;
    position: absolute;
    right: 8px;
    top: 9px;
}
.library-footer {
    margin: auto 12px 0;
    padding-top: 45px;
    color: var(--muted);
}
.small-star {
    font-size: 28px;
    color: var(--accent);
}
.library-footer p {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 15px;
    line-height: 1.7;
}
.library-footer a {
    font-size: 10px;
    color: #6f7e96;
}
.play-area {
    padding: 0 32px;
    min-width: 0;
}
.game-toolbar {
    height: 76px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.game-location {
    font-size: 10px;
    letter-spacing: 1.8px;
    display: flex;
    gap: 13px;
    align-items: center;
    color: #adb8cb;
}
.game-location > span:first-child {
    color: var(--accent);
}
.location-line {
    width: 27px;
    height: 1px;
    background: #3a475e;
}
.toolbar-actions {
    display: flex;
    gap: 14px;
}
.toolbar-actions button {
    font-size: 11px;
    color: #acb9ca;
    padding: 8px 0;
}
.stage {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: #080d1a;
    border: 1px solid #8eb3d51f;
    border-radius: 4px;
    aspect-ratio: 1000/650;
    max-height: calc(100svh - 260px);
    min-height: 340px;
}
.stage:after {
    content: '';
    pointer-events: none;
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 100px #03061088;
    z-index: 0;
}
#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    touch-action: none;
    outline-offset: -5px;
}
.stage-corner {
    position: absolute;
    width: 17px;
    height: 17px;
    border-color: #7493967d;
    border-style: solid;
    z-index: 2;
    pointer-events: none;
}
.corner-tl {
    left: 14px;
    top: 14px;
    border-width: 1px 0 0 1px;
}
.corner-br {
    right: 14px;
    bottom: 14px;
    border-width: 0 1px 1px 0;
}
.overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #070c19e8 0%, #070c19a8 30%, transparent 67%);
    display: flex;
    align-items: center;
    z-index: 3;
    padding: 6%;
}
.intro {
    max-width: 365px;
}
.eyebrow {
    font-size: 9px;
    letter-spacing: 2.7px;
    color: var(--accent);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 9px;
}
.eyebrow:before {
    content: '';
    width: 18px;
    height: 1px;
    background: var(--accent);
}
h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(44px, 5.2vw, 85px);
    font-weight: 500;
    line-height: 0.99;
    letter-spacing: -4px;
    margin: 0 0 24px;
}
h1 em {
    font-weight: 400;
    color: var(--accent);
    font-style: normal;
}
.intro p {
    font-size: 14px;
    line-height: 1.8;
    color: #a9b7cc;
    max-width: 280px;
    margin: 0 0 28px;
}
.play-button {
    background: var(--accent);
    color: #09191d;
    font-weight: 600;
    font-size: 13px;
    border-radius: 3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 38px;
    padding: 17px 23px;
    min-width: 180px;
    box-shadow: 0 0 26px #82eee312;
    transition:
        filter 0.2s,
        transform 0.2s;
}
.play-button:hover {
    filter: brightness(1.12);
    transform: translateY(-2px);
}
.play-button span {
    font-size: 21px;
    line-height: 1;
}
.intro-meta {
    font-size: 8px;
    letter-spacing: 1.3px;
    color: #75869d;
    display: block;
    margin-top: 20px;
    line-height: 1.7;
}
.scene-caption {
    position: absolute;
    right: 25px;
    bottom: 23px;
    font-size: 8px;
    letter-spacing: 1.6px;
    color: #78909f;
    display: flex;
    align-items: center;
    gap: 14px;
}
.crosshair {
    font-size: 20px;
}
.caption-line {
    width: 28px;
    height: 1px;
    background: #4d68766e;
}
.hud {
    position: absolute;
    top: 28px;
    left: 34px;
    right: 34px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 2;
}
.hud-label {
    font-size: 9px;
    letter-spacing: 2px;
    color: #95a7bd;
    display: block;
    margin-bottom: 7px;
}
.hud strong {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 27px;
    font-weight: 500;
    letter-spacing: 1px;
}
.hud-secondary {
    text-align: right;
}
.announcement {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Space Grotesk', sans-serif;
    white-space: nowrap;
    letter-spacing: 2px;
    color: var(--accent);
    font-size: 15px;
    pointer-events: none;
    text-shadow: 0 2px 12px #000;
    z-index: 2;
}
.game-bottom {
    display: flex;
    justify-content: space-between;
    gap: 25px;
    padding: 21px 0 18px;
    border-bottom: 1px solid var(--line);
}
.instructions p {
    font-size: 12px;
    color: #b0bed1;
    margin: 0 0 12px;
}
.control-legend {
    display: flex;
    gap: 17px;
    align-items: center;
    flex-wrap: wrap;
    color: #788ba4;
    font-size: 10px;
}
.control-legend span {
    display: flex;
    gap: 6px;
    align-items: center;
}
kbd {
    font-family: inherit;
    color: #b8c7dd;
    border: 1px solid #ffffff1f;
    border-bottom-width: 2px;
    border-radius: 3px;
    padding: 3px 5px;
    font-size: 9px;
    min-width: 20px;
    text-align: center;
}
.personal-best {
    text-align: right;
    flex-shrink: 0;
}
.personal-best span {
    font-size: 8px;
    letter-spacing: 1.5px;
    color: #8493aa;
    display: block;
}
.personal-best strong {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    display: block;
    font-weight: 400;
    margin-top: 4px;
}
.personal-best small {
    font-size: 8px;
    color: #5f718b;
    display: block;
    margin-top: 3px;
}
.arcade-footer {
    display: flex;
    justify-content: space-between;
    padding: 18px 0;
    font-size: 9px;
    color: #60718c;
}
.arcade-footer > span:first-child {
    letter-spacing: 1.8px;
}
.arcade-footer > span:nth-child(2) {
    font-style: italic;
    color: #7e8da4;
}
.touch-controls {
    display: none;
    justify-content: center;
    gap: 8px;
    padding: 15px 0 0;
    flex-wrap: wrap;
}
.touch-controls button {
    min-width: 52px;
    height: 46px;
    border: 1px solid #ffffff24;
    border-radius: 6px;
    background: #ffffff06;
    font-size: 14px;
    touch-action: none;
    user-select: none;
}
.touch-controls button:active {
    background: #82eee322;
    border-color: var(--accent);
}
.touch-controls button.wide {
    min-width: 100px;
    color: var(--accent);
}
.no-script {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 5;
    background: #080c16;
    padding: 20px;
}
.overlay.paused,
.overlay.ended {
    background: #070c19ce;
    backdrop-filter: blur(6px);
    justify-content: center;
    text-align: center;
}
.overlay.paused .intro,
.overlay.ended .intro {
    max-width: 440px;
}
.overlay.paused .eyebrow,
.overlay.ended .eyebrow {
    justify-content: center;
}
.overlay.paused h1,
.overlay.ended h1 {
    font-size: 60px;
    letter-spacing: -2px;
}
.overlay.paused p,
.overlay.ended p {
    margin-left: auto;
    margin-right: auto;
}
.overlay.paused button,
.overlay.ended button {
    margin: auto;
}
.overlay.paused .scene-caption,
.overlay.ended .scene-caption {
    display: none;
}
@media (pointer: coarse) {
    .touch-controls {
        display: flex;
    }
    .stage {
        max-height: calc(100svh - 340px);
    }
}
@media (min-width: 1700px) {
    .stage {
        max-height: 820px;
    }
    .play-area {
        padding: 0 50px;
    }
}
@media (max-width: 1100px) {
    .arcade-shell {
        grid-template-columns: 200px 1fr;
    }
    .library {
        padding-left: 12px;
        padding-right: 12px;
    }
    .library-heading {
        font-size: 8px;
        letter-spacing: 1px;
    }
    .game-card {
        grid-template-columns: 29px 1fr;
        gap: 8px;
        padding-left: 9px;
    }
    .game-card strong {
        font-size: 12px;
    }
    .game-icon {
        font-size: 24px;
    }
    .play-area {
        padding: 0 22px;
    }
    .game-card[aria-current='true']:before {
        left: -13px;
    }
    .topbar {
        padding: 0 24px;
    }
    .topbar-right {
        gap: 22px;
    }
    .stage {
        min-height: 360px;
    }
    .intro p {
        font-size: 13px;
        max-width: 240px;
    }
    .scene-caption {
        display: none;
    }
    .control-legend {
        gap: 10px;
    }
}
@media (max-width: 760px) {
    .arcade-shell {
        display: flex;
        flex-direction: column;
    }
    .topbar {
        height: 68px;
        padding: 0 18px;
        flex-shrink: 0;
    }
    .wordmark {
        font-size: 16px;
    }
    .wordmark-divider {
        margin: 0 10px;
    }
    .arcade-word {
        font-size: 9px;
        letter-spacing: 2px;
    }
    .topbar-right .text-link {
        display: none;
    }
    .edition {
        font-size: 8px;
        letter-spacing: 1px;
        gap: 7px;
    }
    .library {
        padding: 13px 12px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .library-heading,
    .library-footer {
        display: none;
    }
    #game-list {
        display: flex;
        gap: 5px;
        overflow: auto;
        scrollbar-width: none;
    }
    .game-card {
        flex: 0 0 128px;
        margin: 0;
        padding: 11px 9px;
        grid-template-columns: 20px 1fr;
        gap: 7px;
        border-radius: 5px;
    }
    .game-icon {
        font-size: 21px;
    }
    .game-card strong {
        font-size: 10px;
    }
    .game-card small {
        font-size: 8px;
        margin-top: 2px;
    }
    .game-card[aria-current='true']:before,
    .new-pill {
        display: none;
    }
    .play-area {
        padding: 0 14px;
    }
    .game-toolbar {
        height: 55px;
    }
    .game-location {
        font-size: 8px;
        letter-spacing: 1px;
        gap: 8px;
    }
    .location-line {
        width: 15px;
    }
    .toolbar-actions {
        gap: 12px;
    }
    .toolbar-actions button {
        font-size: 10px;
    }
    .stage {
        aspect-ratio: 1/1.08;
        max-height: none;
        min-height: 0;
    }
    .overlay {
        padding: 7%;
        align-items: flex-end;
        padding-bottom: 10%;
        background: linear-gradient(0deg, #070c19eb, transparent);
    }
    .intro {
        max-width: 100%;
    }
    h1 {
        font-size: clamp(45px, 11vw, 70px);
        letter-spacing: -3px;
        margin-bottom: 14px;
    }
    .eyebrow {
        margin-bottom: 16px;
        font-size: 8px;
    }
    .intro p {
        font-size: 12px;
        max-width: 270px;
        margin-bottom: 20px;
    }
    .play-button {
        padding: 13px 19px;
        min-width: 165px;
        font-size: 12px;
    }
    .intro-meta {
        font-size: 7px;
        margin-top: 13px;
    }
    .game-bottom {
        padding: 16px 0;
        gap: 10px;
    }
    .instructions p {
        font-size: 11px;
        line-height: 1.6;
        margin-bottom: 9px;
    }
    .control-legend {
        font-size: 9px;
        gap: 7px;
    }
    .personal-best span {
        font-size: 7px;
    }
    .personal-best strong {
        font-size: 20px;
    }
    .personal-best small {
        max-width: 70px;
        font-size: 7px;
        line-height: 1.5;
    }
    .hud {
        top: 20px;
        left: 24px;
        right: 24px;
    }
    .hud strong {
        font-size: 21px;
    }
    .hud-label {
        font-size: 8px;
    }
    .announcement {
        font-size: 12px;
        bottom: 17px;
    }
    .arcade-footer {
        font-size: 8px;
        padding: 16px 0;
    }
    .arcade-footer > span:nth-child(2) {
        display: none;
    }
    .touch-controls {
        display: flex;
    }
    .overlay.paused,
    .overlay.ended {
        align-items: center;
    }
    .overlay.paused h1,
    .overlay.ended h1 {
        font-size: 44px;
    }
    .overlay.paused .intro,
    .overlay.ended .intro {
        width: 100%;
    }
}
@media (prefers-reduced-motion: reduce) {
    *,
    *:before,
    *:after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}

/* Event Horizon instruments stay in CSS pixels, including on small screens. */
body[data-game='horizon'] .stage {
    width: 100%;
    border-color: #9fccc638;
    background: #030711;
}
body[data-game='horizon'] .announcement {
    bottom: 105px;
    max-width: 92%;
    white-space: normal;
    text-align: center;
    font-size: clamp(9px, 1vw, 13px);
    line-height: 1.6;
    letter-spacing: 1.4px;
}
body[data-game='horizon'] .overlay.ended .intro {
    max-width: 560px;
}
body[data-game='horizon'] .overlay.ended p {
    max-width: 380px;
}
body[data-game='horizon'] .overlay.ended .intro-meta {
    color: #adc8d0;
    font-size: 10px;
}
.flight-hud {
    position: absolute;
    z-index: 2;
    left: 25px;
    right: 25px;
    bottom: 19px;
    display: grid;
    grid-template-columns: 0.85fr 1.25fr 1fr 1fr;
    gap: 22px;
    padding: 15px 10px 0;
    pointer-events: none;
    background: linear-gradient(0deg, #030711e6, #03071100);
}
.flight-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: #a4dcd322;
}
.flight-progress i,
.flight-meter i {
    display: block;
    height: 100%;
    width: 100%;
    background: #8cf6dc;
    transform-origin: left;
}
.flight-instrument > span {
    display: block;
    color: #8fa9b9;
    font-size: 8px;
    letter-spacing: 1.5px;
    margin-bottom: 7px;
}
.flight-instrument strong {
    display: block;
    color: #c9eee9;
    font:
        500 15px 'Space Grotesk',
        sans-serif;
    letter-spacing: 1.2px;
    white-space: nowrap;
}
.flight-instrument kbd {
    float: right;
    font-size: 7px;
    padding: 1px 3px;
    opacity: 0.7;
}
.flight-meter {
    height: 2px;
    background: #9fe7d41f;
    margin-top: 8px;
}
.phase-meter i {
    background: #bca4ff;
}
#hull-value {
    color: #92ffe1;
    letter-spacing: 5px;
}
#hull-value[data-critical='true'] {
    color: #ff917e;
}
#chain-value {
    color: #ffd1a2;
    font-size: 13px;
}
#chain-meter {
    background: #ffd1a2;
}
.flight-guide {
    border-bottom: 1px solid var(--line);
    padding: 14px 0;
    color: #8fa4b6;
    font-size: 11px;
}
.flight-guide summary {
    cursor: pointer;
    color: #c0d8df;
}
.flight-guide summary span {
    margin-left: 14px;
    color: #71899c;
    font-size: 10px;
}
.flight-guide > div {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding-top: 6px;
}
.flight-guide p {
    line-height: 1.8;
}
.flight-guide strong {
    color: #b8e8dc;
    font-weight: 500;
}
.play-area:fullscreen {
    background: #030711;
    padding: 0 24px;
    overflow: auto;
    display: flex;
    flex-direction: column;
}
.play-area:fullscreen .stage {
    flex: 1;
    width: 100%;
    aspect-ratio: auto;
    max-height: none;
    min-height: 220px;
}
.play-area:fullscreen .game-toolbar {
    height: 52px;
    flex-shrink: 0;
}
.play-area:fullscreen .game-bottom {
    padding: 12px 0;
}
.play-area:fullscreen .arcade-footer {
    display: none;
}
.play-area:fullscreen .flight-guide {
    display: none;
}
@media (max-width: 760px) {
    body[data-game='horizon'] .stage {
        aspect-ratio: 1 / 1.12;
    }
    body[data-game='horizon'] .hud {
        top: 20px;
        left: 22px;
        right: 22px;
    }
    body[data-game='horizon'] .hud strong {
        font-size: 23px;
    }
    body[data-game='horizon'] .hud-label {
        font-size: 8px;
    }
    body[data-game='horizon'] .announcement {
        bottom: 91px;
        font-size: 9px;
        letter-spacing: 0.8px;
    }
    body[data-game='horizon'] .touch-controls {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 6px;
    }
    body[data-game='horizon'] .touch-controls button {
        flex: 1;
        min-width: 0;
        max-width: none;
        padding: 0;
        font-size: 12px;
    }
    body[data-game='horizon'] .touch-controls button.wide {
        min-width: 0;
    }
    body[data-game='horizon'] .game-location .location-line,
    body[data-game='horizon'] #game-number {
        display: none;
    }
    .flight-hud {
        left: 14px;
        right: 14px;
        bottom: 17px;
        gap: 10px;
        padding: 12px 2px 0;
        grid-template-columns: 0.85fr 1.15fr 1fr 1fr;
    }
    .flight-instrument > span {
        font-size: 6px;
        letter-spacing: 0.9px;
    }
    .flight-instrument strong {
        font-size: 12px;
    }
    .flight-instrument kbd {
        display: none;
    }
    #chain-value {
        font-size: 9px;
        letter-spacing: 0;
    }
    #hull-value {
        letter-spacing: 2px;
    }
    .flight-guide > div {
        grid-template-columns: 1fr;
        gap: 0;
    }
    body[data-game='horizon'] .overlay.ended h1 {
        font-size: clamp(38px, 11vw, 60px);
    }
    body[data-game='horizon'] .overlay.ended .intro-meta {
        font-size: 8px;
        letter-spacing: 0.5px;
    }
}
@media (max-width: 380px) {
    body[data-game='horizon'] .stage {
        min-height: 355px;
    }
    body[data-game='horizon'] .eyebrow {
        font-size: 7px;
        letter-spacing: 1.3px;
    }
    body[data-game='horizon'] .toolbar-actions {
        gap: 9px;
    }
    body[data-game='horizon'] .toolbar-actions button {
        font-size: 9px;
        white-space: nowrap;
    }
    body[data-game='horizon'] .game-location {
        font-size: 7px;
        letter-spacing: 0.7px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .play-button,
    .game-card {
        transition: none;
    }
}

.gravity-hud {
    text-align: center;
}
.gravity-hud strong {
    color: #ffd1a2;
}
.gravity-hud small {
    display: block;
    margin-top: 5px;
    font-size: 8px;
    letter-spacing: 1.2px;
    color: #c0aa92;
}
.gravity-hud[data-danger='true'] strong,
.gravity-hud[data-danger='true'] small {
    color: #ff9681;
}
@media (max-width: 760px) {
    body[data-game='horizon'] .gravity-hud strong {
        font-size: 19px;
    }
    .gravity-hud small {
        font-size: 6px;
        letter-spacing: 0.5px;
    }
    body[data-game='horizon'] .hud {
        left: 18px;
        right: 18px;
    }
}
