:root {
  color-scheme: light;
  --paper: #fff8e7;
  --paper-deep: #f3e7c9;
  --white: #fffdf8;
  --ink: #17324d;
  --ink-soft: #52677a;
  --coral: #c84833;
  --teal: #087f7b;
  --sky: #2f6f98;
  --sun: #f2c84b;
  --line: rgba(23, 50, 77, 0.17);
  --shape-color: var(--coral);
  --display-font: "ZCOOL KuaiLe", "FZKaTong-M19S", cursive;
  --body-font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(23, 50, 77, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 50, 77, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: var(--body-font);
  font-size: 16px;
  line-height: 1.7;
}

button,
input,
summary {
  font: inherit;
}

button,
input[type="range"],
summary,
.shape-stage {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible,
.shape-stage:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 30;
  padding: 8px 14px;
  color: var(--white);
  background: var(--ink);
  border-radius: 6px;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.paper-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.24;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.13'/%3E%3C/svg%3E");
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 20px 0 16px;
}

.course-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: min(610px, calc(100% - 3.5%));
  margin-left: 3.5%;
}

.course-nav a {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 7px 11px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.82);
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 3px 3px 0 rgba(23, 50, 77, 0.2);
  text-decoration: none;
  transition: color 140ms ease, background 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.course-nav a:hover,
.course-nav a:focus-visible {
  color: var(--ink);
  background: var(--sun);
  transform: translateY(-2px);
  box-shadow: 4px 5px 0 var(--ink);
}

.course-nav a[aria-current="page"] {
  color: var(--white);
  background: var(--teal);
  border-color: var(--teal);
  box-shadow: 4px 4px 0 var(--ink);
}

.course-nav__number {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--white);
  background: var(--ink);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
}

.course-nav a[aria-current="page"] .course-nav__number {
  color: var(--ink);
  background: var(--sun);
}

.course-nav__copy {
  display: flex;
  flex-direction: column;
  font-size: 0.83rem;
  font-weight: 800;
  line-height: 1.22;
}

.course-nav__copy small {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 0.65rem;
  font-weight: 600;
}

.course-nav a[aria-current="page"] .course-nav__copy small {
  color: rgba(255, 253, 248, 0.78);
}

.course-nav svg {
  width: 18px;
  height: 18px;
}

.intro-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 252px;
  gap: 28px;
  align-items: center;
  margin-bottom: 22px;
}

.hero {
  position: relative;
  width: 100%;
  padding: 25px 0 15px 3.5%;
}

.hero::before {
  position: absolute;
  top: 10px;
  left: 0;
  width: 72px;
  height: 6px;
  content: "";
  background: var(--teal);
  transform: rotate(-3deg);
}

.lesson-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  color: var(--teal);
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.lesson-tag span {
  width: 34px;
  height: 2px;
  background: currentColor;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 860px;
  margin-bottom: 8px;
  font-family: var(--display-font);
  font-size: clamp(2.45rem, 4.3vw, 3.45rem);
  font-weight: 400;
  line-height: 1.03;
  letter-spacing: -0.035em;
}

h1 mark {
  color: inherit;
  background: linear-gradient(transparent 68%, rgba(242, 200, 75, 0.76) 68%);
}

.hero__lead {
  max-width: 670px;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: clamp(0.9rem, 1.35vw, 1.02rem);
  font-weight: 500;
}

.question-note {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 17px 17px 15px;
  background: var(--sun);
  box-shadow: 6px 7px 0 var(--ink);
  transform: rotate(1.4deg);
}

