main > section,
.game-hud {
  grid-area: 1 / 1;
}

.game-hud {
  --hud-top: 4.25%;
  --hud-right: 2.58%;
  --hud-icon-width: 3.1%;
  position: relative;
  container-type: inline-size;
  width: min(100vw, calc(100vh * var(--hud-ratio)));
  width: min(100vw, calc(100dvh * var(--hud-ratio)));
  aspect-ratio: var(--hud-ratio);
  z-index: 12;
  pointer-events: none;
}

.hud-clock,
.hud-location,
.hud-bag,
.hud-inventory {
  position: absolute;
  right: var(--hud-right);
  height: auto;
}

.hud-clock,
.hud-location {
  top: var(--hud-top);
  width: 14.46%;
}

.hud-clock img {
  display: block;
  width: 100%;
  height: auto;
}

.hud-clock-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hud-day {
  position: absolute;
  inset: 19.5% 41.9% 62% 53.4%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hud-digit {
  height: 100%;
  max-width: 100%;
  aspect-ratio: 5 / 7;
  background: url("../assets/ui/hud-day-digits.png") calc(var(--digit) * 100% / 9) center / 1000% 100% no-repeat;
  image-rendering: pixelated;
}

.hud-location {
  right: auto;
  left: 2.1%;
  aspect-ratio: 600 / 217;
  color: #51250e;
  font: 750 1.4cqw / 1.2 system-ui, sans-serif;
  background: url("../assets/ui/hud-location.png") center / 100% 100% no-repeat;
}

.hud-location:not([hidden]) {
  display: grid;
  place-items: center;
}

.hud-bag,
.hud-inventory {
  width: var(--hud-icon-width);
}

.hud-bag {
  top: 15.09%;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  min-height: 20px;
  touch-action: manipulation;
}
.hud-bag img { display: block; width: 100%; }
.hud-bag:not(:disabled):hover { filter: brightness(1.14); }


.hud-inventory {
  top: 23.2%;
  display: grid;
  border-radius: .4cqw;
  outline: max(1px, .13cqw) solid #6b3a21;
  overflow: hidden;
}

.hud-slot {
  position: relative;
  box-sizing: border-box;
  aspect-ratio: 1;
  border: max(1px, .15cqw) solid #ad6c3e;
  background: linear-gradient(#ffe9c9, #f8d4a2);
  box-shadow: inset 0 0 0 max(1px, .12cqw) #ffedcc;
}

.hud-slot + .hud-slot { border-top: 0; }

.hud-journal {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

img.hud-journal,
.hud-journal img {
  object-fit: cover;
  clip-path: inset(17%);
}

button.hud-journal {
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
}

.hud-journal img { width: 100%; height: 100%; }

button.hud-journal[aria-expanded="true"] {
  background: #ffc56c4d;
}

button.hud-journal:focus-visible {
  outline: 2px solid #235e84;
  outline-offset: -2px;
}

.hud-time:not([hidden]) {
  position: absolute;
  inset: 43.2% 11.4% 20.3% 43.2%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2%;
  background: #ffdfad;
}

.hud-colon {
  height: 71%;
  aspect-ratio: 1 / 2;
  background: #3e1806;
  clip-path: polygon(0 0, 100% 0, 100% 28%, 0 28%, 0 72%, 100% 72%, 100% 100%, 0 100%);
}

.guide-journal #hud-journal-button[aria-expanded="false"]::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 125%;
  width: 170%;
  aspect-ratio: 1.25;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 38'%3E%3Cpath d='M3 12h24V3l18 16-18 16v-9H3z' fill='%23fff4bb' stroke='%23b72b20' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E");
  filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 5px #ffbd31);
  pointer-events: none;
  animation: journal-guide 1.25s ease-in-out infinite alternate;
}

@keyframes journal-guide { from { transform: translate(-26%, -50%); } to { transform: translate(9%, -50%); } }
@media (prefers-reduced-motion: reduce) {
  .guide-journal #hud-journal-button[aria-expanded="false"]::before { animation: none; transform: translateY(-50%); }
}

.guide-journal .hud-inventory { overflow: visible; }

.game-hud.room-hud {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  z-index: 61;
}
