:root {
  --ink: #ece7db;
  --muted: #898b84;
  --dim: #5c605c;
  --gold: #c8a567;
  --gold-bright: #e2c58d;
  --red: #9d3026;
  --line: rgba(220, 207, 176, 0.16);
  --line-strong: rgba(220, 207, 176, 0.32);
  --panel: rgba(13, 15, 14, 0.84);
  --panel-solid: #101211;
  --serif: "Songti SC", "STSong", "SimSun", serif;
  --sans: "Avenir Next", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #090b0b;
  color: var(--ink);
  font-family: var(--sans);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 1px solid var(--gold-bright);
  outline-offset: 3px;
}

.experience,
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#scene {
  display: block;
  cursor: grab;
  touch-action: none;
}

#scene:active {
  cursor: grabbing;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(3, 5, 5, 0.52), transparent 27%, transparent 73%, rgba(3, 5, 5, 0.48)),
    radial-gradient(circle at 52% 43%, transparent 34%, rgba(3, 5, 5, 0.18) 63%, rgba(3, 5, 5, 0.78) 118%);
  z-index: 1;
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.museum-panel {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25), inset 0 1px rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(18px) saturate(86%);
  -webkit-backdrop-filter: blur(18px) saturate(86%);
}

.masthead {
  position: fixed;
  z-index: 4;
  top: 24px;
  left: 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: none;
}

.seal,
.loading-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(207, 61, 47, 0.85);
  background: rgba(125, 32, 26, 0.78);
  color: #f1d7bd;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1;
  box-shadow: inset 0 0 0 3px rgba(45, 10, 8, 0.3);
}

