:root {
  color-scheme: dark;
  font-family: Georgia, "Times New Roman", serif;
  color: #f2e6cc;
  background: #0a100e;
  --ink: #f2e6cc;
  --dim: #d5c7aa;
  --line: #e3c58945;
  --mono: "Courier New", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 240px; overflow: hidden; }
button { font: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid #fff3be; outline-offset: 4px; }
p, h1, h2 { margin: 0; }

.game {
  height: 100vh;
  height: 100dvh;
  width: 100%;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #142018 url("forest.jpg") center 58% / cover;
  touch-action: none;
}

canvas, .frame { position: absolute; inset: 0; width: 100%; height: 100%; }
canvas { display: block; }
.frame { pointer-events: none; }
.frame::after {
  content: "";
  position: absolute;
  inset: 13px;
  border: 1px solid var(--line);
  z-index: -1;
}

.top, .bottom {
  position: absolute;
  left: clamp(20px, 4.3vw, 76px);
  right: clamp(20px, 4.3vw, 76px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font: 11px/1.4 var(--mono);
  text-shadow: 0 1px 6px #000;
}
.top { top: clamp(24px, 4.5vh, 52px); }
.bottom {
  bottom: max(22px, env(safe-area-inset-bottom));
  color: var(--dim);
}
.wordmark { font-weight: bold; letter-spacing: .19em; }

.sound {
  pointer-events: auto;
  color: var(--ink);
  border: 1px solid var(--line);
  background: #11201ad9;
  padding: 8px 11px;
  font: 11px var(--mono);
}

.hud {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 16px;
  position: absolute;
  top: clamp(69px, 11vh, 108px);
  left: clamp(20px, 4.3vw, 76px);
  right: clamp(20px, 4.3vw, 76px);
  color: var(--ink);
  text-shadow: 0 1px 5px #000, 0 1px 10px #000;
}
.label, .overline { font: 11px/1.5 var(--mono); letter-spacing: .2em; }
.objective { margin-top: 4px; font-size: clamp(15px, 2.2vw, 20px); font-style: italic; }
.measure { margin-left: auto; width: clamp(78px, 17vw, 205px); text-align: right; font: 12px var(--mono); }
progress { display: block; height: 5px; width: 100%; margin-top: 5px; accent-color: #ebba65; }
.health { font: 16px var(--mono); align-self: center; border-left: 1px solid var(--line); padding-left: 12px; }
.health .label { color: #f2b4a9; }
.game[data-level="3"] { --line: #d9928060; }
.game[data-level="3"] .sound { background: #271218ec; }
.game[data-level="3"] progress { accent-color: #eb7764; }

.prompt {
  display: grid;
  align-items: center;
  position: absolute;
  inset: 86px clamp(25px, 9vw, 164px) 80px;
  pointer-events: none;
}
.intro { max-width: 690px; text-shadow: 0 4px 40px #070a06, 0 1px 4px #070a06; }
.overline { color: #efd59d; }
h1 {
  font-weight: normal;
  font-size: clamp(54px, 9.4vw, 146px);
  letter-spacing: -.075em;
  line-height: .83;
  margin: .23em 0 .28em;
}
.invitation { color: var(--dim); font: italic clamp(17px, 2.3vw, 23px)/1.45 Georgia, serif; }
.primary {
  pointer-events: auto;
  background: #e8cd96;
  border: 1px solid #fff2c2;
  box-shadow: 0 5px 24px #0007;
  color: #221a11;
  margin-top: 24px;
  padding: 13px 18px;
  font-size: 16px;
}
.primary span { padding-left: 12px; }
.primary:hover { background: #f5dfa9; }

.scene-message {
  justify-self: center;
  max-width: min(92vw, 600px);
  padding: 23px 28px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #100b0bd9;
  text-align: center;
  box-shadow: 0 0 40px #0008;
}
.scene-message h2 { font-size: clamp(24px, 5vw, 50px); font-weight: normal; margin: .25em 0; }
.scene-message p:last-of-type { color: var(--dim); font: 13px/1.6 var(--mono); }
.game[data-mode="play"] .prompt { display: none; }
.game[data-mode="settled"] .prompt { z-index: 1; }

@media (max-width: 520px) {
  .frame::after { inset: 8px; }
  .top, .bottom, .hud { left: 16px; right: 16px; }
  .top, .bottom { font-size: 10px; }
  .bottom { align-items: flex-end; }
  .bottom p { max-width: 48%; }
  .bottom p:last-child { text-align: right; }
  .hud { gap: 7px; }
  .objective { font-size: 14px; }
  .measure { width: 68px; }
  .health { padding-left: 6px; }
}

@media (max-height: 450px) {
  .prompt { inset-block: 57px 44px; }
  h1 { font-size: clamp(40px, 13vh, 76px); }
  .invitation { font-size: 15px; }
  .primary { margin-top: 12px; }
}
