:root {
  color: #293c37;
  background: #f7f5ef;
  font: 15px/1.4 'Inter', 'Helvetica Neue', Arial, sans-serif;
}
/* The on-scene controls' colours: prompts, station pins, and in embed mode the Play button and the
   badge. An embedding page can set them through the frame's address (diorama-embed.js). */
:root {
  --panel: #fffaf0; --panel-ink: #383c32; --panel-line: #c9bfa9;
  --action: #334d41; --action-ink: #fffaf0; --action-hover: #263e33;
  --action-off: #ebe6d9; --action-off-ink: #625e52;
  --pin: #b77c31; --pin-ring: #fff4d5;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.viewer-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px clamp(12px, 3vw, 48px);
  border-bottom: 1px solid #d7d8ce;
}
h1 {
  margin: 0;
  text-align: center;
  font: 500 clamp(18px, 2.3vw, 31px)/1.15 'Baskervville', Georgia, serif;
  letter-spacing: -.035em;
}
.viewer-bar a {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  color: inherit;
  text-decoration: none;
}
.gallery-link { justify-self: start; font-weight: 600; }
.gallery-link:hover { text-decoration: underline; }
.slideshow-controls { display: flex; align-items: center; justify-self: end; gap: 4px; }
.scene-arrow { min-width: 44px; border: 1px solid #bfc5bc; border-radius: 50%; font-size: 22px; }
.scene-arrow:hover { background: #e7eae1; }
:focus-visible { outline: 2px solid #94623b; outline-offset: 2px; }
.scene-window { min-height: 0; overflow: hidden; }
.scene-track, #stage { position: relative; height: 100%; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
canvas:focus-visible { outline-offset: -3px; }
canvas:active { cursor: grabbing; }
.scene-poster, .incoming-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.scene-poster { background: #f7f5ef; }
#stage:has(#loading[hidden]) .scene-poster {
  opacity: 0;
  visibility: hidden;
  transition: opacity 160ms ease-out, visibility 0s linear 160ms;
}
@media (prefers-reduced-motion: reduce) {
  #stage:has(#loading[hidden]) .scene-poster { transition: none; }
}
#loading {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  margin: 0;
  color: #54615a;
  text-align: center;
  font-size: 13px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
@media (max-width: 600px) {
  .viewer-bar { grid-template-columns: auto minmax(0,1fr) auto; gap: 8px; }
}

.interaction-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.scene-track:has(.incoming-scene) .interaction-layer { visibility: hidden; }
.station-pin, .character-prompt { position: absolute; top: 0; left: 0; pointer-events: auto; }
.station-pin {
  width: 30px; height: 30px; margin: -15px;
  border: 0; padding: 0; border-radius: 50%; background: transparent; cursor: pointer;
}
.station-pin::after {
  content: ''; display: block; width: 8px; height: 8px; margin: auto;
  border: 2px solid var(--pin-ring); border-radius: 50%; background: var(--pin);
  box-shadow: 0 0 0 1px #624b32aa, 0 1px 4px #50361b55;
}
.station-pin:is(:hover, :focus-visible, .in-reach)::after { box-shadow: 0 0 0 3px #fff3cf99, 0 0 0 4px #73553188; }
.character-prompt {
  width: max-content; min-width: 135px; max-width: min(210px, calc(100% - 12px));
  padding: 9px 10px 8px; border-radius: 11px; border: 1px solid var(--panel-line);
  background: var(--panel); color: var(--panel-ink); box-shadow: 0 3px 12px #48351b29;
}
.character-prompt::after {
  content: ''; position: absolute; left: var(--tip); bottom: -5px;
  width: 8px; height: 8px; border: solid var(--panel-line); border-width: 0 1px 1px 0;
  background: var(--panel); transform: translateX(-50%) rotate(45deg); pointer-events: none;
}
.character-prompt.below::after { top: -5px; bottom: auto; transform: translateX(-50%) rotate(225deg); }
.prompt-station { display: block; margin: 0 2px 5px; font: 500 15px/1.15 Georgia, serif; }
.prompt-action {
  width: 100%; min-height: 34px; padding: 5px 10px; border: 0; border-radius: 6px;
  background: var(--action); color: var(--action-ink); line-height: 1.25; font-family: inherit;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.prompt-action:disabled { background: var(--action-off); color: var(--action-off-ink); cursor: default; }
.prompt-action:enabled:hover { background: var(--action-hover); }
.prompt-hint { margin: 5px 2px 0; font-size: 12px; line-height: 1.3; }
.prompt-hint:empty { display: none; }
@media (pointer: coarse) { .prompt-action { min-height: 44px; } }

/* ?embed (diorama.js): the scene alone, for a frame on another site. */
.embedded body { grid-template-rows: minmax(0, 1fr); }
/* Transparent, so the host page shows through: the canvas renders with alpha, and the posters
   have transparent backgrounds. A host with a different color-scheme gets an opaque backdrop
   unless its iframe sets `color-scheme: normal`. */
.embedded, .embedded body, .embedded .scene-poster { background: transparent; }
.embedded .viewer-bar { display: none; }
.embedded:not(.playing) #loading { visibility: hidden; }
.embedded #loading { color: var(--panel-ink); }
.embed-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  min-width: 112px; min-height: 48px; padding: 0 24px 0 44px;
  border: 0; border-radius: 999px; background: var(--action); color: var(--action-ink);
  font-family: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 16px #2e3b3340;
}
.embed-play::before {
  content: ''; position: absolute; left: 22px; top: 50%; transform: translateY(-50%);
  border-style: solid; border-width: 7px 0 7px 12px; border-color: transparent transparent transparent currentColor;
}
.embed-play:hover { background: var(--action-hover); }
.embed-open {
  position: absolute; right: 10px; bottom: 10px;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 12px; border-radius: 8px; background: var(--panel); color: var(--panel-ink); border: 1px solid var(--panel-line);
  font-size: 12px; font-weight: 600; text-decoration: none; box-shadow: 0 1px 6px #48351b29;
}
/* The gallery's Maple Line mark (diorama-gallery.css), at the badge's size. */
.embed-rail {
  display: inline-block; position: relative; width: 19px; height: 10px;
  border-block: 2px solid var(--action); transform: skew(-16deg);
}
.embed-rail::before, .embed-rail::after {
  content: ''; position: absolute; top: -4px; left: 4px; width: 2px; height: 15px; background: var(--action);
}
.embed-rail::after { left: 12px; }
.embed-brand { font: 600 15px/1 'Baskervville', Georgia, serif; letter-spacing: -.5px; }
.embed-go { padding-left: 8px; border-left: 1px solid var(--panel-line); color: var(--pin); }
.embed-open:hover .embed-brand { text-decoration: underline; }
.embedded:not(.playing) canvas { cursor: default; }
