@font-face { font-family: "Saira Stencil One"; font-weight: 400; font-display: swap; src: url("../assets/fonts/saira-stencil-one.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 300; font-display: swap; src: url("../assets/fonts/barlow-condensed-300.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 400; font-display: swap; src: url("../assets/fonts/barlow-condensed-400.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("../assets/fonts/barlow-condensed-600.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("../assets/fonts/ibm-plex-mono-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; font-display: swap; src: url("../assets/fonts/ibm-plex-mono-600.woff2") format("woff2"); }
:root {
  --bg: #0b0a09; --ink: #e8e1d3; --dim: #9a9082; --amber: #e3a43c; --amber-d: #8a5f1c; --line: rgba(232, 225, 211, .16);
  --panel: rgba(16, 14, 12, .88);
  --display: "Saira Stencil One", "Big Shoulders Stencil Display", "Bebas Neue", "Oswald", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --body: "IBM Plex Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; font-family: var(--body); -webkit-font-smoothing: antialiased; }
body { touch-action: none; overscroll-behavior: none; user-select: none; -webkit-user-select: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; background: #000; }
.hidden { display: none !important; }
kbd { font: 600 .72em/1 var(--body); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: .28em .5em; background: rgba(255, 255, 255, .06); color: var(--ink); white-space: nowrap; }

/* ───────────── HUD ───────────── */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud-level { position: absolute; left: max(18px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top)); text-shadow: 0 2px 10px rgba(0, 0, 0, .8); }
.lvl-label { font: 600 .68rem/1 var(--body); letter-spacing: .42em; color: var(--amber); }
.lvl-num { font: 400 clamp(2.6rem, 6.5vw, 4.4rem)/.95 var(--display); letter-spacing: .04em; color: var(--ink); margin-top: 2px; }
.lvl-name { font: 600 clamp(.78rem, 1.5vw, .95rem)/1.3 var(--body); letter-spacing: .14em; text-transform: uppercase; max-width: 46vw; }
.lvl-zone { font: 500 .68rem/1.6 var(--body); letter-spacing: .3em; color: var(--dim); text-transform: uppercase; }

#gauge { position: absolute; right: max(14px, env(safe-area-inset-right)); top: 50%; transform: translateY(-50%); height: min(62vh, 520px); display: flex; gap: 8px; align-items: stretch; opacity: .92; padding: 10px 6px 10px 26px; background: linear-gradient(to left, rgba(0, 0, 0, .42), rgba(0, 0, 0, 0)); border-radius: 6px; }
.gauge-track { position: relative; width: 6px; background: rgba(255, 255, 255, .2); border-radius: 3px; }
.gauge-track::before, .gauge-track::after { content: ""; position: absolute; left: -3px; right: -3px; height: 1px; background: var(--line); }
.gauge-track::before { top: 34%; } .gauge-track::after { top: 86.1%; }
.gauge-fill { position: absolute; left: 0; right: 0; top: 0; height: 0; background: linear-gradient(var(--amber), var(--amber-d)); border-radius: 3px; opacity: .55; }
.gauge-mark { position: absolute; right: -4px; width: 14px; height: 2px; background: var(--amber); top: 0; box-shadow: 0 0 8px var(--amber); }
.gauge-mark span { position: absolute; right: 20px; top: -8px; font: 600 .72rem/1.3 var(--body); color: var(--amber); text-shadow: 0 1px 6px #000; }
.gauge-zones { display: flex; flex-direction: row; justify-content: space-around; font: 600 .68rem/1 var(--body); letter-spacing: .2em; color: #c2b8a8; text-shadow: 0 1px 4px #000, 0 0 2px #000; writing-mode: vertical-rl; text-align: center; }
.gauge-zones span { flex: 49; display: flex; align-items: center; justify-content: center; white-space: nowrap; }
.gauge-zones span:nth-child(2) { flex: 75; } .gauge-zones span:nth-child(3) { flex: 20; letter-spacing: .08em; }

#crosshair { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: rgba(255, 255, 255, .55); box-shadow: 0 0 4px rgba(0, 0, 0, .9); }
#prompt { position: absolute; left: 0; right: 0; margin-inline: auto; width: fit-content; max-width: 86vw; bottom: 22%; display: flex; gap: 10px; align-items: center; padding: 8px 14px; background: rgba(10, 9, 8, .72); border: 1px solid var(--line); border-radius: 6px; font-size: .86rem; letter-spacing: .06em; backdrop-filter: blur(4px); }
#toast { position: absolute; left: 0; right: 0; margin-inline: auto; width: fit-content; top: max(17%, 164px); max-width: min(680px, 86vw); text-align: center; padding: 10px 18px; background: rgba(10, 9, 8, .66); border-left: 2px solid var(--amber); font-size: .88rem; line-height: 1.55; letter-spacing: .02em; backdrop-filter: blur(4px); animation: toast-in .5s ease both; }
#caption { position: absolute; left: 0; right: 0; margin-inline: auto; width: fit-content; bottom: 9%; max-width: min(760px, 90vw); text-align: center; font-size: .92rem; line-height: 1.5; text-shadow: 0 2px 8px #000, 0 0 2px #000; color: #f3ecdf; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
#hints { position: absolute; left: 0; right: 0; margin-inline: auto; bottom: max(12px, env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: .68rem; color: var(--dim); letter-spacing: .06em; transition: opacity 1.2s; width: max-content; max-width: 94vw; }
#hints.faded { opacity: 0; }
#fps { position: absolute; left: 18px; bottom: 44px; font-size: .7rem; color: var(--dim); white-space: pre; text-shadow: 0 1px 3px #000; }

/* ───────────── touch ───────────── */
#touch { position: fixed; inset: 0; pointer-events: none; }
#stick { position: absolute; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .05); display: none; }
#stick-knob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(227, 164, 60, .5); }
.tbtn { position: absolute; pointer-events: auto; right: max(18px, env(safe-area-inset-right)); width: 64px; height: 64px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .28); background: rgba(12, 11, 10, .5); color: var(--ink); font: 600 .62rem/1 var(--body); letter-spacing: .08em; -webkit-tap-highlight-color: transparent; }
#t-jump { bottom: max(28px, env(safe-area-inset-bottom)); } #t-use { bottom: calc(max(28px, env(safe-area-inset-bottom)) + 76px); }
#t-torch { bottom: max(28px, env(safe-area-inset-bottom)); right: calc(max(18px, env(safe-area-inset-right)) + 76px); }
#t-run { bottom: calc(max(28px, env(safe-area-inset-bottom)) + 76px); right: calc(max(18px, env(safe-area-inset-right)) + 76px); width: 54px; height: 54px; }
#t-run.on { background: rgba(227, 164, 60, .5); border-color: var(--amber); }
#t-map, #t-menu { top: max(14px, env(safe-area-inset-top)); width: 52px; height: 52px; }
#t-map { right: calc(max(18px, env(safe-area-inset-right)) + 62px); } #t-menu { font-size: 1.2rem; }
.tbtn:active { background: rgba(227, 164, 60, .45); }

/* ───────────── overlays ───────────── */
.overlay { position: fixed; inset: 0; display: flex; align-items: flex-start; justify-content: flex-start; background: radial-gradient(ellipse at 50% 40%, rgba(22, 19, 16, .9), rgba(4, 4, 3, .97)); z-index: 10; padding: 18px; overflow: auto; }
#title { background: radial-gradient(ellipse at 50% 35%, #1b1814 0%, #0b0a09 55%, #030302 100%); }
.overlay > * { margin: auto; }   /* centred when it fits, scrollable from the top when it does not */
.title-inner { max-width: 820px; width: 100%; text-align: center; }
.title-kicker { font-size: .68rem; letter-spacing: .5em; color: var(--amber); margin-bottom: 14px; }
h1 { font: 400 clamp(4rem, 17vw, 10.5rem)/.86 var(--display); margin: 0; letter-spacing: .05em; color: var(--ink); text-shadow: 0 0 60px rgba(227, 164, 60, .12); }
h1 span { color: var(--amber); }
.pact { color: #b9afa0; font-size: clamp(.74rem, 1.7vw, .92rem); line-height: 1.9; margin: 26px auto 26px; max-width: 640px; font-style: italic; }
.loadbar { height: 2px; background: rgba(255, 255, 255, .1); max-width: 420px; margin: 0 auto 10px; overflow: hidden; }
#loadfill { height: 100%; width: 0%; background: var(--amber); transition: width .25s; }
#loadtext { font-size: .7rem; letter-spacing: .3em; color: var(--dim); text-transform: uppercase; min-height: 1.4em; }
.btn { font: 600 .78rem/1 var(--body); letter-spacing: .24em; color: var(--ink); background: rgba(255, 255, 255, .04); border: 1px solid var(--line); padding: 13px 20px; cursor: pointer; border-radius: 3px; transition: all .18s; }
.btn:hover:not(:disabled) { border-color: var(--amber); color: var(--amber); background: rgba(227, 164, 60, .08); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.big { font-size: .92rem; padding: 17px 34px; margin: 22px 0 18px; border-color: rgba(227, 164, 60, .6); color: var(--amber); }
.btn.big:hover:not(:disabled) { background: var(--amber); color: #120e06; }
.title-controls { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; font-size: .72rem; color: var(--dim); margin-top: 6px; }
.fine { font-size: .62rem; color: #6f675c; margin-top: 24px; letter-spacing: .04em; line-height: 1.6; }

.panel { width: min(520px, 100%); background: var(--panel); border: 1px solid var(--line); padding: 26px 28px; text-align: center; border-radius: 4px; }
.panel h2, .map-head h2 { font: 400 1.9rem/1 var(--display); letter-spacing: .12em; margin: 0 0 6px; color: var(--ink); }
.settings { display: grid; gap: 12px; text-align: left; margin: 6px 0 18px; font-size: .78rem; color: #c9c0b1; }
.settings label { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.settings label.chk { justify-content: flex-start; }
.settings select, .settings input[type=range] { flex: 0 0 52%; accent-color: var(--amber); }
.settings select { background: #1a1714; color: var(--ink); border: 1px solid var(--line); padding: 6px 8px; font: inherit; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.help { text-align: left; font-size: .76rem; color: #c9c0b1; display: grid; gap: 8px; margin-top: 16px; }
#fatal pre { white-space: pre-wrap; text-align: left; font-size: .68rem; color: #e9a08c; max-height: 36vh; overflow: auto; user-select: text; -webkit-user-select: text; }
#fatal p { font-size: .84rem; line-height: 1.6; color: #c9c0b1; } #fatal details { margin-top: 14px; font-size: .72rem; color: var(--dim); text-align: left; }

/* ───────────── directory ───────────── */
.map-panel { width: min(1080px, 100%); height: min(88vh, 860px); background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; border-radius: 4px; }
.map-head { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.map-head h2 { margin: 0; flex: 1 1 auto; font-size: 1.5rem; }
#map-search { flex: 1 1 180px; background: #14110f; border: 1px solid var(--line); color: var(--ink); padding: 10px 12px; font: inherit; font-size: .8rem; user-select: text; -webkit-user-select: text; }
.map-body { flex: 1; display: flex; min-height: 0; }
#map-section { flex: 0 0 150px; padding: 14px 10px 14px 16px; border-right: 1px solid var(--line); position: relative; overflow: hidden; }
#map-list { flex: 1; overflow-y: auto; padding: 8px 10px 18px; touch-action: pan-y; }
.zone-head { font: 400 1.05rem/1 var(--display); letter-spacing: .2em; color: var(--amber); padding: 16px 8px 8px; position: sticky; top: -8px; background: rgb(16, 14, 12); box-shadow: 0 6px 8px -4px rgba(0, 0, 0, .7); z-index: 1; }
.lv { display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: baseline; padding: 7px 8px; border-bottom: 1px solid rgba(255, 255, 255, .05); cursor: pointer; border-radius: 3px; }
.lv:hover { background: rgba(227, 164, 60, .1); }
.lv.here { background: rgba(227, 164, 60, .16); }
.lv .n { font: 400 1.15rem/1 var(--display); color: var(--dim); letter-spacing: .06em; }
.lv.key .n { color: var(--amber); }
.lv .t { font-size: .8rem; letter-spacing: .04em; }
.lv .d { display: block; font-size: .68rem; color: var(--dim); margin-top: 3px; line-height: 1.45; letter-spacing: 0; }
.lv .go { font-size: .62rem; letter-spacing: .2em; color: var(--amber); opacity: 0; }
.lv:hover .go, .lv.here .go { opacity: 1; }
.sec-svg { width: 100%; height: 100%; display: block; }
@media (max-width: 640px) {
  #map-section { flex-basis: 74px; padding: 10px 4px 10px 8px; }
  #hints { display: none; }
  .lvl-name { max-width: 70vw; }
  #gauge { height: 46vh; }
  .panel { padding: 20px 16px; }
}
.lv .d.bk { color: #a8966e; font-style: italic; }

/* ───────────── added after the first review ───────────── */
.pact cite { display: block; font-style: normal; font-size: .82em; letter-spacing: .28em; color: var(--dim); margin-top: 6px; }
.title-note { font-size: .64rem; color: #6f675c; letter-spacing: .04em; margin-top: 10px; }
.title-controls.touch { display: none; }
body.touch .title-controls.keys, body.touch #hints { display: none; }
body.touch .title-controls.touch { display: flex; }
body.touch #caption { bottom: 33%; }   /* above the prompt (22 % + its height): on touch the two were printed through each other */
@media (max-width: 900px) and (orientation: portrait) {   /* an upright phone or tablet: stop both short of the depth gauge on the right */
  body.touch #caption, body.touch #prompt { left: 12px; right: 78px; max-width: none; }
}
@media (min-width: 900px) and (min-height: 521px) { body.touch #gauge { height: min(50vh, 520px); } }   /* tablets: the gauge ended under USE */
.overlay, .panel { touch-action: pan-y; }   /* tall menus scroll by touch (the page itself does not) */
body.touch .lv .go { opacity: .75; }
/* the title floats over the live shaft once the silo is built */
#title.live { background: radial-gradient(ellipse at 50% 42%, rgba(11, 10, 9, .5) 0%, rgba(6, 6, 5, .72) 55%, rgba(2, 2, 2, .9) 100%); }
#title.live .title-inner { text-shadow: 0 2px 14px #000; }
/* destination card on the black of a fast travel */
#travel { position: fixed; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; pointer-events: none; opacity: 0; transition: opacity .35s; text-align: center; padding: 20px; }
#travel.on { opacity: 1; }
#travel .tv-label { font: 600 .7rem/1 var(--body); letter-spacing: .42em; color: var(--amber); }
#travel .tv-num { font: 400 clamp(4rem, 16vw, 8rem)/.9 var(--display); letter-spacing: .05em; color: var(--ink); }
#travel .tv-name { font: 600 clamp(.9rem, 2.4vw, 1.2rem)/1.4 var(--body); letter-spacing: .16em; text-transform: uppercase; }
#travel .tv-zone { font: 500 .7rem/1.6 var(--body); letter-spacing: .3em; color: var(--dim); text-transform: uppercase; }
/* "click to look" when the mouse is not captured */
#lookchip { position: absolute; left: 0; right: 0; margin-inline: auto; width: fit-content; top: 58%; padding: 9px 16px; background: rgba(10, 9, 8, .78); border: 1px solid rgba(227, 164, 60, .55); border-radius: 20px; color: var(--amber); font-size: .78rem; letter-spacing: .12em; pointer-events: none; }
#map-empty { padding: 28px 12px; color: var(--dim); font-size: .8rem; text-align: center; }
@media (max-width: 640px) {
  #map-section { flex-basis: 26px; padding: 8px 2px 8px 6px; }
  .lv { grid-template-columns: 44px 1fr; }
  .lv .go { display: none; }
  .lv .t { font-size: .86rem; } .lv .d { font-size: .76rem; }
  .map-head { padding: 12px; gap: 10px; } .map-head h2 { font-size: 1.2rem; }
}
/* short screens (a phone on its side, a small laptop) */
@media (max-height: 520px) {
  #gauge { display: none; }
  #toast { top: max(10px, env(safe-area-inset-top)); left: 44vw; right: max(140px, env(safe-area-inset-right)); margin: 0; width: auto; max-width: none; text-align: left; font-size: .76rem; padding: 7px 12px; }
  .lvl-name { max-width: 40vw; }
  body.touch #caption { left: max(16px, env(safe-area-inset-left)); right: calc(max(18px, env(safe-area-inset-right)) + 158px); margin: 0; width: auto; max-width: none; bottom: 7%; font-size: .82rem; }
  body.touch #prompt { bottom: 30%; max-width: calc(100vw - 330px); }   /* (a long prompt ran under RUN) */
  h1 { font-size: clamp(3rem, 22vh, 6rem); } .pact { margin: 12px auto; line-height: 1.6; } .btn.big { margin: 12px 0 10px; padding: 13px 28px; } .fine { margin-top: 10px; }
  .panel { padding: 16px 20px; } .settings { gap: 8px; margin-bottom: 12px; }
}

/* ───────────── added after the second review ───────────── */
.set-note { font-size: .68rem; color: var(--dim); line-height: 1.5; margin: -2px 0 2px; }
.help.touch { display: none; }
body.touch .help.keys { display: none; }
body.touch .help.touch:not(.hidden) { display: grid; }
