/*
 * Chud Samurai (js/engine/game.js): a top bar, the stage, the sentence line, then the verbs and the inventory, with phones getting a
 * zoomed, scrolling stage and thumb-sized buttons. In a fight (js/engine/combat.js) the stage gets
 * bars for life and Ki, and the verbs give way to a pad of buttons.
 */

/* One look, dark, whatever the device's theme */
:root {
    color-scheme: dark;
}

html,
body {
    margin: 0;
    background: #0c0a10;
    color: #e9e4ff;
}

body {
    overflow: hidden;
}

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

/* Without JavaScript there's no game, so say so */
.noscript {
    max-width: 32em;
    margin: 0 auto;
    padding: 48px 16px;
    font-family: 'VT323', ui-monospace, Menlo, Consolas, monospace;
    font-size: 22px;
}

.noscript h1 {
    color: #f4d34c;
    font-weight: normal;
}

.game {
    --px: 4;
    --g-bg: #0c0a10;
    --g-panel: #17121a;
    --g-line: #33262c;
    --g-verb: #d89a6a;     /* lacquer and lantern light */
    --g-verb-on: #ffffff;
    --g-hot: #f4d34c;
    --g-sentence: #8fd0b8;
    --g-choice: #f0a8b8;  /* cherry blossom */
    --g-asked: #a8788a; /* a question already asked */
    --g-red: #c8302c;     /* vermilion */
    /* A pixel crosshair */
    --g-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' shape-rendering='crispEdges'%3E%3Cpath d='M7 0h3v6H7zM7 11h3v6H7zM0 7h6v3H0zM11 7h6v3h-6z' fill='%23000'/%3E%3Cpath d='M8 1h1v5H8zM8 11h1v5H8zM1 8h5v1H1zM11 8h5v1h-5z' fill='%23fff'/%3E%3C/svg%3E") 8 8, crosshair;
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    /* Clear of a phone's notch, home bar and rounded corners */
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    background: var(--g-bg);
    color: #e9e4ff;
    font-family: 'VT323', ui-monospace, Menlo, Consolas, monospace;
    font-size: 22px;
    line-height: 1.1;
    overflow: hidden;
    -webkit-font-smoothing: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

.game input {
    -webkit-user-select: text;
    user-select: text;
}

.game[hidden] {
    display: none;
}

.game button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.game :focus-visible {
    outline: 2px solid var(--g-hot);
    outline-offset: 1px;
    box-shadow: none;
    border-radius: 0;
}

/* ---------- Top bar ---------- */

.game__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 16px;
    border-bottom: 2px solid var(--g-line);
    flex: none;
}

.game__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: #fff;
    text-decoration: none;
    font-size: 24px;
    white-space: nowrap;
}

.game__brand:hover {
    color: var(--g-hot);
}

.game__mark {
    display: inline-grid;
    place-items: center;
    min-width: 26px;
    height: 26px;
    padding: 0 4px;
    flex: none;
    background: var(--g-red);
    color: #fff;
    font-size: 16px;
    font-family: 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif JP', serif;
    box-shadow: inset 0 0 0 2px #f0d8b0;
}

.game__room {
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--g-sentence);
}

.game__room:empty {
    display: none;
}

.game__room::before {
    content: '·';
    margin-right: 8px;
    color: #5a527a;
}

.game__tools {
    display: flex;
    gap: 6px;
    flex: none;
}

.game .game__tool {
    padding: 2px 10px;
    border: 2px solid var(--g-line);
    color: var(--g-verb);
    font-size: 20px;
}

.game .game__tool:hover {
    color: var(--g-hot);
    border-color: #4a3f70;
}

/* ---------- Stage ---------- */

.game__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding-top: 4px;
}

.game__stage {
    position: relative;
    width: 320px;
    height: 144px;
    max-width: 100%;
    flex: none;
    overflow: hidden;
    overflow: clip; /* not a scroll container, so focusing an off-screen hotspot can't shift it */
    cursor: var(--g-cursor);
    transition: opacity 0.22s;
    touch-action: manipulation;
}

/* Keyboard focus rests on the stage when what had it goes away (see keepFocus in js/game.js);
   it isn't a control, so it shows no ring */
.game__stage:focus {
    outline: none;
}

.game__stage.is-fading {
    opacity: 0;
}

.is-busy .game__stage {
    cursor: wait;
}

/* The room; it scrolls inside the stage when the stage is narrower than the room (portrait) */
.game__world {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    will-change: transform;
}

/* Low on the floor, where there are no hotspots to cover */
.game .game__pan {
    position: absolute;
    bottom: 6px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 44px;
    height: 48px;
    background: rgba(10, 8, 18, 0.45);
    color: var(--g-hot);
}

