.artifact-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  color: var(--white);
  background: #b7a793;
  touch-action: pan-y;
}

.artifact-stage::before,
.artifact-stage::after {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  content: "";
}

.artifact-stage::before {
  inset: 0;
  background:
    linear-gradient(180deg, rgba(23, 16, 12, .08), transparent 30%, transparent 68%, rgba(23, 16, 12, .22)),
    linear-gradient(90deg, rgba(32, 20, 14, .08), transparent 28%, transparent 72%, rgba(68, 17, 13, .12));
}

.artifact-stage::after {
  left: 8%;
  top: 11%;
  width: 84%;
  height: 78%;
  border: 1px solid rgba(255, 249, 239, .16);
  border-radius: 50%;
}

.artifact-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus, center);
  transform: scale(1.012);
  transition:
    opacity var(--scene-duration) var(--ease),
    transform 900ms var(--ease),
    object-position 700ms var(--ease),
    filter 500ms var(--ease);
  animation: stage-in 680ms var(--ease) both;
}

.artifact-img[data-fit="contain"] {
  object-fit: contain;
  padding: clamp(6px, 1vw, 14px);
  background: #c9baa5;
  transform: none;
  animation-name: stage-contain-in;
}

img.is-broken {
  visibility: hidden;
}

.image-fallback {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 50%;
  width: min(78%, 320px);
  margin: 0;
  padding: 16px;
  border: 1px solid rgba(255, 249, 239, .28);
  color: rgba(255, 249, 239, .88);
  background: rgba(24, 20, 17, .72);
  font: 12px/1.65 var(--sans);
  text-align: center;
  transform: translate(-50%, -50%);
}

.stage-caption {
  position: absolute;
  z-index: 6;
  left: clamp(18px, 3vw, 42px);
  bottom: clamp(18px, 3vw, 36px);
  max-width: min(72%, 460px);
  padding: 9px 12px;
  border-left: 2px solid var(--gold);
  color: rgba(255, 249, 239, .9);
  background: rgba(24, 20, 17, .72);
  backdrop-filter: blur(10px);
  font: 11px/1.5 var(--sans);
}

.stage-badge {
  position: absolute;
  z-index: 6;
  top: clamp(18px, 3vw, 38px);
  left: clamp(18px, 3vw, 42px);
  padding: 8px 12px;
  border: 1px solid rgba(255, 249, 239, .32);
  border-radius: 99px;
  color: var(--white);
  background: rgba(24, 20, 17, .62);
  backdrop-filter: blur(10px);
  font: 800 10px/1 var(--sans);
  letter-spacing: .12em;
}

.scene-nav {
  position: absolute;
  z-index: 40;
  right: max(28px, calc((44vw - 420px) / 2));
  bottom: calc(13px + var(--safe-bottom));
  width: min(380px, calc(44vw - 48px));
  height: 50px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 54px;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 249, 239, .28);
  border-radius: 999px;
  color: var(--white);
  background: rgba(24, 20, 17, .95);
  box-shadow: 0 12px 36px rgba(24, 14, 10, .18);
  font: 12px/1 var(--sans);
}

.scene-nav button {
  height: 100%;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.scene-nav button:hover {
  background: rgba(255, 255, 255, .07);
}

.scene-nav button:disabled {
  cursor: default;
  opacity: .3;
}

.nav-arrow {
  font-size: 18px;
}

.nav-label {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 8px;
}

#scene-nav-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-menu {
  width: min(620px, calc(100% - 28px));
  max-height: min(760px, calc(100dvh - 40px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper-evidence);
  box-shadow: var(--shadow);
}

.scene-menu::backdrop {
  background: rgba(24, 20, 17, .62);
  backdrop-filter: blur(6px);
}

.menu-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 26px 18px;
  border-bottom: 1px solid var(--line);
}

.menu-head h2 {
  margin-bottom: 0;
  font-size: 28px;
}

.icon-button {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font: 25px/1 var(--sans);
}

.scene-menu ol {
  max-height: calc(min(760px, 100dvh - 40px) - 112px);
  margin: 0;
  padding: 10px 18px 22px;
  overflow-y: auto;
  list-style: none;
  counter-reset: menu-scene;
}

.scene-menu li {
  counter-increment: menu-scene;
}

.scene-menu li button {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.scene-menu li button::before {
  content: counter(menu-scene, decimal-leading-zero);
  color: var(--qin);
  font: 800 11px/1 var(--sans);
}

.scene-menu li button[aria-current="true"] {
  color: var(--qin-dark);
  background: rgba(143, 32, 28, .065);
}

.menu-chapter {
  color: var(--muted);
  font: 10px/1 var(--sans);
}

.control-group,
.tab-group {
  display: grid;
  grid-template-columns: repeat(var(--columns, 3), minmax(0, 1fr));
  gap: 7px;
  margin-top: 24px;
}

.control-group button,
.tab-group button {
  min-height: 46px;
  padding: 9px 7px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, .2);
  cursor: pointer;
  font: 700 12px/1.3 var(--sans);
}

.control-group button[aria-pressed="true"],
.tab-group button[aria-selected="true"] {
  color: var(--white);
  border-color: var(--qin);
  background: var(--qin);
}

.component-copy {
  min-height: 116px;
  margin-top: 12px;
  padding: 17px;
  border-left: 3px solid var(--qin);
  background: rgba(255, 255, 255, .34);
  font-size: 15px;
  line-height: 1.74;
}

