:root,
:host {
  color-scheme: dark;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #f0e6cb;
  background: #17282c;
  font-size: 14px;
  line-height: 1.5;
  --muted: #b1b8aa;
  --amber: #e2b16b;
  --line: #adc3ae25;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
select,
input {
  font: inherit;
}
button,
select {
  color: inherit;
  background: #253a3c;
  border: 1px solid #bacdb131;
  border-radius: 5px;
  min-height: 40px;
  padding: 7px 12px;
}
button {
  cursor: pointer;
}
button:hover,
select:hover {
  background: #35494a;
}
button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 4px;
}
a {
  color: inherit;
  text-underline-offset: 4px;
}
button[aria-pressed="true"] {
  background: #42534d;
  color: #fff0d0;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
[hidden] {
  display: none !important;
}
#app {
  max-width: 1600px;
  margin: auto;
  padding: 22px 28px 16px;
  background: radial-gradient(ellipse at 50% 28%, #35484944, transparent 65%);
}
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.masthead > div {
  display: flex;
  align-items: center;
  gap: 20px;
}
.wordmark {
  font-weight: 800;
  letter-spacing: -1.3px;
  font-size: 24px;
  text-decoration: none;
}
.edition {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--muted);
}
.journal {
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
}
.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 22px 0 0;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--amber);
  margin: 0 0 7px;
}
.intro h1 {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: clamp(25px, 3.1vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.7px;
  margin: 0;
}
.intro > p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.explorer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}
.explorer:has(#inspector:not([hidden])) {
  grid-template-columns: minmax(0, 1fr) 280px;
}
.scene-column {
  min-width: 0;
}
#viewport {
  position: relative;
  height: 540px;
  min-width: 0;
}
#scene {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
}
.scene-top,
.scene-bottom {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  color: var(--muted);
}
.scene-top {
  top: 18px;
  align-items: center;
  font-size: 9px;
  letter-spacing: 2px;
}
.scene-top > div {
  display: flex;
  gap: 7px;
  pointer-events: auto;
}
.scene-top button {
  font-size: 20px;
  width: 36px;
  min-height: 34px;
  padding: 0;
  background: #203234bb;
}
.scene-bottom {
  bottom: 12px;
  font-size: 10px;
  gap: 15px;
}
.scene-bottom span:last-child {
  text-align: right;
}
.scene-focus {
  position: absolute;
  right: 0;
  bottom: 48px;
  min-height: 44px;
  padding: 10px 16px;
  border-color: #f0cc94;
  background: var(--amber);
  color: #17282c;
  font-size: 12px;
  font-weight: 650;
  box-shadow: 0 5px 18px #0003;
}
.scene-focus:hover {
  background: #f0cc94;
}
#loading,
#render-error {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #19292af5;
  padding: 18px;
  border-radius: 8px;
  text-align: center;
  width: min(90%, 340px);
}
#render-error p {
  font-size: 13px;
  color: var(--muted);
}
#selection-label {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -100%);
  padding: 5px 9px;
  border: 1px solid #e2b16b77;
  border-radius: 4px;
  background: #1a2e30ed;
  color: #f4e9cf;
  font-size: 11px;
  white-space: nowrap;
  max-width: 95%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dock {
  border: 1px solid var(--line);
  background: #192d2eeb;
  border-radius: 9px;
  box-shadow: 0 15px 40px #0002;
  overflow: hidden;
}
.view-tabs {
  display: flex;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}
