:root {
  color-scheme: light dark;
  --bg: #0f1220;
  --panel: #171b2e;
  --card: #1f2540;
  --text: #e9ecff;
  --sub: #aab3da;
  --primary: #7aa2ff;
  --line: #3f4875;
  --active: #41539f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at top, #161c33, var(--bg) 62%);
  color: var(--text);
}

.topbar {
  padding: 22px 24px 10px;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
}

.topbar p {
  margin: 10px 0 0;
  color: var(--sub);
}

.intro-details {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #121a36;
}

.intro-details summary {
  cursor: pointer;
  padding: 10px 12px;
  color: #dbe5ff;
  font-weight: 600;
}

.intro-details-content {
  padding: 0 12px 12px;
  color: #c5d0fb;
}

#introDetailsFrame {
  width: 100%;
  min-height: 320px;
  border: 1px solid #39457a;
  border-radius: 8px;
  background: #0f1531;
}

.intro-details-content p {
  margin: 8px 0 0;
}

.intro-details-placeholder {
  color: #95a6e8;
}

.intro-details-content h1,
.intro-details-content h2,
.intro-details-content h3 {
  margin: 10px 0 0;
  color: #e8eeff;
}

.intro-details-content ul,
.intro-details-content ol {
  margin: 8px 0 0;
  padding-left: 20px;
}

.intro-details-content li {
  margin: 4px 0;
}

.layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  gap: 16px;
  padding: 14px 24px 24px;
  overflow: hidden;
}

.panel {
  background: color-mix(in srgb, var(--panel) 86%, #000);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.list-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
}

.list-header h2 {
  margin: 0;
  font-size: 18px;
}

.tag {
  border: 1px solid var(--line);
  color: var(--sub);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
}

.curve-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.curve-item {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  transition: 0.2s ease;
}

.curve-item:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.curve-item.active {
  background: var(--active);
  border-color: var(--primary);
}

.curve-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.curve-title strong {
  font-size: 14px;
}

.curve-title span {
  color: var(--sub);
  font-size: 11px;
}

.mini-svg {
  width: 100%;
  height: 46px;
}

.mini-path {
  fill: none;
  stroke: #9bc2ff;
  stroke-width: 2;
}

.detail-panel {
  padding: 16px;
  min-height: 0;
  overflow-y: auto;
}

.detail-head h2 {
  margin: 0;
  font-size: 24px;
}

.detail-head code {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: #c7d3ff;
  background: #101632;
}

.chart-wrap {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0d132c;
  overflow: hidden;
}

#mainChart {
  width: 100%;
  height: 280px;
  display: block;
}

.axis {
  stroke: #6d78ae;
  stroke-width: 1.5;
}

.axis-label {
  fill: #aeb8e3;
  font-size: 13px;
}

.curve-path {
  fill: none;
  stroke: #7eb6ff;
  stroke-width: 3;
}

.cursor-guide {
  stroke: #90a7ff;
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
  opacity: 0.85;
}

.curve-cursor {
  fill: #d7e7ff;
  stroke: #4f8dff;
  stroke-width: 2;
}

.cursor-value {
  fill: #cfe0ff;
  font-size: 12px;
}

.demo-controls {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.demo-controls label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--sub);
}

.demo-controls input[type="range"] {
  width: 180px;
}

.demo-controls button {
  border: 1px solid #5f7be2;
  background: #2b3f8d;
  color: #eff3ff;
  border-radius: 8px;
  padding: 7px 13px;
  font-weight: 600;
  cursor: pointer;
}

.demo-controls button:hover {
  filter: brightness(1.08);
}

.timeline-controls {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.timeline-controls label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--sub);
}

.timeline-controls input[type="range"] {
  width: 280px;
}

.timeline-controls span {
  color: #d8e1ff;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.range-controls {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.range-controls label {
  display: grid;
  gap: 6px;
  color: var(--sub);
  font-size: 12px;
}

.range-controls input {
  width: 100%;
  border: 1px solid #475087;
  border-radius: 8px;
  background: #0f1531;
  color: #ebefff;
  padding: 6px 8px;
}

.demo-stage {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #111730;
  display: grid;
  gap: 14px;
}

.demo-row {
  display: grid;
  gap: 8px;
}

.demo-row-title {
  color: #c7cff2;
  font-size: 13px;
}

.demo-dual {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.demo-dual-position {
  grid-template-columns: 1fr;
}

.demo-cell {
  display: grid;
  gap: 6px;
}

.demo-cell-title {
  color: #9eabd8;
  font-size: 12px;
}

.track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: #2c365f;
  overflow: visible;
}

.dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  transform: translate(0, -50%);
  background: radial-gradient(circle at 30% 30%, #cae3ff, #4d8cff);
  box-shadow: 0 0 20px #5b94ff66;
}

.demo-box {
  width: 80px;
  height: 80px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #7f9cff, #4a63d0);
  font-weight: 700;
  letter-spacing: 0.4px;
}

.preview-box-wrap {
  height: 96px;
  border-radius: 10px;
  background: #20284c;
  border: 1px solid #3a4272;
  display: grid;
  place-items: center;
}

.demo-box-opacity {
  background: linear-gradient(145deg, #89b4ff, #527eff);
}

.metrics {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid #384170;
  border-radius: 10px;
  background: #0f1531;
}

.metric-row {
  display: grid;
  grid-template-columns: 54px 130px 1fr;
  align-items: center;
  gap: 10px;
}

.metric-label {
  color: #c4ccef;
  font-size: 13px;
}

.metric-value {
  color: #e4e9ff;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.metric-bar {
  height: 8px;
  border-radius: 999px;
  background: #2e3762;
  overflow: hidden;
}

.metric-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6d90ff, #7ec8ff);
}

.usage h3 {
  margin: 16px 0 8px;
}

.usage ul {
  margin: 0;
  padding-left: 18px;
  color: #d2dbff;
}

.usage li {
  margin: 6px 0;
}

@media (max-width: 980px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .layout {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .list-panel {
    max-height: 42vh;
  }

  .range-controls {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .demo-dual {
    grid-template-columns: 1fr;
  }
}