.game .game__pan[hidden] {
    display: none;
}

.game__pan--left {
    left: 0;
    border-radius: 0 6px 6px 0;
}

.game__pan--right {
    right: 0;
    border-radius: 6px 0 0 6px;
}

.game__pan span {
    display: block;
    animation: game-nudge 1.4s ease-in-out infinite;
}

.game__pan svg {
    display: block;
    filter: drop-shadow(2px 2px 0 #000);
}

.game__pan--left svg {
    transform: scaleX(-1);
}

.game__pan--left span {
    animation-direction: reverse;
}

@keyframes game-nudge {
    50% { transform: translateX(3px); }
}

.game__canvas {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* The room's still picture, behind the canvas with what moves on it */
.game__canvas--still {
    position: absolute;
    left: 0;
    top: 0;
}

/* Parallax layers (js/game.js): each slides inside the world, behind or in front of the room */
.game__layer {
    position: absolute;
    pointer-events: none;
}

.game__layer--clip {
    overflow: hidden;
}

.game__layer canvas {
    position: absolute;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    will-change: transform;
}

.game__hotspots {
    position: absolute;
    inset: 0;
}

.game .game__hotspot {
    position: absolute;
    cursor: var(--g-cursor);
}

.game .game__hotspot:focus-visible {
    outline: 2px dashed var(--g-hot);
    outline-offset: 0;
}

.game__speech {
    position: absolute;
    max-width: min(70%, 460px);
    margin: 0;
    font-size: max(18px, calc(var(--px) * 8px));
    line-height: 1.1;
    text-align: center;
    text-wrap: balance;
    pointer-events: none;
    /* A thick, round black outline that grows with the scene, so the line reads over anything
       behind it, however busy: a ring of copies at --o, evenly round (sixteen points on a circle,
       so no corners or teeth), an inner ring at --h so a thick outline has no gaps, and the lower
       arc of the ring again, a little lower, for a smooth, slightly heavier bottom edge */
    --o: max(4px, calc(var(--px) * 1.35px));
    --h: calc(var(--o) * 0.5);
    text-shadow:
        var(--o) 0 0 #000, calc(var(--o) * 0.924) calc(var(--o) * 0.383) 0 #000, calc(var(--o) * 0.707) calc(var(--o) * 0.707) 0 #000,
        calc(var(--o) * 0.383) calc(var(--o) * 0.924) 0 #000, 0 var(--o) 0 #000, calc(var(--o) * -0.383) calc(var(--o) * 0.924) 0 #000,
        calc(var(--o) * -0.707) calc(var(--o) * 0.707) 0 #000, calc(var(--o) * -0.924) calc(var(--o) * 0.383) 0 #000, calc(var(--o) * -1.0) 0 0 #000,
        calc(var(--o) * -0.924) calc(var(--o) * -0.383) 0 #000, calc(var(--o) * -0.707) calc(var(--o) * -0.707) 0 #000, calc(var(--o) * -0.383) calc(var(--o) * -0.924) 0 #000,
        0 calc(var(--o) * -1.0) 0 #000, calc(var(--o) * 0.383) calc(var(--o) * -0.924) 0 #000, calc(var(--o) * 0.707) calc(var(--o) * -0.707) 0 #000,
        calc(var(--o) * 0.924) calc(var(--o) * -0.383) 0 #000, var(--h) 0 0 #000, calc(var(--h) * 0.707) calc(var(--h) * 0.707) 0 #000,
        0 var(--h) 0 #000, calc(var(--h) * -0.707) calc(var(--h) * 0.707) 0 #000, calc(var(--h) * -1.0) 0 0 #000,
        calc(var(--h) * -0.707) calc(var(--h) * -0.707) 0 #000, 0 calc(var(--h) * -1.0) 0 #000, calc(var(--h) * 0.707) calc(var(--h) * -0.707) 0 #000,
        calc(var(--o) * 0.966) calc(var(--o) * 0.609) 0 #000, calc(var(--o) * 0.866) calc(var(--o) * 0.85) 0 #000, calc(var(--o) * 0.707) calc(var(--o) * 1.057) 0 #000,
        calc(var(--o) * 0.5) calc(var(--o) * 1.216) 0 #000, calc(var(--o) * 0.259) calc(var(--o) * 1.316) 0 #000, 0 calc(var(--o) * 1.35) 0 #000,
        calc(var(--o) * -0.259) calc(var(--o) * 1.316) 0 #000, calc(var(--o) * -0.5) calc(var(--o) * 1.216) 0 #000, calc(var(--o) * -0.707) calc(var(--o) * 1.057) 0 #000,
        calc(var(--o) * -0.866) calc(var(--o) * 0.85) 0 #000, calc(var(--o) * -0.966) calc(var(--o) * 0.609) 0 #000;
}

.game__title {
    margin: 0;
    color: var(--g-hot);
    font-size: max(30px, calc(var(--px) * 16px));
    line-height: 0.9;
    text-shadow: 3px 3px 0 #a8302c, 6px 6px 0 #000;
}

.game__subtitle {
    margin: 0.4em 0 0;
    color: #fff;
    font-size: max(18px, calc(var(--px) * 7px));
}

/* ---------- The opening: press start, title screen, credits ---------- */

.is-title .game__sentence,
.is-title .game__ui,
.is-cinematic .game__sentence,
.is-cinematic .game__ui {
    visibility: hidden;
}

.is-title .game__hotspots,
.is-cinematic .game__hotspots {
    display: none;
}

.is-title .game__stage,
.is-cinematic .game__stage {
    cursor: default;
}

.game__lockup {
    position: absolute;
    top: 6%;
    left: 0;
    right: 0;
    text-align: center;
    pointer-events: none;
}

.game__lockup[hidden] {
    display: none;
}

.game__chapter {
    margin: 0.5em 0 0;
    color: var(--g-hot);
    font-size: max(15px, calc(var(--px) * 5px));
    text-shadow: 2px 2px 0 #000;
}

.game__lockup .game__subtitle {
    margin-top: 0.3em;
    color: #c8c2ea;
    font-size: max(16px, calc(var(--px) * 6px));
    text-shadow: 2px 2px 0 #000;
}

.game__credits {
    position: absolute;
    top: 8%;
    left: 5%;
    max-width: 34%;
    margin: 0;
    pointer-events: none;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000;
}

.game__credits[hidden] {
    display: none;
}

.game__credits span {
    display: block;
}

.game__credits-small {
    color: var(--g-hot);
    font-size: max(16px, calc(var(--px) * 6px));
}

.game__credits-big {
    color: #fff;
    font-size: max(20px, calc(var(--px) * 9px));
    line-height: 0.95;
}

.game .game__skipintro {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 2;
    padding: 2px 10px;
    background: rgba(10, 8, 18, 0.75);
    box-shadow: inset 0 0 0 2px var(--g-line);
    color: var(--g-verb);
    font-size: 19px;
}

.game .game__skipintro:hover {
    color: var(--g-hot);
}

.game__skipintro[hidden] {
    display: none;
}

.game__menu {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.game__menu[hidden] {
    display: none;
}

/* Menu joins the top bar once you've gone in past the title screen */
.is-title .game__tool--inside {
    display: none;
}

/* By day (the title screen's day, as it goes by) the subtitle sits on a pale sky, so outline it */
.game.is-day .game__lockup .game__subtitle {
    color: #fff;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 2px 2px 0 #000;
}

/* The pause menu */
.game__pause {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

.game__dialog-title + .game__pause {
    margin-top: 10px;
}

.game .game__menu-item {
    padding: 2px 16px;
    color: var(--g-verb);
    font-size: 28px;
}

.game .game__menu-item:hover,
.game .game__menu-item:focus-visible {
    color: var(--g-hot);
    outline: none;
}

.game .game__menu-item::before,
.game .game__menu-item::after {
    visibility: hidden;
}

.game .game__menu-item::before {
    content: '▸ ';
}

.game .game__menu-item::after {
    content: ' ◂';
}

.game .game__menu-item:hover::before,
.game .game__menu-item:hover::after,
.game .game__menu-item:focus-visible::before,
.game .game__menu-item:focus-visible::after {
    visibility: visible;
}

/* ---------- Sentence line, verbs and inventory ---------- */

.game__sentence {
    flex: none;
    width: 100%;
    margin: 0;
    padding: 4px 16px 2px;
    color: var(--g-sentence);
    font-size: 24px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game__panel {
    position: relative;
    flex: none;
    width: 100%;
    max-width: 960px;
    height: 124px;
    padding: 4px 16px 10px;
}

.game__ui {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 16px;
    height: 100%;
}

.game__ui.is-hidden {
    visibility: hidden;
}

.game__verbs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 1fr;
}

.game .game__verb {
    color: var(--g-verb);
    font-size: 26px;
    text-align: left;
    padding: 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game .game__verb:hover,
.game .game__verb.is-default {
    color: var(--g-hot);
}

.game .game__verb[aria-pressed="true"] {
    color: var(--g-verb-on);
    background: #2a2342;
}

.game__inventory {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
}

.game__inventory li {
    min-height: 0;
    background: var(--g-panel);
    box-shadow: inset 0 0 0 2px var(--g-line);
}

.game .game__item {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    padding: 4px;
}

.game .game__item:hover {
    background: #2a2342;
}

/* Held for Use or Give: it glows until it's used */
.game .game__item.is-held {
    background: #3a2f5a;
    box-shadow: inset 0 0 0 2px var(--g-hot);
}

.game .game__item {
    touch-action: none;
}

/* A thing being dragged, under the pointer */
.game__drag {
    position: fixed;
    z-index: 30;
    width: 48px;
    height: 36px;
    object-fit: contain;
    image-rendering: pixelated;
    pointer-events: none;
    transform: translate(-50%, -60%);
    filter: drop-shadow(2px 2px 0 #000);
}

.game__item img {
    width: 100%;
    max-width: 64px;
    height: 100%;
    max-height: 48px;
    object-fit: contain;
    image-rendering: pixelated;
}

.game__choices {
    /* Exactly the panel's box, in place of the verbs, so nothing moves or changes size; many
       options scroll inside it */
    position: absolute;
    inset: 0;
    z-index: 2;
    margin: 0;
    padding: 8px 16px 10px;
    background: var(--g-bg);
    border-top: 2px solid var(--g-line);
    list-style: none;
    overflow-y: auto;
    columns: 2;
    column-gap: 24px;
}

.game__choices[hidden] {
    display: none;
}

.game__choices li {
    break-inside: avoid;
}

.game .game__choice {
    display: block;
    width: 100%;
    padding: 1px 0;
    color: var(--g-choice);
    /* As big as the verbs on a desktop, and bigger on a bigger screen; smaller, if there are too
       many to fit the panel (--choice-size, set by fitChoices) */
    font-size: var(--choice-size, max(26px, calc(var(--px) * 7.5px)));
    text-align: left;
}

.game .game__choice.is-asked {
    color: var(--g-asked);
}

.game .game__choice:hover,
.game .game__choice:focus-visible {
    color: var(--g-hot);
}

/* While the talking's being done, the choices go (keeping their place, so nothing moves) */
.game__choices.is-waiting {
    visibility: hidden;
}

/* ---------- Modals ---------- */

.game__modal {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(10, 8, 18, 0.7);
}

.game__modal[hidden] {
    display: none;
}

.game__dialog {
    width: min(100%, 420px);
    max-height: 100%;
    overflow-y: auto;
    padding: 18px 20px;
    background: #1c1630;
    box-shadow: 0 0 0 2px #000, 0 0 0 4px #5a4f8a, 8px 8px 0 4px #000;
    color: #e9e4ff;
    font-size: 21px;
}

.game__dialog p {
    margin: 0 0 10px;
}

.game__dialog a {
    color: var(--g-sentence);
}

.game__dialog a:hover {
    color: var(--g-hot);
}

.game__dialog-title {
    color: var(--g-hot);
    font-size: 28px;
}

.game__label {
    display: block;
    margin-bottom: 4px;
    color: var(--g-sentence);
}

.game__input {
    width: 100%;
    padding: 6px 8px;
    border: 0;
    background: #0a0812;
    box-shadow: inset 0 0 0 2px #5a4f8a;
    color: #fff;
    font: inherit;
    font-size: 22px;
}

.game__error {
    margin-top: 8px !important;
    color: #ff8a7a;
}

.game__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0 10px;
}

.game .game__button {
    padding: 4px 14px;
    background: #2a2342;
    box-shadow: inset 0 0 0 2px #5a4f8a;
    color: #fff;
}

.game .game__button:hover {
    color: var(--g-hot);
}

.game .game__button--primary {
    background: #232e54;
    box-shadow: inset 0 0 0 2px #5ab7f2;
}

.game .game__button:disabled {
    opacity: 0.7;
    cursor: wait;
}

.game__small {
    color: #a9a0cc;
    font-size: 19px;
}

.game__help {
    margin: 0;
    padding-left: 1.1em;
    list-style: square;
}

.game__help li {
    margin-bottom: 6px;
}

.game__help b {
    color: var(--g-verb);
    font-weight: normal;
}

/* A fight's moves, from the pause menu: what to press, by name */
.game__moves {
    width: 100%;
    margin: 0 0 10px;
    border-collapse: collapse;
    font-size: 19px;
    line-height: 1.15;
}

.game__moves caption {
    padding: 6px 0 2px;
    color: var(--g-hot);
    text-align: left;
}

.game__moves th {
    width: 38%;
    padding: 2px 10px 2px 0;
    color: var(--g-verb);
    font-weight: normal;
    text-align: left;
    vertical-align: top;
}

.game__moves td {
    padding: 2px 0;
    overflow-wrap: anywhere;
}

/* ---------- Phones ---------- */

@media (max-width: 699px) {
    .game {
        font-size: 20px;
    }

    .game__bar {
        padding: 6px 12px;
    }

    .game__brand {
        font-size: 21px;
    }

    .game__room {
        display: none;
    }

    .game .game__tool {
        padding: 2px 8px;
        font-size: 18px;
    }

    .game__sentence {
        padding: 6px 12px 4px;
        font-size: 21px;
    }

    .game__body {
        justify-content: flex-start;
        padding-top: 12px;
    }

    .game__panel {
        height: 220px;
        padding: 4px 12px 12px;
    }

    .game__ui {
        grid-template-columns: 1fr;
        grid-template-rows: 3fr 2fr;
        gap: 10px;
    }

    .game .game__verb {
        font-size: 23px;
        text-align: center;
        box-shadow: inset 0 0 0 1px var(--g-line);
    }

    .game__choices {
        columns: 1;
        padding: 6px 12px 12px;
    }

    .game .game__choice {
        padding: 4px 0;
        font-size: var(--choice-size, 21px);
        border-bottom: 1px solid var(--g-line);
    }
}

/* Narrow phones: keep the TT mark, drop the name so the tools fit */
@media (max-width: 420px) {
    .game__name {
        display: none;
    }
}

/* Landscape phones: verbs beside the inventory, kept short */
@media (max-height: 500px) and (min-width: 600px) {
    .game__panel {
        height: 96px;
    }

    .game .game__verb {
        font-size: 21px;
    }
}

/* Portrait phones: a zoomed, scrolling scene with big thumb-sized controls (sized in js/game.js) */
.is-portrait .game__body {
    justify-content: flex-start;
    padding-top: 0;
}

.is-portrait .game__sentence {
    padding: 8px 12px 6px;
}

.is-portrait .game__ui {
    grid-template-rows: 3fr 2fr;
    gap: 12px;
}

.is-portrait .game__verbs {
    gap: 4px;
}

.game.is-portrait .game__verb {
    font-size: 25px;
    background: var(--g-panel);
}

.game.is-portrait .game__verb[aria-pressed="true"] {
    background: #2a2342;
}

.is-portrait .game__credits {
    max-width: 80%;
}

.is-portrait .game__menu {
    gap: 10px;
}

.game.is-portrait .game__menu-item {
    font-size: 32px;
}

@media (prefers-reduced-motion: reduce) {
    .game__stage {
        transition: none;
    }


    .game__pan span {
        animation: none;
    }
}

/* ---------- Fights (js/engine/combat.js) ---------- */

/* In a fight the verbs and the sentence give way to the pad, and the stage keeps its own cursor */
.is-fighting .game__sentence,
.is-fighting .game__ui {
    visibility: hidden;
}

.is-fighting .game__hotspots,
.is-fighting .game__pan {
    display: none;
}

.is-fighting .game__stage,
.is-fighting.is-busy .game__stage {
    cursor: default;
}

/* Bars along the top of the stage: Chud's on the left, whoever he's fighting on the right */
.game__hud {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    --hud: max(13px, calc(var(--px) * 4.6px));
}

.game__hud[hidden],
.game__hud [hidden],
.game__defeat[hidden] {
    display: none;
}

.game__hud-side {
    position: absolute;
    top: 4%;
    width: 38%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: var(--hud);
    line-height: 1;
    text-shadow: 2px 2px 0 #000;
}

.game__hud-side--chud {
    left: 2.5%;
}

.game__hud-side--foe {
    right: 2.5%;
    align-items: flex-end;
    text-align: right;
}

.game__hud-name {
    color: #fff;
    font-size: calc(var(--hud) * 1.15);
}

.game__hud-bar {
    position: relative;
    display: block;
    width: 100%;
    height: calc(var(--hud) * 0.62);
    background: #1a0e10;
    box-shadow: 0 0 0 2px #000, inset 0 0 0 1px #5a3a3a;
    overflow: hidden;
}

.game__hud-bar i {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    background: repeating-linear-gradient(90deg, #e8433c 0 6px, #c8302c 6px 8px);
    transition: width 0.12s linear;
}

.game__hud-side--foe .game__hud-bar i {
    left: auto;
    right: 0;
    background: repeating-linear-gradient(90deg, #e8a63c 0 6px, #c8862c 6px 8px);
}

.game__hud-side--foe.is-boss .game__hud-bar {
    height: calc(var(--hud) * 0.8);
}

.game__hud-side--foe.is-boss .game__hud-bar i {
    background: repeating-linear-gradient(90deg, #a84ae8 0 6px, #7a2ac8 6px 8px);
}

.game__hud-side.is-low .game__hud-bar--hp {
    animation: game-low 0.6s steps(2) infinite;
}

@keyframes game-low {
    50% { box-shadow: 0 0 0 2px #ff3a3a, inset 0 0 0 1px #5a3a3a; }
}

.game__hud-bar--ki {
    width: 70%;
    height: calc(var(--hud) * 0.38);
}

.game__hud-bar--ki i {
    background: linear-gradient(90deg, #8ad0ff, #ffe2a8);
}

.game__hud-side.is-full .game__hud-bar--ki i {
    background: repeating-linear-gradient(90deg, #ffe2a8 0 4px, #ffffff 4px 8px);
    animation: game-ki 0.4s steps(2) infinite;
}

@keyframes game-ki {
    50% { filter: brightness(1.5); }
}

/* The three stances, the one held lit */
.game__hud-stance {
    display: flex;
    gap: 0.5em;
    margin-top: 1px;
    font-size: calc(var(--hud) * 0.85);
}

.game__hud-stance b {
    font-weight: normal;
    color: #6a5a62;
}

.game__hud-stance b.is-on {
    color: var(--g-hot);
}

/* FIGHT!, a combo's name, VICTORY: big, in the middle, punched in */
.game__hud-banner {
    position: absolute;
    top: 30%;
    left: 0;
    right: 0;
    margin: 0;
    color: #fff;
    font-size: calc(var(--hud) * 2.4);
    text-align: center;
    letter-spacing: 0.06em;
    text-shadow: 3px 3px 0 var(--g-red), 6px 6px 0 #000;
}

.game__hud-banner.is-in {
    animation: game-banner 0.35s ease-out;
}

@keyframes game-banner {
    0% { transform: scale(2.2); opacity: 0; }
    60% { transform: scale(0.94); opacity: 1; }
    100% { transform: scale(1); }
}

.game__hud-combo {
    position: absolute;
    top: 22%;
    left: 3%;
    margin: 0;
    color: var(--g-hot);
    font-size: calc(var(--hud) * 1.5);
    text-shadow: 2px 2px 0 #000;
}

/* The tutorial's hint, low in the middle */
.game__hud-hint {
    position: absolute;
    bottom: 4%;
    left: 10%;
    right: 10%;
    margin: 0;
    padding: 2px 8px;
    background: rgba(12, 10, 16, 0.72);
    color: #fff;
    font-size: var(--hud);
    text-align: center;
    box-shadow: inset 0 0 0 1px #5a3a3a;
}

/* Beaten: another go, or back off */
.game__defeat {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(40, 6, 8, 0.55);
}

.game__defeat-title {
    margin: 0 0 6px;
    color: #fff;
    font-size: max(30px, calc(var(--px) * 13px));
    text-shadow: 3px 3px 0 var(--g-red), 6px 6px 0 #000;
}

.game__defeat-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* The pad: a thumb's worth of buttons, moves on the left and cuts on the right. On a desktop it
   shows the keys too */
.game__pad {
    position: absolute;
    inset: 4px 16px 10px;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: 16px;
    touch-action: none;
}

.game__pad[hidden] {
    display: none;
}

.game__pad-move {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
}

.game__pad-acts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 4px;
}

.game .game__pad-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    background: var(--g-panel);
    box-shadow: inset 0 0 0 2px var(--g-line);
    color: var(--g-verb);
    font-size: 24px;
    line-height: 1;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.game .game__pad-btn small {
    margin-top: 2px;
    color: #7a6a70;
    font-size: 16px;
}

.game .game__pad-btn:hover,
.game .game__pad-btn.is-down {
    color: var(--g-hot);
    background: #2a1e24;
}

.game .game__pad-btn--high,
.game .game__pad-btn--low {
    color: #ff8a7a;
}

.game .game__pad-btn--special.is-ready {
    color: #fff;
    background: #5a3a12;
    box-shadow: inset 0 0 0 2px var(--g-hot);
    animation: game-ki 0.4s steps(2) infinite;
}

@media (pointer: coarse) {
    .game .game__pad-btn small {
        display: none;
    }
}

@media (max-width: 699px) {
    .game__pad {
        inset: 4px 12px 12px;
        gap: 10px;
    }

    .game__pad-move {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .game .game__pad-btn {
        font-size: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .game__hud-banner.is-in,
    .game__hud-side.is-low .game__hud-bar--hp,
    .game__hud-side.is-full .game__hud-bar--ki i,
    .game .game__pad-btn--special.is-ready {
        animation: none;
    }
}

/* ---------- The painted art (js/art.js) ----------
 * A quiet navy frame for the cobalt and amber paintings: the panel, verbs and things carried
 * (each with its name under it), the title lockup, and the loading screen while the art loads
 * (#art-loading, in index.html). Smoothed, not crisp: the paintings are drawn at four times the
 * room's pixels.
 */
:root {
    color-scheme: dark;
}

body {
    background: #050b18;
}

.game {
    --g-bg: #070e20;
    --g-panel: #0b1930;
    --g-line: #243d62;
    --g-verb: #dac39a;
    --g-hot: #ffd17a;
    --g-choice: #c5ddf5;
    --g-sentence: #efd3a0;
    background: radial-gradient(ellipse at 50% 0,#13213a 0,#070d1b 75%);
    font-family: 'VT323',monospace;
}

.game__bar {
    padding: 12px 22px;
    border-bottom: 1px solid #33455e;
    background: #081224;
    min-height: 32px;
}

.game__brand {
    gap: 12px;
    font-size: 25px;
}

.game__name {
    letter-spacing: 1px;
    color: #f3d8a7;
}

.game__mark {
    background: #ac512a;
    box-shadow: inset 0 0 0 1px #edbb6f;
    width: 30px;
    height: 30px;
}

.game__room {
    font-size: 20px;
    color: #9daec7;
}

.game .game__tool {
    font-size: 19px;
    padding: 6px 13px;
    border: 1px solid #32435c;
    border-radius: 3px;
    color: #bdcadd;
}

.game .game__tool:hover {
    background: #1c2b43;
    color: #ffdb9a;
    border-color: #8a795c;
}

.game__body {
    padding-top: 8px;
}

.game__stage {
    box-shadow: 0 0 0 1px #2b456a,0 8px 32px #0009;
}

.game__canvas {
    image-rendering: auto;
}

.game__canvas--still {
    image-rendering: auto;
}

.game__sentence {
    box-sizing: border-box;
    font-size: 26px;
    line-height: 1.2;
    padding: 11px 16px 8px;
    min-height: 50px;
    text-shadow: 0 2px 2px #000;
}

.game__panel {
    box-sizing: border-box;
    max-width: 1280px;
    height: 158px;
    padding: 10px 24px 18px;
    border-top: 1px solid #3a4c67;
    background: linear-gradient(180deg,#101b30,#080f21);
}

.game__ui {
    grid-template-columns: minmax(0,1fr) minmax(0,1.1fr);
    gap: 28px;
}

.game__verbs {
    gap: 5px 8px;
}

.game .game__verb {
    font-size: 25px;
    padding: 3px 13px;
    border: 1px solid transparent;
    border-radius: 3px;
}

.game .game__verb:hover {
    border-color: #394e6d;
    background: #182941;
}

.game .game__verb[aria-pressed=true] {
    background: #243853;
    border-color: #d5a55e;
    color: #ffe4b3;
}

.game__inventory {
    gap: 9px;
    grid-template-columns: repeat(4,minmax(0,1fr));
    padding: 0;
}

.game__inventory li {
    border: 1px solid #405675;
    border-radius: 4px;
    box-shadow: inset 0 0 0 3px #080f21;
    background: radial-gradient(ellipse at center,#1a2c49,#0b1528);
}

.game .game__item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    justify-content: center;
    padding: 4px;
    box-sizing: border-box;
    overflow: hidden;
}

.game__item img {
    height: 38px;
    max-height: 38px;
    max-width: 72px;
    filter: drop-shadow(0 3px 3px #0008);
}

.game__item-label {
    font-size: 17px;
    line-height: .95;
    color: #dac9a8;
    text-align: center;
}

.game .game__item:hover {
    background: #223b58;
}

.game__choices {
    background: #0b1528;
    border-top: 1px solid #5f718b;
    padding: 9px 24px;
}

.game .game__choice {
    font-size: clamp(22px,2vw,28px);
    line-height: 1.15;
    padding: 3px;
}

.game__dialog {
    background: linear-gradient(145deg,#15253d,#080f20);
    border: 1px solid #ab8e5b;
    box-shadow: 0 20px 80px #000b;
}

.game__speech {
    font-size: clamp(21px,2.3vw,32px);
    --o: 3px;
    --h: 1px;
    line-height: 1.15;
}

.game__lockup {
    left: 43%;
    right: 3%;
    top: 15%;
    text-align: center;
}

.game__lockup .game__title {
    font-family: Georgia,'Times New Roman',serif;
    font-weight: 900;
    letter-spacing: .04em;
    font-size: clamp(36px,6.5vw,100px);
    line-height: .89;
    color: #ffe2a4;
    text-shadow: 0 3px 0 #683c22,0 5px 0 #271c21,2px 7px 15px #000;
}

.game__lockup .game__subtitle {
    font-size: clamp(20px,2.3vw,32px);
    color: #fff0d2;
    margin-top: 22px;
    text-shadow: 0 2px 5px #000;
}

.game__chapter {
    font-size: clamp(16px,1.7vw,24px);
    margin-top: 12px;
    color: #f3c477;
}

.game .game__menu-item {
    font-size: 28px;
    padding: 10px 32px;
    color: #ffe0a5;
    border: 1px solid #97713f;
    background: linear-gradient(#26344b,#101b2d);
    border-radius: 3px;
    min-width: 210px;
    box-shadow: 0 4px 12px #0008;
}

.game .game__menu-item:hover {
    background: #2c405d;
    border-color: #ffd797;
}

.game__menu {
    flex-direction: row;
    gap: 18px;
}

.is-title .game__panel {
    border-top: 0;
    background: transparent;
}

.game__pan {
    backdrop-filter: blur(6px);
}

.game .game__skipintro {
    border: 1px solid #a28c61;
    border-radius: 3px;
    padding: 8px 14px;
    background: #0a1428db;
}

.game__hp.game__ki {
    box-shadow: 0 2px 8px #0008;
}

.game__pad {
    background: #0c162a;
}

.game .game__button {
    border-radius: 3px;
}

.game__hotspot:focus-visible {
    outline: 2px solid #ffe0a0!important;
    background: #ffd47718;
}

.game__credits {
    max-width: 40%;
    background: #0814269c;
    padding: 12px 16px;
    border-left: 2px solid #efc675;
}

/* Two rows of things on a wide screen: a name a line each */
@media (min-width: 701px) {
    .game__item-label {
        white-space: nowrap;
    }
}

#art-loading {
    position: fixed;
    inset: 0;
    display: grid;
    place-content: center;
    text-align: center;
    background: #071021;
    color: #efcea0;
    font: 24px Georgia,serif;
    letter-spacing: 4px;
    z-index: 9999;
}

#art-loading small {
    font: 14px monospace;
    color: #a0b4d0;
    letter-spacing: 1px;
    margin-top: 16px;
}

@media (max-width: 700px) {
    .game__bar {
        padding: 8px 10px;
    }
    .game__name {
        font-size: 20px;
    }
    .game__room {
        display: none;
    }
    .game__tools {
        gap: 4px;
    }
    .game .game__tool {
        padding: 5px 8px;
    }
    .game__panel {
        padding: 8px 10px 12px;
        height: 174px;
    }
    .game__ui {
        gap: 10px;
        grid-template-columns: 1fr 1fr;
    }
    .game .game__verb {
        font-size: 22px;
        padding: 2px 4px;
    }
    .game__inventory {
        gap: 4px;
        grid-template-columns: repeat(2,minmax(0,1fr));
    }
    .game__item-label {
        font-size: 14px;
    }
    .game__item img {
        height: 34px;
    }
    .game .game__item {
        padding: 3px;
        gap: 3px;
    }
    .game__sentence {
        font-size: 22px;
        min-height: 42px;
        padding: 8px;
    }
    .game__lockup {
        top: 20%;
        left: 38%;
        right: 2%;
    }
    .game__lockup .game__title {
        font-size: clamp(26px,8vw,55px);
    }
    .game__lockup .game__subtitle {
        font-size: 18px;
        margin-top: 14px;
    }
    .game__chapter {
        font-size: 16px;
    }
    .game__menu {
        gap: 9px;
    }
    .game .game__menu-item {
        font-size: 23px;
        min-width: 140px;
        padding: 8px 16px;
    }
    .game__speech {
        font-size: 21px;
    }
    .game__choices {
        padding: 8px 12px;
    }
    .game .game__choice {
        font-size: 22px;
    }
    .game__credits {
        max-width: 55%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .game__stage {
        transition: none;
    }
}

.game__item img {
    image-rendering: auto;
}

@media (max-width: 700px) {
    .game.is-portrait .game__ui {
        grid-template-columns: 1fr;
        grid-template-rows: 135px minmax(80px,1fr);
        gap: 10px;
    }
    .game.is-portrait .game__inventory {
        grid-template-columns: repeat(4,minmax(0,1fr));
        grid-auto-rows: minmax(80px,1fr);
    }
    .game.is-portrait .game__verb {
        font-size: 23px;
        padding: 5px 10px;
    }
    .game.is-portrait .game__item img {
        height: 48px;
        max-height: 48px;
    }
    .game.is-portrait .game__item-label {
        font-size: 16px;
    }
    .game.is-portrait .game__choices {
        columns: 1;
    }
    .game.is-portrait .game__name {
        display: inline;
        font-size: 18px;
    }
}
