@import url("/fonts/source-han-serif-sc/fonts.css");

:root {
  color-scheme: dark;
  --ink: #f6f1e7;
  --muted: rgba(246, 241, 231, 0.62);
  --faint: rgba(246, 241, 231, 0.12);
  --glass: rgba(19, 18, 22, 0.58);
  --glass-strong: rgba(20, 19, 23, 0.78);
  --line: rgba(255, 255, 255, 0.11);
  --accent: #ef7357;
  --accent-soft: rgba(239, 115, 87, 0.18);
  --warm: #f6c593;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  font-family: "Source Han Serif SC", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  overflow: hidden;
  background: #0d0d0f;
}

body {
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

#app {
  position: relative;
  width: 100vw;
  height: 100svh;
  min-height: 640px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 64% 48%, rgba(170, 99, 76, 0.18), transparent 26%),
    radial-gradient(circle at 48% 40%, rgba(110, 107, 132, 0.14), transparent 34%),
    linear-gradient(132deg, #111115 0%, #171416 48%, #0b0b0e 100%);
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}

.ambient-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.35;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: radial-gradient(circle at 63% 48%, black 0%, transparent 72%);
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 62% 48%, transparent 24%, rgba(2, 2, 4, 0.08) 54%, rgba(2, 2, 4, 0.48) 100%);
}

.glass-panel {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.016)), var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
}

.eyebrow {
  margin: 0;
  color: var(--warm);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero-copy {
  position: absolute;
  top: clamp(28px, 5vh, 60px);
  left: clamp(24px, 4.5vw, 78px);
  z-index: 5;
  width: min(480px, 34vw);
  pointer-events: none;
}

.experience-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  pointer-events: auto;
}

.experience-nav a,
.experience-nav span {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.experience-nav a {
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.experience-nav a:hover,
.experience-nav a:focus-visible {
  border-color: rgba(239, 115, 87, 0.52);
  background: rgba(239, 115, 87, 0.1);
  color: var(--ink);
  outline: none;
}

.experience-nav span {
  color: rgba(255, 255, 255, 0.32);
}

.hero-copy h1 {
  margin: 14px 0 16px;
  font-family: "Source Han Serif SC", serif;
  font-size: clamp(2.5rem, 4.6vw, 5.25rem);
  font-weight: 500;
  line-height: 0.94;
  letter-spacing: -0.055em;
}

.hero-copy h1 span {
  color: var(--accent);
}

.lede {
  max-width: 440px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.88rem, 1.05vw, 1.02rem);
  line-height: 1.8;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.hero-tags span {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
}

.mechanism-panel {
  position: absolute;
  left: clamp(24px, 4.5vw, 78px);
  bottom: clamp(22px, 5vh, 54px);
  z-index: 6;
  width: min(470px, 35vw);
  padding: 22px;
  border-radius: 24px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-title-row h2,
.focus-card h2 {
  margin: 7px 0 0;
  font-size: 1.05rem;
  font-weight: 690;
  letter-spacing: 0.02em;
}

.round-button {
  position: relative;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.round-button:hover {
  transform: translateY(-1px);
  border-color: rgba(239, 115, 87, 0.65);
  background: rgba(239, 115, 87, 0.12);
}

.pause-icon,
.pause-icon::after {
  position: absolute;
  top: 13px;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--ink);
  content: "";
}

.pause-icon {
  left: 16px;
}

.pause-icon::after {
  top: 0;
  left: 7px;
}

.round-button:not(.is-playing) .pause-icon {
  top: 13px;
  left: 16px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid var(--ink);
  border-radius: 0;
  background: transparent;
}

.round-button:not(.is-playing) .pause-icon::after {
  display: none;
}

.stage-description {
  min-height: 2.8em;
  margin: 14px 0 16px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.65;
}

.stage-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.stage-button {
  min-width: 0;
  padding: 10px 8px 9px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.stage-button:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
}

.stage-button.is-active {
  border-color: rgba(239, 115, 87, 0.56);
  background: linear-gradient(150deg, rgba(239, 115, 87, 0.2), rgba(239, 115, 87, 0.055));
}

.stage-number {
  display: block;
  margin-bottom: 11px;
  color: rgba(255, 255, 255, 0.28);
  font-size: 0.56rem;
  letter-spacing: 0.14em;
}

.stage-button.is-active .stage-number {
  color: var(--warm);
}

.stage-button strong,
.stage-button small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-button strong {
  font-size: 0.68rem;
  font-weight: 720;
}

.stage-button small {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.58rem;
}

.timeline-control {
  display: block;
  margin-top: 17px;
}

.timeline-control > span {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 9px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.65rem;
}

.timeline-control strong {
  color: rgba(255, 255, 255, 0.72);
}

.timeline-control output {
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  appearance: none;
  background: linear-gradient(90deg, var(--accent) var(--progress, 0%), rgba(255, 255, 255, 0.1) var(--progress, 0%));
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  border: 3px solid #22191a;
  border-radius: 50%;
  appearance: none;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(239, 115, 87, 0.26);
}

input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 3px solid #22191a;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(239, 115, 87, 0.26);
}

.metrics-panel {
  position: absolute;
  top: clamp(28px, 5vh, 60px);
  right: clamp(24px, 3vw, 52px);
  z-index: 6;
  width: min(300px, 24vw);
  padding: 20px;
  border-radius: 22px;
}

.metric-primary {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.relation {
  margin: 8px 0 6px;
  color: var(--accent);
  font-family: "Source Han Serif SC", serif;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1;
}

.relation i {
  font-weight: 500;
}

.metric-primary > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.55;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 12px;
  margin: 16px 0 0;
}

.metric-grid div {
  min-width: 0;
}

.metric-grid dt {
  overflow: hidden;
  margin-bottom: 5px;
  color: rgba(255, 255, 255, 0.38);
  font-size: 0.61rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-grid dd {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}

.metric-grid small {
  color: rgba(255, 255, 255, 0.38);
  font-size: 0.6rem;
  font-weight: 500;
}

.focus-card {
  position: absolute;
  right: clamp(24px, 3vw, 52px);
  bottom: clamp(82px, 11vh, 126px);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(330px, 26vw);
  padding: 17px;
  border-radius: 20px;
}

.focus-card > div:last-child {
  min-width: 0;
}

.focus-card p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.55;
}

.focus-orbit {
  position: relative;
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(239, 115, 87, 0.34);
  border-radius: 50%;
}

.focus-orbit::before,
.focus-orbit::after {
  position: absolute;
  inset: 11px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  content: "";
  transform: rotate(55deg) scaleY(0.38);
}

.focus-orbit::after {
  transform: rotate(-55deg) scaleY(0.38);
}

.focus-orbit span {
  position: absolute;
  top: 23px;
  left: 23px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 20px rgba(239, 115, 87, 0.75);
}

.scene-toolbar {
  position: absolute;
  right: clamp(24px, 3vw, 52px);
  bottom: clamp(22px, 4.5vh, 48px);
  z-index: 7;
  display: flex;
  gap: 6px;
  padding: 7px;
  border-radius: 15px;
}

.scene-toolbar button {
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.64rem;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.scene-toolbar button:hover,
.scene-toolbar button.is-active {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.9);
}

.scene-label {
  position: absolute;
  z-index: 8;
  width: max-content;
  max-width: 150px;
  padding: 9px 11px 9px 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(13, 13, 16, 0.74);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease;
}

.scene-label::before {
  position: absolute;
  top: 50%;
  right: 100%;
  width: 30px;
  height: 1px;
  background: rgba(255, 255, 255, 0.25);
  content: "";
}

.scene-label .label-dot {
  position: absolute;
  top: 15px;
  left: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(239, 115, 87, 0.8);
}

.scene-label strong,
.scene-label small {
  display: block;
}

.scene-label strong {
  font-size: 0.66rem;
}

.scene-label small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.56rem;
}

.interaction-hint {
  position: absolute;
  bottom: 17px;
  left: 50%;
  z-index: 5;
  margin: 0;
  color: rgba(255, 255, 255, 0.28);
  font-size: 0.61rem;
  letter-spacing: 0.09em;
  pointer-events: none;
  transform: translateX(-50%);
}

.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: #101014;
  transition: opacity 500ms ease, visibility 500ms ease;
}

