:root {
  --bg: #f3f1eb;
  --paper: #fbfaf6;
  --ink: #2a3036;
  --muted: #8a8680;
  --line: #e0dbd2;
  --green: #2c3844;
  --orange: #e09570;
  --water: #1498b0;
  --gold: #3a4046;
  --cyl: #6aab98;
  --cone: #e09570;
  --soft: #efece6;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button {
  cursor: pointer;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: background .15s, border-color .15s;
}
button:hover { background: #e8e4dc; border-color: #b7b1a6; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}
button:disabled { cursor: default; opacity: .45; }
header {
  height: 78px;
  max-width: 1360px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 42px;
  border-bottom: 1px solid var(--line);
}
.brand {
  text-decoration: none;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 13px;
}
.brand svg { width: 36px; height: 36px; fill: none; stroke: var(--cyl); stroke-width: 1.4; }
.brand svg path:last-child { stroke: var(--cone); }
.brand > span { font-size: 16px; letter-spacing: 2px; font-weight: 600; }
.brand small {
  display: block;
  font-family: monospace;
  font-size: 7px;
  letter-spacing: 1.4px;
  margin-top: 6px;
  color: #8d8880;
  font-weight: 400;
}
.header-middle { font-size: 15px; color: #3e4550; letter-spacing: 0.5px; }
.edition { font-family: monospace; font-size: 9px; color: #8a8680; letter-spacing: 1px; }
main { max-width: 1200px; margin: 0 auto; padding: 32px 28px 60px; }
.intro { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
.eyebrow { font-family: monospace; font-size: 12px; letter-spacing: 1.4px; color: #5c6570; }
h1 { font-size: 39px; letter-spacing: 1px; font-weight: 550; line-height: 1.25; margin: 16px 0; }
h1 > span { color: var(--green); }
.intro p { margin: 0; color: #2a3036; font-size: 17px; letter-spacing: 0; line-height: 1.6; }
.intro-note {
  display: flex;
  align-items: center;
  gap: 17px;
  padding-right: 6px;
  color: #3e4550;
  font-size: 15px;
  line-height: 2;
}
.intro-note b { font-weight: 600; color: #2a3036; font-size: 16px; }
.tiny-solid {
  width: 46px;
  height: 46px;
  position: relative;
}
.tiny-solid:before {
  content: "";
  position: absolute;
  left: 4px;
  top: 8px;
  width: 16px;
  height: 28px;
  border: 1.4px solid var(--cyl);
  border-radius: 1px;
}
.tiny-solid:after {
  content: "";
  position: absolute;
  right: 2px;
  top: 8px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 28px solid transparent;
  border-top: 0;
  width: 0;
  height: 0;
  border-bottom-color: transparent;
  background:
    linear-gradient(to top right, transparent 49%, var(--cone) 50%, transparent 51%) 0 0 / 18px 28px no-repeat,
    linear-gradient(to top left, transparent 49%, var(--cone) 50%, transparent 51%) 100% 0 / 18px 28px no-repeat;
}
#steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
#steps button {
  font-size: 17px;
  padding: 18px 14px;
  text-align: left;
  border: 0;
  border-radius: 0;
  position: relative;
  color: #5c6570;
}
#steps button > span { font-family: monospace; margin-right: 12px; font-size: 14px; color: #6a7380; }
#steps button.active { color: var(--ink); background: #efece6; }
#steps button.active:after {
  content: "";
  height: 2px;
  background: var(--green);
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
}
#steps button.active > span { color: var(--green); }
.experiment { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; }
.drawing-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  overflow: hidden;
}
.panel-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 22px 26px 0; }
.panel-top h2 { font-weight: 600; font-size: 22px; margin: 8px 0 0; line-height: 1.4; }
#scene-status { margin: 10px 0 0; color: #2a3036; font-size: 16px; line-height: 1.65; max-width: 46em; }
.n-badge {
  color: var(--ink);
  font-family: monospace;
  font-size: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 7px 12px;
  background: var(--paper);
  white-space: nowrap;
}
.n-badge b { font-size: 12px; font-weight: 500; }
.stage {
  position: relative;
  height: 560px;
  margin-top: 8px;
  background-color: #f7f6f2;
  background-image: radial-gradient(#d9d4ca .7px, transparent .75px);
  background-size: 18px 18px;
}
#world { display: block; width: 100%; height: 100%; touch-action: none; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tag {
  position: absolute;
  left: 0;
  top: 0;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 254, 249, .9);
  border: 1px solid #e4dfd6;
  font-size: 14px;
  color: #2a3036;
  white-space: nowrap;
  will-change: transform;
}
.tag.green { color: #3f8f7c; border-color: #c9e6dc; }
.tag.orange { color: #c47a58; border-color: #f3d7c6; }
.tag.gold { color: #2a3036; border-color: #d9d5cc; background: #f7f6f2; }
.tag.lilac { color: #8d6eab; border-color: #e4d4f2; }
.tag.quiet { color: #8a8680; background: rgba(251, 250, 246, .75); }
.view-tools {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
}
.view-tools button {
  background: rgba(255, 254, 249, .9);
  border-color: #e4dfd6;
  color: #6f6b64;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 6px;
}
.view-tools button.active { color: var(--ink); border-color: #c5c0b6; background: #f4f2ec; }
.diagram-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 22px 14px;
  color: #847f78;
  font-size: 11px;
}
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 15px; color: #2a3036; }
.legend span { display: flex; align-items: center; gap: 6px; }
.swatch { width: 16px; height: 8px; border-radius: 4px; display: inline-block; margin-right: 4px; }
.swatch.water { background: var(--water); }
.swatch.cyl { background: linear-gradient(180deg, #e5f6ef, var(--cyl)); }
.swatch.cone { background: linear-gradient(180deg, #fde8da, var(--cone)); }
.swatch.half { width: 16px; height: 0; border-top: 1.5px dashed var(--gold); border-radius: 0; background: transparent; }
.swatch.lilac { background: linear-gradient(180deg, #f3e9fb, #cbb4e6); }
.hint { font-size: 14px; color: #5c6570; white-space: nowrap; }
.comparison { border-top: 1px solid var(--line); padding: 16px 22px 18px; background: #f7f6f2; min-height: 92px; }
.comparison-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 16px;
  color: #2a3036;
  margin-bottom: 12px;
}
.comparison-title small { font-size: 14px; color: #5c6570; }
.compare-note { margin: 10px 0 0; font-size: 15px; line-height: 1.7; color: #2a3036; }
.track {
  position: relative;
  height: 12px;
  background: #e6e2da;
  border-radius: 8px;
}
.track .fill {
  height: 100%;
  background: linear-gradient(90deg, #d5e6ea, var(--water));
  border-radius: 8px;
  width: 0;
}
.track .mark {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 0;
  border-left: 1.5px dashed #b7b1a6;
  z-index: 1;
}
.track .mark.half { border-left-color: var(--gold); border-left-width: 2px; }
.track .mark.third, .track .mark.twothird { border-left-color: #c5c0b6; }
.captions {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 10px;
  color: #8a8680;
  font-variant-numeric: tabular-nums;
}
.captions.marks { position: relative; display: block; height: 16px; }
.captions.marks span { position: absolute; top: 0; }
.cup-row { display: flex; gap: 8px; margin-bottom: 12px; }
.cup-row i {
  font-style: normal;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #f3d7c6;
  color: #c47a58;
  background: #fff6f0;
}
.cup-row i.empty { color: #9a958e; background: #f6f4ef; border-color: #e4dfd6; }
.cup-row i.mid { background: #e7f2f4; border-color: #c5dbe0; color: var(--water); }
.cup-row i.cyl {
  margin-left: auto;
  color: #3f8f7c;
  border-color: #c9e6dc;
  background: #f3faf6;
}
.slice-compare, .pack-compare { display: block; }
.pack-compare svg { width: 100%; max-width: 520px; height: auto; display: block; }
.pack-compare text { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; }
.slice-compare { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 12px; align-items: center; }
.slice-compare svg { width: 100%; height: auto; display: block; }
.slice-compare text { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; }
.controls-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f6f4ef;
  padding: 22px 22px 18px;
}
.control-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}
.control-heading button { border: 0; font-size: 15px; color: #3e4550; padding: 3px 0; }
.slider-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  color: #2a3036;
  margin: 16px 0 10px;
}
.slider-heading i { font-family: Georgia, serif; margin-left: 4px; }
.slider-heading output { font-family: ui-monospace, monospace; font-size: 14px; color: var(--ink); }
#angle-value, #n-value { color: var(--ink); }
input[type=range] {
  appearance: none;
  display: block;
  width: 100%;
  height: 3px;
  background: #ddd8d0;
  margin: 0;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 3px solid #f6f4ef;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 1px #8a8680;
}
#angle::-webkit-slider-thumb, #n-slider::-webkit-slider-thumb {
  background: var(--ink);
  box-shadow: 0 0 0 1px #8a8680;
}
.range-captions { display: flex; justify-content: space-between; font-size: 13px; color: #5c6570; margin-top: 8px; }
.play-row { display: flex; gap: 8px; margin: 16px 0 4px; }
#play-rev, #spin-pack, #play-probe, #pour, #voice {
  background: var(--ink);
  color: #f6f4ef;
  border: 0;
  flex: 1;
  padding: 11px 8px;
  font-size: 15px;
}
#voice { background: #1f6f62; }
#voice[aria-pressed="true"] { background: #2a3036; }
.voice-row { margin-top: 4px; }
#play-rev:hover, #spin-pack:hover, #play-probe:hover, #pour:hover { background: #1c2228; }
#voice:hover { background: #18584e; }
#voice[aria-pressed="true"]:hover { background: #1c2228; }
#play-rev-icon, #spin-pack-icon, #play-probe-icon { margin-right: 6px; }
.pour-actions { align-items: stretch; }
#pour-all.secondary {
  flex: 1;
  background: #fbfaf6;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 11px 8px;
  font-size: 15px;
}
.text-btn { border: 0; color: #3e4550; padding: 8px 0 0; font-size: 15px; }
.guess { margin-top: 12px; }
.guess > span { display: block; font-size: 16px; color: #2a3036; margin-bottom: 8px; }
.guess > div { display: flex; gap: 6px; }
.guess button { flex: 1; padding: 8px 0; background: #fbfaf6; color: #6f6b64; }
.guess button.active { background: #eef1f4; border-color: #c5d0da; color: #3e5668; }
#guess-note { min-height: 2.6em; margin: 8px 0 0; font-size: 15px; line-height: 1.7; color: #3e4550; }
#presets { display: flex; gap: 5px; margin-top: 12px; }
#presets button {
  flex: 1;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  padding: 6px 0;
  background: #fbfaf6;
  color: #847f78;
  border-color: var(--line);
}
#presets button.active { background: #e8eef2; border-color: #c5d0da; color: #3e5668; }
.shared { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 2px; }
.shared.r-resting label[for="r"],
.shared.r-resting #r,
.shared.r-resting #r + .range-captions { opacity: 0.38; }
.lock-note { font-size: 15px; line-height: 1.7; color: #3e4550; margin: 12px 0 0; }
.live-data { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 8px; }
.metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
}
.metric > span { font-size: 15px; color: #3e4550; }
.metric output, .metric b {
  font-family: ui-monospace, monospace;
  font-size: 18px;
  font-weight: 500;
  color: #2a3036;
  font-variant-numeric: tabular-nums;
}
.metric.hero { align-items: center; }
.metric.hero b { font-family: Georgia, serif; font-size: 34px; letter-spacing: -0.5px; color: var(--green); font-weight: 500; }
.metric .sub { font-family: ui-monospace, monospace; font-size: 10px; color: #a39e96; font-weight: 400; margin-left: 6px; }
.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: .95;
  font-size: .72em;
  vertical-align: middle;
  margin-right: 2px;
}
.frac i { font-style: normal; display: block; padding: 0 2px; }
.frac i:first-child { border-bottom: 1px solid currentColor; }
.observe { font-size: 16px; line-height: 1.7; color: #2a3036; margin: 4px 0 0; min-height: 4.5em; }
.lesson {
  display: grid;
  grid-template-columns: 57px 1fr 220px;
  gap: 24px;
  padding: 32px 8px;
  margin: 8px 0 24px;
  border-bottom: 1px solid var(--line);
}
.lesson-number { font-family: Georgia, serif; font-size: 45px; color: #d4cfc6; line-height: 1; }
.lesson.is-speaking .lesson-number { color: #1f6f62; }
.lesson h2 { font-size: 26px; font-weight: 600; margin: 12px 0 12px; }
.lesson p { max-width: 680px; color: #2a3036; font-size: 17px; line-height: 1.75; margin: 0; }
.lesson-formula {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  margin-top: 14px;
  color: var(--green);
  line-height: 1.5;
}
.integral {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.28em 0.45em;
  margin-top: 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  line-height: 1;
  color: #2a3036;
}
.integral .eq { color: #8a8680; font-size: 0.86em; }
.integral .int { display: inline-flex; align-items: center; }
.integral .sym { font-size: 1.85em; line-height: 0.75; padding: 0 0.02em; }
.integral .limits {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  height: 2.15em;
  font-size: 0.42em;
  line-height: 1;
  margin: 0 0.28em 0 0.04em;
}
.integral .limits i { font-style: normal; }
.integral .body { font-size: 0.86em; }
.integral .result { color: #1f6f62; }
.big-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.62em;
  line-height: 0.95;
  margin-right: 0.12em;
  vertical-align: middle;
}
.big-frac i { font-style: normal; padding: 0 0.18em; }
.big-frac i:first-child { border-bottom: 1.5px solid currentColor; }
.integral-note {
  flex: 1 0 100%;
  margin-top: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #3e4550;
}
.lesson button { border: 0; color: var(--green); font-size: 17px; font-weight: 600; margin-top: 16px; padding: 0; }
.lesson button span { margin-left: 10px; }
.limit-note { border-left: 1px solid var(--line); padding-left: 26px; margin: 6px 0; }
.limit-note > span { font-size: 11px; color: #a39e96; }
.limit-note > div { font-family: Georgia, serif; font-size: 22px; color: #5c5852; margin-top: 14px; }
.limit-note > div > span { color: #c5c0b6; padding: 0 8px; }
.limit-note small { display: block; font-size: 11px; line-height: 1.8; color: #a39e96; margin-top: 16px; }
.records-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.records-heading h2 { font-size: 19px; font-weight: 500; margin: 10px 0 0; }
.records-heading > span { font-size: 12px; color: #a39e96; white-space: nowrap; }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; font-size: 16px; text-align: left; }
th {
  font-weight: 400;
  font-size: 12px;
  color: #8a8680;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f6f4ef;
}
td {
  padding: 13px 16px;
  border-bottom: 1px solid #e8e4dc;
  font-variant-numeric: tabular-nums;
  color: #5c5852;
}
td:first-child { color: #2a3036; }
tr.current td { color: var(--ink); background: #eef1f4; }
tr.gold td { background: #f6f4ef; }
.math-note { display: flex; gap: 24px; margin-top: 22px; }
.math-note > span { white-space: nowrap; color: #8a8680; font-size: 12px; padding-top: 2px; }
.math-note p { color: #3e4550; font-size: 15px; line-height: 1.75; margin: 0; }
.math-note b { font-weight: 500; color: #3e5668; }
footer {
  border-top: 1px solid var(--line);
  max-width: 1360px;
  margin: auto;
  padding: 22px 42px 32px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: #a39e96;
}
footer > span:first-child { font-family: ui-monospace, monospace; letter-spacing: 1px; }
.webgl-error { padding: 24px; color: #8d5836; }
@media (max-width: 1000px) {
  header { padding: 0 22px; }
  .header-middle { display: none; }
  .experiment { grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; }
  .stage { height: 480px; }
  .lesson { grid-template-columns: 42px 1fr 180px; }
}
@media (max-width: 760px) {
  header { height: 70px; padding: 0 16px; }
  .brand > span { font-size: 15px; letter-spacing: 1px; }
  .edition { display: none; }
  main { padding: 24px 14px 40px; }
  h1 { font-size: 30px; }
  .intro-note { display: none; }
  #steps button { text-align: center; padding: 12px 4px; font-size: 12px; }
  #steps button > span { display: block; margin: 0 0 4px; }
  .experiment { grid-template-columns: 1fr; }
  .stage { height: 420px; }
  .panel-top { padding: 16px 16px 0; }
  .diagram-footer, .comparison { padding-left: 16px; padding-right: 16px; }
  .hint { display: none; }
  .slice-compare { grid-template-columns: 1fr; }
  .lesson { grid-template-columns: 36px 1fr; }
  .limit-note { display: none; }
  .lesson-number { font-size: 32px; }
  .records-heading { flex-direction: column; align-items: flex-start; }
  footer { padding: 16px; }
  footer > span:nth-child(2) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
