/* Hollow County: page shell, loader, run results and the tuning desk. */

:root {
    --ink: #f4ecd8;
    --dim: #a7a293;
    --night: #0b0d16;
    --panel: rgba(18, 18, 28, 0.94);
    --edge: #e9dcb8;
    --gold: #f2ba3b;
    --red: #ef4b3c;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: var(--night);
    color: var(--ink);
    font: 13px/1.5 var(--mono);
    /* (On a phone: no double-tap zoom, no pinch, no rubber band.) */
    touch-action: none;
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}
/* Nothing to select or call a menu up on, save a box to type in (a long
   press on a phone would otherwise lift a word out and stall the game). */
* { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, select, #admin, #admin * { -webkit-user-select: text; user-select: text; }

/* The screen there is to see (dvh: a phone's browser bars taken off), edge
   to edge: the HUD keeps clear of a phone's notch itself (Hud.inset). */
#world {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: block;
    image-rendering: pixelated;
    cursor: crosshair;
}
body:not(.playing) #world { cursor: default; }

/* ---------------------------------------------------------------- loader */

#loader, #gate, #install, #results {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: radial-gradient(ellipse at 50% 60%, #1b2a3a 0%, #0b0d16 70%);
    transition: opacity 0.6s ease, visibility 0.6s;
    z-index: 10;
}
#loader { background: #07080b; }
#loader.ready { background: rgba(7, 8, 11, 0.85); }
#loader.gone { opacity: 0; visibility: hidden; pointer-events: none; }
#gate[hidden], #install[hidden], #results[hidden], #loader[hidden], #loader [hidden] { display: none; }

.card {
    width: min(460px, 88vw);
    max-height: 96vh;
    overflow-y: auto;
    padding: 28px 30px 24px;
    border: 2px solid var(--edge);
    background: var(--panel);
    box-shadow: 4px 4px 0 #05060a;
    text-align: center;
}
.card h1 {
    margin: 0 0 6px;
    font-size: 22px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold);
}
.card .lede { margin: 0 0 18px; color: var(--dim); }

.bar {
    height: 8px;
    border: 2px solid var(--edge);
    background: #0d0e15;
    overflow: hidden;
}
.bar span {
    display: block;
    height: 100%;
    background: repeating-linear-gradient(90deg, var(--gold) 0 6px, #d99a22 6px 12px);
    transform-origin: left center;
    transform: scaleX(0.02);
    transition: transform 0.25s steps(8);
}
/* The loader is bare: a thin bar and a line of text. */
.boot { width: min(220px, 70vw); text-align: center; }
.boot .bar { height: 2px; border: 0; background: rgba(233, 220, 184, 0.12); }
.boot .bar span { background: var(--dim); }
#loader-stage { margin: 10px 0 0; min-height: 1.5em; color: var(--dim); font-size: 11px; letter-spacing: 0.04em; }
#loader.failed #loader-stage { color: #ef6f5c; }
#loader.ready .bar { display: none; }

#again, #to-menu {
    margin: 16px auto 4px;
    padding: 9px 22px;
    font: 700 14px var(--mono);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #14131a;
    background: var(--gold);
    border: 2px solid #14131a;
    box-shadow: 3px 3px 0 #05060a;
    cursor: pointer;
}
#again:hover { background: #ffd062; }
#to-menu.quiet { color: var(--ink); background: #262635; border-color: var(--edge); }
#to-menu.quiet:hover { background: #34344a; }
#again:active, #to-menu:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #05060a; }

/* --------------------------------------------------------- phone screens */
/* (html.phone, and .app from the home screen or .browser in one; .ios or
   .android for the steps: main.js.) */

.card, #results { touch-action: pan-y; }
html:not(.ios) .steps.ios, html.ios .steps.android { display: none !important; }
html.app .browser-only, html:not(.app) .app-only { display: none; }

