:root {
  --bg: #f4efe7;
  --paper: rgba(255, 252, 247, 0.88);
  --ink: #17354a;
  --muted: #5e7282;
  --line: rgba(20, 59, 81, 0.14);
  --teal: #1f8a8a;
  --teal-deep: #125f69;
  --orange: #ff9157;
  --orange-soft: rgba(255, 145, 87, 0.28);
  --blue: #59b8ff;
  --blue-soft: rgba(89, 184, 255, 0.3);
  --green: #5cbf7b;
  --green-soft: rgba(92, 191, 123, 0.28);
  --rose: #e86a7a;
  --shadow: 0 22px 60px rgba(30, 52, 66, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 185, 120, 0.28), transparent 28%),
    radial-gradient(circle at top right, rgba(93, 181, 191, 0.18), transparent 24%),
    linear-gradient(180deg, #fbf7f2 0%, var(--bg) 100%);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1500px, calc(100vw - 28px));
  margin: 22px auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(16, 42, 67, 0.08);
  position: sticky;
  top: 12px;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 28% 30%, #ffcc7a 0 24%, transparent 25%),
    linear-gradient(135deg, var(--teal-deep) 0%, #1e707f 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.42);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-text strong {
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.brand-text em {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: normal;
}

.top-nav {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  color: var(--muted);
  font-size: 0.95rem;
}

.top-nav a {
  position: relative;
  color: inherit;
  text-decoration: none;
}

.top-nav a:hover {
  color: var(--ink);
}

.top-nav a:hover::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 2px;
  border-radius: 999px;
  background: #d97706;
}

.site-return {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(18, 95, 105, 0.18);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.site-return:hover {
  transform: translateY(-1px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 28px 32px;
  margin-top: 20px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 30px;
  background: linear-gradient(135deg, rgba(255, 253, 250, 0.88), rgba(247, 242, 235, 0.82));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero__eyebrow {
  margin: 0 0 12px;
  color: var(--teal-deep);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 46px);
  line-height: 1.1;
}

.hero__desc {
  max-width: 850px;
  margin: 16px 0 0;
  line-height: 1.7;
  color: var(--muted);
}

.hero__desc span {
  color: var(--teal-deep);
  font-weight: 700;
}

.hero__badge {
  min-width: 220px;
  padding: 16px 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(245, 252, 251, 0.7));
  border: 1px solid rgba(31, 138, 138, 0.16);
  text-align: right;
}

.hero__badge span {
  display: block;
  font-size: 13px;
  color: var(--muted);
}

.hero__badge strong {
  display: block;
  margin-top: 6px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(680px, 1.35fr) minmax(370px, 0.82fr);
  gap: 22px;
  margin-top: 22px;
}

.scene-panel,
.panel-card {
  border-radius: 28px;
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.scene-panel {
  padding: 22px;
}

.scene-panel__head,
.panel-card__title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.scene-panel__head h2,
.panel-card__title h2 {
  margin: 0;
  font-size: 20px;
}

.scene-panel__head p,
.panel-card__title p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.anchor-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ghost-button {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(18, 95, 105, 0.18);
  background: rgba(255, 255, 255, 0.72);
  color: var(--teal-deep);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.ghost-button:hover,
.formula-card:hover,
.switch-pill:hover {
  transform: translateY(-1px);
}

.scene-stage {
  position: relative;
  margin-top: 20px;
  padding: 16px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 243, 236, 0.86)),
    linear-gradient(135deg, rgba(255, 177, 120, 0.08), rgba(72, 161, 189, 0.1));
  overflow: hidden;
}

.scene3d-root {
  display: grid;
  gap: 16px;
}

.rotation-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(23, 53, 74, 0.08);
  color: var(--muted);
}

.rotation-note strong {
  color: var(--teal-deep);
}

.scene-grid3d {
  display: grid;
  gap: 18px;
}

.scene-pair {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.scene-link-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.scene-card3d,
.board-card {
  position: relative;
  z-index: 2;
  padding: 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(23, 53, 74, 0.08);
}

.scene-card3d__head h3,
.board-card h3 {
  margin: 0;
  font-size: 24px;
}

.scene-card3d__head p,
.board-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.scene-canvas {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 14px;
  border-radius: 20px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.95), rgba(245, 239, 232, 0.82)),
    linear-gradient(180deg, rgba(250, 252, 254, 0.82), rgba(246, 241, 236, 0.88));
  cursor: grab;
}