.question-note::after {
  position: absolute;
  right: -7px;
  bottom: -8px;
  width: 27px;
  height: 27px;
  content: "";
  background: linear-gradient(135deg, #d0a51f 50%, transparent 50%);
}

.tape {
  position: absolute;
  top: -11px;
  left: 78px;
  width: 78px;
  height: 20px;
  background: rgba(255, 253, 248, 0.76);
  transform: rotate(-4deg);
}

.question-note__title {
  margin-bottom: 7px;
  font-family: var(--display-font);
  font-size: 1.3rem;
}

.question-note ol {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin: 0 0 7px;
  padding: 0;
  list-style-position: inside;
  font-size: 0.76rem;
  font-weight: 700;
}

.question-note li + li {
  margin-top: 0;
}

.question-note__hint {
  margin-bottom: 0;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.5;
}

.experiment {
  position: relative;
  padding: clamp(22px, 3vw, 34px);
  background: var(--white);
  border: 3px solid var(--ink);
  box-shadow: 12px 14px 0 var(--ink);
}

.experiment::before {
  position: absolute;
  top: 18%;
  left: -13px;
  width: 22px;
  height: 76px;
  content: "";
  background: var(--shape-color);
  transition: background 200ms ease;
}

.experiment__heading {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 2px dashed var(--line);
}

.section-index,
.desk-step {
  margin-bottom: 4px;
  color: var(--coral);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h2 {
  margin-bottom: 0;
  font-family: var(--display-font);
  font-size: clamp(1.75rem, 3vw, 2.55rem);
  font-weight: 400;
  line-height: 1.15;
}

.text-button,
.center-helper {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  color: var(--teal);
  background: transparent;
  border: 0;
  border-bottom: 3px solid currentColor;
  cursor: pointer;
  font-weight: 800;
}

.text-button svg,
.center-helper svg {
  width: 20px;
  height: 20px;
}

.shape-switcher {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 15px 0 13px;
}

.shape-tab {
  position: relative;
  display: grid;
  min-height: 60px;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease;
}

.shape-tab:hover {
  transform: translateY(-2px);
}

.shape-tab.is-active {
  border-color: var(--shape-color);
  box-shadow: 4px 4px 0 var(--shape-color);
}

.shape-tab.is-solved::after {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 9px;
  height: 9px;
  content: "";
  background: var(--teal);
  border-radius: 50%;
}

.shape-tab__number {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--white);
  background: var(--ink);
  clip-path: polygon(50% 0, 100% 28%, 88% 100%, 12% 100%, 0 28%);
  font-weight: 800;
}

.shape-tab strong,
.shape-tab small {
  display: block;
}

.shape-tab small {
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.lab-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(290px, 0.7fr);
  gap: clamp(24px, 4vw, 42px);
  align-items: stretch;
}

.stage-column {
  min-width: 0;
}

.stage-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.stage-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-line {
  display: block;
  width: 27px;
  height: 0;
  border-top: 3px solid var(--shape-color);
}

.legend-line--original {
  border-top-color: var(--ink-soft);
  border-top-style: dashed;
}

.stage-frame {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(rgba(23, 50, 77, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 50, 77, 0.055) 1px, transparent 1px),
    var(--paper);
  background-size: 24px 24px;
  border: 2px solid var(--ink);
}

.stage-frame::after {
  position: absolute;
  right: -34px;
  bottom: -34px;
  width: 92px;
  height: 92px;
  content: "";
  background: var(--sun);
  transform: rotate(45deg);
}

.shape-stage {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  cursor: crosshair;
}

.original-shape {
  fill: transparent;
  stroke: var(--ink-soft);
  stroke-width: 4;
  stroke-dasharray: 11 9;
  stroke-linejoin: round;
  opacity: 0.62;
}

.rotating-shape {
  fill: var(--shape-color);
  fill-opacity: 0.18;
  stroke: var(--shape-color);
  stroke-width: 6;
  stroke-linejoin: round;
}

.angle-ray,
.angle-arc {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-dasharray: 6 7;
  opacity: 0;
  pointer-events: none;
}

.angle-ray--moving,
.angle-arc {
  stroke: var(--shape-color);
  stroke-dasharray: none;
}

.stage-frame.is-ready .angle-ray,
.stage-frame.is-ready .angle-arc {
  opacity: 0.68;
}

.student-mark {
  fill: var(--white);
  stroke: var(--coral);
  stroke-width: 5;
  opacity: 0;
  pointer-events: none;
}

.student-mark.is-visible {
  opacity: 1;
  animation: mark-pop 260ms ease;
}

.student-mark.is-correct {
  stroke: var(--teal);
}

.center-marker {
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
}

.center-marker circle,
.center-marker line {
  fill: var(--white);
  stroke: currentColor;
  stroke-width: 4;
}

.center-marker circle:last-child {
  fill: var(--shape-color);
  stroke: var(--white);
  stroke-width: 2;
}

.center-marker.is-visible {
  opacity: 1;
}

.center-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  width: 104px;
  height: 116px;
  color: var(--coral);
  pointer-events: none;
  transform: translate(-50%, -3px);
  animation: center-guide-bob 1.25s ease-in-out infinite;
}

