:root {
    color-scheme: dark;
    --ink: #090c11;
    --ink-soft: #111722;
    --night: #172331;
    --blue: #84a8bd;
    --blue-dim: #526e7f;
    --cream: #eee5ca;
    --cream-dim: #bcb49e;
    --amber: #d99a35;
    --amber-hot: #f0b54d;
    --rule: rgba(238, 229, 202, 0.3);
    --hard-shadow: 8px 8px 0 rgba(0, 0, 0, 0.42);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-width: 320px;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--ink);
}

body.game-page {
    color: var(--cream);
    font-family: "Arial Narrow", "Roboto Condensed", "Franklin Gothic Medium", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    text-rendering: optimizeLegibility;
}

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

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
canvas:focus-visible {
    outline: 3px solid var(--amber-hot);
    outline-offset: 3px;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

[hidden] {
    display: none !important;
}

::selection {
    color: var(--ink);
    background: var(--amber-hot);
}

.skip-link {
    position: fixed;
    top: calc(10px + var(--safe-top));
    left: calc(10px + var(--safe-left));
    z-index: 100;
    padding: 9px 12px;
    color: var(--ink);
    background: var(--cream);
    border: 2px solid var(--ink);
    font: 800 0.72rem/1 ui-monospace, Consolas, monospace;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
    transform: translateY(-180%);
}

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

.game-shell,
.game-stage,
#gameCanvas {
    width: 100%;
    height: 100%;
}

.game-shell {
    min-height: 100svh;
    min-height: 100dvh;
}

.game-stage {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: var(--night);
}

#gameCanvas {
    position: absolute;
    inset: 0;
    display: block;
    background: var(--night);
    image-rendering: auto;
}

.frame-lines {
    position: absolute;
    inset: 0;
    z-index: 8;
    pointer-events: none;
}

.frame-lines span {
    position: absolute;
    background: var(--cream);
    opacity: 0.45;
}

.frame-lines span:nth-child(1),
.frame-lines span:nth-child(2) {
    top: calc(18px + var(--safe-top));
    width: clamp(22px, 4vw, 66px);
    height: 2px;
}

.frame-lines span:nth-child(1) {
    left: calc(18px + var(--safe-left));
}

.frame-lines span:nth-child(2) {
    right: calc(18px + var(--safe-right));
}

.frame-lines span:nth-child(3),
.frame-lines span:nth-child(4) {
    bottom: calc(18px + var(--safe-bottom));
    width: 2px;
    height: clamp(22px, 4vw, 66px);
}

.frame-lines span:nth-child(3) {
    left: calc(18px + var(--safe-left));
}

.frame-lines span:nth-child(4) {
    right: calc(18px + var(--safe-right));
}

.game-hud {
    position: absolute;
    top: calc(28px + var(--safe-top));
    right: calc(30px + var(--safe-right));
    left: calc(30px + var(--safe-left));
    z-index: 20;
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr) auto auto;
    align-items: center;
    gap: 22px;
    pointer-events: none;
}

.story-mark,
.place-readout,
.memory-readout,
.utility-controls {
    pointer-events: auto;
}

.story-mark {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    position: relative;
    color: var(--ink);
    background: var(--cream);
    border: 2px solid var(--ink);
    box-shadow: 4px 4px 0 var(--amber);
    font: 900 0.62rem/1 ui-monospace, Consolas, monospace;
    letter-spacing: 0.06em;
}

.story-mark i {
    position: absolute;
    right: 4px;
    bottom: 4px;
    left: 4px;
    height: 3px;
    background: var(--ink);
}

.place-readout {
    width: max-content;
    display: grid;
    grid-template-columns: auto auto;
    align-items: baseline;
    column-gap: 10px;
    padding: 8px 12px 9px;
    background: rgba(9, 12, 17, 0.82);
    border-left: 3px solid var(--amber);
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.28);
}

.place-readout strong {
    grid-column: 1;
    display: block;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.015em;
}