.loading-overlay.is-hidden {
  visibility: hidden;
  opacity: 0;
}

.loading-overlay p {
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.molecule-loader {
  position: relative;
  width: 58px;
  height: 58px;
  animation: spin 1.8s linear infinite;
}

.molecule-loader i {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(239, 115, 87, 0.52);
}

.molecule-loader i:nth-child(1) {
  top: 0;
  left: 22px;
}

.molecule-loader i:nth-child(2) {
  right: 4px;
  bottom: 6px;
}

.molecule-loader i:nth-child(3) {
  bottom: 6px;
  left: 4px;
}

.error-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 30;
  width: min(460px, calc(100vw - 40px));
  padding: 28px;
  border: 1px solid rgba(239, 115, 87, 0.35);
  border-radius: 22px;
  background: rgba(24, 15, 17, 0.94);
  box-shadow: var(--shadow);
  transform: translate(-50%, -50%);
}

.error-panel h2 {
  margin: 0 0 10px;
}

.error-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1100px) {
  .hero-copy {
    width: 42vw;
  }

  .mechanism-panel {
    width: 44vw;
  }

  .metrics-panel {
    width: 250px;
  }

  .focus-card {
    display: none;
  }
}

@media (max-width: 780px) {
  html,
  body {
    overflow: auto;
  }

  #app {
    min-height: 980px;
    height: 100svh;
  }

  .hero-copy {
    top: 20px;
    left: 20px;
    width: calc(100vw - 40px);
  }

  .experience-nav {
    margin-bottom: 14px;
  }

  .hero-copy h1 {
    font-size: clamp(2.6rem, 12vw, 4.4rem);
  }

  .lede {
    max-width: 86vw;
  }

  .metrics-panel {
    top: 330px;
    right: 16px;
    width: 210px;
    padding: 15px;
  }

  .mechanism-panel {
    right: 16px;
    bottom: 22px;
    left: 16px;
    width: auto;
    padding: 16px;
  }

  .stage-list {
    gap: 5px;
  }

  .stage-button {
    padding: 8px 5px;
  }

  .stage-button small {
    display: none;
  }

  .scene-toolbar {
    right: auto;
    bottom: 280px;
    left: 16px;
  }

  .scene-label,
  .interaction-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
