@import url("/fonts/source-han-serif-sc/fonts.css");

:root {
  color-scheme: dark;
  --panel: rgba(8, 16, 24, 0.74);
  --panel-border: rgba(176, 211, 230, 0.22);
  --text: #edf7fb;
  --muted: #9fb4c0;
  --accent: #ff8751;
  --accent-soft: rgba(255, 135, 81, 0.18);
  --cyan: #58d8ff;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #071018;
  font-family: "Source Han Serif SC", serif;
  color: var(--text);
}

button, input, select { font: inherit; }
button { color: inherit; }

#app {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
  background:
    radial-gradient(circle at 72% 22%, rgba(67, 129, 155, 0.16), transparent 32%),
    linear-gradient(140deg, #0a151e 0%, #071018 54%, #03080d 100%);
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.glass-panel {
  position: absolute;
  z-index: 10;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(13, 25, 35, 0.86), rgba(6, 13, 19, 0.68));
  box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
}

.eyebrow {
  margin: 0 0 8px;
  color: #79d6f0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.hero-panel {
  top: 18px;
  left: 18px;
  width: min(390px, calc(100vw - 390px));
  padding: 14px 16px 13px;
}

.experience-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 11px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(176, 211, 230, 0.14);
}

.experience-nav a,
.experience-nav span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
}

.experience-nav a {
  color: rgba(237, 247, 251, .68);
  text-decoration: none;
}

.experience-nav a:hover,
.experience-nav a:focus-visible { color: #fff; }
.experience-nav span { color: rgba(121, 214, 240, .7); }

.hero-panel h1,
.control-panel h2 {
  margin: 0;
  letter-spacing: -0.035em;
}

.hero-panel h1 {
  font-size: clamp(22px, 1.8vw, 31px);
  line-height: 1.12;
}

.subtitle {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.status-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  padding: 6px 10px;
  border: 1px solid rgba(106, 226, 255, 0.22);
  border-radius: 999px;
  background: rgba(48, 155, 184, 0.1);
  color: #d8f9ff;
  font-size: 10px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6fe8ff;
  box-shadow: 0 0 0 4px rgba(111, 232, 255, 0.1), 0 0 13px #6fe8ff;
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.48; transform: scale(0.82); }
}

.control-panel {
  top: 18px;
  right: 18px;
  width: 318px;
  max-height: calc(100vh - 126px);
  padding: 14px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(121, 214, 240, 0.34) transparent;
}

.control-panel::-webkit-scrollbar { width: 5px; }
.control-panel::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(121, 214, 240, 0.3); }

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.control-panel h2 { font-size: 19px; }

.panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-panel-body { min-width: 0; }
.control-panel.is-collapsed {
  width: 190px;
  max-height: none;
  overflow: hidden;
}
.control-panel.is-collapsed .panel-heading { margin-bottom: 0; }
.control-panel.is-collapsed .control-panel-body { display: none; }

.icon-button {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(179, 216, 233, 0.2);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
  transition: 160ms ease;
}

.icon-button:hover {
  border-color: rgba(115, 221, 255, 0.52);
  background: rgba(76, 188, 224, 0.14);
  transform: translateY(-1px);
}

.range-row { display: block; margin: 11px 0; }

.range-row > span {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.range-row strong { font-size: 13px; }
.range-row output { color: #ffb38f; font-size: 12px; font-variant-numeric: tabular-nums; }

input[type="range"] {
  width: 100%;
  height: 4px;
  appearance: none;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 126, 66, 0.85), rgba(85, 206, 255, 0.65));
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  appearance: none;
  border: 2px solid #f6fbfd;
  border-radius: 50%;
  background: #ff8550;
  box-shadow: 0 0 0 5px rgba(255, 133, 80, 0.14);
  cursor: pointer;
}

.path-settings {
  margin: 12px 0 2px;
  border: 1px solid rgba(169, 205, 222, 0.13);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.14);
  overflow: hidden;
}

.path-settings summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.path-settings summary::-webkit-details-marker { display: none; }
.path-settings summary::after {
  content: "+";
  flex: 0 0 auto;
  color: #79d6f0;
  font-size: 17px;
  line-height: 1;
}
.path-settings[open] summary::after { content: "−"; }