.view-tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  white-space: nowrap;
  font-size: 12px;
}
.physical-controls {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.range-label {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  font-size: 11px;
  flex: 1;
  min-width: 90px;
}
.range-label > span {
  color: var(--muted);
  text-align: right;
}
.range-label input {
  grid-column: span 2;
  width: 100%;
  margin: 0;
  accent-color: var(--amber);
  cursor: pointer;
  height: 20px;
}
.check {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  min-height: 36px;
}
.check input {
  accent-color: var(--amber);
  width: 16px;
  height: 16px;
}
.physical-controls button {
  font-size: 11px;
}
.explore-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
}
.picker-label {
  display: flex;
  gap: 9px;
  align-items: center;
  flex: 1;
  color: var(--muted);
  font-size: 11px;
}
.picker-label select {
  min-width: 0;
  width: 100%;
  font-size: 12px;
  color: #f0e6cb;
}
.explore-controls > button {
  font-size: 12px;
  border-color: #e2b16b66;
  color: #f4d7a0;
}
.system-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px 10px;
  font-size: 12px;
}
.system-controls select {
  min-height: 34px;
  padding: 4px 10px;
}
.view-note {
  font-size: 11px;
  color: var(--muted);
  padding: 0 16px;
  margin: 0 0 12px;
}
#story {
  margin: 20px 0 0;
  padding: 12px 14px;
  border-left: 2px solid var(--amber);
  background: #34433b66;
}
#story > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#story button[aria-label],
.inspector-top button {
  border: 0;
  background: none;
  padding: 0;
  min-height: 28px;
  width: 28px;
  font-size: 21px;
}
#story-text {
  font-size: 13px;
  min-height: 40px;
  margin: 6px 0 12px;
}
.story-actions {
  display: flex;
  gap: 8px;
}
.story-actions button {
  font-size: 11px;
  min-height: 32px;
}
.story-hint {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 0;
}
#inspector {
  align-self: start;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 18px;
  background: #1c3031;
}
.inspector-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.inspector-top p {
  margin: 0;
}
h2 {
  font:
    400 25px/1.16 Georgia,
    serif;
  margin: 0 0 14px;
}
#description {
  font-size: 13px;
  line-height: 1.65;
}
#specifications {
  margin: 18px 0;
  grid-column: 1 / -1;
}
#spec-heading {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--amber);
}
#spec-list {
  margin: 0;
  font-size: 11px;
}
#spec-list > div {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}
#spec-list dt {
  color: var(--muted);
}
#spec-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}
#spec-list .unrecorded {
  color: var(--muted);
  font-style: italic;
}
#spec-missing,
#spec-source {
  font-size: 10px;
  color: var(--muted);
}
figure {
  margin: 20px 0 16px;
}
figure a {
  text-decoration: none;
}
figure img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
  border-radius: 5px;
}
figcaption {
  font-size: 10px;
  color: var(--muted);
  margin-top: 6px;
}
.detail {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.article-link {
  font-size: 12px;
  color: var(--amber);
}
footer {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted);
  margin-top: 15px;
}
footer i {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
  margin-right: 6px;
}
.noscript {
  padding: 24px;
}
#app:fullscreen {
  max-width: none;
  overflow: auto;
  background: #17282c;
}
#app:fullscreen #viewport {
  height: calc(100vh - 365px);
  min-height: 390px;
}
@media (max-width: 950px) {
  .explorer:has(#inspector:not([hidden])) {
    grid-template-columns: minmax(0, 1fr);
  }
  #inspector {
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 22px;
  }
  #inspector > * {
    grid-column: 1;
  }
  #photo-wrap {
    grid-column: 2;
    grid-row: 2/6;
    margin: 6px 0;
  }
  .inspector-top {
    grid-column: span 2 !important;
  }
  .intro > p {
    font-size: 11px;
  }
  .physical-controls {
    gap: 12px;
  }
  #viewport {
    height: 450px;
  }
}
@media (max-width: 540px) {
  #app {
    padding: 16px 14px;
  }
  .edition {
    display: none;
  }
  .journal {
    font-size: 10px;
  }
  .intro {
    margin-top: 20px;
  }
  .intro > p {
    display: none;
  }
  .eyebrow {
    font-size: 8px;
  }
  .intro h1 {
    font-size: 29px;
  }
  #viewport {
    height: 360px;
  }
  .scene-top {
    font-size: 8px;
  }
  .scene-bottom {
    font-size: 9px;
  }
  .scene-bottom span:last-child {
    max-width: 125px;
  }
  .view-tabs {
    gap: 0;
    padding: 5px;
  }
  .view-tabs button {
    font-size: 10px;
    padding: 6px;
  }
  .physical-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 20px;
    padding: 12px;
  }
  .physical-controls > .check {
    grid-column: 1;
  }
  .physical-controls > button {
    justify-self: end;
    min-height: 32px;
  }
  .explore-controls {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px 12px;
  }
  .picker-label {
    flex-basis: 100%;
  }
  .explore-controls > button {
    margin-left: auto;
    min-height: 34px;
    font-size: 11px;
  }
  .view-note {
    font-size: 10px;
    padding: 0 12px;
  }
  footer {
    flex-wrap: wrap;
    gap: 5px 12px;
    font-size: 8px;
  }
  footer span:last-child {
    flex-basis: 100%;
  }
  #inspector {
    display: block;
    padding: 16px;
  }
  #photo-wrap {
    margin: 16px 0;
  }
  #photo {
    max-height: 220px;
  }
  .system-controls {
    font-size: 11px;
    flex-wrap: wrap;
  }
  #app:fullscreen #viewport {
    height: 45vh;
    min-height: 290px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

#card-focus {
  display: block;
  width: 100%;
  margin: 14px 0;
  color: var(--amber);
  font-size: 12px;
}
.system-controls {
  flex-wrap: wrap;
}