.title-lockup .kicker {
  margin: 0 0 4px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.title-lockup h1 {
  margin: 0;
  color: #b9b8b0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.title-lockup h1 span {
  margin-right: 8px;
  color: #f0ebdf;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.scene-status {
  position: fixed;
  z-index: 4;
  top: 30px;
  right: 28px;
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: rgba(11, 13, 12, 0.72);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
}

.scene-status b {
  margin-left: 11px;
  padding-left: 11px;
  border-left: 1px solid var(--line);
  color: #bdbbad;
  font-weight: 500;
}

.status-light {
  width: 5px;
  height: 5px;
  margin-right: 9px;
  border-radius: 50%;
  background: #c5a565;
  box-shadow: 0 0 10px rgba(210, 174, 106, 0.65);
}

.stage-panel {
  position: fixed;
  z-index: 4;
  top: 102px;
  left: 28px;
  width: 286px;
  padding: 18px;
}

.panel-heading {
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.panel-heading > div,
.material-heading > div {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.panel-heading h2,
.material-heading h2 {
  margin: 0;
  color: #ded9cd;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.panel-heading p {
  max-width: 30ch;
  margin: 8px 0 0 30px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.panel-heading.compact {
  padding-bottom: 12px;
}

.section-number {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.stage-list {
  list-style: none;
  margin: 9px 0 0;
  padding: 0;
}

.stage-list li {
  position: relative;
}

.stage-list li:not(:last-child)::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 37px;
  bottom: -7px;
  left: 12px;
  width: 1px;
  background: var(--line);
}

.stage-list li.is-complete:not(:last-child)::after {
  background: rgba(196, 157, 94, 0.56);
}

.stage-item {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 25px 1fr 8px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 5px 2px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.stage-index {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid #3d403c;
  border-radius: 50%;
  background: #151715;
  color: #747870;
  font-family: var(--mono);
  font-size: 8px;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.stage-copy {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: baseline;
}

.stage-copy b {
  color: #898b84;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  transition: color 180ms ease;
}

.stage-copy small {
  color: #5f625e;
  font-size: 9px;
  letter-spacing: 0.04em;
}

.stage-state {
  width: 5px;
  height: 5px;
  border: 1px solid #4c504b;
  transform: rotate(45deg);
}

.stage-item:hover .stage-copy b,
.stage-item:hover .stage-copy small {
  color: #d1cabd;
}

.stage-list li.is-complete .stage-index {
  border-color: rgba(197, 158, 95, 0.55);
  color: var(--gold);
}

.stage-list li.is-complete .stage-state {
  border-color: rgba(197, 158, 95, 0.72);
  background: rgba(197, 158, 95, 0.56);
}

.stage-list li.is-active .stage-item {
  background: linear-gradient(90deg, rgba(170, 48, 38, 0.15), transparent 78%);
}

.stage-list li.is-active .stage-index {
  border-color: var(--red);
  background: rgba(137, 39, 31, 0.35);
  color: #f0c9a9;
}

.stage-list li.is-active .stage-copy b {
  color: #f0e9dd;
}

.stage-list li.is-active .stage-copy small {
  color: #a9a89f;
}

.stage-list li.is-active .stage-state {
  border-color: #c75849;
  background: #a33228;
  box-shadow: 0 0 12px rgba(175, 57, 46, 0.65);
}

.stage-narrative {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 10px;
  min-height: 58px;
  margin: 9px -18px -18px;
  padding: 13px 18px 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.stage-narrative span {
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 16px;
}

.stage-narrative p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.component-panel {
  position: fixed;
  z-index: 4;
  top: 102px;
  right: 28px;
  width: 242px;
  padding: 17px;
}

.component-list {
  list-style: none;
  margin: 9px 0 0;
  padding: 0;
}

.component-list li {
  display: grid;
  grid-template-columns: 8px 1fr;
  align-items: center;
  gap: 11px;
  min-height: 45px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(220, 207, 176, 0.085);
  transition: opacity 160ms ease, transform 160ms ease, background 160ms ease;
}

.component-list li:last-child {
  border-bottom: 0;
}

.component-list li.is-active {
  transform: translateX(4px);
  background: linear-gradient(90deg, rgba(199, 164, 102, 0.08), transparent);
}

.component-list.is-filtering li:not(.is-active) {
  opacity: 0.35;
}

.component-list div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.component-list b {
  color: #d3cfc4;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
}

.component-list em {
  margin-left: 4px;
  color: #7e817b;
  font-family: var(--sans);
  font-size: 8px;
  font-style: normal;
  letter-spacing: 0.06em;
}

.component-list span {
  color: #696d68;
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.swatch {
  display: block;
  width: 5px;
  height: 18px;
  background: #777;
}

.swatch.vermilion { background: #9e3429; }
.swatch.redwood { background: #713028; }
.swatch.timber { background: #785033; }
.swatch.darkwood { background: #493024; }
.swatch.honey { background: #a47c4a; }
.swatch.cinnabar { background: #b05735; }

.material-panel {
  position: fixed;
  z-index: 4;
  right: 28px;
  bottom: 96px;
  width: 242px;
  padding: 16px;
}

.material-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 13px;
}

.material-heading output {
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 18px;
}

.material-heading output::after {
  content: "%";
  margin-left: 2px;
  color: #817963;
  font-size: 9px;
}

.range-label {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  color: #646861;
  font-size: 7px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.range-label b {
  color: #9a9a90;
  font-size: 8px;
  font-weight: 500;
}

.range-label span:last-child {
  text-align: right;
}

input[type="range"] {
  width: 100%;
  height: 16px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(90deg, #9a7846, #302e29);
}

input[type="range"]::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -5px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #d7bb86;
  border-radius: 50%;
  background: #171816;
  box-shadow: 0 0 0 3px rgba(203, 166, 101, 0.08);
}

input[type="range"]::-moz-range-track {
  height: 2px;
  background: #5c4e38;
}

input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 1px solid #d7bb86;
  border-radius: 50%;
  background: #171816;
}

.xray-button {
  display: grid;
  grid-template-columns: 29px 1fr auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin-top: 13px;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.xray-button > span:nth-child(2) {
  display: flex;
  flex-direction: column;
}

.xray-button b {
  color: #c9c5ba;
  font-size: 10px;
  font-weight: 500;
}

.xray-button small {
  margin-top: 2px;
  color: #666a64;
  font-size: 8px;
}

.xray-button em {
  color: #777b74;
  font-family: var(--mono);
  font-size: 8px;
  font-style: normal;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.xray-glyph {
  position: relative;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid #484b46;
}

.xray-glyph i {
  position: absolute;
  display: block;
  width: 13px;
  height: 1px;
  background: #777b74;
}

.xray-glyph i:nth-child(1) { transform: translateY(-4px); }
.xray-glyph i:nth-child(3) { transform: translateY(4px); }

.xray-button[aria-pressed="true"] .xray-glyph {
  border-color: rgba(212, 178, 112, 0.72);
  background: rgba(196, 156, 91, 0.12);
}

.xray-button[aria-pressed="true"] .xray-glyph i {
  background: var(--gold-bright);
  box-shadow: 0 0 5px rgba(225, 193, 133, 0.45);
}

.xray-button[aria-pressed="true"] em {
  color: var(--gold-bright);
}

.control-dock {
  position: fixed;
  z-index: 5;
  bottom: 22px;
  left: 50%;
  display: grid;
  grid-template-columns: auto auto minmax(190px, 300px);
  align-items: center;
  gap: 19px;
  width: min(720px, calc(100vw - 600px));
  min-width: 610px;
  min-height: 58px;
  padding: 10px 15px;
  transform: translateX(-50%);
}

.current-stage {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding-right: 15px;
  border-right: 1px solid var(--line);
  white-space: nowrap;
}

.current-stage span {
  color: #686c66;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.current-stage b {
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 500;
}

.current-stage i {
  color: #5e615d;
  font-family: var(--mono);
  font-size: 8px;
  font-style: normal;
}

.transport {
  display: flex;
  gap: 4px;
}

.transport button {
  min-width: 48px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-right-color: var(--line);
  background: transparent;
  color: #838780;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.transport button:last-child {
  border-right-color: transparent;
}

.transport button:hover,
.transport button.is-active {
  border-color: var(--line-strong);
  background: rgba(199, 163, 100, 0.08);
  color: #e5d8bf;
}

.transport button:active,
.stage-item:active,
.xray-button:active {
  transform: translateY(1px);
}

.progress-wrap {
  display: grid;
  grid-template-columns: 1fr 34px;
  align-items: center;
  gap: 10px;
}

.progress-track {
  position: relative;
  height: 18px;
  cursor: pointer;
}

.progress-track::before {
  content: "";
  position: absolute;
  top: 8px;
  right: 0;
  left: 0;
  height: 2px;
  background: #2d302d;
}

.progress-track > span {
  position: absolute;
  z-index: 1;
  top: 8px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, #8d2d25, #d0aa65);
  box-shadow: 0 0 8px rgba(196, 150, 80, 0.25);
}

.progress-track i {
  position: absolute;
  z-index: 2;
  top: 6px;
  width: 1px;
  height: 6px;
  background: #62635c;
}

.progress-wrap > span {
  color: #888a82;
  font-family: var(--mono);
  font-size: 8px;
  text-align: right;
}

.component-tooltip {
  position: fixed;
  z-index: 8;
  top: 0;
  left: 0;
  width: 270px;
  padding: 12px 14px 13px;
  border: 1px solid rgba(218, 190, 138, 0.38);
  border-radius: 2px;
  background: rgba(12, 14, 13, 0.94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  opacity: 0;
  pointer-events: none;
  transform: translate(16px, calc(-100% - 13px));
  transition: opacity 100ms ease;
}

.component-tooltip.is-visible {
  opacity: 1;
}

.component-tooltip > span {
  display: block;
  margin-bottom: 5px;
  color: #786f5e;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.component-tooltip div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.component-tooltip b {
  color: #f0e7d8;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
}

.component-tooltip em {
  color: var(--gold);
  font-size: 9px;
  font-style: normal;
  letter-spacing: 0.06em;
}

.component-tooltip strong {
  margin-left: auto;
  color: #858880;
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.component-tooltip p {
  margin: 5px 0 0;
  color: #9c9d96;
  font-size: 9px;
  line-height: 1.5;
}

.interaction-hint {
  position: fixed;
  z-index: 3;
  bottom: 34px;
  left: 28px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #5e635d;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
}

.interaction-hint i {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #6d6353;
}

.loading {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 13px;
  background: #090b0b;
  transition: opacity 600ms ease, visibility 600ms ease;
}

.loading.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-mark {
  width: 50px;
  height: 50px;
}

.loading-line {
  width: 120px;
  height: 1px;
  overflow: hidden;
  background: #282b28;
}

.loading-line span {
  display: block;
  width: 45%;
  height: 100%;
  background: var(--gold);
  animation: loading-sweep 1.2s ease-in-out infinite;
}

.loading p {
  margin: 0;
  color: #74776f;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.webgl-fallback {
  position: fixed;
  z-index: 30;
  inset: 0;
  place-content: center;
  background: #0b0d0c;
  text-align: center;
}

.webgl-fallback:not([hidden]) {
  display: grid;
}

.webgl-fallback b {
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 24px;
}

.webgl-fallback p {
  color: var(--muted);
  font-size: 12px;
}

body.is-xray .atmosphere {
  background:
    linear-gradient(90deg, rgba(2, 9, 10, 0.58), transparent 30%, transparent 70%, rgba(2, 9, 10, 0.56)),
    radial-gradient(circle at 50% 42%, rgba(43, 91, 92, 0.08), rgba(2, 6, 7, 0.76) 78%);
}

@keyframes loading-sweep {
  from { transform: translateX(-110%); }
  50% { transform: translateX(120%); }
  to { transform: translateX(260%); }
}

@media (max-width: 1180px) {
  .control-dock {
    width: min(620px, calc(100vw - 340px));
    min-width: 560px;
    left: 22px;
    transform: none;
  }

  .component-panel {
    display: none;
  }
}

@media (max-width: 860px) {
  .masthead {
    top: 14px;
    left: 14px;
  }

  .seal {
    width: 36px;
    height: 36px;
    font-size: 19px;
  }

  .title-lockup .kicker {
    font-size: 7px;
  }

  .title-lockup h1 {
    font-size: 10px;
  }

  .title-lockup h1 span {
    font-size: 17px;
  }

  .scene-status,
  .interaction-hint {
    display: none;
  }

  .stage-panel {
    top: 72px;
    right: 12px;
    left: 12px;
    width: auto;
    padding: 11px;
  }

  .stage-panel .panel-heading,
  .stage-narrative,
  .stage-list li::after {
    display: none;
  }

  .stage-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    margin: 0;
  }

  .stage-item {
    grid-template-columns: 21px 1fr;
    gap: 5px;
    min-height: 38px;
    padding: 2px 4px;
  }

  .stage-index {
    width: 21px;
    height: 21px;
    font-size: 7px;
  }

  .stage-copy {
    display: block;
  }

  .stage-copy b {
    display: block;
    font-size: 12px;
  }

  .stage-copy small,
  .stage-state {
    display: none;
  }

  .material-panel {
    right: 12px;
    bottom: 88px;
    width: 210px;
    padding: 12px;
  }

  .material-heading {
    margin-bottom: 8px;
  }

  .material-heading h2 {
    font-size: 13px;
  }

  .control-dock {
    right: 12px;
    bottom: 12px;
    left: 12px;
    grid-template-columns: auto 1fr;
    gap: 10px;
    width: auto;
    min-width: 0;
    min-height: 62px;
    padding: 8px 10px;
  }

  .current-stage {
    padding-right: 9px;
  }

  .transport {
    justify-content: space-between;
  }

  .transport button {
    min-width: 0;
    flex: 1;
    padding: 0 5px;
  }

  .progress-wrap {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 560px) {
  .title-lockup .kicker {
    display: none;
  }

  .title-lockup h1 span {
    display: block;
    margin-bottom: 1px;
  }

  .stage-panel {
    top: 70px;
  }

  .stage-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
  }

  .stage-copy b {
    font-size: 11px;
  }

  .material-panel {
    bottom: 92px;
    width: 188px;
  }

  .material-panel .section-number,
  .xray-button small,
  .range-label span {
    display: none;
  }

  .range-label {
    display: block;
  }

  .control-dock {
    grid-template-columns: 48px 1fr;
  }

  .current-stage span,
  .current-stage i {
    display: none;
  }

  .transport button {
    font-size: 7px;
  }

  .component-tooltip {
    width: min(250px, calc(100vw - 24px));
  }
}

@media (max-height: 680px) and (min-width: 861px) {
  .stage-panel {
    top: 82px;
  }

  .stage-panel .panel-heading p,
  .stage-narrative,
  .component-panel .panel-heading p {
    display: none;
  }

  .stage-panel .panel-heading {
    padding-bottom: 8px;
  }

  .stage-item {
    min-height: 40px;
  }

  .component-panel {
    top: 82px;
  }

  .component-list li {
    min-height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@supports not (backdrop-filter: blur(1px)) {
  .museum-panel,
  .scene-status {
    background: rgba(14, 16, 15, 0.97);
  }
}