.center-guide[hidden] {
  display: none;
}

.center-guide__pulse {
  position: absolute;
  top: 0;
  left: 50%;
  width: 30px;
  height: 30px;
  border: 4px solid var(--coral);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: center-guide-pulse 1.25s ease-out infinite;
}

.center-guide__hand {
  position: absolute;
  top: 4px;
  left: 50%;
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  color: var(--coral);
  filter: drop-shadow(3px 4px 0 rgba(23, 50, 77, 0.22));
  transform: translateX(-50%);
}

.center-guide__hand svg {
  width: 62px;
  height: 62px;
  fill: var(--white);
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.center-guide__hand-detail {
  fill: none;
  stroke-width: 3.5;
}

.center-guide strong {
  position: absolute;
  top: 70px;
  left: 50%;
  width: max-content;
  padding: 4px 10px 5px;
  color: var(--white);
  background: var(--coral);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-family: var(--display-font);
  font-size: 1rem;
  letter-spacing: 0.08em;
  line-height: 1.1;
  transform: translateX(-50%) rotate(-2deg);
}

.overlap-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  color: var(--white);
  background: var(--shape-color);
  font-size: 0.8rem;
  font-weight: 800;
  transform: rotate(2deg);
}

.overlap-badge[hidden] {
  display: none;
}

.overlap-badge svg {
  width: 17px;
  height: 17px;
}

.success-check {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--coral);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.success-check[hidden] {
  display: none;
}

.success-check__halo {
  position: absolute;
  top: 0;
  left: 50%;
  width: 144px;
  height: 144px;
  border: 7px solid var(--coral);
  border-radius: 50%;
  opacity: 0;
  transform: translateX(-50%) scale(0.62);
}

.success-check__mark {
  position: relative;
  display: grid;
  width: 144px;
  height: 144px;
  place-items: center;
  background: rgba(255, 253, 248, 0.94);
  border: 8px solid var(--coral);
  border-radius: 50%;
  box-shadow: 7px 8px 0 rgba(23, 50, 77, 0.22);
}

.success-check__mark svg {
  width: 94px;
  height: 94px;
  color: var(--coral);
  stroke-width: 3.6;
}

.success-check strong {
  padding: 4px 13px 5px;
  color: var(--white);
  background: var(--coral);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-family: var(--display-font);
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  line-height: 1.1;
  transform: rotate(-2deg);
}

.success-check.is-celebrating .success-check__mark {
  animation: success-pop 620ms cubic-bezier(0.18, 0.9, 0.32, 1.35) both;
}

.success-check.is-celebrating .success-check__halo {
  animation: success-halo 720ms ease-out both;
}

.success-check.is-celebrating .success-check__mark svg path,
.success-check.is-celebrating .success-check__mark svg polyline {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: success-draw 460ms 170ms ease-out forwards;
}

.success-check.is-celebrating strong {
  animation: success-label 420ms 260ms cubic-bezier(0.18, 0.9, 0.32, 1.28) both;
}

.center-feedback {
  position: absolute;
  bottom: 12px;
  left: 14px;
  z-index: 3;
  max-width: calc(100% - 86px);
  margin: 0;
  padding: 6px 10px;
  color: var(--white);
  background: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.center-helper {
  margin-top: 8px;
}

.control-desk {
  position: relative;
  padding: 24px 22px;
  background: var(--paper-deep);
  border-left: 6px solid var(--shape-color);
  transform: translateY(14px) rotate(0.6deg);
  transition: border-color 200ms ease;
}

.desk-step {
  color: var(--teal);
}

.control-desk h3 {
  margin-bottom: 20px;
  font-size: 1.15rem;
}

.angle-readout {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 19px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--ink);
}