/* The steps, a number and a picture each. */
.steps { margin: 0; padding: 0; list-style: none; text-align: left; }
.steps li { display: grid; grid-template-columns: 22px 34px 1fr; align-items: center; gap: 10px; padding: 7px 0; }
.steps li + li { border-top: 1px solid rgba(233, 220, 184, 0.1); }
.steps .n {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    background: var(--gold);
    color: #241906;
    font-weight: 700;
    font-size: 12px;
    box-shadow: 2px 2px 0 #05060a;
}
.steps .t { color: var(--dim); font-size: 13px; line-height: 1.35; }
.steps .t b { color: var(--ink); }
.steps small { display: block; color: rgba(167, 162, 147, 0.7); font-size: 11px; }
.steps .ico { position: relative; justify-self: center; width: 30px; height: 30px; color: #6fb3ff; }
.steps img.ico { border-radius: 7px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); image-rendering: pixelated; }
/* Safari's Share mark: a box with an arrow up out of it. */
.steps .ico.share::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 11px;
    width: 14px;
    height: 13px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 2px;
}
.steps .ico.share::after {
    content: "";
    position: absolute;
    left: 14px;
    top: 3px;
    width: 2px;
    height: 14px;
    background: currentColor;
    box-shadow: -2px 2px 0 -0px currentColor, 2px 2px 0 0 currentColor;
}
/* Add to Home Screen: a plus in a rounded square. */
.steps .ico.add::before {
    content: "";
    position: absolute;
    inset: 5px;
    border: 2px solid var(--ink);
    border-radius: 5px;
}
.steps .ico.add::after {
    content: "+";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--ink);
    font: 700 17px/1 var(--mono);
}
/* A browser's menu: three dots. */
.steps .ico.dots::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 6px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--ink);
    box-shadow: 0 7px 0 var(--ink), 0 14px 0 var(--ink);
}

/* --- Held upright: the Keeper in the dark, his lantern, the eyes. */
#upright {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: none;
    overflow: hidden;
    background: #05060a;
    color: var(--ink);
}
@media (orientation: portrait) {
    html.phone #upright { display: block; }
}
/* (From the home screen, iOS lays the page out from the top of the screen,
   under the clock, but a fixed layer still stops the clock's height short of
   the bottom: it goes on down that far.) */
html.app #upright { bottom: calc(-1 * env(safe-area-inset-top, 0px)); }
/* The picture (the game's own, 240 x 520 pixels) covering the screen, and
   what's put on it placed in its own terms (% of it). */
#upright .art {
    /* (Filling the screen, cropped to it: the picture's own shape is a phone's, so
       what's put on it in its terms still lands where it should.) */
    position: absolute;
    inset: 0;
    background: url(../img/keeper-night.png) 50% 50% / cover no-repeat;
    image-rendering: pixelated;
    animation: breathe 14s ease-in-out infinite alternate;
}
@keyframes breathe { from { transform: scale(1.02); } to { transform: translateY(-1%) scale(1.07); } }
/* (In a browser the steps take the foot of the screen: the picture rides up
   so he and his lantern stand just over them.) */