.intro > button {
  font-size: 11px;
  flex-shrink: 0;
}
.welcome {
  position: absolute;
  z-index: 5;
  top: 40px;
  left: 18px;
  width: 348px;
  max-width: calc(100% - 36px);
  max-height: calc(100% - 48px);
  overflow-y: auto;
  padding: 18px;
  background: #203537f5;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 40px #0003;
}
.welcome h2 {
  font:
    400 24px Georgia,
    serif;
  margin: 0 0 8px;
}
.welcome p:not(.eyebrow) {
  font-size: 13px;
  max-width: 650px;
  margin: 6px 0;
}
.welcome .welcome-hint {
  color: var(--muted);
  font-size: 12px;
}
.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
#start-tour,
#next {
  background: var(--amber);
  color: #17282c;
  border-color: var(--amber);
  font-weight: 650;
}
#start-tour:hover,
#next:hover {
  background: #f0cc94;
}
#dismiss-welcome {
  font-size: 12px;
}
@media (max-width: 540px) {
  .intro {
    align-items: center;
    gap: 12px;
  }
  .intro h1 {
    font-size: 26px;
  }
  .intro > button {
    max-width: 88px;
    padding: 6px 9px;
  }
  .welcome {
    top: 46px;
    left: 12px;
    width: 330px;
    max-width: calc(100% - 24px);
    max-height: calc(100% - 58px);
    padding: 16px;
  }
  .welcome h2 {
    font-size: 22px;
  }
  .welcome-actions {
    flex-direction: column;
    margin-top: 12px;
  }
  .welcome-actions button {
    flex: 1;
    font-size: 11px;
  }
  #story {
    padding: 10px 12px;
    margin-top: 16px;
  }
  #story-text {
    font-size: 12px;
  }
}

/* The guide shares the available screen height with the scene and controls. */
.scene-column {
  display: flex;
  flex-direction: column;
  height: var(--explorer-height, calc(100dvh - 180px));
}
.scene-column #viewport {
  flex: 1 1 0;
  height: auto;
  min-height: 0;
}
.scene-column .dock {
  flex: 0 0 auto;
  max-height: 55%;
  overflow-y: auto;
}
#story {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 14px;
  flex: 0 0 auto;
  max-height: 35%;
  overflow-y: auto;
  margin: 12px 0 0;
  padding: 10px 14px;
}
#story > div:first-child {
  grid-column: 1;
  grid-row: 1;
}
#step-count {
  margin: 0;
  line-height: 1.6;
}
#close-tour {
  position: absolute;
  top: 11px;
  right: 8px;
}
#story-text {
  grid-column: 1 / -1;
  grid-row: 2;
  min-height: 0;
  margin: 0;
}
.story-actions {
  grid-column: 2;
  grid-row: 1;
  margin-right: 30px;
}
.story-hint {
  display: none;
}
@media (min-width: 951px) {
  #inspector {
    max-height: calc(var(--explorer-height, calc(100dvh - 180px)) - 18px);
    overflow-y: auto;
  }
}
@media (max-width: 540px) {
  #story {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    padding: 9px 12px;
  }
  #step-count {
    padding-right: 24px;
  }
  .story-actions {
    grid-column: 1;
    grid-row: 3;
    margin: 3px 0 0;
  }
  #close-tour {
    top: 4px;
    right: 5px;
  }
  .scene-column .physical-controls {
    padding: 8px 12px;
    gap: 4px 16px;
  }
  .scene-column .explore-controls {
    padding: 8px 12px;
    gap: 5px 12px;
  }
}

/* Keep secondary controls available without crowding the mobile scene. */
.mobile-only,
.scene-settings > summary {
  display: none;
}
.scene-settings {
  display: contents;
}
.dock {
  display: flex;
  flex-direction: column;
}
.view-tabs {
  order: 0;
}
.physical-controls {
  order: 1;
}
.explore-controls {
  order: 2;
}
.power-controls {
  order: 3;
}
.view-note {
  order: 4;
}
@media (max-width: 700px), (max-width: 900px) and (max-height: 500px) {
  .mobile-only {
    display: inline-flex;
  }
  .scene-column {
    height: auto;
  }
  .scene-column #viewport {
    order: 0;
    flex: none;
    height: clamp(280px, 42svh, 380px);
  }
  #story {
    order: 1;
    max-height: none;
    overflow: visible;
    grid-template-columns: minmax(0, 1fr);
    padding: 14px;
  }
  #story-text {
    font-size: 14px;
    line-height: 1.6;
  }
  .story-actions {
    grid-column: 1;
    grid-row: 3;
    margin: 6px 0 0;
    flex-wrap: wrap;
  }
  .scene-column .dock {
    order: 2;
    max-height: none;
    overflow: visible;
  }
  .scene-settings {
    display: block;
    order: 3;
  }
  .scene-settings > summary {
    display: list-item;
    cursor: pointer;
    padding: 16px;
    font-size: 14px;
  }
  .scene-settings > summary span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-top: 5px;
  }
  #inspector {
    max-height: none;
    overflow: visible;
    scroll-margin-top: 16px;
  }
  #viewport {
    scroll-margin-top: 12px;
  }
  #back-to-scene {
    margin-bottom: 16px;
  }
  .story-actions button,
  .explore-controls button {
    min-height: 44px;
  }
}

.scene-column {
  position: relative;
}
@media (max-width: 700px), (max-width: 900px) and (max-height: 500px) {
  .scene-column .welcome {
    position: static;
    order: -1;
    width: 100%;
    max-width: none;
    max-height: none;
    overflow: visible;
    margin-bottom: 12px;
  }
}