.hud-label,
.hud-year {
    font: 800 0.62rem/1 ui-monospace, Consolas, monospace;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.place-readout > .hud-label {
    grid-column: 1 / -1;
    margin-bottom: 5px;
    color: var(--blue);
}

.hud-year {
    grid-column: 2;
    grid-row: 2;
    color: var(--amber-hot);
}

.memory-readout {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    color: var(--cream);
    background: rgba(9, 12, 17, 0.82);
    border-bottom: 2px solid var(--blue-dim);
}

.memory-readout strong {
    font: 800 1.05rem/1 ui-monospace, Consolas, monospace;
}

.memory-readout .hud-label {
    color: var(--cream-dim);
}

.memory-symbol {
    width: 10px;
    height: 10px;
    display: inline-block;
    background: var(--amber);
    border: 2px solid var(--cream);
    transform: rotate(45deg);
}

.utility-controls {
    display: flex;
    gap: 6px;
}

.icon-button {
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--cream);
    background: rgba(9, 12, 17, 0.84);
    border: 1px solid var(--rule);
    border-radius: 0;
    cursor: pointer;
    font: 900 0.62rem/1 ui-monospace, Consolas, monospace;
    letter-spacing: 0.06em;
}

.icon-button:hover,
.icon-button[aria-pressed="true"] {
    color: var(--ink);
    background: var(--cream);
    border-color: var(--cream);
}

.icon-button[aria-pressed="true"] span {
    text-decoration: line-through 2px;
}

.screen-layer {
    position: absolute;
    inset: 0;
    z-index: 40;
}

.loading-screen {
    display: grid;
    place-items: end start;
    padding: max(44px, 7vw) max(28px, 7vw);
    color: var(--cream);
    background: var(--ink);
}

.loading-screen::before {
    content: "";
    position: absolute;
    top: 0;
    left: clamp(34px, 18vw, 290px);
    width: clamp(12px, 2vw, 30px);
    height: 72%;
    background: var(--blue-dim);
    opacity: 0.22;
    transform: skewX(-18deg);
    transform-origin: top;
}

.loading-screen::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 13%;
    width: 42%;
    height: 2px;
    background: var(--amber);
}

.loading-card {
    width: min(560px, 100%);
    position: relative;
    z-index: 1;
}

.eyebrow {
    margin: 0;
    color: var(--amber-hot);
    font: 800 0.68rem/1.3 ui-monospace, Consolas, monospace;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.loading-title {
    max-width: 480px;
    margin: 16px 0 30px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 6vw, 4.6rem);
    font-weight: 400;
    line-height: 0.88;
    letter-spacing: -0.055em;
}

.loading-card progress {
    width: 100%;
    height: 5px;
    display: block;
    overflow: hidden;
    appearance: none;
    border: 0;
    background: #29313a;
}

.loading-card progress::-webkit-progress-bar {
    background: #29313a;
}

.loading-card progress::-webkit-progress-value {
    background: var(--amber-hot);
}

.loading-card progress::-moz-progress-bar {
    background: var(--amber-hot);
}

.loading-meta {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    color: var(--cream-dim);
    font: 700 0.62rem/1.3 ui-monospace, Consolas, monospace;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.title-screen {
    overflow: hidden;
    color: var(--cream);
    background-color: var(--ink);
    background-image: url("assets/the-long-way-home.png");
    background-position: center;
    background-size: cover;
}

.title-screen::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: min(62%, 980px);
    height: 100%;
    background: rgba(9, 12, 17, 0.86);
    border-left: clamp(8px, 1.4vw, 24px) solid var(--amber);
}

.title-landscape {
    position: absolute;
    inset: 0 0 0 50%;
    overflow: hidden;
    background: rgba(23, 35, 49, 0.2);
    border-left: 1px solid var(--blue-dim);
}

.title-landscape::before {
    content: "";
    position: absolute;
    top: 54%;
    right: -8%;
    left: -12%;
    height: 38%;
    background: var(--ink-soft);
    transform: skewY(-7deg);
}