html.browser #upright .art { top: -17%; bottom: 17%; }
html.browser #upright .logo { width: min(58vw, 266px); }
/* His lantern: warm, and never quite still. */
#upright .glow {
    position: absolute;
    left: 51.7%;
    top: 71.2%;
    width: 70%;
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 214, 140, 0.55) 0, rgba(255, 170, 80, 0.22) 14%, rgba(255, 140, 60, 0.07) 34%, transparent 62%);
    mix-blend-mode: screen;
    animation: flicker 3.1s steps(1) infinite;
}
@keyframes flicker {
    0%, 100% { opacity: 1; }
    17% { opacity: 0.86; }
    23% { opacity: 0.97; }
    48% { opacity: 0.8; }
    52% { opacity: 0.95; }
    77% { opacity: 0.88; }
}
/* Eyes in the trees: a pair at a time, opening and gone again. */
#upright .eyes {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 1.25%;
    height: 0.2%;
    opacity: 0;
    background: linear-gradient(90deg, #ff4a3a 0 33.4%, transparent 33.4% 66.6%, #ff4a3a 66.6%);
    filter: drop-shadow(0 0 3px rgba(255, 60, 40, 0.9));
    animation: eyes 12s var(--d) infinite;
}
@keyframes eyes {
    0%, 62%, 100% { opacity: 0; }
    66% { opacity: 1; }
    80% { opacity: 1; }
    81% { opacity: 0; }
    82% { opacity: 1; }
    92% { opacity: 0.8; }
}
/* Mist along the ground, two banks drifting past each other. */
#upright .fog {
    position: absolute;
    left: -50%;
    width: 200%;
    height: 34%;
    bottom: 12%;
    background: radial-gradient(ellipse at 30% 60%, rgba(150, 170, 210, 0.16), transparent 60%), radial-gradient(ellipse at 75% 40%, rgba(150, 170, 210, 0.12), transparent 55%);
    animation: drift 38s linear infinite alternate;
    pointer-events: none;
}
#upright .fog.two { bottom: 24%; height: 26%; opacity: 0.7; animation-duration: 52s; animation-direction: alternate-reverse; }
@keyframes drift { from { transform: translateX(-12%); } to { transform: translateX(12%); } }
/* Motes off the lantern, rising and going out. */
#upright .motes i {
    position: absolute;
    left: var(--x, 50%);
    bottom: 26%;
    width: 3px;
    height: 3px;
    background: #ffcf7a;
    box-shadow: 0 0 6px #ffb347;
    opacity: 0;
    animation: mote 7s var(--d, 0s) linear infinite;
}
#upright .motes i:nth-child(1) { --x: 46%; --d: 0s; }
#upright .motes i:nth-child(2) { --x: 55%; --d: 1.3s; }
#upright .motes i:nth-child(3) { --x: 50%; --d: 2.1s; }
#upright .motes i:nth-child(4) { --x: 41%; --d: 3.4s; }
#upright .motes i:nth-child(5) { --x: 60%; --d: 4.2s; }
#upright .motes i:nth-child(6) { --x: 52%; --d: 5s; }
#upright .motes i:nth-child(7) { --x: 37%; --d: 5.9s; }
#upright .motes i:nth-child(8) { --x: 64%; --d: 6.5s; }
#upright .motes i:nth-child(9) { --x: 48%; --d: 2.8s; }
#upright .motes i:nth-child(10) { --x: 57%; --d: 4.7s; }
@keyframes mote {
    0% { opacity: 0; transform: translate(0, 0); }
    12% { opacity: 0.9; }
    50% { transform: translate(14px, -18vh); }
    80% { opacity: 0.5; }
    100% { opacity: 0; transform: translate(-10px, -34vh); }
}
/* Dark round the edges, deeper at the top (the name) and the foot (the words). */
#upright .shade {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(5, 6, 10, 0.85) 0%, rgba(5, 6, 10, 0) 26%, rgba(5, 6, 10, 0) 52%, rgba(5, 6, 10, 0.92) 82%),
        radial-gradient(ellipse at 50% 58%, transparent 40%, rgba(0, 0, 0, 0.6) 100%);
}
/* (From the home screen there's only the one line at the foot: he stays lit.) */
html.app #upright .shade {
    background:
        linear-gradient(180deg, rgba(5, 6, 10, 0.85) 0%, rgba(5, 6, 10, 0) 24%, rgba(5, 6, 10, 0) 74%, rgba(5, 6, 10, 0.92) 96%),
        radial-gradient(ellipse at 50% 62%, transparent 38%, rgba(0, 0, 0, 0.6) 100%);
}
#upright header {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 6vh);
    left: 0;
    right: 0;
    text-align: center;
}
#upright .logo {
    width: min(68vw, 304px);
    image-rendering: pixelated;
    filter: drop-shadow(0 0 18px rgba(239, 75, 60, 0.35));
    animation: rise 1.2s ease-out both;
}
@keyframes rise { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
#upright .kicker {
    margin: 10px 0 0;
    color: var(--gold);
    font-size: 11px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    opacity: 0.85;
    animation: rise 1.2s 0.3s ease-out both;
}
/* In a browser: how to put it on the home screen, on dark glass. */
#upright .howto {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
    padding: 16px 16px 10px;
    border: 1px solid rgba(233, 220, 184, 0.22);
    background: rgba(10, 10, 18, 0.72);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: rise 1s 0.5s ease-out both;
}
html.app #upright .howto { display: none; }
#upright h2 { margin: 0 0 4px; color: var(--gold); font-size: 14px; letter-spacing: 0.16em; text-transform: uppercase; }
#upright .why { margin: 0 0 8px; color: var(--dim); font-size: 12px; line-height: 1.4; }
.install-now {
    width: 100%;
    margin: 6px 0 4px;
    padding: 10px;
    border: 2px solid #14131a;
    background: var(--gold);
    color: #14131a;
    font: 700 13px var(--mono);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    box-shadow: 3px 3px 0 #05060a;
}
/* The foot: a phone turning on its side, and what to do. */
#upright .turn {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 26px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--gold);
    font-size: 13px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    animation: rise 1s 0.8s ease-out both;
}
#upright .turn b { animation: pulse 2.4s ease-in-out infinite; }
html.app #upright .turn { bottom: calc(env(safe-area-inset-bottom, 0px) + 7vh); flex-direction: column; gap: 18px; font-size: 14px; letter-spacing: 0.26em; }
@keyframes pulse { 50% { opacity: 0.55; } }
#upright .phone {
    position: relative;
    width: 20px;
    height: 34px;
    border: 2px solid currentColor;
    border-radius: 5px;
    animation: tilt 2.8s ease-in-out infinite;
}
#upright .phone i { position: absolute; left: 50%; bottom: 2px; width: 6px; height: 2px; margin-left: -3px; background: currentColor; border-radius: 1px; }
html.app #upright .phone { width: 28px; height: 48px; }
@keyframes tilt {
    0%, 20% { transform: rotate(0); }
    50%, 75% { transform: rotate(-90deg); }
    100% { transform: rotate(0); }
}

