@font-face {
  font-family: Silkscreen;
  src: url("assets/silkscreen-bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --ink: #101411;
  --surface: #1c231c;
  --edge: #485245;
  --light: #f2e4c3;
  --muted: #b1b39c;
  --ember: #f7a857;
  --pixel: Silkscreen, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--light);
  background: repeating-linear-gradient(#0d100d00 0 3px, #080b0855 3px 4px), #151a15;
  font: 14px/1.45 ui-monospace, "Courier New", monospace;
}
body:has(.cabinet:is([data-phase="menu"], [data-phase="entering"])) {
  background: repeating-linear-gradient(transparent 0 3px, #03070945 3px 4px),
    radial-gradient(ellipse at 50% 29%, #182932, #080e15 64%, #05090f);
}
button { font: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }
button:disabled { opacity: .45; cursor: default; }
canvas { image-rendering: pixelated; }
.cabinet { width: min(100% - 40px, 1000px, max(780px, 153vh - 365px)); margin: 24px auto; }
.top, .readout, .console { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.top { margin: 0 0 13px; }
.wordmark { color: var(--muted); font: 700 11px var(--pixel); }
.switches { display: flex; gap: 7px; }
.switches button { padding: 4px 9px; border: 1px solid var(--edge); background: var(--surface); color: var(--muted); font-size: 11px; }
.switches button:not(:disabled):hover { border-color: var(--ember); color: var(--light); }
#sound-icon { margin-right: 6px; color: var(--ember); }
.arena { border: 1px solid var(--edge); background: var(--ink); box-shadow: 0 0 0 3px #0b0f0b, 0 10px 24px #050705a0; }
.cabinet:is([data-phase="menu"], [data-phase="entering"]) .arena {
  border-color: #506763;
  box-shadow: 0 0 0 3px #0b1011, 0 0 0 4px #263638, 0 21px 78px #020509d9;
}
.cabinet:is([data-phase="menu"], [data-phase="entering"]) .readout,
.cabinet:is([data-phase="menu"], [data-phase="entering"]) .bestiary,
.cabinet[data-phase="menu"] .console,
.cabinet[data-phase="menu"] .wordmark,
.cabinet[data-phase="menu"] #pause { display: none; }
.cabinet[data-phase="menu"] .top { justify-content: flex-end; }
.cabinet[data-phase="menu"] #sound { color: #adbec1; border-color: #3c5155; background: #101a1f; }
.cabinet[data-phase="menu"] #sound-icon { color: #b0d6cc; }
.cabinet[data-phase="menu"] button:focus-visible { outline-color: #aad2cd; }
.readout { padding: 9px 13px; border-bottom: 1px solid #3b473c; background: #1c231c; }
.stat { display: flex; align-items: baseline; gap: 9px; }
.stat-label, .arena-state { color: var(--muted); font: 700 10px var(--pixel); }
.stat strong { font: 700 19px/1 var(--pixel); }
.stat strong span { font-size: .72em; }
.record strong { color: var(--ember); }
.survival-gear { display: flex; align-items: center; gap: 10px; padding: 7px 13px; border-bottom: 1px solid #3b473c; background: #171e17; }
.endurance { display: flex; align-items: center; gap: 8px; color: var(--muted); font: 700 10px var(--pixel); }
.endurance meter { width: clamp(70px, 18vw, 160px); height: 12px; accent-color: #99b876; }
.endurance meter::-webkit-meter-bar { border: 1px solid #475443; border-radius: 0; background: #111812; }
.endurance meter::-webkit-meter-optimum-value { background: #9eb877; }
.endurance meter::-webkit-meter-suboptimum-value { background: #dd8952; }
.stamina-status { color: var(--ember); font: 700 9px var(--pixel); }
.stones { margin-left: auto; color: var(--muted); font: 700 11px var(--pixel); }
.board { position: relative; isolation: isolate; background: #101510; }
#maze { display: block; width: 100%; outline: 0; }
.scanlines {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: repeating-linear-gradient(transparent 0 3px, #04060438 3px 4px);
  box-shadow: inset 0 0 45px #05070588;
  pointer-events: none;
}
.hide-prompt { position: absolute; z-index: 2; left: 50%; bottom: 10px; transform: translateX(-50%); display: grid; grid-template-columns: auto auto auto; align-items: center; gap: 4px 7px; max-width: 95%; padding: 5px 8px; border: 1px solid #7d7462; background: #141610; color: #f0dfba; font: 700 9px var(--pixel); white-space: nowrap; }
.hide-key { color: var(--ember); }
.hide-prompt.spotted { border-color: #e66d56; color: #ffc3a8; background: #2b1512; }
.hide-prompt meter { width: 45px; accent-color: var(--ember); }
.breath-gauge { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 45px 34px; align-items: center; gap: 6px; border-top: 1px solid #625d4c; padding-top: 4px; color: #bbd398; --breath-color: #a2c27c; }
.breath-gauge.warning { color: #ffab84; --breath-color: #ff9265; }
.breath-gauge meter::-webkit-meter-bar { border: 1px solid #625d4c; border-radius: 0; background: #171710; }
.breath-gauge meter::-webkit-meter-optimum-value { background: var(--breath-color); }
.breath-gauge meter::-moz-meter-bar { background: var(--breath-color); }
.breath-gauge #breath-seconds { text-align: right; }
.veil { position: absolute; z-index: 2; inset: 0; display: grid; place-items: center; background: #0b0e0bb0; }
.dialog { width: min(390px, 92%); padding: 17px; text-align: center; }
.veil[data-scene="menu"] {
  background: linear-gradient(#050810cf, #070e1500 38%, #060c1300 59%, #050910e8 100%);
}
.veil[data-scene="menu"] .dialog {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  justify-items: center;
  align-items: center;
  padding: 4% 12px 3%;
}
.dialog h1 {
  margin: 0;
  color: #e1ebe0;
  font: 700 clamp(25px, 5vw, 68px)/.84 var(--pixel);
  letter-spacing: -.055em;
  text-shadow: 2px 3px #344c4e, -2px 6px #070b11, 0 0 25px #9ec7c43f;
}
.dialog h1 span { display: flex; justify-content: center; align-items: center; gap: 13px; margin-bottom: .68em; color: #9fbeb7; font-size: .28em; letter-spacing: .48em; text-shadow: 1px 2px #222d39; }
.dialog h1 span::before, .dialog h1 span::after { content: ""; width: 29px; height: 1px; background: #6d9090; box-shadow: 0 2px #172632; }
.dialog h1 em { display: block; color: #c28486; font-size: 1.06em; font-style: normal; text-shadow: 2px 3px #542b3b, -2px 6px #090a13; }
.dialog h2 { margin: 0; color: var(--ember); font: 700 clamp(18px, 3vw, 32px) var(--pixel); }
.dialog p { margin: 15px 0 17px; color: var(--muted); }
.play { padding: 9px 13px; border: 1px solid #ffce8f; color: #2a1b13; background: var(--ember); box-shadow: 3px 4px #6a3d2a; font: 700 14px var(--pixel); }
.play:hover { background: #ffd18b; }
.play:active { transform: translate(2px, 2px); box-shadow: 1px 2px #6a3d2a; }
.dialog small { display: block; margin-top: 12px; color: var(--muted); font: 700 9px var(--pixel); }
.dialog-actions, #menu-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.veil[data-scene="menu"] #description { grid-row: 3; margin: 0 0 10px; color: #d0dcd2; font-size: 12px; text-shadow: 1px 2px #050a0d; }
.veil[data-scene="menu"] .dialog-actions { grid-row: 4; width: min(100%, 246px); }
.veil[data-scene="menu"] .play {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-color: #ad6b77;
  background: linear-gradient(100deg, #4c2431, #6f3443 57%, #522733);
  box-shadow: inset 0 0 0 2px #27121bcc, 3px 4px #100a11;
  color: #ffe0da;
}
.veil[data-scene="menu"] .play::after { content: ""; width: 9px; height: 9px; background: currentColor; clip-path: polygon(0 0, 34% 0, 34% 22%, 66% 22%, 66% 40%, 100% 40%, 100% 60%, 66% 60%, 66% 78%, 34% 78%, 34% 100%, 0 100%); }
.veil[data-scene="menu"] .play:hover { background: #914a54; }
.veil[data-scene="menu"] #menu-links { grid-row: 5; display: grid; grid-template-columns: 1fr 1fr; width: min(100%, 246px); gap: 4px; margin-top: 8px; }
.menu-link { padding: 6px 8px; border: 1px solid var(--edge); color: var(--light); background: #1b221b; font: 700 10px var(--pixel); }
.menu-link:hover { border-color: var(--ember); color: var(--ember); }
#menu-links .menu-link { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 8px 5px; border-color: #466063; background: #121e26e8; color: #d0dfd8; font-size: 9px; }
#menu-links .menu-link:hover { border-color: #a8c1bd; color: #f9fff4; }
#menu-links .menu-link > :last-child { color: #a7c8c2; }
#menu-links .menu-link > span[aria-hidden] { font-size: 13px; line-height: .75; }
#menu-links strong span { opacity: .72; }
.veil[data-scene="menu"] #shortcut { display: none; }
.veil[data-scene="menu-page"] { background: #070a14ab; overflow: auto; }
.menu-page { width: min(445px, 92%); padding: clamp(12px, 3vw, 27px); background: #121d25; border: 1px solid #5e7978; box-shadow: inset 0 0 0 3px #1d2b34, 5px 5px #090d15; }
.menu-page h2 { color: #d2e7dc; }
.menu-page dl { text-align: left; margin: 13px 0; font-size: 12px; }
.menu-page dl div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid #35474d; }
.menu-page dd { margin: 0; text-align: right; color: #b0c8c8; }
.menu-page p { font-size: 11px; margin: 8px 0 12px; }
.menu-page .menu-link { border-color: #587171; background: #233741; }
#menu-record-time { display: block; margin-top: 13px; color: #e2a8ae; font: 700 clamp(25px, 5vw, 44px) var(--pixel); }
.console { padding: 9px 13px; border-top: 1px solid #3b473c; color: var(--muted); font-size: 11px; }
.keyboard { flex-shrink: 0; }
kbd { color: var(--light); font: inherit; }
.touch { display: none; }
.bestiary { display: flex; gap: 17px 36px; flex-wrap: wrap; margin-top: 17px; }
.monster { display: flex; align-items: center; gap: 8px; }
.monster canvas { width: 40px; height: 40px; }
.monster strong { color: var(--light); font-size: 12px; }
.monster p { margin: 0; color: var(--muted); font-size: 11px; }
@media (pointer: coarse) {
  .hide-key { display: none; }
  .dialog small, .keyboard { display: none; }
  .touch { display: grid; grid-template-columns: repeat(3, 46px); gap: 4px; justify-content: center; padding: 0 0 10px; }
  .touch button { height: 40px; touch-action: none; color: var(--light); background: var(--surface); border: 1px solid var(--edge); }
  .touch button:first-child { grid-column: 2; }
  .touch button:nth-child(2) { grid-column: 1; }
  .touch-actions { grid-column: 1 / -1; display: flex; gap: 5px; justify-self: center; }
  .touch-actions button { padding: 0 9px; font-size: 11px; }
}
@media (max-width: 550px) {
  .cabinet { width: calc(100% - 24px); margin: 15px auto; }
  .stat { gap: 4px; flex-wrap: wrap; }
  .stat-label, .arena-state, .wordmark { font-size: 8px; }
  .stat strong { font-size: 14px; }
  .record { justify-content: flex-end; }
  .readout { padding: 7px 6px; }
  .cabinet:is([data-phase="menu"], [data-phase="entering"]) #maze { min-height: 350px; object-fit: cover; object-position: center; }
  .veil[data-scene="menu"] .dialog { padding-top: 24px; padding-bottom: 15px; }
  .veil[data-scene="menu"] #description { margin: 0 0 8px; font-size: 10px; }
  .veil[data-scene="menu"] .play { min-height: 36px; padding: 6px 9px; }
  .veil[data-scene="menu"] #menu-links { margin-top: 8px; }
  #menu-links .menu-link { padding: 6px; }
  .dialog p { font-size: 11px; margin: 7px 0 9px; }
  .play { padding: 5px 8px; font-size: 11px; }
  .menu-page { padding: 10px; }
  .menu-page dl { margin: 5px 0 8px; font-size: 10px; }
  .console { flex-wrap: wrap; }
  .keyboard { flex-shrink: 1; }
  .bestiary { gap: 8px; }
}