.title-landscape::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 16%;
    background: var(--ink);
}

.moon {
    position: absolute;
    top: clamp(60px, 12vh, 130px);
    right: clamp(44px, 10vw, 170px);
    width: clamp(68px, 9vw, 128px);
    aspect-ratio: 1;
    background: var(--cream);
    border: clamp(7px, 1vw, 14px) solid var(--amber);
    border-radius: 50%;
    box-shadow: 20px 16px 0 rgba(9, 12, 17, 0.4);
}

.road {
    position: absolute;
    bottom: -14%;
    left: 42%;
    width: 3px;
    height: 80%;
    background: var(--cream-dim);
    transform: rotate(18deg);
    transform-origin: bottom;
    opacity: 0.7;
}

.road-two {
    left: 56%;
    transform: rotate(-10deg);
}

.milepost {
    position: absolute;
    right: 13%;
    bottom: 17%;
    width: 44px;
    height: 84px;
    display: grid;
    place-items: start center;
    padding-top: 12px;
    color: var(--ink);
    background: var(--cream-dim);
    border-top: 8px solid var(--amber);
    box-shadow: 10px 8px 0 rgba(0, 0, 0, 0.35);
    font: 900 0.72rem/1 ui-monospace, Consolas, monospace;
}

.title-copy {
    position: absolute;
    top: 50%;
    left: clamp(38px, 7vw, 116px);
    z-index: 2;
    width: min(52vw, 760px);
    transform: translateY(-52%);
}

.title-copy .eyebrow span {
    display: inline-block;
    margin-right: 10px;
    padding: 3px 5px;
    color: var(--ink);
    background: var(--amber);
}

.title-copy h1 {
    margin: 18px 0 0;
    color: var(--cream);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(4rem, 9.3vw, 9.5rem);
    font-weight: 400;
    line-height: 0.75;
    letter-spacing: -0.075em;
    text-shadow: 6px 6px 0 var(--ink);
}

.title-copy h1 span {
    display: block;
    white-space: nowrap;
}

.title-copy h1 span:last-child {
    margin-left: clamp(18px, 5vw, 90px);
    color: var(--amber-hot);
    font-style: italic;
}

.title-deck {
    width: min(420px, 88%);
    margin: clamp(26px, 5vh, 52px) 0 0;
    color: var(--cream-dim);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    line-height: 1.5;
}