/* --- ENTER in a phone's browser: put it on the home screen first? */
#install { z-index: 14; background: rgba(5, 6, 10, 0.78); }
#install .card { width: min(560px, 92vw); text-align: left; padding: 18px 22px 14px; }
#install .head { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
#install .head .app { width: 58px; height: 58px; border-radius: 13px; image-rendering: pixelated; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 6px 18px rgba(0, 0, 0, 0.5); }
#install .head .logo { width: 152px; image-rendering: pixelated; display: block; }
#install .lede { margin: 6px 0 0; font-size: 12px; }
#install .steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
#install .steps li { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 4px; padding: 8px 4px; border: 1px solid rgba(233, 220, 184, 0.12); background: rgba(255, 255, 255, 0.02); }
#install .steps li + li { border-top: 1px solid rgba(233, 220, 184, 0.12); }
#install .steps .t { font-size: 11px; }
#install .note { margin: 10px 0 0; color: var(--dim); font-size: 11px; }
#install .buttons { display: flex; justify-content: flex-end; gap: 12px; }
#install .buttons .install-now { width: auto; margin: 12px 0 4px; padding: 9px 22px; }
#install-skip {
    margin: 12px 0 4px;
    padding: 9px 22px;
    font: 700 14px var(--mono);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
    background: #262635;
    border: 2px solid var(--edge);
    box-shadow: 3px 3px 0 #05060a;
}
#install button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #05060a; }
@media (max-height: 500px) {
    .card { padding: 14px 20px 12px; }
    .card .lede { margin-bottom: 8px; }
}

/* --------------------------------------------------------------- results */

#results { background: rgba(11, 13, 22, 0.72); z-index: 12; }
#results h1.lost { color: var(--red); }
#results .rows { margin: 14px 0 6px; text-align: left; }
#results .rows div {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px solid rgba(233, 220, 184, 0.12);
}
#results .rows span { color: var(--dim); }
#results .rows b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
#results .buttons { display: flex; justify-content: center; gap: 12px; }
/* A phone on its side: the rows in two columns, so Again and Menu fit too. */
@media (max-height: 500px) {
    #results .card { width: min(680px, 92vw); }
    #results .rows { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; margin: 8px 0 4px; }
    #results .rows div { padding: 1px 0; }
    #results-reel { margin: 6px 0 2px; }
    #results #results-reel video { width: min(100%, 22vh * 16 / 9); margin: 0 auto; }
    #again, #to-menu { margin-top: 8px; }
}
#results-note { margin: 4px 0 2px; min-height: 1.5em; color: var(--dim); font-size: 11px; }
/* The best kill cam of the run, looping. */
#results-reel { margin: 12px 0 4px; }
#results-reel video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; image-rendering: pixelated; border: 2px solid var(--edge); background: #05060a; }
#results-reel figcaption { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; color: var(--dim); font-size: 11px; text-align: left; }
#results-reel figcaption b { color: var(--gold); font-weight: 600; }
#results-save { padding: 3px 8px; font: 11px var(--mono); color: var(--ink); background: #262635; border: 1px solid var(--edge); cursor: pointer; }
#results-save:hover { background: #34344a; }
#results-unlocks { margin: 10px 0 0; padding: 8px 10px; list-style: none; text-align: left; border: 1px solid var(--gold); }
#results-unlocks li { color: var(--gold); }
#results-unlocks li span { color: var(--dim); }