.angle-readout span {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.angle-readout output {
  color: var(--shape-color);
  font-family: var(--body-font);
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 0.85;
  font-variant-numeric: tabular-nums;
}

.angle-guesses > p,
.angle-slider > span {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.angle-guesses > div {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.angle-guesses button {
  min-height: 46px;
  color: var(--ink);
  background: var(--white);
  border: 2px solid rgba(23, 50, 77, 0.24);
  cursor: pointer;
  font-weight: 800;
}

.angle-guesses button:hover:not(:disabled),
.angle-guesses button.is-selected {
  color: var(--white);
  background: var(--shape-color);
  border-color: var(--shape-color);
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.angle-slider {
  display: block;
  margin: 18px 0;
}

input[type="range"] {
  width: 100%;
  height: 30px;
  margin: 0;
  accent-color: var(--shape-color);
  cursor: pointer;
}

.desk-actions {
  display: grid;
  gap: 9px;
}

.action-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  font-weight: 800;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.action-button:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--ink);
}

.action-button:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.action-button--primary {
  color: var(--white);
  background: var(--ink);
}

.action-button--quiet {
  border-color: transparent;
  box-shadow: none;
}

.action-button svg {
  width: 18px;
  height: 18px;
}

.result-message {
  min-height: 58px;
  margin: 18px 0 0;
  padding-top: 13px;
  color: var(--ink-soft);
  border-top: 2px dashed rgba(23, 50, 77, 0.24);
  font-size: 0.87rem;
  font-weight: 700;
  line-height: 1.55;
}

.result-message.is-success {
  color: var(--teal);
}

.result-message.is-near {
  color: var(--coral);
}

.thinking-strip {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 18px;
  align-items: center;
  margin: 32px 5% 22px 7%;
}

.thinking-strip__label {
  width: max-content;
  padding: 5px 11px;
  color: var(--white);
  background: var(--coral);
  font-size: 0.84rem;
  font-weight: 800;
  transform: rotate(-5deg);
}

.thinking-strip h2 {
  margin-bottom: 2px;
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
}

.thinking-strip div > p {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.answer-section {
  margin: 0 0 24px;
}

.answer-section details {
  color: var(--white);
  background: var(--ink);
  transform: rotate(-0.45deg);
}

.answer-section summary {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 4%;
  cursor: pointer;
  list-style: none;
}

.answer-section summary::-webkit-details-marker {
  display: none;
}

.answer-section summary span,
.answer-section summary small,
.answer-section summary strong {
  display: block;
}

.answer-section summary small {
  color: var(--sun);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.answer-section summary strong {
  font-family: var(--display-font);
  font-size: 1.45rem;
  font-weight: 400;
}

.answer-section summary svg {
  width: 28px;
  height: 28px;
  transition: transform 180ms ease;
}

.answer-section details[open] summary svg {
  transform: rotate(180deg);
}

.answer-content {
  padding: 2px 4% 24px;
}

.formula {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
  border-top: 2px solid rgba(255, 253, 248, 0.24);
  border-bottom: 2px solid rgba(255, 253, 248, 0.24);
}

.formula span {
  font-weight: 700;
}

.formula strong {
  color: var(--sun);
  font-family: var(--display-font);
  font-size: clamp(1.7rem, 3.5vw, 2.6rem);
  font-weight: 400;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 20px 0 14px;
}

.answer-grid article {
  display: grid;
  grid-template-columns: 62px 1fr;
  column-gap: 15px;
  align-items: center;
}

.answer-shape {
  grid-row: 1 / 4;
  display: block;
  width: 48px;
  height: 48px;
  background: var(--coral);
}

.answer-shape--pentagon {
  background: var(--teal);
  clip-path: polygon(50% 0, 98% 36%, 80% 100%, 20% 100%, 2% 36%);
}

.answer-shape--hexagon {
  background: var(--sky);
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}

.answer-grid h3,
.answer-grid p,
.answer-grid strong {
  margin: 0;
  line-height: 1.35;
}

.answer-grid p {
  color: rgba(255, 253, 248, 0.7);
  font-size: 0.82rem;
}

.answer-grid strong {
  color: var(--sun);
  font-size: 1.35rem;
}

.answer-note {
  margin-bottom: 0;
  color: rgba(255, 253, 248, 0.78);
  font-size: 0.86rem;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 2%;
  color: var(--ink-soft);
  border-top: 1px solid var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
}

@keyframes mark-pop {
  0% {
    transform: scale(0.45);
    transform-origin: center;
  }
  70% {
    transform: scale(1.24);
    transform-origin: center;
  }
  100% {
    transform: scale(1);
    transform-origin: center;
  }
}

@keyframes center-guide-bob {
  0%,
  100% {
    transform: translate(-50%, -3px);
  }
  48% {
    transform: translate(-50%, 7px);
  }
}

@keyframes center-guide-pulse {
  0% {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(0.45);
  }
  72%,
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.55);
  }
}

@keyframes success-pop {
  0% {
    opacity: 0;
    transform: scale(0.2) rotate(-12deg);
  }
  62% {
    opacity: 1;
    transform: scale(1.14) rotate(3deg);
  }
  82% {
    transform: scale(0.94) rotate(-1deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes success-halo {
  0% {
    opacity: 0.7;
    transform: translateX(-50%) scale(0.62);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(1.55);
  }
}

@keyframes success-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes success-label {
  0% {
    opacity: 0;
    transform: translateY(10px) rotate(-2deg) scale(0.72);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(-2deg) scale(1);
  }
}

@media (max-width: 920px) {
  .page-shell {
    width: min(100% - 28px, 760px);
  }

  .course-nav,
  .hero {
    padding-left: 2%;
  }

  .course-nav {
    width: calc(100% - 2%);
    margin-left: 2%;
    padding-left: 0;
  }

  .intro-band {
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 16px;
    margin-bottom: 18px;
  }

  .hero {
    width: 100%;
  }

  .question-note {
    width: 100%;
    margin: 0;
  }

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

  .control-desk {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 24px;
    transform: rotate(0.4deg);
  }

  .desk-step,
  .control-desk h3,
  .result-message {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .page-shell {
    width: calc(100% - 18px);
    padding-top: 14px;
  }

  .course-nav {
    gap: 6px;
    width: calc(100% - 16px);
    margin: 0 8px;
    padding: 0;
  }

  .course-nav a {
    grid-template-columns: 30px minmax(0, 1fr) 16px;
    gap: 7px;
    min-height: 52px;
    padding: 6px 8px;
  }

  .course-nav__number {
    width: 30px;
    height: 30px;
    font-size: 0.68rem;
  }

  .course-nav__copy {
    font-size: 0.75rem;
  }

  .course-nav__copy small {
    font-size: 0.58rem;
  }

  .course-nav svg {
    width: 16px;
    height: 16px;
  }

  .intro-band {
    grid-template-columns: 1fr;
    gap: 7px;
    margin-bottom: 14px;
  }

  .hero {
    width: 100%;
    padding: 21px 8px 9px;
  }

  h1 {
    margin-bottom: 6px;
    font-size: clamp(2.15rem, 11.5vw, 3.05rem);
  }

  .hero__lead {
    font-size: 0.86rem;
  }

  .question-note {
    width: calc(100% - 16px);
    margin: 0 8px 5px;
    padding: 13px 14px 11px;
    transform: rotate(0.5deg);
  }

  .question-note__title {
    font-size: 1.14rem;
  }

  .question-note ol {
    gap: 3px;
    font-size: 0.72rem;
  }

  .experiment {
    padding: 18px 13px 20px;
    box-shadow: 7px 8px 0 var(--ink);
  }

  .experiment::before {
    display: none;
  }

  .experiment__heading {
    display: grid;
    gap: 5px;
  }

  .text-button {
    width: max-content;
  }

  .shape-switcher {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 12px 0 11px;
  }

  .shape-tab {
    min-height: 52px;
    grid-template-columns: 31px 1fr;
    gap: 5px;
    padding: 6px 5px;
    font-size: 0.78rem;
  }

  .shape-tab strong {
    font-size: 0.72rem;
    white-space: nowrap;
  }

  .shape-tab__number {
    width: 30px;
    height: 30px;
  }

  .shape-tab small {
    display: none;
  }

  .shape-stage {
    min-height: 250px;
    aspect-ratio: auto;
  }

  .success-check__mark,
  .success-check__halo {
    width: 112px;
    height: 112px;
  }

  .success-check__mark {
    border-width: 7px;
  }

  .success-check__mark svg {
    width: 72px;
    height: 72px;
  }

  .success-check strong {
    font-size: 1rem;
  }

  .center-guide {
    width: 88px;
    height: 102px;
  }

  .center-guide__hand {
    width: 56px;
    height: 56px;
  }

  .center-guide__hand svg {
    width: 52px;
    height: 52px;
  }

  .center-guide strong {
    top: 60px;
    font-size: 0.88rem;
  }

  .center-feedback {
    font-size: 0.76rem;
  }

  .control-desk {
    display: block;
    padding: 22px 17px;
  }

  .thinking-strip {
    grid-template-columns: 1fr;
    gap: 7px;
    margin: 24px 10px 16px;
  }

  .thinking-strip h2 {
    font-size: 1.28rem;
  }

  .answer-section summary {
    min-height: 54px;
    padding-inline: 16px;
  }

  .answer-content {
    padding-inline: 16px;
  }

  .formula {
    align-items: start;
    flex-direction: column;
    gap: 3px;
  }

  .answer-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    margin: 16px 0 12px;
  }

  .answer-grid article {
    grid-template-columns: 58px 1fr;
  }

  footer {
    flex-direction: column;
    gap: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .center-guide,
  .center-guide__pulse {
    animation: none !important;
  }
}

/* Direct rotation shares the same angle state as the slider and demonstration. */
.rotation-handle { display: none; cursor: grab; }
.stage-frame.is-ready .rotation-handle { display: inline; }
.rotation-handle__hit { fill: transparent; pointer-events: all; }
.rotation-handle__knob { fill: var(--white); stroke: var(--shape-color); stroke-width: 3; }
.rotation-handle__icon { fill: none; stroke: var(--shape-color); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.stage-frame.is-ready .shape-stage { cursor: default; touch-action: none; user-select: none; }
.stage-frame.is-ready .rotating-shape { cursor: grab; }
.stage-frame.is-rotating .shape-stage,
.stage-frame.is-rotating .rotating-shape,
.stage-frame.is-rotating .rotation-handle { cursor: grabbing; }
.stage-frame.is-rotating .rotating-shape { fill-opacity: 0.28; }
.stage-frame.is-rotating:not(.is-snapped) .success-check { visibility: hidden; }
.stage-frame.is-ready .center-feedback,
.stage-frame.is-ready .overlap-badge { pointer-events: none; }

.stage-frame.is-snapped .rotation-handle__knob {
  fill: #fff0ad;
  stroke-width: 4;
  filter: drop-shadow(0 0 5px rgb(224 177 34 / 65%));
}
.stage-frame.is-snapped .rotating-shape { fill-opacity: 0.3; }
.stage-frame.is-rotating.is-snapped .success-check { gap: 5px; }
.stage-frame.is-rotating.is-snapped .success-check__mark,
.stage-frame.is-rotating.is-snapped .success-check__halo { width: 76px; height: 76px; border-width: 5px; }
.stage-frame.is-rotating.is-snapped .success-check__mark svg { width: 48px; height: 48px; }
.stage-frame.is-rotating.is-snapped .success-check strong { font-size: 0.95rem; }

/* Three connected classroom experiments. */
.course-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); width: min(920px, 100%); }
@media (max-width: 620px) { .course-nav { grid-template-columns: 1fr; margin-left: 0; } }