.path-settings summary > span {
  display: grid;
  gap: 3px;
}

.path-settings summary small {
  color: #6f8996;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.path-settings summary strong { font-size: 12px; }
.path-settings summary output {
  margin-left: auto;
  color: #ffb38f;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.parameter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 0 12px 12px;
}

.parameter-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.parameter-grid label > span {
  color: #93aab6;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.parameter-grid label > span small {
  color: #657d89;
  font-size: 8px;
  font-weight: 600;
}

.parameter-grid input,
.parameter-grid select {
  width: 100%;
  height: 34px;
  min-width: 0;
  border: 1px solid rgba(169, 205, 222, 0.16);
  border-radius: 9px;
  outline: none;
  background: rgba(255, 255, 255, 0.05);
  color: #edf7fb;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  transition: 150ms ease;
}

.parameter-grid input { padding: 0 9px; }
.parameter-grid select { padding: 0 26px 0 9px; color-scheme: dark; }
.parameter-grid input:focus,
.parameter-grid select:focus {
  border-color: rgba(88, 216, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(88, 216, 255, 0.09);
}

.path-actions {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 8px;
  padding: 0 12px 12px;
}

.path-action {
  min-height: 34px;
  border: 1px solid rgba(169, 205, 222, 0.15);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
  color: #aec2cc;
  font-size: 10px;
  cursor: pointer;
}

.path-action:hover { background: rgba(255, 255, 255, 0.08); }
.path-action.primary {
  border-color: rgba(255, 147, 96, 0.38);
  background: rgba(255, 135, 81, 0.16);
  color: #ffe4d6;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.control-button {
  min-height: 34px;
  border: 1px solid rgba(186, 218, 233, 0.16);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.045);
  color: #bfd0d9;
  font-size: 10px;
  cursor: pointer;
  transition: 160ms ease;
}

.control-button:hover { background: rgba(255, 255, 255, 0.085); }
.control-button.is-active {
  border-color: rgba(255, 147, 96, 0.38);
  background: var(--accent-soft);
  color: #ffe4d6;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.metric-grid > div {
  padding: 8px 9px;
  border: 1px solid rgba(169, 205, 222, 0.11);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.16);
}

