:root {
  color-scheme: dark;
  font-family: Georgia, 'Times New Roman', serif;
  color: #fff0cb;
  background: #100d0b;
  --gold: #e6ba6c;
  --line: #b08b504d;
}
* { box-sizing: border-box; }
body { margin: 0; position: relative; height: 100vh; height: 100dvh; }
[hidden] { display: none !important; }
button { color: inherit; font: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.toolbar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 5;
  padding: 8px clamp(14px, 3vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.tools { display: flex; gap: 13px; align-items: center; }
#score { font-size: clamp(15px, 2vw, 20px); font-style: italic; margin-right: 12px; text-shadow: 0 1px 5px #000, 0 0 8px #000; }
.toolbar button {
  display: grid;
  place-items: center;
  border: 1px solid #b08b50;
  border-radius: 50%;
  width: 43px;
  height: 43px;
  background: #19130d;
  color: #ffe1a2;
  font-size: 22px;
  pointer-events: auto;
}
.home-link { pointer-events: auto; display: block; line-height: 0; }
.emblem {
  width: 46px;
  height: 46px;
  border-radius: 50%;
}
main { position: relative; height: 100%; min-height: 0; container-type: size; }
.stage { position: relative; height: 100%; overflow: hidden; isolation: isolate; }
.fill { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(22px) brightness(.5); }
.frame { position: relative; margin: auto; }
#background { width: 100%; display: block; }
#portrait { position: absolute; left: 33.3%; top: 35%; width: 9%; height: 44%; object-fit: contain; }
.speaking #background { filter: blur(3px) brightness(.75); }
#birthday-photo { position: absolute; left: 47.1%; top: 26%; width: 10.35%; height: 13.5%; object-fit: cover; filter: brightness(.65) sepia(.25); }
#room-item { position: absolute; left: 32.6%; top: 65%; width: 1.6%; height: 2.5%; object-fit: contain; }
#hotspots { position: absolute; inset: 0; }
.hotspot { position: absolute; border: 0; background: transparent; border-radius: 5px; }
.hotspot:hover, .hotspot:focus-visible { box-shadow: inset 0 0 0 1px #fbd9938c; background: #fbd99312; }
.stage::after { content: ''; position: absolute; inset: 53% 0 0; background: linear-gradient(transparent, #140e0bad); pointer-events: none; }
#inventory {
  position: absolute;
  right: clamp(10px, 2vw, 32px);
  bottom: clamp(8px, 2vh, 24px);
  display: flex;
  gap: 6px;
  z-index: 3;
  max-width: 48%;
  justify-content: flex-end;
}
.speaking #inventory { right: max(8%, 12px); }
.item {
  width: clamp(65px, 9vw, 128px);
  height: clamp(48px, 7vw, 100px);
  padding: 3px;
  border: 0;
  background: none;
  filter: drop-shadow(0 2px 4px #000);
}
.item:hover { filter: drop-shadow(0 0 5px #e6ba6c); }
.item img { width: 100%; height: 100%; object-fit: contain; }
#toast:not(:empty) { position: absolute; right: 3%; top: 3%; padding: .6rem; background: #100d0b; z-index: 2; }
h1 { font-size: clamp(17px, 1.6vw, 22px); font-variant: small-caps; letter-spacing: .06em; color: #ffda94; margin: 0 0 .6rem; width: fit-content; }
#description { white-space: pre-line; max-width: 39rem; font-size: clamp(16px, 1.65vw, 22px); line-height: 1.29; margin: 0 0 .8rem; font-style: italic; text-shadow: 0 1px 3px #000; }
#choices { display: grid; }
#choices button { text-align: left; border: 0; border-bottom: 1px solid var(--line); padding: .42rem .25rem; background: transparent; font-size: clamp(16px, 1.55vw, 20px); text-shadow: inherit; }
#choices button::before { content: '›'; color: var(--gold); padding-right: .85rem; }
#choices button:hover { background: #b08b5026; }
dialog { width: min(90vw, 590px); color: inherit; border: 1px solid #b08b50; background: #1b130e; padding: 24px; }
dialog::backdrop { background: #080604bd; }
dialog h2 { margin: 0 0 .8rem; color: #ffda94; }
#detail-art img { display: block; width: 100%; height: min(46vh, 380px); object-fit: contain; margin: auto; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dialog-actions button { padding: .45rem .7rem; border: 1px solid #b08b50; background: #2a1e15; }
@media (max-width: 620px) {
  .emblem { width: 43px; height: 43px; font-size: 28px; }
}

#sound-button[aria-pressed="true"] .sound-off,
#sound-button[aria-pressed="false"] .sound-on { display: none; }
.frame {
  width: min(100%, calc(100cqh * 16 / 9));
  margin: 0 auto;
  top: 50%;
  transform: translateY(-50%);
}
#background { aspect-ratio: 16 / 9; object-fit: contain; }
#dialogue-portrait {
  position: absolute;
  z-index: 1;
  right: 7%;
  bottom: 0;
  height: min(68%, 560px);
  max-width: 45%;
  object-fit: contain;
  object-position: bottom right;
  pointer-events: none;
}
.speaking #portrait { display: none; }
#story-toggle {
  position: absolute;
  left: clamp(10px, 2vw, 32px);
  bottom: clamp(8px, 2vh, 24px);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  z-index: 3;
  border: 1px solid #b08b50;
  border-radius: 50%;
  background: #19130ddb;
  color: #ffe1a2;
}
#story-toggle[aria-expanded="true"] .eye-slash { display: none; }
.story {
  position: absolute;
  left: clamp(10px, 2vw, 32px);
  bottom: calc(clamp(8px, 2vh, 24px) + 52px);
  width: min(47%, 39rem);
  max-height: calc(100% - clamp(8px, 2vh, 24px) - 60px);
  margin: 0;
  padding: clamp(10px, 1.4vw, 20px);
  background: rgb(18 14 11 / 10%);
  border-radius: 3px;
  z-index: 2;
  overflow: auto;
  overscroll-behavior: contain;
  pointer-events: none;
  scrollbar-color: #8f7045 transparent;
  text-shadow: 0 1px 3px #000, 0 0 6px #000;
}
@media (max-aspect-ratio: 1/1) {
  .frame { top: 0; transform: none; }
  .story { width: min(72%, 34rem); max-height: 60%; }
  #dialogue-portrait { max-width: 38%; height: min(45%, 400px); right: 1%; }
}
@media (max-width: 620px) and (max-aspect-ratio: 1/1) {
  .stage:not(.speaking) .story { width: calc(100% - 20px); }
  #dialogue-portrait { max-width: 31%; }
}

#dialogue-portrait[src$="bentley-dialog.webp"] { transform: scaleX(-1); }
#scene-actor { position: absolute; bottom: 42%; left: 54%; height: 31%; width: 16%; object-fit: contain; object-position: center bottom; pointer-events: none; }
@media (min-aspect-ratio: 16/9) {
  .story { max-height: calc(100% - clamp(8px, 2vh, 24px) - 115px); }
}

.story #choices button, #help-button { pointer-events: auto; }
#help-button { padding: .35rem .25rem; border: 0; background: transparent; text-shadow: inherit; }
#inventory:has(> :nth-child(3)) {
  justify-content: flex-start;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
#inventory:has(> :nth-child(3)) .item { flex: 0 0 auto; }
#inventory:has(> :nth-child(3)) .item {
  width: clamp(42px, 5.2vw, 78px);
  height: clamp(37px, 4.4vw, 64px);
}
.story:focus-within { scrollbar-color: #8f7045 transparent; }