.scene-canvas.is-dragging {
  cursor: grabbing;
}

.scene-card3d__meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.scene-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.scene-chip {
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid rgba(23, 53, 74, 0.08);
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
}

.scene-chip--orange {
  color: #c96932;
}

.scene-chip--blue {
  color: #1e84d6;
}

.scene-chip--green {
  color: #2a8b50;
}

.scene-chip--rose {
  color: #c64d5f;
}

.board-card {
  min-height: 100%;
  margin-top: 2px;
}

.board-flow {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.board-step {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(249, 251, 252, 0.88);
  border: 1px solid rgba(23, 53, 74, 0.08);
}

.board-step strong {
  display: block;
  margin-bottom: 6px;
}

.board-arrow {
  text-align: center;
  color: var(--teal-deep);
  font-weight: 700;
  font-size: 18px;
}

.board-result {
  margin-top: 12px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(20, 59, 81, 0.92);
  color: white;
  line-height: 1.6;
}

.board-result strong {
  color: #a9dfff;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 14px;
  font-size: 13px;
}

.legend__item {
  position: relative;
  padding-left: 18px;
  color: var(--muted);
}

.legend__item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translateY(-50%);
}

.legend__item--orange::before {
  background: var(--orange);
}

.legend__item--blue::before {
  background: var(--blue);
}

.legend__item--green::before {
  background: var(--green);
}

.control-panel {
  display: grid;
  gap: 18px;
  align-content: start;
}

.panel-card {
  padding: 20px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.field {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
}

.field label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.field input {
  width: 100%;
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(23, 53, 74, 0.12);
  background: rgba(254, 254, 254, 0.96);
  color: var(--ink);
}

.switch-row {
  margin-top: 16px;
}

.switch-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
  cursor: pointer;
}

.switch-pill input {
  accent-color: var(--teal);
}

.mode-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.mode-picker label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
  cursor: pointer;
}

.mode-picker input {
  accent-color: var(--teal);
}

.slider-block {
  margin-top: 18px;
}

.slider-block__label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 8px;
}

#mainSlider,
#baseSlider {
  width: 100%;
  accent-color: var(--teal);
}

.slider-inline-input {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.slider-inline-input label {
  flex: 0 0 auto;
}

.slider-inline-input input {
  width: 96px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(23, 53, 74, 0.12);
  background: rgba(254, 254, 254, 0.96);
  color: var(--ink);
}

.muted-text {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.formula-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.formula-card {
  text-align: left;
  width: 100%;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(18, 95, 105, 0.12);
  background: rgba(255, 255, 255, 0.76);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.formula-card strong {
  display: block;
  margin-bottom: 8px;
  line-height: 1.45;
}

.formula-card span {
  color: var(--muted);
  line-height: 1.5;
}

.formula-card.active {
  border-color: rgba(18, 95, 105, 0.42);
  background: linear-gradient(135deg, rgba(235, 250, 248, 0.98), rgba(255, 249, 243, 0.95));
  box-shadow: inset 0 0 0 1px rgba(18, 95, 105, 0.12);
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.toggle-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
}

.toggle-chip input {
  accent-color: var(--teal);
}

.metric-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
}

.metric-row span {
  color: var(--muted);
}

.metric-row strong {
  font-weight: 700;
}

.panel-card--warning {
  background: linear-gradient(180deg, rgba(255, 250, 245, 0.96), rgba(255, 242, 236, 0.88));
}

#messageText {
  margin-top: 10px;
  line-height: 1.6;
  color: #844c1d;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .scene-grid3d {
    grid-template-columns: 1fr;
  }

  .scene-pair {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
  }

  .hero__badge {
    text-align: left;
  }

  .site-header {
    border-radius: 28px;
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100vw - 16px, 100%);
    margin: 8px auto 16px;
  }

  .hero,
  .scene-panel,
  .panel-card {
    border-radius: 22px;
  }

  .site-header {
    padding: 18px;
  }

  .hero {
    padding: 22px 18px;
  }

  .scene-panel,
  .panel-card {
    padding: 16px;
  }

  .field-grid,
  .toggle-grid {
    grid-template-columns: 1fr;
  }

  .top-nav {
    gap: 14px;
    flex-wrap: wrap;
    font-size: 0.88rem;
  }
}