.noscript { position: fixed; inset: 0; display: grid; place-items: center; }

/* ---------------------------------------------------------- keeper's desk */

#admin {
    position: fixed;
    top: 12px;
    right: 12px;
    bottom: 12px;
    width: 330px;
    overflow-y: auto;
    padding: 12px 14px 16px;
    background: var(--panel);
    border: 2px solid var(--edge);
    box-shadow: 4px 4px 0 #05060a;
    z-index: 20;
    font-size: 12px;
    user-select: none;
}
#admin[hidden] { display: none; }
#admin header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
#admin h2 { margin: 0; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
#admin .hint { color: var(--dim); font-size: 11px; }
#admin header .tools { display: flex; align-items: baseline; gap: 10px; }
#admin header h2, #admin header .tools > * { white-space: nowrap; }
#admin button.reset { min-width: 11ch; }
#admin button.reset.armed { background: #b8483a; color: #fff4ea; border-color: #b8483a; }
#admin section { padding: 8px 0 6px; border-top: 1px solid rgba(233, 220, 184, 0.18); }
#admin h3 { margin: 0 0 6px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
#admin .row { display: grid; grid-template-columns: 104px 1fr 56px; align-items: center; gap: 8px; margin: 3px 0; }
#admin .row.check { grid-template-columns: 18px 1fr; }
#admin .row.chips { display: flex; flex-wrap: wrap; gap: 4px; }
#admin .row.chips .name { width: 100%; color: var(--dim); }
#admin .name { color: var(--ink); }
#admin .name.changed { color: var(--gold); }
#admin .hint.tuned { color: #ef6f5c; }
#admin .io-box { padding-top: 10px; border-top: 1px solid rgba(233, 220, 184, 0.18); }
#admin textarea.io {
    width: 100%;
    margin-top: 6px;
    padding: 6px;
    font: 10.5px/1.4 var(--mono);
    color: var(--ink);
    background: #0d0e15;
    border: 1px solid rgba(233, 220, 184, 0.35);
    resize: vertical;
}
#admin .val { text-align: right; color: var(--gold); font-variant-numeric: tabular-nums; }
#admin input[type="range"] { width: 100%; accent-color: var(--gold); }
#admin input[type="checkbox"] { accent-color: var(--gold); margin: 0; }
#admin button {
    padding: 3px 8px;
    font: 11px var(--mono);
    color: var(--ink);
    background: #262635;
    border: 1px solid rgba(233, 220, 184, 0.35);
    cursor: pointer;
}
#admin button:hover, #admin button.on { background: var(--gold); color: #14131a; border-color: var(--gold); }
#admin .field {
    min-width: 0;
    padding: 3px 6px;
    font: 11px var(--mono);
    color: var(--ink);
    background: #0d0e15;
    border: 1px solid rgba(233, 220, 184, 0.35);
}
#admin .field.miss { border-color: #d0694f; }
#admin .seed { width: 90px; }
#admin .tabs { display: flex; flex-wrap: wrap; gap: 3px; margin: 4px 0 8px; }
#admin .tabs button { flex: 1 0 auto; padding: 4px 6px; }
#admin .pane[hidden] { display: none; }
#admin .row.wide { grid-template-columns: 1fr auto; }
#admin .note { margin: 6px 0 2px; color: var(--dim); font-size: 10.5px; line-height: 1.4; }
#admin .legend { margin: 4px 0 8px; }
#admin .legend .ramp { height: 10px; border: 1px solid rgba(233, 220, 184, 0.25); image-rendering: pixelated; }
#admin .legend .ends { display: flex; justify-content: space-between; margin-top: 2px; color: var(--dim); font-size: 10.5px; }
#admin .stats {
    margin: 8px 0 0;
    padding: 8px;
    font-size: 10.5px;
    line-height: 1.45;
    white-space: pre-wrap;
    color: var(--dim);
    background: #0d0e15;
    border: 1px solid rgba(233, 220, 184, 0.15);
}

/* ------------------------------------------------------- touch controls */
/* (input/touch.js: only on a phone or a tablet, and only in play.) */

