@font-face {
  font-family: Plakat;
  src: url("plakat-fraktur.black.ttf") format("truetype");
  font-weight: 900;
  font-display: swap;
}

:root { color-scheme: light; --yellow: #ffe347; --black: #11110e; }
* { box-sizing: border-box; }
html { background: var(--yellow); }
body { margin: 0; background: var(--yellow); color: var(--black); font-family: "Courier New", monospace; }
button, a { color: inherit; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px dashed currentColor; outline-offset: 4px; }
.game-shell { max-width: 1100px; margin: auto; padding: 18px clamp(12px, 3vw, 36px) 28px; }
.game-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.game-header a { font-size: 11px; font-weight: bold; text-decoration: none; white-space: nowrap; }
.game-header a:hover { text-decoration: underline; }
h1 { margin: 0; font: 900 clamp(24px, 4vw, 45px)/1 Plakat, serif; text-align: right; }
h1, .death-content h2 { text-transform: lowercase; }
h1 span { font-size: .6em; }
.screen { position: relative; border: 5px solid var(--black); background: var(--yellow); overflow: hidden; }
section[aria-label="game world"] { position: relative; }
.game-stage { position: relative; }
#world { display: block; width: 100%; aspect-ratio: 8 / 5; image-rendering: pixelated; touch-action: none; }
.crosshair { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; color: var(--yellow); mix-blend-mode: difference; font: 18px monospace; }
.dialogue { position: absolute; left: 2%; bottom: 3%; width: min(55%, 470px); max-height: 94%; overflow-y: auto; padding: clamp(6px, 1vw, 12px); border: 2px solid var(--yellow); outline: 2px solid var(--black); background: var(--black); color: var(--yellow); font: bold clamp(10px, 1.15vw, 13px)/1.25 "Courier New", monospace; }
.dialogue[hidden] { display: none; }
.dialogue:has(.waiting-panel:not([hidden])) { width: min(42%, 400px); }
.thought { position: absolute; right: 2%; top: 3%; width: min(42%, 360px); padding: clamp(6px, 1vw, 12px); border: 2px solid var(--yellow); outline: 2px solid var(--black); background: var(--black); color: var(--yellow); font: bold clamp(10px, 1.15vw, 13px)/1.25 "Courier New", monospace; }
.thought[hidden] { display: none; }
.screen.in-haven ~ .thought { top: auto; bottom: 3%; }
.thought p { margin: 0; }
.magazine { position: fixed; z-index: 10; inset: 0; overflow-y: auto; padding: clamp(20px, 6vw, 70px); background: var(--black); color: var(--yellow); }
.magazine[hidden] { display: none; }
.magazine-content { max-width: 720px; margin: auto; font-size: clamp(16px, 2vw, 22px); line-height: 1.6; }
.magazine h2 { font: 900 clamp(32px, 6vw, 64px)/1 Plakat, serif; }
.magazine button { border: 2px solid var(--yellow); background: var(--yellow); color: var(--black); padding: 10px 16px; font-weight: bold; }
.intro-screen { position: absolute; z-index: 3; inset: 0; display: grid; place-items: center; padding: 12px; background: var(--black); color: var(--yellow); }
.intro-screen[hidden] { display: none; }
.intro-screen { overflow-y: auto; }
.intro-content { max-width: 430px; font-size: clamp(11px, 1.6vw, 16px); line-height: 1.4; }
.intro-content p { margin: 0 0 10px; }
.loading-content { width: min(100%, 300px); }
.loading-title { font-weight: bold; }
#loading-progress { display: block; width: 100%; height: 16px; border: 2px solid var(--yellow); background: var(--black); color: var(--yellow); appearance: none; }
#loading-progress::-webkit-progress-bar { background: var(--black); }
#loading-progress::-webkit-progress-value { background: var(--yellow); }
#loading-progress::-moz-progress-bar { background: var(--yellow); }
#loading-percent { margin: 4px 0; text-align: right; }
#loading-status:empty { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.intro-content button { padding: 9px 16px; border: 2px solid var(--yellow); background: var(--yellow); color: var(--black); font-weight: bold; }
.intro-content button:hover, .intro-content button:focus-visible { background: var(--black); color: var(--yellow); }
.intro-content button:disabled { opacity: .5; cursor: not-allowed; }
.encounter { font: inherit; }
.encounter[hidden] { display: none; }
.encounter-voice { margin: 0 0 5px; font-size: .75em; }
.encounter h2 { margin: 0 0 7px; font: inherit; }
.choose-label { margin: 0 0 3px; }
.choices { display: flex; flex-direction: column; align-items: stretch; }
.choices button { text-align: left; min-height: 32px; padding: 4px; border: 0; background: transparent; color: var(--yellow); font: inherit; }
.choices button span { display: inline-block; min-width: 1.8em; }
.choices button:hover, .choices button:focus-visible { background: var(--yellow); color: var(--black); }
.waiting-panel p { margin: 0 0 4px; }
.waiting-panel #enjoying { border: 1px solid var(--yellow); background: transparent; color: var(--yellow); padding: 5px; font: inherit; text-align: left; }
.waiting-panel #enjoying:hover, .waiting-panel #enjoying:focus-visible { background: var(--yellow); color: var(--black); }
.waiting-panel #waiting-timer { font-size: 1.25em; }
.game-status { min-height: 0; margin: 0; font-size: 12px; font-weight: bold; line-height: 1.4; }
.game-status:not(:empty) { padding: 9px 0 0; }
.read-magazine { margin-top: 8px; padding: 8px 12px; border: 2px solid var(--black); background: var(--yellow); font-weight: bold; }
.read-magazine { display: block; background: var(--black); color: var(--yellow); }
.read-magazine[hidden] { display: none; }
.read-magazine:hover, .read-magazine:focus-visible { background: var(--yellow); color: var(--black); }
.instructions, .mobile-instructions { font-size: 10px; font-weight: bold; line-height: 1.5; letter-spacing: .03em; }
.instructions { padding: 7px 0; }
.instructions p { margin: 0; }
.mobile-instructions { display: none; }
.controls { display: flex; align-items: center; justify-content: space-between; gap: 20px; max-width: 320px; }
.controls button { width: 76px; height: 76px; border: 2px solid var(--black); border-radius: 50%; background: transparent; font: bold 18px/1 "Courier New", monospace; touch-action: manipulation; }
.joystick { position: relative; width: 120px; height: 120px; border: 3px solid var(--black); border-radius: 50%; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; cursor: grab; }
.joystick-knob { position: absolute; width: 42px; height: 42px; left: calc(50% - 21px); top: calc(50% - 21px); border-radius: 50%; background: var(--black); pointer-events: none; }
.controls button:hover, .controls button.pressed { color: var(--yellow); background: var(--black); }
.death-screen { position: absolute; z-index: 2; inset: 0; display: grid; place-items: center; background: var(--black); color: var(--yellow); text-align: center; padding: 12px; }
.death-screen[hidden] { display: none; }
.death-content h2 { margin: 4px 0; font: 900 clamp(38px, 8vw, 100px)/1 Plakat, serif; }
.death-content p { margin: 8px 0; font-size: clamp(10px, 1.6vw, 14px); }
.death-small { font-weight: bold; letter-spacing: .1em; }
.death-content button { margin-top: 8px; padding: 10px 20px; border: 2px solid var(--yellow); background: var(--yellow); color: var(--black); font-weight: bold; }
.death-content button:hover { background: var(--black); color: var(--yellow); }
.win-screen { position: absolute; z-index: 4; inset: 0; display: grid; place-items: center; padding: 12px; background: var(--black); color: var(--yellow); text-align: center; }
.win-screen[hidden] { display: none; }
.win-content { max-width: 430px; opacity: 0; animation: win-reveal 2.5s ease forwards; font-weight: bold; }
.win-content img { width: min(120px, 22vw); background: var(--yellow); }
.win-content h2 { font: 900 clamp(28px, 5vw, 55px)/1 Plakat, serif; margin: 8px 0; }
.win-content p { font-size: clamp(10px, 1.4vw, 14px); }
.win-content button { background: var(--yellow); color: var(--black); border: 0; padding: 8px 14px; font-weight: bold; }
@keyframes win-reveal { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .win-content { animation: none; opacity: 1; } }
.no-script { padding: 20px; font-weight: bold; }
@media (max-width: 600px) {
  .game-shell { padding-top: 14px; padding-bottom: calc(164px + env(safe-area-inset-bottom, 0px)); }
  .game-header a { font-size: 10px; }
  .screen { border-width: 3px; }
  .instructions { display: none; }
  .controls { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; max-width: none; margin: 0; padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); background: var(--yellow); border-top: 2px solid var(--black); }
  .game-shell:not(.is-playing) .controls { visibility: hidden; }
  .controls button { height: 76px; }
  .mobile-instructions { display: block; margin: 10px 0 0; }
  .dialogue, .dialogue:has(.waiting-panel:not([hidden])), .thought, .screen.in-haven ~ .thought { position: static; width: 100%; max-height: none; margin-top: 8px; padding: 9px; font-size: 12px; }
  .choices button { min-height: 44px; }
  .waiting-panel h2, .waiting-panel p { margin-bottom: 2px; }
  .waiting-panel .choices button { min-height: 44px; padding: 4px; }
  .win-screen { padding: 6px; }
  .win-content img { width: min(45px, 16vw); }
  .win-content h2 { font-size: 25px; margin: 3px 0; }
  .win-content p { margin: 4px 0; }
  .win-content button { padding: 5px 10px; }
}