.title-actions {
    margin-top: 26px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.action-button {
    min-width: 190px;
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    padding: 12px 16px;
    color: var(--cream);
    background: var(--ink-soft);
    border: 1px solid var(--cream-dim);
    border-radius: 0;
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.38);
    cursor: pointer;
    font: 800 0.72rem/1.2 ui-monospace, Consolas, monospace;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.action-button:hover {
    color: var(--ink);
    background: var(--cream);
    border-color: var(--cream);
}

.action-button--primary {
    color: var(--ink);
    background: var(--amber-hot);
    border-color: var(--amber-hot);
}

.action-button--primary:hover {
    background: var(--cream);
}

.title-footer {
    position: absolute;
    right: calc(32px + var(--safe-right));
    bottom: calc(28px + var(--safe-bottom));
    left: calc(38px + var(--safe-left));
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    font: 700 0.62rem/1.4 ui-monospace, Consolas, monospace;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.title-footer p {
    margin: 0;
    color: var(--blue);
}

.back-link {
    color: var(--cream);
    text-decoration-color: var(--amber);
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
}

.pause-screen {
    display: grid;
    place-items: center;
    padding: 28px;
    background: rgba(9, 12, 17, 0.92);
}

.pause-card {
    width: min(460px, 100%);
    padding: clamp(28px, 5vw, 48px);
    background: var(--ink-soft);
    border: 1px solid var(--blue-dim);
    border-top: 8px solid var(--amber);
    box-shadow: var(--hard-shadow);
}

.pause-card h2 {
    margin: 8px 0 28px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 400;
    line-height: 1;
}

.pause-actions {
    border-top: 1px solid var(--rule);
}

.menu-button {
    width: 100%;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 2px;
    color: var(--cream);
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-align: left;
    text-decoration: none;
}

.menu-button:hover {
    padding-inline: 10px;
    color: var(--ink);
    background: var(--cream);
}

.menu-button kbd,
.control-hint kbd {
    min-width: 24px;
    display: inline-grid;
    place-items: center;
    padding: 4px 5px;
    color: inherit;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 0;
    font: 700 0.61rem/1 ui-monospace, Consolas, monospace;
}

.pause-note {
    margin: 22px 0 0;
    color: var(--cream-dim);
    font: 700 0.61rem/1.4 ui-monospace, Consolas, monospace;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.dialogue-panel {
    position: absolute;
    right: max(28px, 7vw);
    bottom: calc(64px + var(--safe-bottom));
    left: max(28px, 7vw);
    z-index: 30;
    min-height: 156px;
    display: grid;
    grid-template-columns: 16px minmax(0, 1.35fr) minmax(220px, 0.65fr);
    gap: clamp(18px, 3vw, 38px);
    padding: clamp(20px, 3vw, 32px);
    color: var(--cream);
    background: rgba(9, 12, 17, 0.94);
    border: 1px solid var(--blue-dim);
    border-bottom: 6px solid var(--amber);
    box-shadow: var(--hard-shadow);
}

.dialogue-rule {
    position: relative;
    border-left: 2px solid var(--amber);
}

.dialogue-rule span {
    position: absolute;
    top: 0;
    left: -6px;
    width: 10px;
    height: 10px;
    background: var(--amber);
    transform: rotate(45deg);
}

.speaker-name {
    margin: 0 0 8px;
    color: var(--blue);
    font: 900 0.68rem/1.2 ui-monospace, Consolas, monospace;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.dialogue-text {
    max-width: 760px;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.2rem, 2.1vw, 1.75rem);
    line-height: 1.38;
}

.choice-list {
    display: grid;
    align-content: center;
    gap: 7px;
}

.choice-list:empty {
    display: none;
}

.choice-button {
    width: 100%;
    min-height: 46px;
    display: grid;
    grid-template-columns: 28px 1fr;
    align-items: center;
    gap: 10px;
    padding: 8px 11px;
    color: var(--cream);
    background: var(--ink-soft);
    border: 1px solid var(--rule);
    border-radius: 0;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: left;
}

.choice-button:hover,
.choice-button[aria-selected="true"] {
    color: var(--ink);
    background: var(--cream);
    border-color: var(--cream);
}

.choice-number {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    color: var(--amber-hot);
    border: 1px solid currentColor;
    font: 800 0.65rem/1 ui-monospace, Consolas, monospace;
}

.choice-button:hover .choice-number,
.choice-button[aria-selected="true"] .choice-number {
    color: var(--ink);
}

.control-hint {
    position: absolute;
    bottom: calc(24px + var(--safe-bottom));
    left: 50%;
    z-index: 15;
    display: flex;
    gap: 22px;
    color: var(--cream-dim);
    font: 800 0.58rem/1 ui-monospace, Consolas, monospace;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    transform: translateX(-50%);
}

.control-hint span {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.touch-controls {
    display: none;
    position: absolute;
    right: calc(20px + var(--safe-right));
    bottom: calc(18px + var(--safe-bottom));
    left: calc(20px + var(--safe-left));
    z-index: 25;
    grid-template-columns: 58px minmax(100px, 1fr) 58px;
    gap: 8px;
    pointer-events: none;
}

.touch-button {
    min-height: 56px;
    color: var(--cream);
    background: rgba(9, 12, 17, 0.82);
    border: 1px solid var(--cream-dim);
    border-radius: 0;
    pointer-events: auto;
    font: 900 1.1rem/1 ui-monospace, Consolas, monospace;
}

.touch-button--interact {
    justify-self: center;
    width: min(180px, 100%);
    color: var(--ink);
    background: var(--amber-hot);
    border-color: var(--amber-hot);
    font-size: 0.67rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.touch-button:active {
    color: var(--ink);
    background: var(--cream);
}

.transcript-panel {
    position: absolute;
    right: calc(30px + var(--safe-right));
    bottom: calc(28px + var(--safe-bottom));
    z-index: 32;
    width: min(390px, calc(100% - 60px));
    color: var(--cream);
    background: var(--ink-soft);
    border: 1px solid var(--blue-dim);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.4);
}

.transcript-panel summary {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    list-style: none;
    color: var(--cream-dim);
    font: 800 0.6rem/1.2 ui-monospace, Consolas, monospace;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.transcript-panel summary::-webkit-details-marker {
    display: none;
}

.transcript-panel summary::after {
    content: "+";
    color: var(--amber-hot);
    font-size: 1rem;
}

.transcript-panel[open] summary::after {
    content: "−";
}

.transcript-body {
    max-height: min(46vh, 420px);
    overflow: auto;
    padding: 0 14px 14px;
    border-top: 1px solid var(--rule);
    scrollbar-color: var(--blue-dim) var(--ink);
}

.transcript-help {
    margin: 12px 0;
    color: var(--cream-dim);
    font-size: 0.75rem;
}

.transcript-body ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

.transcript-body li {
    padding: 10px 0;
    border-top: 1px solid rgba(238, 229, 202, 0.15);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.88rem;
}

.transcript-body li strong {
    display: block;
    margin-bottom: 3px;
    color: var(--amber-hot);
    font: 800 0.58rem/1.2 ui-monospace, Consolas, monospace;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.noscript-message {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    align-content: center;
    justify-items: start;
    padding: clamp(30px, 10vw, 130px);
    color: var(--cream);
    background: var(--ink);
    border-left: clamp(8px, 2vw, 24px) solid var(--amber);
}

.noscript-message h1 {
    max-width: 720px;
    margin: 12px 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 400;
    line-height: 0.9;
}

.noscript-message p:not(.eyebrow) {
    max-width: 560px;
    color: var(--cream-dim);
}

.noscript-message a {
    margin-top: 24px;
    color: var(--amber-hot);
    text-underline-offset: 5px;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.is-visible {
    display: grid;
}

@media (max-width: 820px) {
    .game-hud {
        top: calc(18px + var(--safe-top));
        right: calc(18px + var(--safe-right));
        left: calc(18px + var(--safe-left));
        grid-template-columns: auto 1fr auto;
        gap: 10px;
    }

    .story-mark {
        width: 42px;
        height: 42px;
    }

    .memory-readout {
        display: none;
    }

    .place-readout {
        padding: 6px 10px 7px;
    }

    .utility-controls {
        gap: 4px;
    }

    .icon-button {
        width: 42px;
        height: 42px;
    }

    .title-landscape {
        inset: 0 0 0 64%;
    }

    .title-copy {
        left: clamp(32px, 8vw, 68px);
        width: 78vw;
    }

    .title-copy h1 {
        font-size: clamp(4.2rem, 15.5vw, 7.4rem);
    }

    .title-copy h1 span:last-child {
        margin-left: 0;
    }

    .dialogue-panel {
        right: 22px;
        bottom: calc(84px + var(--safe-bottom));
        left: 22px;
        grid-template-columns: 10px 1fr;
        gap: 14px;
        padding: 18px;
    }

    .choice-list {
        grid-column: 2;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .control-hint {
        display: none;
    }

    .transcript-panel {
        right: calc(18px + var(--safe-right));
        bottom: calc(18px + var(--safe-bottom));
        width: min(360px, calc(100% - 36px));
    }
}

@media (max-width: 560px) {
    .frame-lines span {
        display: none;
    }

    .game-hud {
        align-items: start;
    }

    .story-mark {
        display: none;
    }

    .place-readout {
        width: min(100%, 180px);
    }

    .place-readout strong {
        max-width: 128px;
        overflow: hidden;
        font-size: 0.82rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .hud-year {
        font-size: 0.55rem;
    }

    .utility-controls {
        justify-self: end;
    }

    .icon-button {
        width: 40px;
        height: 40px;
    }

    .title-landscape {
        inset: 58% 0 0;
        border-top: 1px solid var(--blue-dim);
        border-left: 0;
    }

    .title-screen::before {
        width: 100%;
        height: 61%;
        background: rgba(9, 12, 17, 0.88);
    }

    .moon {
        top: 18px;
        right: 34px;
        width: 64px;
        border-width: 7px;
    }

    .milepost {
        right: 16%;
        bottom: 8%;
        width: 34px;
        height: 58px;
    }

    .title-copy {
        top: calc(88px + var(--safe-top));
        right: 22px;
        left: 30px;
        width: auto;
        transform: none;
    }

    .title-copy h1 {
        margin-top: 14px;
        font-size: clamp(3.45rem, 18vw, 5.4rem);
        line-height: 0.8;
    }

    .title-copy h1 span {
        white-space: normal;
    }

    .title-deck {
        margin-top: 24px;
        font-size: 0.95rem;
    }

    .title-actions {
        margin-top: 18px;
    }

    .action-button {
        width: min(100%, 260px);
        min-height: 48px;
    }

    .title-footer {
        right: calc(20px + var(--safe-right));
        bottom: calc(16px + var(--safe-bottom));
        left: calc(28px + var(--safe-left));
    }

    .title-footer p {
        display: none;
    }

    .dialogue-panel {
        right: 12px;
        bottom: calc(80px + var(--safe-bottom));
        left: 12px;
        min-height: 0;
        grid-template-columns: 5px minmax(0, 1fr);
        gap: 12px;
        padding: 15px 14px;
        border-bottom-width: 4px;
        box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.42);
    }

    .dialogue-text {
        font-size: 1.05rem;
        line-height: 1.32;
    }

    .choice-list {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .choice-button {
        min-height: 42px;
    }

    .loading-screen {
        padding: 34px 26px calc(48px + var(--safe-bottom));
    }

    .loading-meta span:last-child {
        display: none;
    }

    .pause-card {
        padding: 28px 24px;
    }
}

@media (hover: none), (pointer: coarse) {
    .touch-controls {
        display: grid;
    }

    .transcript-panel {
        bottom: calc(88px + var(--safe-bottom));
    }

    .dialogue-panel:not([hidden]) ~ .touch-controls,
    .pause-screen:not([hidden]) ~ .touch-controls,
    .title-screen:not([hidden]) ~ .touch-controls,
    .loading-screen:not([hidden]) ~ .touch-controls {
        display: none;
    }
}

@media (max-height: 650px) and (orientation: landscape) {
    .title-copy {
        top: 46%;
    }

    .title-copy h1 {
        font-size: clamp(3.2rem, 10vw, 6rem);
    }

    .title-deck {
        margin-top: 20px;
    }

    .title-actions {
        margin-top: 16px;
    }

    .title-footer {
        bottom: calc(14px + var(--safe-bottom));
    }

    .dialogue-panel {
        bottom: calc(18px + var(--safe-bottom));
        min-height: 126px;
        padding-block: 16px;
    }
}

body[data-reduced-motion="true"] *,
body[data-reduced-motion="true"] *::before,
body[data-reduced-motion="true"] *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
}

@media (prefers-reduced-motion: no-preference) {
    .title-screen:not([hidden]) .title-copy {
        animation: title-arrive 700ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
    }

    .dialogue-panel:not([hidden]) {
        animation: dialogue-arrive 220ms ease-out both;
    }

    .loading-screen::after {
        animation: road-pulse 1400ms steps(4, end) infinite;
    }

    @keyframes title-arrive {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }

    @keyframes dialogue-arrive {
        from {
            opacity: 0;
            transform: translateY(16px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes road-pulse {
        0%, 100% { opacity: 0.25; }
        50% { opacity: 1; }
    }
}

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