#touch {
    position: fixed;
    top: 0;
    left: env(safe-area-inset-left, 0px);
    right: env(safe-area-inset-right, 0px);
    height: 100vh;
    height: 100dvh;
    z-index: 5;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}
#touch[hidden] { display: none; }
/* The buttons by FIRE move in this far when the screen's edge has no notch
   margin for +HP and the gun to stand in (a phone with none, a computer). */
#touch { --shift: max(0px, 36px - env(safe-area-inset-right, 0px)); }
#touch .zone { position: absolute; top: 0; bottom: 0; }
/* (The thumbs' halves reach on under the notch: only the buttons keep clear of it.) */
#touch .zone.left { left: calc(-1 * env(safe-area-inset-left, 0px)); width: calc(45% + env(safe-area-inset-left, 0px)); }
#touch .zone.right { right: calc(-1 * env(safe-area-inset-right, 0px)); width: calc(55% + env(safe-area-inset-right, 0px)); }
#touch .stick {
    position: absolute;
    left: 100px;
    top: calc(100% - 116px);
    width: 136px;
    height: 136px;
    margin: -68px 0 0 -68px;
    border: 2px solid rgba(244, 236, 216, 0.22);
    border-radius: 50%;
    pointer-events: none;
}
#touch .stick.live { border-color: rgba(244, 236, 216, 0.45); background: rgba(7, 8, 11, 0.18); }
#touch .stick i {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 52px;
    height: 52px;
    margin: -26px 0 0 -26px;
    border-radius: 50%;
    background: rgba(244, 236, 216, 0.28);
}
#touch .stick.live i { background: rgba(244, 236, 216, 0.55); }
/* Out past the ring: running. */
#touch .stick.run { border-color: rgba(242, 186, 59, 0.75); }
#touch .stick.run i { background: rgba(242, 186, 59, 0.75); }
/* The buttons: dark glass in the HUD's own cream edge, with a pixel picture
   (input/touch.js ICONS) or a word. */
#touch .pad {
    position: absolute;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    padding: 0;
    border: 2px solid rgba(233, 220, 184, 0.6);
    border-radius: 50%;
    background: rgba(12, 12, 20, 0.5);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
    color: var(--ink);
    font: bold 11px/1 var(--mono);
    letter-spacing: 0.06em;
    touch-action: none;
    transition: opacity 0.15s;
}
#touch .pad svg { display: block; filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.6)); }
#touch .pad.fire { border-color: rgba(239, 75, 60, 0.85); background: rgba(40, 10, 10, 0.45); }
#touch .pad.down { background: rgba(244, 236, 216, 0.32); }
#touch .pad.fire.down { background: rgba(239, 75, 60, 0.4); }
#touch .pad.on { background: rgba(242, 186, 59, 0.42); border-color: var(--gold); color: #fff6dc; }
#touch .pad.view, #touch .pad.pause { border-radius: 8px; }
#touch .pad.use { border-color: var(--gold); color: var(--gold); font-size: 13px; }
#touch .pad.start {
    grid-auto-flow: column;
    gap: 4px;
    border-radius: 8px;
    border-color: #8f5d0c;
    background: rgba(242, 186, 59, 0.88);
    color: #241906;
}
#touch .pad.start svg { filter: none; }
#touch .pad.gone { opacity: 0; pointer-events: none; }
/* The padlock over the stick: drag up into it and the run keeps going. */
#touch .lock {
    position: absolute;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 2px dashed rgba(233, 220, 184, 0.5);
    border-radius: 50%;
    color: rgba(244, 236, 216, 0.7);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}
#touch .lock.shown { opacity: 1; }
#touch .lock.armed { border-style: solid; border-color: var(--gold); color: var(--gold); transform: scale(1.15); }
#touch .lock.on { border-style: solid; border-color: var(--gold); background: rgba(242, 186, 59, 0.35); color: #fff6dc; }
/* (Locked with no thumb on it: it stays where it was, over the stick's place.) */
#touch .radar { position: absolute; border-radius: 4px; }
#touch .radar.down { background: rgba(244, 236, 216, 0.18); }
/* The phone's keyboard for a box in the menu (Touch.type): out of sight, and
   16px so iOS doesn't zoom in on it. */
#type {
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
    font-size: 16px;
}