.component-copy strong {
  display: block;
  margin-bottom: 7px;
  color: var(--qin);
  font: 800 12px/1.4 var(--sans);
}

.primary-button,
.secondary-button {
  min-height: 46px;
  padding: 11px 19px;
  border: 1px solid var(--line);
  border-radius: 99px;
  cursor: pointer;
  font: 700 13px/1 var(--sans);
}

.primary-button {
  color: var(--white);
  border-color: var(--qin);
  background: var(--qin);
}

.secondary-button {
  color: var(--ink);
  background: rgba(255, 255, 255, .32);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.modern-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin-top: 22px;
}

.modern-controls button {
  min-height: 62px;
  padding: 8px 4px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, .23);
  cursor: pointer;
  font: 700 11px/1.25 var(--sans);
}

.modern-controls button[aria-pressed="true"] {
  color: var(--white);
  border-color: var(--qin);
  background: var(--qin);
}

.modern-answer {
  min-height: 72px;
  margin-top: 10px;
  padding: 14px 16px;
  color: #51463d;
  background: rgba(255, 255, 255, .32);
  font-size: 14px;
  line-height: 1.65;
}

.timeline-control {
  margin-top: 26px;
}

.timeline-years {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font: 11px/1 var(--sans);
}

.timeline-years b {
  color: var(--qin);
}

.timeline-range {
  position: relative;
  height: 52px;
  margin: 8px 0 5px;
}

.timeline-ruler {
  position: absolute;
  z-index: 1;
  left: 9px;
  right: 9px;
  bottom: 9px;
  height: 31px;
  border-bottom: 2px solid rgba(80, 60, 44, .68);
  background:
    repeating-linear-gradient(
      90deg,
      rgba(80, 60, 44, .56) 0 1px,
      transparent 1px calc(4.166% - 1px),
      rgba(80, 60, 44, .56) calc(4.166% - 1px) 4.166%
    );
  clip-path: polygon(0 56%, 100% 56%, 100% 100%, 0 100%);
}

.timeline-ruler::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    repeating-linear-gradient(
      90deg,
      rgba(85, 18, 15, .82) 0 2px,
      transparent 2px calc(16.666% - 2px),
      rgba(85, 18, 15, .82) calc(16.666% - 2px) 16.666%
    );
  clip-path: polygon(0 26%, 100% 26%, 100% 100%, 0 100%);
}

.timeline-range input {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 52px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: ew-resize;
}

.timeline-range input::-webkit-slider-runnable-track {
  height: 2px;
  background: transparent;
}

.timeline-range input::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -10px;
  appearance: none;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--qin);
  box-shadow: 0 0 0 1px rgba(85, 18, 15, .45), 0 5px 12px rgba(55, 36, 26, .2);
}

.timeline-range input::-moz-range-track {
  height: 2px;
  background: transparent;
}

.timeline-range input::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--qin);
  box-shadow: 0 0 0 1px rgba(85, 18, 15, .45), 0 5px 12px rgba(55, 36, 26, .2);
}

.timeline-value {
  min-height: 142px;
  padding: 18px;
  border-left: 3px solid var(--qin);
  background: rgba(255, 255, 255, .34);
}

.timeline-value strong {
  display: block;
  margin-bottom: 7px;
  color: var(--qin);
  font-size: 26px;
}

.timeline-value b {
  display: block;
  margin-bottom: 6px;
}

.relation-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 22px;
}

.relation-controls button {
  min-height: 52px;
  padding: 8px 5px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, .24);
  cursor: pointer;
  font: 700 11px/1.25 var(--sans);
}

.relation-controls button:hover,
.relation-controls button:focus-visible {
  border-color: var(--qin);
  color: var(--qin);
}

.scene-next-action {
  display: flex;
  margin-top: 28px;
}

.scene-next-action .primary-button {
  min-width: 178px;
}

.branch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.branch-panel {
  display: none;
  margin-top: 18px;
}

.branch-panel.is-open {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.branch-card {
  min-height: 112px;
  padding: 13px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, .24);
}

.branch-card b {
  display: block;
  margin-bottom: 7px;
  color: var(--qin-dark);
  font-size: 14px;
}

.branch-card span {
  color: var(--muted);
  font: 12px/1.55 var(--sans);
}

@keyframes stage-in {
  from {
    opacity: 0;
    transform: scale(1.04);
  }
  to {
    opacity: 1;
    transform: scale(1.012);
  }
}

@keyframes stage-contain-in {
  from {
    opacity: 0;
    filter: blur(3px);
  }
  to {
    opacity: 1;
    filter: none;
  }
}

@media (max-width: 980px) and (min-width: 761px) {
  .scene-nav {
    right: 24px;
    width: calc(44vw - 36px);
  }

  .scene-scroll {
    padding-right: 32px;
    padding-left: 32px;
  }
}

@media (max-width: 760px) {
  .scene-nav {
    right: auto;
    left: 50%;
    bottom: calc(12px + var(--safe-bottom));
    width: min(360px, calc(100% - 28px - var(--safe-left) - var(--safe-right)));
    height: 50px;
    transform: translateX(-50%);
  }

  .stage-caption {
    left: 14px;
    bottom: 13px;
    max-width: calc(100% - 28px);
  }

  .stage-badge {
    top: 12px;
    left: 14px;
  }

  .modern-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .branch-panel {
    grid-template-columns: 1fr;
  }
}
