/* The overlay is drawn like the game: flat shapes, one ink outline, a hard little shadow, few words.
   "Sticker" is the shared look: cream paper, ink edge. Nothing here is a web panel. */
/* Fredoka, SIL Open Font License 1.1 (vendor/fonts/fredoka-LICENSE.txt). One small file; the game still
   works if it fails to load, in the system's own face. */
@font-face { font-family: 'Fredoka'; src: url('../vendor/fonts/fredoka-latin.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a1020; }
canvas { display: block; }
#hud { position: fixed; inset: 0; pointer-events: none; user-select: none; color: var(--ink);
  font: 600 18px/1.25 'Fredoka', ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif; letter-spacing: .01em;
  --ink: #1a1020; --paper: #fbf6ea; --cyan: #39e6e0; --red: #ff5a4d; --amber: #ffb02e; --edge: 3px solid var(--ink); --drop: 0 4px 0 rgba(26, 16, 32, .38); }
#hud * { box-sizing: border-box; }
#hud [hidden] { display: none !important; }
#hud .sticker { background: var(--paper); border: var(--edge); border-radius: 999px; box-shadow: var(--drop); }

/* ---- vitals ---- */
#hud .corner { position: absolute; left: 18px; bottom: 18px; display: grid; gap: 10px; justify-items: start; }
#hud .vitals { display: flex; align-items: flex-end; gap: 10px; }
#hud .dial { position: relative; width: 62px; height: 62px; transition: width .35s cubic-bezier(.3, 1.6, .5, 1), height .35s cubic-bezier(.3, 1.6, .5, 1); filter: drop-shadow(0 4px 0 rgba(26, 16, 32, .38)); }
#hud .dial svg { display: block; width: 100%; height: 100%; overflow: visible; }
#hud .dial circle { fill: none; }
#hud .dial .back { fill: var(--paper); stroke: var(--ink); stroke-width: 5; }
#hud .dial .track { stroke: rgba(26, 16, 32, .13); stroke-width: 10; }
#hud .dial .fill { stroke-width: 10; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50px 50px; transition: stroke-dasharray .4s ease-out; }
#hud .dial .harm { stroke: var(--red); stroke-width: 5; transform: rotate(-90deg); transform-origin: 50px 50px; transition: stroke-dasharray .4s ease-out; }
#hud .dial .icon { stroke: var(--ink); stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
/* the count sits on the dial's shoulder like a badge */
#hud .dial b { position: absolute; right: -5px; bottom: -3px; min-width: 24px; height: 24px; padding: 0 5px; display: grid; place-items: center; border-radius: 12px; background: var(--ink); color: var(--paper); font-size: 15px; line-height: 1; }
#hud .dial.suit b, #hud .dial.power b { opacity: 0; transition: opacity .3s .9s; }
#hud .dial.bump b { opacity: 1; transition: none; }
#hud .dial.low .fill { stroke: var(--red); }
/* The suit's dial is dark, the others cream: the bright cyan ring reads at about 12 to 1 against it (it was 1.4 to 1 on
   cream), and the shield is marked out as the dial that keeps you alive. Running low is a warm red; permanent radiation
   damage is hazard tape, so the two no longer share one colour and damage reads by pattern as well as hue.
   Options were compared side by side in prototypes/hudlab/. */
#hud .dial.suit .back { fill: var(--ink); }
#hud .dial.suit .track { stroke: rgba(251, 246, 234, .2); }
#hud .dial.suit .icon { stroke: var(--paper); }
#hud .dial.suit.low .fill { stroke: #ff6a5c; }
#hud .dial.suit .harm { stroke: url(#hazard-tape); stroke-width: 7; }
#hud .dial.low { animation: wobble 1.1s ease-in-out infinite; }
#hud .dial.bump svg { animation: bump .45s cubic-bezier(.3, 1.8, .5, 1); }
#hud .dial.sting svg { animation: sting .5s; }
#hud .vitals.out .dial.suit { width: 86px; height: 86px; }
#hud .dial em { position: absolute; left: 50%; top: -6px; font-style: normal; font-size: 20px; opacity: 0; transform: translateX(-50%); -webkit-text-stroke: 4px var(--paper); paint-order: stroke fill; }
#hud .dial em.up { color: #2f9e3a; }
#hud .dial em.down { color: #d8352f; }
#hud .dial em.go { animation: floatUp 1.4s ease-out; }
#hud .carry { display: flex; align-items: center; gap: 7px; padding: 5px 14px 5px 9px; font-size: 18px; }
/* carry, cargo and hunger arrive with the panel kit's pop (ui.css); hud.js kicks it when one appears or its count changes */
#hud .carry.pop, #hud .hunger.pop { animation: ui-pop .22s cubic-bezier(.2, 1.35, .45, 1); }
#hud svg { flex: none; }
#hud .carry svg, #hud .tag svg, #hud .wxb svg { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- the day ---- */
#hud .day { position: absolute; left: 50%; top: 10px; width: 300px; margin-left: -150px; text-align: center; filter: drop-shadow(0 3px 0 rgba(26, 16, 32, .3)); }
#hud .day svg { display: block; width: 100%; overflow: visible; }
#hud .day .sky { fill: none; stroke: var(--paper); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 1 17; paint-order: stroke; }
#hud .day .flare { fill: none; stroke: var(--amber); stroke-width: 11; stroke-linecap: round; }
#hud .day .dusk { stroke: var(--paper); stroke-width: 5; stroke-linecap: round; }
/* the marker is placed with a transform, so it glides from one clock tick to the next; a big jump (dusk, a new sol) snaps */
#hud .day .orb { fill: #ffd23e; stroke: var(--ink); stroke-width: 4; transition: transform .25s linear; }
#hud .day .orb.snap { transition: none; }
#hud .day.night .orb { fill: #dfe6ff; }
#hud .day .sol { position: relative; margin-top: -36px; display: flex; justify-content: center; align-items: baseline; gap: 8px; color: var(--paper); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
#hud .day .sol b { font-size: 26px; }
/* today's weather as a small picture; amber when it is trouble */
#hud .day .wxb { align-self: center; display: grid; place-items: center; width: 34px; height: 34px; border: var(--edge); border-radius: 50%; background: var(--paper); -webkit-text-stroke: 0; }
#hud .day .wxb.bad { background: var(--amber); }
#hud .day .wxb.bump { animation: bump .45s cubic-bezier(.3, 1.8, .5, 1); }
#hud .day .clock { font-size: 18px; }
#hud .day .wx { position: absolute; top: 100%; left: 0; right: 0; margin-top: 34px; font-size: 18px; color: var(--amber); }
#hud .day .wx:empty { display: none; }
#hud .day .pips { display: flex; justify-content: center; gap: 7px; margin-top: 5px; }
#hud .day .pips i { width: 17px; height: 17px; border-radius: 50%; background: rgba(26, 16, 32, .35); border: 3px solid var(--ink); }
#hud .day .pips i.on { background: var(--cyan); }
#hud .day .pips.bump { animation: bump .4s cubic-bezier(.3, 1.8, .5, 1); }
/* arriving somewhere: its name, large, then gone */
#hud .place { position: absolute; left: 0; right: 0; top: 168px; text-align: center; font-size: 46px; letter-spacing: .02em; color: var(--paper); -webkit-text-stroke: 9px var(--ink); paint-order: stroke fill; opacity: 0; white-space: nowrap; }
#hud .place.show { animation: arrive 2.4s ease-out; }
#hud .alert { position: absolute; left: 50%; top: 168px; transform: translateX(-50%); padding: 8px 22px; border: var(--edge); border-radius: 999px; background: var(--amber); font-size: 26px; white-space: nowrap; opacity: 0; }
#hud .alert.on { opacity: 1; animation: throb .7s ease-in-out infinite alternate; }

/* ---- the goal ---- */
#hud .goal { position: absolute; left: 18px; top: 18px; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 36px); white-space: nowrap; padding: 7px 16px 7px 9px; }
#hud .goal i { flex: none; width: 26px; height: 26px; border: var(--edge); border-radius: 8px; background: #fff; display: grid; place-items: center; }
#hud .goal.tick i { background: #7fcf4a; }
#hud .goal.tick i::after { content: ''; width: 12px; height: 7px; border: solid var(--ink); border-width: 0 0 4px 4px; transform: translateY(-2px) rotate(-45deg); }
#hud .goal.tick span { text-decoration: line-through; opacity: .6; }
#hud .goal small { margin-left: 4px; font-size: 14px; opacity: .55; white-space: nowrap; }
#hud .goal.in { animation: slideIn .4s cubic-bezier(.3, 1.4, .5, 1); }

/* ---- the prompt and messages ---- */
#hud .prompt { position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 7px 22px 7px 8px; font-size: 22px; white-space: nowrap; }
#hud .prompt.in { animation: popUp .22s cubic-bezier(.3, 1.6, .5, 1); }
#hud .prompt kbd { --held: 0deg; flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--paper); font-weight: 700; font-size: 21px; line-height: 1; font-family: inherit;
  background: radial-gradient(circle, var(--ink) 0 62%, transparent 63%), conic-gradient(var(--cyan) var(--held), rgba(26, 16, 32, .16) 0); }
#hud .prompt small { font-size: 16px; color: #b3541e; }
#hud .prompt.no { background: #e3ddd0; }
#hud .prompt.no kbd { opacity: .45; }
#hud .gear { display: flex; align-items: flex-end; gap: 5px; padding: 5px 13px 6px; font-size: 15px; line-height: 1; transform: rotate(-2deg); }
#hud .gear span { margin-right: 4px; align-self: center; }
#hud .gear i { --c: var(--cyan); width: 11px; height: 10px; border: 2px solid var(--ink); border-radius: 4px; background: linear-gradient(var(--c), var(--c)) bottom / 100% 0 no-repeat, rgba(26, 16, 32, .1); }
#hud .gear i:nth-of-type(2) { --c: #ffd23e; height: 14px; }
#hud .gear i:nth-of-type(3) { --c: #ff8a3d; height: 18px; }
#hud .gear i.on { background: var(--c); }
#hud .gear i.next { background-size: 100% calc(var(--charge, 0) * 100%); transition: background-size .12s linear; }
#hud .gear em { margin-left: 5px; align-self: center; font-style: normal; font-size: 13px; opacity: .65; }
#hud .gear.g3 em { opacity: 1; color: #c4451c; font-weight: 700; }
#hud .gear.up { animation: gearUp .38s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes gearUp { 0% { transform: rotate(-2deg) scale(1); } 40% { transform: rotate(-5deg) scale(1.2); } 100% { transform: rotate(-2deg) scale(1); } }
#hud .toasts { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; }
#hud .toast { padding: 7px 18px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 19px; white-space: nowrap; animation: popIn .28s cubic-bezier(.3, 1.6, .5, 1); }
/* a message fades and drops a little as it leaves */
#hud .toast.out { animation: toastOut .2s ease-in forwards; }

/* ---- name tags over doors and trip goals ---- */
#hud .tag.nav { grid-template-columns: auto auto; column-gap: 6px; align-items: center; justify-items: start; padding: 3px 12px 3px 8px; background: var(--cyan); }
#hud .tag.way { z-index: 2; }
#hud :is(.modal, .help, .veil, .title) { z-index: 3; }
#hud .tag.nav svg { grid-row: span 2; width: 22px; height: 22px; }
#hud .tag { position: absolute; left: 0; top: 0; display: grid; justify-items: center; padding: 2px 11px 3px; border: var(--edge); border-radius: 999px; background: var(--paper); font-size: 15px; line-height: 1.1; white-space: nowrap; will-change: transform; transition: opacity .18s; }
#hud .tag span { font-size: 12px; opacity: .6; }

/* ---- screen edges ---- */
#hud .vig { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 58%, rgba(20, 8, 24, .28) 100%); }
#hud .edge { position: absolute; inset: 0; opacity: 0; transition: opacity .4s; }
#hud .edge.on { opacity: 1; }
#hud .warn { box-shadow: inset 0 0 120px 30px rgba(255, 60, 40, .55); }
#hud .glow { box-shadow: inset 0 0 110px 26px rgba(255, 176, 46, .6); }
#hud .glow.on { animation: pulse .7s ease-in-out infinite alternate; }
#hud .veil { position: absolute; inset: 0; background: #0b0710; color: var(--paper); opacity: 0; transition: opacity .35s; display: grid; place-items: center; font-size: 28px; }
#hud .veil.on { opacity: 1; }
#hud .fps { position: absolute; right: 12px; top: 10px; padding: 3px 10px; border-radius: 8px; background: rgba(0, 0, 0, .6); color: #fff; font: 600 14px/1.4 ui-monospace, monospace; }

/* ---- cards ---- */
#hud .modal { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(11, 7, 16, .45); pointer-events: auto; }
#hud .card { width: min(560px, 86vw); background: var(--paper); border-radius: 22px; padding: 22px 26px; box-shadow: 0 0 0 4px var(--ink), 0 12px 0 rgba(0, 0, 0, .35); animation: popIn .25s cubic-bezier(.3, 1.4, .5, 1); }
/* closing: the card shrinks a touch and fades with its backdrop; it no longer takes clicks */
#hud .modal.closing { pointer-events: none; animation: fadeOut .15s ease-in forwards; }
#hud .modal.closing .card { animation: cardOut .15s ease-in forwards; }
#hud .card h2 { margin: 0 0 10px; font-size: 28px; }
#hud .card p { margin: 0 0 8px; font-size: 20px; font-weight: 600; white-space: pre-line; }
#hud .card .source { font-size: 15px; opacity: .65; }
#hud .card .opts { display: grid; gap: 9px; margin-top: 12px; }
#hud .card button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 16px; border: var(--edge); border-radius: 16px; background: #fff; color: var(--ink); font-weight: 700; font-size: 20px; line-height: 1.2; font-family: inherit; text-align: left; cursor: pointer; box-shadow: 0 4px 0 rgba(26, 16, 32, .25); }
#hud .card button.sel { background: var(--cyan); }
#hud .card button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(26, 16, 32, .25); }
#hud .card button:disabled { opacity: .45; cursor: default; }
#hud .card button small { margin-left: auto; font-size: 16px; opacity: .7; }
#hud .card button kbd { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--paper); font-weight: 700; font-size: 16px; line-height: 1; font-family: inherit; }
#hud .card .ok { justify-content: center; margin-top: 14px; background: #ffd23e; }
#hud .card .ok.quiet { background: #fff; }
#hud .help { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: auto; pointer-events: auto; animation: none; }
#hud .help .row { display: flex; align-items: center; gap: 8px; margin: 7px 0; font-size: 19px; font-weight: 700; }
#hud .help .row.go { margin-top: 14px; color: #b3541e; }
#hud .help kbd { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 9px; background: var(--ink); color: var(--paper); font-weight: 700; font-size: 16px; line-height: 1; font-family: inherit; }
#hud .help .btns { display: flex; gap: 10px; margin-top: 12px; }
#hud .help .btns button { min-height: 44px; justify-content: center; font-size: 16px; }
#loading { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; text-align: center; background: #c9824b; color: #fbf6ea; font: 700 34px/1.3 'Fredoka', ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", system-ui, sans-serif; -webkit-text-stroke: 8px #1a1020; paint-order: stroke fill; }
#loading small { display: block; margin-top: 8px; font-size: 20px; -webkit-text-stroke: 6px #1a1020; }
/* three dots that pulse in turn, so a slow load still looks alive */
#loading .dots { display: inline-flex; gap: .2em; margin-left: .22em; }
#loading .dots i { width: .24em; height: .24em; border-radius: 50%; background: #fbf6ea; box-shadow: 0 0 0 4px #1a1020; animation: dot 1.2s ease-in-out infinite both; }
#loading .dots i:nth-child(2) { animation-delay: .2s; }
#loading .dots i:nth-child(3) { animation-delay: .4s; }

@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes sting { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-7deg); } 75% { transform: rotate(7deg); } }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 6px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -34px); } }
@keyframes popIn { from { transform: scale(.82); opacity: 0; } }
@keyframes popUp { from { transform: translateX(-50%) translateY(12px) scale(.9); opacity: 0; } }
@keyframes slideIn { from { transform: translateX(-30px); opacity: 0; } }
@keyframes arrive { 0% { opacity: 0; transform: scale(.8); } 12% { opacity: 1; transform: scale(1.06); } 20% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
@keyframes throb { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.06); } }
@keyframes pulse { from { opacity: .55; } to { opacity: 1; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }
@keyframes cardOut { to { opacity: 0; transform: scale(.96); } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes dot { 0%, 60%, 100% { opacity: .4; transform: scale(.7); } 30% { opacity: 1; transform: translateY(-.14em) scale(1); } }

/* ---- the opening screen ---- */
#hud.titling > :not(.title):not(.vig):not(.veil) { display: none !important; }
#hud .title { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center; pointer-events: auto; background: radial-gradient(ellipse at center, rgba(26, 16, 32, .1), rgba(26, 16, 32, .55)); }
#hud .title h1 { margin: 0; font-size: 120px; line-height: 1; letter-spacing: .03em; color: var(--paper); -webkit-text-stroke: 18px var(--ink); paint-order: stroke fill; filter: drop-shadow(0 8px 0 rgba(26, 16, 32, .5)); animation: popIn .5s cubic-bezier(.3, 1.5, .5, 1); }
#hud .title p { margin: 0; font-size: 24px; color: var(--paper); -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; }
#hud .title .btns { display: flex; gap: 14px; margin-top: 12px; }
#hud .title button { min-height: 60px; padding: 10px 28px; border: var(--edge); border-radius: 999px; background: #ffd23e; color: var(--ink); font-weight: 700; font-size: 24px; font-family: inherit; cursor: pointer; box-shadow: 0 5px 0 rgba(26, 16, 32, .45); }
#hud .title button.quiet { background: var(--paper); font-size: 20px; }
#hud .title button:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(26, 16, 32, .45); }
#hud .title small { font-size: 16px; color: var(--paper); opacity: .85; }

/* the to-do module's own list is replaced by the single goal line */
#hud .goals { display: none !important; }

#hud .hunger { padding: 5px 13px; font-size: 15px; }
#hud .hunger.weak { background: var(--amber); }
#hud .dial.food.hungry .back { stroke: #b3541e; }
#hud .day .pips { align-items: center; }
#hud .day .pips i.lost { opacity: .25; border-style: dashed; }
#hud .day .pips small { color: var(--paper); font-size: 14px; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
@media (max-width: 600px) { #hud .vitals { gap: 5px; } #hud .dial { width: 48px; height: 48px; } #hud .vitals.out .dial.suit { width: 62px; height: 62px; } }

/* Hold feedback beside the helmet, following the same cream-and-ink stickers. */
#hud .hold-ring { position: absolute; width: 44px; height: 44px; transform: translate(-50%, -50%); filter: drop-shadow(0 3px 0 rgba(26, 16, 32, .38)); }
#hud .hold-ring svg { display: block; width: 100%; height: 100%; }
#hud .hold-ring .paper { fill: var(--paper); stroke: var(--ink); stroke-width: 3; }
#hud .hold-ring .track { fill: none; stroke: var(--ink); stroke-width: 7; }
#hud .hold-ring .fill { fill: none; stroke: var(--cyan); stroke-width: 5; stroke-dasharray: 0 100; transform: rotate(-90deg); transform-origin: 22px 22px; }
#hud .hold-ring kbd { position: absolute; inset: 0; display: grid; place-items: center; font: inherit; font-size: 14px; }
#hud .hold-ring svg.pop { animation: bump .3s cubic-bezier(.3, 1.8, .5, 1); }
/* calm mode: nothing slides or pulses; hud.js also skips the exit waits */
@media (prefers-reduced-motion: reduce) {
  #hud .toast, #hud .toast.out, #hud .card, #hud .modal.closing, #hud .modal.closing .card, #hud .carry.pop, #hud .hunger.pop, #loading .dots i, #hud .hold-ring svg.pop { animation: none; }
  #hud .day .orb, #hud .dial .harm { transition: none; }
}

/* The play surface owns gestures; cards keep their own vertical scroll. */
html, body { overscroll-behavior: none; }
body > canvas { touch-action: none; }
.touch-device body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.touch-device #hud :is(button, .title) { touch-action: manipulation; }
.touch-controls { position: absolute; inset: 0; pointer-events: none; }
.touch-controls button { pointer-events: auto; touch-action: none; min-width: 56px; min-height: 56px; border: var(--edge); border-radius: 50%; background: var(--paper); color: var(--ink); box-shadow: var(--drop); font: 600 14px/1.1 'Fredoka', system-ui, sans-serif; }
.touch-controls button:active { background-color: var(--cyan); }
.touch-controls button:disabled { opacity: .45; }
.touch-top { position: absolute; right: max(12px, env(safe-area-inset-right)); top: max(10px, env(safe-area-inset-top)); display: flex; gap: 8px; }
.touch-top button { font-size: 12px; width: 56px; }
.touch-actions { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; gap: 14px; align-items: flex-end; }
.touch-actions .touch-use { --held: 0deg; width: 76px; height: 76px; background: radial-gradient(circle, var(--paper) 0 59%, transparent 61%), conic-gradient(var(--cyan) var(--held), #b9b3a6 0); font-size: 17px; }
.touch-actions .touch-jump { width: 60px; height: 60px; margin-bottom: 8px; }
.touch-stick { position: absolute; width: 112px; height: 112px; margin: -56px; border: 3px solid #fbf6ea99; border-radius: 50%; background: #1a102044; display: grid; place-items: center; }
.touch-stick i { width: 42px; height: 42px; border: var(--edge); border-radius: 50%; background: #fbf6eacc; }
.touch-device #hud .corner { left: max(12px, env(safe-area-inset-left)); bottom: auto; top: calc(max(10px, env(safe-area-inset-top)) + 74px); gap: 5px; }
.touch-device #hud .vitals { gap: 5px; order: -1; }
.touch-device #hud .dial { width: 36px; height: 36px; }
.touch-device #hud .vitals.out .dial.suit { width: 46px; height: 46px; }
.touch-device #hud .dial b { font-size: 11px; min-width: 19px; height: 19px; }
.touch-device #hud .carry { font-size: 14px; padding: 3px 9px; max-width: 210px; }
.touch-device #hud .hunger, .touch-device #hud .gear { font-size: 12px; }
.touch-device #hud .goal { left: max(12px, env(safe-area-inset-left)); top: max(10px, env(safe-area-inset-top)); max-width: calc(100vw - 340px); font-size: 13px; padding: 5px 9px; gap: 6px; }
.touch-device #hud .goal small { font-size: 11px; }
.touch-device #hud .day { top: max(8px, env(safe-area-inset-top)); width: 160px; margin-left: -80px; }
.touch-device #hud .day .sol { margin-top: -20px; gap: 4px; }
.touch-device #hud .day .sol b { font-size: 18px; }
.touch-device #hud .day .clock { font-size: 14px; }
.touch-device #hud .day .wxb { width: 24px; height: 24px; }
.touch-device #hud .day .wxb svg { width: 17px; height: 17px; }
.touch-device #hud .day .pips { gap: 4px; margin-top: 2px; }
.touch-device #hud .day .pips i { width: 12px; height: 12px; border-width: 2px; }
.touch-device #hud .day .pips small { font-size: 11px; }
.touch-device #hud .prompt { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 88px); max-width: calc(100vw - 48px); white-space: normal; flex-wrap: wrap; justify-content: center; padding: 5px 12px; font-size: 16px; gap: 6px; text-align: center; }
.touch-device #hud .prompt kbd { width: 34px; height: 34px; font-size: 13px; }
.touch-device #hud .prompt { pointer-events: auto; touch-action: none; cursor: pointer; }
.touch-device #hud .prompt small { font-size: 13px; }
.touch-device #hud .toasts { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 156px); width: calc(100vw - 48px); }
.touch-device #hud .toast { max-width: 100%; white-space: normal; text-align: center; font-size: 15px; }
.touch-device #hud .place { top: 40%; font-size: 30px; white-space: normal; }
.touch-device #hud .alert { top: 30%; font-size: 18px; max-width: calc(100% - 48px); white-space: normal; text-align: center; }
.touch-device #hud .tag { max-width: calc(100vw - 64px); font-size: 12px; white-space: normal; }
.touch-device #hud .tag span { font-size: 11px; }
.touch-device #hud .modal, .touch-device #hud .help { z-index: 20; }
.touch-device #hud .modal { padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.touch-device #hud .card { box-sizing: border-box; width: min(560px, 100%); max-height: calc(100dvh - max(24px, env(safe-area-inset-top)) - max(24px, env(safe-area-inset-bottom))); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 16px; }
.touch-device #hud .help { width: min(560px, calc(100vw - 48px)); top: calc((100dvh + env(safe-area-inset-top) - env(safe-area-inset-bottom)) / 2); }
.touch-device #hud .help .row { font-size: 15px; }
/* phones: the card scrolls inside the screen and its buttons stay in view, Let's go first */
.touch-device #hud .help { max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
.touch-device #hud .help .foot { position: sticky; bottom: -16px; margin: 8px -16px -16px; padding: 10px 16px 14px; background: var(--paper); display: flex; flex-direction: column; gap: 8px; }
.touch-device #hud .help .foot .btns { margin-top: 0; }
.touch-device #hud .help .foot .btns button { flex: 1; }
.touch-device #hud .card p { font-size: 17px; }
.touch-device #hud .card .ok { position: sticky; bottom: 0; }
.touch-device #hud .card button kbd { display: none; }
.touch-device #hud .title { padding: max(18px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); overflow-y: auto; touch-action: pan-y; }
.touch-device #hud .title h1 { font-size: clamp(54px, 12vw, 90px); -webkit-text-stroke-width: 12px; }
.touch-device #hud .title p { font-size: 18px; }
.touch-device #hud .title .btns { flex-wrap: wrap; justify-content: center; gap: 10px; }
.touch-device #hud .title button { font-size: 19px; padding: 8px 18px; min-height: 56px; }
@media (max-width: 600px) and (orientation: portrait) {
  .touch-device #hud .goal { top: calc(max(10px, env(safe-area-inset-top)) + 142px); max-width: calc(100vw - 24px); }
  .touch-device #hud .corner { top: calc(max(10px, env(safe-area-inset-top)) + 200px); }
  .touch-device #hud .corner .vitals { position: absolute; left: 0; top: -128px; }
  .touch-device #hud .day { left: max(90px, calc(env(safe-area-inset-left) + 80px)); }
  .touch-device #hud .corner :is(.carry, .gear, .hunger) { max-width: calc(100vw - 48px); }

}
@media (prefers-reduced-motion: reduce) {
  .touch-device #hud *, .touch-device #hud *::before, .touch-device #hud *::after { animation: none !important; transition: none !important; }
}

/* A quick practice strip, below the day arc. Only Skip takes pointer input. */
#hud .warmup { position: absolute; left: 50%; top: 158px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 24px); padding: 5px 10px; border-radius: 16px; font-size: 14px; transition: opacity .2s; }
#hud .warmup ul { display: flex; align-items: center; gap: 8px; padding: 0; margin: 0; list-style: none; }
#hud .warmup li { display: flex; align-items: center; gap: 4px; padding: 3px 5px; border-radius: 7px; white-space: nowrap; }
#hud .warmup kbd { font: inherit; font-weight: 700; border: 2px solid var(--ink); border-radius: 5px; min-width: 23px; padding: 2px 4px; text-align: center; }
#hud .warmup svg { width: 16px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
#hud .warmup li i { flex: none; width: 12px; height: 12px; border: 2px solid var(--ink); border-radius: 3px; }
#hud .warmup li.done { background: #7fcf4a; animation: bump .25s ease-out; }
#hud .warmup li.done i { border-width: 0 0 3px 3px; border-radius: 0; width: 10px; height: 6px; transform: translateY(-2px) rotate(-45deg); }
#hud .warmup button { pointer-events: auto; min-height: 32px; padding: 0 4px; border: 0; background: none; color: var(--ink); font: inherit; text-decoration: underline; cursor: pointer; }
#hud .warmup button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
#hud .warmup [role="status"]:empty { display: none; }
#hud .warmup.complete { flex-direction: column; gap: 2px; }
#hud .warmup.out { opacity: 0; pointer-events: none; }
#hud .warmup.out button { pointer-events: none; }
.touch-device #hud .warmup { top: calc(max(10px, env(safe-area-inset-top)) + 100px); gap: 8px; padding: 4px 8px; font-size: 12px; }
.touch-device #hud .warmup ul { gap: 6px; }
.touch-device #hud .warmup li { padding: 2px; }
@media (max-width: 600px) and (orientation: portrait) {
  .touch-device #hud .warmup { top: calc(max(10px, env(safe-area-inset-top)) + 132px); }
  .touch-device #hud.warming-up .goal { top: calc(max(10px, env(safe-area-inset-top)) + 200px); }
  .touch-device #hud.warming-up .corner { top: calc(max(10px, env(safe-area-inset-top)) + 258px); }
  .touch-device #hud.warming-up .corner .vitals { top: -186px; }
}
@media (prefers-reduced-motion: reduce) {
  #hud .warmup, #hud .warmup li.done { animation: none; transition: none; }
}
