:root {
  color-scheme: dark;
  --paper: #eee1be;
  --amber: #d7b77d;
  --line: #b6a27b61;
  --mono: "IBM Plex Mono", "Courier New", monospace;
  --display: "Silkscreen", "Courier New", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #15151a;
  color: var(--paper);
  font: 13px var(--mono);
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
  image-rendering: pixelated;
  cursor: none;
}

#ui, #menu, #hud, #veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

button {
  color: inherit;
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
  border-radius: 0;
}

button:focus-visible { outline: 2px solid var(--paper); outline-offset: 5px; }

#menu {
  --gutter: clamp(16px, 3.5vw, 52px);
  --lower: clamp(20px, 5.5vh, 58px);
  background: linear-gradient(90deg, #13131b70, #17141824 25%, #17141824 75%, #13131b70),
    linear-gradient(180deg, #13131b57, #18151b18 28%, #18151b34 62%, #13131be8);
  pointer-events: auto;
  cursor: default;
}

.frame {
  position: absolute;
  inset: calc(var(--lower) * .66) calc(var(--gutter) * .67);
  background:
    linear-gradient(var(--line), var(--line)) top left / 18px 1px,
    linear-gradient(var(--line), var(--line)) top left / 1px 18px,
    linear-gradient(var(--line), var(--line)) top right / 18px 1px,
    linear-gradient(var(--line), var(--line)) top right / 1px 18px,
    linear-gradient(var(--line), var(--line)) bottom left / 18px 1px,
    linear-gradient(var(--line), var(--line)) bottom left / 1px 18px,
    linear-gradient(var(--line), var(--line)) bottom right / 18px 1px,
    linear-gradient(var(--line), var(--line)) bottom right / 1px 18px;
  background-repeat: no-repeat;
}

.title-card {
  position: absolute;
  display: grid;
  justify-items: center;
  width: min(760px, 94vw);
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
}

h1 {
  font: 700 clamp(58px, 12.4vw, 174px)/.91 var(--display);
  letter-spacing: .045em;
  text-indent: .045em;
  margin: 7px 0 clamp(22px, 4vh, 43px);
  color: #ead9ae;
  text-shadow: 0 3px #8c704d, 0 7px #1a1821, 0 14px 35px #14121cbd;
}

.sigil {
  position: relative;
  display: grid;
  place-items: center;
  width: 130px;
  height: 41px;
  color: var(--amber);
  background: linear-gradient(90deg, transparent, #cba9789c) left center / 47px 1px,
    linear-gradient(270deg, transparent, #cba9789c) right center / 47px 1px;
  background-repeat: no-repeat;
  filter: drop-shadow(0 2px 2px #121018);
}

.sigil i, .sigil b { position: absolute; background: currentColor; }
.sigil i { width: 9px; height: 30px; top: 1px; clip-path: polygon(50% 0, 83% 12%, 70% 92%, 50% 100%, 30% 92%, 17% 12%); }
.sigil b { width: 17px; height: 2px; top: 28px; box-shadow: 0 3px 0 -0.4px #b898696b; }
.sigil::after { content: ""; position: absolute; top: 31px; width: 2px; height: 6px; background: currentColor; }

#start {
  min-width: 231px;
  padding: 12px 14px;
  background: #201c24d9;
  border: 1px solid #caaa74a6;
  box-shadow: inset 0 0 0 3px #201c24, inset 0 0 0 4px #caaa7436, 0 5px 0 #14121b8a;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .075em;
}

#start span { padding: 0 .45em; color: var(--amber); font-size: .65em; vertical-align: 15%; }
#start:hover { background: #3e3329; color: #fff1c6; transform: translateY(-2px); }
#start:active { transform: translateY(2px); }

#sound {
  position: absolute;
  right: var(--gutter);
  top: var(--lower);
  display: flex;
  gap: 9px;
  align-items: center;
  border: 1px solid var(--line);
  padding: 7px 10px;
  background: #1c1a21c9;
  color: #dbc9a4;
  font-size: 12px;
}

#sound:hover { color: #fff1c6; border-color: var(--amber); transform: translateY(-1px); }
.sound-icon {
  width: 14px;
  height: 12px;
  background: currentColor;
  clip-path: polygon(0 33%, 25% 33%, 52% 8%, 52% 92%, 25% 67%, 0 67%, 0 33%,
    61% 25%, 72% 25%, 81% 41%, 90% 25%, 100% 25%, 87% 50%, 100% 75%,
    90% 75%, 81% 59%, 72% 75%, 61% 75%, 74% 50%, 61% 25%);
}

#sound[aria-pressed="true"] .sound-icon {
  clip-path: polygon(0 33%, 25% 33%, 52% 8%, 52% 92%, 25% 67%, 0 67%, 0 33%,
    66% 25%, 88% 35%, 100% 50%, 88% 65%, 66% 75%, 66% 62%, 81% 50%, 66% 38%, 66% 25%);
}

#notice { margin: 18px 0 0; color: var(--paper); max-width: 35ch; text-align: center; }
.controls {
  position: absolute;
  inset: auto var(--gutter) var(--lower);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px clamp(14px, 3vw, 44px);
  color: #dbcdad;
  font-size: clamp(10px, 1vw, 12px);
  text-shadow: 0 2px #141219;
}

.controls span { white-space: nowrap; }
kbd { font: 500 1em var(--mono); color: var(--paper); }
.controls kbd {
  display: inline-block;
  margin-right: 4px;
  padding: 2px 5px;
  border: 1px solid #b39c6e63;
  background: #1a1820ad;
}

.compass {
  width: min(235px, 52vw);
  height: 34px;
  position: absolute;
  top: clamp(12px, 3vh, 28px);
  left: 50%;
  transform: translateX(-50%);
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
  border-top: 1px solid #d9c6926b;
}

.compass::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 5px;
  background: #f2d49a;
  top: 1px;
  left: calc(50% - 3px);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

#compass-track { position: absolute; left: 50%; top: 8px; }
.tick {
  position: absolute;
  top: 0;
  height: 5px;
  width: 1px;
  background: #eed8a8a8;
  text-shadow: 0 1px #18151c, 1px 1px #18151c;
}

.tick.cardinal { height: 8px; background: #f3dfb2; }
.tick b {
  display: block;
  margin-top: 8px;
  transform: translateX(-5px);
  color: #fff1c7;
  font-weight: 500;
  font-size: 11px;
}

.vitals { position: absolute; bottom: clamp(22px, 5vh, 49px); left: clamp(18px, 4vw, 64px); }
.vital { display: flex; align-items: center; gap: 9px; margin-top: 6px; }
.vital > span {
  color: var(--paper);
  font-size: 10px;
  text-shadow: 0 1px #15131b, 1px 1px #15131b;
  width: 51px;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.meter {
  --fill: 1;
  height: 8px;
  width: clamp(95px, 11vw, 157px);
  background: #25222abf;
  border: 1px solid #b8a17f80;
  padding: 1px;
}
.meter i {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(var(--fill));
  transform-origin: left;
  background: #b36950;
}
#stamina i { background: #b4a36f; }

#enemy, #shrine {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #fff0c6;
  text-shadow: 0 2px #16141d, 1px 1px #16141d;
  margin: 0;
}
#enemy { display: grid; justify-items: center; gap: 6px; bottom: clamp(35px, 8vh, 76px); }
#enemy span { font-size: 11px; letter-spacing: .08em; }
#enemy .meter { width: min(184px, 30vw); height: 6px; }
#enemy i { background: #c58d66; }
#shrine {
  bottom: 20%;
  min-width: max-content;
  padding: 5px 9px;
  border: 1px solid #ccb07e63;
  background: #211c25b8;
}
#veil { background: #17131b; opacity: 0; }
@media (max-height: 440px) {
  h1 { font-size: clamp(40px, 11vw, 86px); margin-bottom: 13px; }
  .sigil { height: 36px; }
  #start { padding-block: 8px; }
}