.metric-grid dt { color: #8098a5; font-size: 10px; letter-spacing: 0.04em; }
.metric-grid dd { margin: 5px 0 0; color: #f6fbfd; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

.flow-legend { left: 18px; bottom: 108px; padding: 11px 13px; }

.legend-items {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 9px 16px;
}

.legend-items span { display: inline-flex; align-items: center; gap: 8px; color: #c3d1d8; font-size: 11px; }

.legend-line {
  display: inline-block;
  width: 28px;
  height: 3px;
  border-radius: 99px;
  box-shadow: 0 0 8px currentColor;
}
.legend-line.water { color: #4bd4ff; background: #4bd4ff; }
.legend-line.laser { color: #ffa23f; background: #ffa23f; }
.legend-line.powder { color: #d7dce0; background: #d7dce0; }
.legend-line.gas { color: #2fbfca; background: #2fbfca; }

.stage-strip {
  left: calc(50% - 76px);
  bottom: 16px;
  display: grid;
  width: min(760px, calc(100vw - 380px));
  grid-template-columns: repeat(4, minmax(0, 1fr));
  transform: translateX(-50%);
  overflow: hidden;
}

.stage-button {
  position: relative;
  display: grid;
  grid-template-columns: 31px 1fr;
  grid-template-rows: auto auto;
  gap: 1px 9px;
  min-height: 70px;
  padding: 12px 14px;
  border: 0;
  border-right: 1px solid rgba(173, 208, 224, 0.12);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: 180ms ease;
}
.stage-button:last-child { border-right: 0; }
.stage-button:hover { background: rgba(255, 255, 255, 0.045); }
.stage-button.is-active { background: linear-gradient(135deg, rgba(255, 125, 67, 0.2), rgba(71, 177, 216, 0.09)); }
.stage-button.is-active::before {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ff8650, transparent);
  box-shadow: 0 0 12px #ff8650;
}

.stage-button span { grid-row: 1 / 3; color: #ff9a68; font-size: 11px; font-weight: 900; letter-spacing: 0.08em; }
.stage-button strong { font-size: 13px; }
.stage-button small { color: #8298a4; font-size: 10px; }

.callout-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  transition: opacity 180ms ease;
}
.callout-layer.is-hidden { opacity: 0; }

.callout { position: absolute; transform: translate(-50%, -50%); opacity: 0; transition: opacity 120ms linear; }
.callout.is-visible { opacity: 1; }
.callout::before {
  content: "";
  position: absolute;
  left: -25px;
  top: 50%;
  width: 20px;
  height: 1px;
  background: rgba(152, 222, 245, 0.72);
  box-shadow: 0 0 8px rgba(81, 201, 239, 0.56);
}
.callout::after {
  content: "";
  position: absolute;
  left: -29px;
  top: calc(50% - 3px);
  width: 6px;
  height: 6px;
  border: 1px solid #79dfff;
  border-radius: 50%;
  background: #0a1720;
}
.callout-card {
  min-width: 102px;
  padding: 7px 9px;
  border: 1px solid rgba(142, 209, 233, 0.24);
  border-radius: 9px;
  background: rgba(4, 12, 18, 0.82);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
}
.callout-card strong { display: block; font-size: 10px; }
.callout-card small { display: block; margin-top: 2px; color: #7993a0; font-size: 8px; }

.interaction-hint {
  position: absolute;
  right: 24px;
  bottom: 122px;
  z-index: 6;
  margin: 0;
  color: rgba(199, 216, 225, 0.6);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 17px;
  background: radial-gradient(circle, #132633, #071018 60%);
  transition: opacity 420ms ease, visibility 420ms ease;
}
.loading-overlay.is-hidden { opacity: 0; visibility: hidden; }
.loading-overlay p { margin: 0; color: #b8cad4; font-size: 13px; letter-spacing: 0.08em; }

.loader-ring {
  width: 47px;
  height: 47px;
  border: 2px solid rgba(139, 210, 235, 0.16);
  border-top-color: #69dcff;
  border-right-color: #ff8f5a;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-panel {
  position: absolute;
  z-index: 40;
  left: 50%;
  top: 50%;
  width: min(470px, calc(100vw - 40px));
  padding: 24px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 118, 99, 0.45);
  border-radius: 16px;
  background: rgba(28, 8, 8, 0.94);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}
.error-panel h2 { margin: 0 0 9px; }
.error-panel p { margin: 0; color: #e2b8b1; line-height: 1.6; }

@media (max-width: 980px) {
  .hero-panel { width: min(340px, calc(100vw - 350px)); }
  .flow-legend { display: none; }
  .stage-button { padding: 13px 11px; }
  .interaction-hint { display: none; }
}

@media (max-width: 760px) {
  .hero-panel { top: 12px; left: 12px; right: 12px; width: auto; padding: 15px 16px; }
  .hero-panel .subtitle { display: none; }
  .experience-nav { margin-bottom: 12px; padding-bottom: 10px; }
  .control-panel { top: auto; right: 12px; left: 12px; bottom: 108px; width: auto; max-height: calc(100vh - 132px); padding: 13px; }
  .control-panel.is-collapsed { width: auto; max-height: calc(100vh - 132px); }
  .control-panel.is-collapsed .control-panel-body { display: block; }
  .panel-heading, .range-row, .metric-grid { display: none; }
  .path-settings { margin: 0 0 9px; }
  .path-settings summary { padding: 9px 11px; }
  .parameter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0 10px 10px; }
  .path-actions { padding: 0 10px 10px; }
  .button-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
  .control-button { min-height: 36px; font-size: 10px; }
  .stage-strip { left: 50%; bottom: 12px; width: calc(100vw - 24px); }
  .stage-button { min-height: 76px; grid-template-columns: 1fr; padding: 12px 7px; text-align: center; }
  .stage-button span { grid-row: auto; font-size: 9px; }
  .stage-button small { display: none; }
  .callout-layer { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
