:root {
  --bg-top: #fffdf6;
  --bg-bottom: #eef6ff;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --border: rgba(217, 228, 243, 0.95);
  --text: #223148;
  --muted: #607188;
  --accent: #ff7148;
  --accent-soft: rgba(255, 113, 72, 0.1);
  --blue: #4c87ff;
  --blue-soft: rgba(76, 135, 255, 0.12);
  --yellow: #ffbf5f;
  --shadow: 0 22px 48px rgba(25, 44, 72, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(126, 170, 255, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 190, 120, 0.16), transparent 30%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

.page-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 56px;
}

.hero {
  padding: 18px 0 28px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 18px;
  color: #4d6485;
  text-decoration: none;
  font-weight: 600;
}

.hero-tag,
.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(255, 177, 92, 0.34);
  color: #d26b2b;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 18px 0 12px;
  font-size: clamp(2.4rem, 4vw, 4rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.hero p {
  max-width: 860px;
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.85;
  color: var(--muted);
}

.experiment-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 22px;
  align-items: start;
}

.experiment-card,
.learn-card {
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.experiment-card {
  padding: 22px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.card-header.compact {
  margin-bottom: 20px;
}

.card-header h2,
.learn-card h2 {
  margin: 10px 0 0;
  font-size: 1.7rem;
  line-height: 1.15;
}

.toolbar,
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.action-btn {
  appearance: none;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff6e4c 0%, #ff915f 100%);
  color: white;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 14px 26px rgba(255, 113, 72, 0.2);
}

.action-btn:hover {
  transform: translateY(-1px);
}

.action-btn.secondary {
  background: white;
  color: #48607f;
  border: 1px solid rgba(215, 225, 240, 0.96);
  box-shadow: none;
}

.action-btn.wide {
  width: 100%;
  justify-content: center;
}

.canvas-wrap {
  position: relative;
}

.helper-strip {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(247, 250, 255, 0.95);
  border: 1px solid rgba(225, 233, 244, 0.96);
}

.helper-strip strong {
  flex: 0 0 auto;
  color: var(--accent);
}

.helper-strip span {
  color: #566982;
  line-height: 1.7;
}

#triangleCanvas {
  width: 100%;
  height: auto;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(245, 249, 255, 0.98) 100%);
  border: 1px solid rgba(230, 237, 247, 0.96);
}

.board-bg {
  fill: rgba(255, 255, 255, 0.38);
}

.grid-layer path {
  stroke: rgba(119, 145, 185, 0.13);
  stroke-width: 1;
}

.triangle-shape {
  fill: url(#triangleFill);
  stroke: rgba(95, 132, 197, 0.18);
  stroke-width: 1.5;
}

.edge-path {
  fill: none;
  stroke: rgba(57, 90, 132, 0.3);
  stroke-width: 4;
  stroke-linecap: round;
}

.angle-arc {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}

.angle-a {
  stroke: #4c87ff;
}

.angle-b {
  stroke: #ff8a54;
}

.angle-c {
  stroke: #35b38a;
}

.angle-text {
  font-size: 22px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: middle;
}

.point-hit {
  fill: transparent;
  cursor: grab;
}

.point-circle {
  stroke: white;
  stroke-width: 5;
  cursor: grab;
}

.point-circle.point-a {
  fill: #4c87ff;
}

.point-circle.point-b {
  fill: #ff8a54;
}

.point-circle.point-c {
  fill: #35b38a;
}

.point-label {
  font-size: 16px;
  font-weight: 800;
  fill: #223148;
  text-anchor: middle;
}

.angle-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.summary-item {
  padding: 14px 12px;
  border-radius: 18px;
  background: rgba(247, 250, 255, 0.96);
  text-align: center;
}

.summary-item .label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.84rem;
  color: #687a92;
}

.summary-item strong {
  font-size: 1.45rem;
}

.summary-item.angle-a {
  box-shadow: inset 0 0 0 1px rgba(76, 135, 255, 0.14);
}

.summary-item.angle-b {
  box-shadow: inset 0 0 0 1px rgba(255, 138, 84, 0.14);
}

.summary-item.angle-c {
  box-shadow: inset 0 0 0 1px rgba(53, 179, 138, 0.14);
}

.sum-card {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, #fff8f3 0%, #fff 100%);
  border: 1px solid rgba(255, 184, 124, 0.26);
}

.sum-card span {
  display: block;
  margin-bottom: 8px;
  color: #8b6245;
  font-size: 0.9rem;
  font-weight: 700;
}

.sum-card strong {
  display: block;
  font-size: 2.3rem;
  line-height: 1;
  color: #ff7148;
}

.sum-card p {
  margin: 12px 0 0;
  line-height: 1.75;
  color: #6b778d;
}

.controls {
  margin-top: 18px;
}

.merge-board {
  margin-top: 18px;
  padding: 18px 18px 20px;
  border-radius: 22px;
  background: rgba(247, 250, 255, 0.94);
  border: 1px solid rgba(224, 232, 244, 0.98);
  opacity: 0.6;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.merge-board.active {
  opacity: 1;
  transform: translateY(-2px);
}

.merge-line {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #4c87ff 0%, #ff8a54 50%, #35b38a 100%);
}

.merge-angle {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 31%;
  min-height: 120px;
  margin-top: 16px;
}

.merge-wedge {
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 74px 0 0 74px;
}

.merge-a .merge-wedge {
  border-color: transparent transparent transparent rgba(76, 135, 255, 0.3);
}

.merge-b .merge-wedge {
  border-color: transparent transparent transparent rgba(255, 138, 84, 0.3);
}

.merge-c .merge-wedge {
  border-color: transparent transparent transparent rgba(53, 179, 138, 0.3);
}

.merge-angle em {
  margin-top: 10px;
  font-style: normal;
  font-weight: 800;
  color: #43536a;
}

.merge-message {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: white;
  color: #596b84;
  line-height: 1.75;
}

.learn-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-top: 22px;
}

.learn-card {
  padding: 24px;
}

.learn-card p,
.learn-card li {
  color: #5e6f87;
  line-height: 1.85;
}

.learn-card ul {
  margin: 16px 0 0;
  padding-left: 18px;
}

@media (max-width: 1100px) {
  .experiment-layout,
  .learn-section {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 20px 14px 40px;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .card-header {
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
  }

  .toolbar .action-btn {
    width: 100%;
  }

  .angle-summary {
    grid-template-columns: 1fr;
  }

  .merge-angle {
    width: 100%;
  }

  .helper-strip {
    flex-direction: column;
  }
}
