:root {
  color-scheme: light;
  --ink: #1f2937;
  --muted: #687083;
  --line: #d8dee8;
  --paper: #fffdf7;
  --panel: #ffffff;
  --chalk: #263247;
  --green: #2f8d68;
  --blue: #3e75d8;
  --yellow: #f5c84c;
  --red: #ef6b57;
  --violet: #7465c9;
  --cyan: #80cde4;
  --shadow: 0 18px 48px rgba(31, 41, 55, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(223, 238, 252, 0.95), rgba(255, 253, 247, 0.98) 45%),
    var(--paper);
  color: var(--ink);
  font-family:
    "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

body[data-version="a"] {
  background:
    linear-gradient(180deg, #eaf0f7, #f8fafc 46%),
    #f8fafc;
}

body[data-version="b"] {
  background:
    radial-gradient(circle at 12% 10%, rgba(245, 200, 76, 0.36), transparent 18%),
    linear-gradient(180deg, #dff1ff 0, #fff5d7 44%, #f3fff1 100%);
}

button,
select {
  font: inherit;
}

button,
select {
  border-radius: 8px;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.shell {
  width: min(1280px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 16px;
}

.kicker,
.lesson-info > p {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 14px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.05;
}

h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.18;
}

.hero-note {
  display: grid;
  min-width: 150px;
  padding: 14px 16px;
  border: 1px solid #efd684;
  border-radius: 8px;
  background: #fff7d9;
  box-shadow: var(--shadow);
}

.hero-note span {
  color: #9a6616;
  font-size: 22px;
  font-weight: 950;
}

.hero-note strong {
  color: #6c4b13;
  font-size: 14px;
}

.control-strip {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.control-strip label,
.version-switch {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.control-strip label span,
.version-switch legend {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 750;
}

.version-switch {
  grid-template-columns: repeat(3, 108px);
}

.version-switch legend {
  grid-column: 1 / -1;
}

.version,
.reset-button {
  min-height: 48px;
  padding: 0 16px;
}

.version.active,
.reset-button {
  background: var(--chalk);
  color: #fff;
  border-color: var(--chalk);
}

body[data-version="b"] .version.active {
  background: #f4b740;
  color: #3c2a05;
  border-color: #c88918;
  box-shadow: inset 0 -3px 0 rgba(120, 78, 8, 0.18);
}

body[data-version="c"] .version.active {
  background: #2a7a3b;
  color: #fff;
  border-color: #1d5a2b;
  box-shadow: inset 0 -3px 0 rgba(20, 70, 30, 0.2);
}

body[data-version="b"] .hero-note {
  border-color: #f2bd63;
  background: #fff0bc;
}

.lesson-frame {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  min-height: 650px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.lesson-info {
  padding: 28px;
  border-right: 1px solid var(--line);
  background: #fbf8ee;
}

.objective,
.teacher-tip {
  margin-top: 18px;
  padding: 16px;
  border-radius: 8px;
  line-height: 1.58;
}

.objective {
  background: #eef7ff;
  color: #225185;
  border: 1px solid #c4daf4;
  font-weight: 800;
}

.teacher-tip {
  background: #eaf7ee;
  color: #276348;
  border: 1px solid #bde0c8;
}

.tool-stage {
  position: relative;
  min-width: 0;
  padding: 28px;
  background: #fff;
}

.tool-stage.version-a {
  background:
    linear-gradient(90deg, rgba(38, 50, 71, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(38, 50, 71, 0.04) 1px, transparent 1px),
    #f8fafc;
  background-size: 28px 28px;
}

.tool-stage.version-b {
  background:
    radial-gradient(circle at 92% 8%, rgba(245, 200, 76, 0.28), transparent 18%),
    linear-gradient(180deg, #fff7e4, #edf7ff 60%, #f6fff5);
}

.tool-stage.version-c {
  background:
    linear-gradient(90deg, rgba(42, 122, 59, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(42, 122, 59, 0.05) 1px, transparent 1px),
    #f6fbf6;
  background-size: 28px 28px;
}

.tool-card {
  min-height: 590px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.version-a .tool-card {
  padding: 2px;
}

.version-b .tool-card {
  gap: 20px;
}

.tool-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.tool-head h3 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

.tool-badge {
  display: inline-grid;
  place-items: center;
  min-width: 88px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  background: #fff7d9;
  color: #80530d;
  font-weight: 950;
}

.version-a .tool-badge {
  background: var(--chalk);
  color: #fff;
}

.version-b .tool-badge {
  background: #fff2bd;
  color: #86580c;
  border: 1px solid #f0c468;
  transform: rotate(-1deg);
}

.version-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 16px;
}

.version-note strong {
  white-space: nowrap;
}

.version-a .version-note {
  border: 1px solid #c8d1df;
  background: #ffffff;
  color: #344054;
}

.version-a .version-note strong {
  color: var(--chalk);
}

.version-b .version-note {
  border: 1px solid #f0ca76;
  background: #fff7d9;
  color: #75520e;
}

.version-b .version-note strong {
  color: #b25a28;
}

.board {
  position: relative;
  min-height: 390px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(180deg, #dcefff 0 56%, #dff2c9 56%),
    #f6fbff;
}

.version-a .board {
  border: 2px solid #c8d1df;
  background: #f8fafc;
  box-shadow: inset 0 0 0 1px rgba(31, 42, 56, 0.04);
}

.version-b .board {
  border-color: #f1d190;
  background:
    linear-gradient(180deg, #ffe8b8 0 46%, #bfead4 46%),
    #fff7e4;
  box-shadow: inset 0 -24px 0 rgba(73, 156, 102, 0.12);
}

.version-c .board {
  border: 2px solid #8ec88e;
  background: #f4fbf4;
  box-shadow: inset 0 0 0 1px rgba(42, 122, 59, 0.06);
}

.action-row,
.number-row,
.symbol-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.action-row button,
.number-row button,
.symbol-row button,
.choice-chip {
  min-height: 50px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.version-a .action-row button,
.version-a .number-row button,
.version-a .symbol-row button,
.version-a .choice-chip {
  background: #ffffff;
  border-color: #c8d1df;
  color: #243042;
  box-shadow: 0 2px 0 #c8d1df;
}

.version-b .action-row button,
.version-b .number-row button,
.version-b .symbol-row button,
.version-b .choice-chip {
  min-height: 56px;
  background: #fff7d9;
  border-color: #eabc58;
  color: #6f4b0f;
  box-shadow: 0 4px 0 rgba(172, 112, 22, 0.18);
}

.version-c .action-row button,
.version-c .number-row button,
.version-c .symbol-row button,
.version-c .choice-chip {
  background: #f4fbf4;
  border-color: #8ec88e;
  color: #1a4a20;
  box-shadow: 0 2px 0 #8ec88e;
}

.number-row button {
  min-width: 64px;
  font-size: 26px;
}

.symbol-row button {
  min-width: 70px;
  font-size: 28px;
}

.action-row button.primary,
.choice-chip.active,
.symbol-row button.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.version-b .action-row button.primary,
.version-b .choice-chip.active,
.version-b .symbol-row button.active {
  background: #ef7a56;
  border-color: #d65d39;
  color: #fff;
}

.version-c .action-row button.primary,
.version-c .choice-chip.active,
.version-c .symbol-row button.active {
  background: #2a7a3b;
  border-color: #1d5a2b;
  color: #fff;
}

.feedback {
  min-height: 64px;
  display: grid;
  align-items: center;
  padding: 14px 16px;
  border-radius: 8px;
  background: #eef7ff;
  border: 1px solid #c4daf4;
  color: #244e82;
  font-size: 18px;
  font-weight: 850;
}

.version-a .feedback {
  border-left: 8px solid var(--blue);
  background: #f8fbff;
}

.version-b .feedback {
  min-height: 72px;
  border: 2px solid #f0ca76;
  background: #fff8df;
  color: #77510d;
  font-size: 19px;
  box-shadow: 0 8px 0 rgba(239, 177, 72, 0.12);
}

.feedback.good {
  background: #eaf7ee;
  border-color: #bde0c8;
  color: #276348;
}

.feedback.try {
  background: #fff0ec;
  border-color: #f1b5a8;
  color: #963d2d;
}

.review-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.version-a .review-panel {
  border-color: #c8d1df;
}

.version-b .review-panel {
  border: 2px solid #f0ca76;
  background: #fff8df;
  box-shadow: 0 8px 0 rgba(239, 177, 72, 0.1);
}

.review-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 58px;
  padding: 0 18px;
  border: 0;
  border-radius: 0;
  background: #f8fbff;
  color: var(--ink);
  text-align: left;
}

.version-a .review-toggle {
  background: #eef2f7;
}

.version-b .review-toggle {
  background: #fff0bc;
  color: #73500e;
}

.review-toggle span {
  font-size: 20px;
  font-weight: 950;
}

.review-toggle strong {
  font-size: 15px;
}

.review-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.review-login {
  display: grid;
  grid-template-columns: 150px 150px auto;
  gap: 10px;
  align-items: center;
}

.review-login.logged-in {
  grid-template-columns: 1fr auto;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 8px;
  background: #eaf7ee;
  color: #276348;
  font-weight: 850;
}

.review-login input,
.review-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.review-login input {
  min-height: 46px;
  padding: 0 12px;
}

.review-login button,
.review-form button,
.review-item button {
  min-height: 46px;
  padding: 0 16px;
}

.review-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.review-form textarea {
  min-height: 90px;
  resize: vertical;
  padding: 12px;
  line-height: 1.5;
}

.review-form button {
  background: var(--chalk);
  color: #fff;
  border-color: var(--chalk);
}

.version-b .review-form button {
  background: #ef7a56;
  border-color: #d65d39;
}

.review-error,
.review-empty {
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 800;
}

.review-error {
  background: #fff0ec;
  color: #963d2d;
  border: 1px solid #f1b5a8;
}

.review-empty {
  background: #f8fafc;
  color: var(--muted);
  border: 1px dashed #c8d1df;
}

.review-list {
  display: grid;
  gap: 10px;
}

.review-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #ffffff;
}

.version-b .review-item {
  border-color: #f0ca76;
  background: #fffdf3;
}

.review-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.review-item header strong {
  color: var(--ink);
}

.review-item p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.6;
}

.review-item button {
  justify-self: start;
  color: #963d2d;
  border-color: #f1b5a8;
  background: #fff0ec;
}

.big-number {
  display: inline-grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: var(--chalk);
  color: #fff;
  font-size: 44px;
  font-weight: 950;
}

.objects-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(52px, 1fr));
  gap: 16px;
  align-content: center;
  justify-items: center;
  min-height: 100%;
  padding: 34px;
}

.obj {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 34px;
  font-weight: 950;
  box-shadow: inset -10px -10px 0 rgba(0, 0, 0, 0.12);
  animation: pop 220ms ease both;
}

.version-a .obj {
  border-radius: 8px;
  background: #e8f0ff;
  color: #1f2a38;
  border: 2px solid #91a7d8;
  box-shadow: inset 0 -8px 0 rgba(62, 117, 216, 0.18);
}

.version-b .obj {
  width: 72px;
  height: 72px;
  border: 4px solid rgba(255, 255, 255, 0.74);
  background: radial-gradient(circle at 35% 28%, #ffd7c8 0 12px, var(--red) 13px);
  box-shadow:
    inset -10px -10px 0 rgba(112, 40, 28, 0.15),
    0 8px 0 rgba(170, 83, 54, 0.14);
}

.obj.square {
  border-radius: 8px;
  background: var(--blue);
}

.version-b .obj.square {
  border-radius: 22px;
  background: radial-gradient(circle at 35% 28%, #d9efff 0 12px, #5c9ded 13px);
}

.obj.rod {
  width: 34px;
  height: 96px;
  border-radius: 18px;
  background: var(--yellow);
  color: #74500e;
}

.obj.empty {
  background: #fff;
  border: 2px dashed #c4cbd8;
  box-shadow: none;
}

.split-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.bin {
  min-height: 260px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8e7;
}

.version-a .bin {
  background: #ffffff;
  border-color: #c8d1df;
}

.version-b .bin {
  border: 2px solid #f0ca76;
  background: rgba(255, 248, 223, 0.92);
  box-shadow: 0 8px 0 rgba(239, 177, 72, 0.1);
}

.bin h4 {
  margin: 0 0 14px;
  color: #80530d;
}

.bin .objects-grid {
  min-height: 180px;
  padding: 0;
  grid-template-columns: repeat(4, 1fr);
}

.formula-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 38px;
  font-weight: 950;
}

.formula-box {
  display: inline-grid;
  place-items: center;
  min-width: 72px;
  min-height: 60px;
  padding: 0 14px;
  border-radius: 8px;
  background: #fff7d9;
  color: #80530d;
  border: 1px solid #efd684;
}

.version-a .formula-box {
  background: #ffffff;
  color: #1f2a38;
  border: 2px solid #344054;
}

.version-b .formula-box {
  border: 2px solid #f0b25a;
  background: #fff0bc;
  color: #8b5510;
  box-shadow: 0 4px 0 rgba(176, 108, 22, 0.14);
}

.ten-frame {
  display: grid;
  grid-template-columns: repeat(5, 72px);
  gap: 10px;
  justify-content: center;
  align-content: center;
  min-height: 310px;
}

.ten-cell {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 2px solid #b9c3d4;
  border-radius: 8px;
  background: #fff;
}

.version-a .ten-cell {
  background: rgba(255, 255, 255, 0.94);
  border-color: #94a3b8;
}

.version-b .ten-cell {
  border-color: #e6b45c;
  background: #fffdf3;
  box-shadow: 0 4px 0 rgba(176, 108, 22, 0.12);
}

.ten-cell.filled::before {
  content: "";
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--red);
}

.place-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.place-column {
  min-height: 320px;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8fbff;
}

.version-a .place-column {
  background: #ffffff;
  border-color: #c8d1df;
}

.version-b .place-column {
  background: #fff8df;
  border: 2px solid #f0ca76;
}

.place-column h4 {
  margin: 0 0 14px;
  color: var(--blue);
  font-size: 22px;
}

.bundle {
  width: 72px;
  height: 150px;
  border-radius: 6px;
  background:
    /* 绑带 */
    linear-gradient(180deg, transparent 43%, #7a3f08 43% 57%, transparent 57%),
    /* 小棒竖纹 */
    repeating-linear-gradient(90deg, #f2b94d 0 4px, #b87828 4px 7px);
  border: 3px solid #9a6a22;
  box-shadow: inset -3px 0 6px rgba(0,0,0,0.18), 2px 3px 6px rgba(0,0,0,0.12);
}

.number-line {
  position: relative;
  min-height: 180px;
  margin: 36px 8px 10px;
}

.number-line::before {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  top: 72px;
  height: 4px;
  border-radius: 4px;
  background: var(--chalk);
}

.tick {
  position: absolute;
  top: 48px;
  transform: translateX(-50%);
  text-align: center;
  font-weight: 900;
}

.tick::before {
  content: "";
  display: block;
  width: 4px;
  height: 48px;
  margin: 0 auto 8px;
  border-radius: 4px;
  background: var(--chalk);
}

.tick.active {
  color: var(--red);
}

.tick.active::before {
  background: var(--red);
}

.solid-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 16px;
}

.solid-card {
  display: grid;
  gap: 10px;
  place-items: center;
  min-height: 170px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.version-a .solid-card {
  border-color: #c8d1df;
  background: #f8fafc;
}

.version-b .solid-card {
  border: 2px solid #f0ca76;
  background: #fff8df;
  box-shadow: 0 8px 0 rgba(239, 177, 72, 0.1);
}

.solid-shape {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 950;
}

.cube {
  border-radius: 8px;
  background: linear-gradient(135deg, #5a89e6, #244a9b);
}

.box {
  width: 112px;
  border-radius: 8px;
  background: linear-gradient(135deg, #39a874, #1f7650);
}

.cylinder {
  border-radius: 50% / 16%;
  background: linear-gradient(90deg, #eaa44f, #c56d2e, #eaa44f);
}

.ball {
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #fff, #e35e69 28%, #9c2632 80%);
}

.blocks {
  display: grid;
  grid-template-columns: repeat(6, 56px);
  grid-auto-rows: 56px;
  gap: 8px;
  justify-content: center;
  align-content: end;
  min-height: 320px;
}

.block {
  border-radius: 8px;
  background: var(--blue);
  box-shadow: inset -8px -8px 0 rgba(0, 0, 0, 0.12);
}

.version-a .block {
  background: #5b6f95;
}

.version-b .block {
  background: #5c9ded;
  border: 3px solid rgba(255, 255, 255, 0.72);
}

.people-line {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 10px;
  min-height: 280px;
}

.person {
  display: grid;
  place-items: center;
  width: 52px;
  height: 88px;
  border-radius: 28px 28px 8px 8px;
  background: var(--cyan);
  color: #0e5365;
  font-weight: 950;
}

.version-a .person {
  border-radius: 8px;
  background: #e8f0ff;
  color: #1f2a38;
  border: 2px solid #91a7d8;
}

.version-b .person {
  border-radius: 28px 28px 12px 12px;
  background: #91ddcf;
}

.person.mark {
  background: var(--red);
  color: #fff;
}

.problem-panel {
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.version-a .problem-panel {
  background: #ffffff;
  border-color: #c8d1df;
}

.version-b .problem-panel {
  background: #fff8df;
  border: 2px solid #f0ca76;
}

.problem-panel p {
  margin: 0;
  font-size: 23px;
  line-height: 1.55;
  font-weight: 850;
}

input[type="range"] {
  width: min(520px, 100%);
  accent-color: var(--blue);
}

/* ===== 加减法方块拖放组件 ===== */
.builder-board {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  min-height: auto;
}

.builder-boxes {
  display: grid;
  gap: 14px;
}

.builder-box {
  min-height: 150px;
  padding: 14px;
  border: 2px dashed #9fb0cf;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.version-b .builder-box {
  border-color: #eabc58;
  background: rgba(255, 248, 223, 0.85);
}

.builder-box h4 {
  margin: 0 0 12px;
  color: #2b4a7a;
  font-size: 18px;
}

.version-b .builder-box h4 {
  color: #80530d;
}

.builder-slot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 56px;
  align-content: flex-start;
}

.builder-pool {
  padding: 14px;
  border: 2px solid #d8dee8;
  border-radius: 12px;
  background: #fff;
}

.version-b .builder-pool {
  border-color: #f0ca76;
  background: #fffdf3;
}

.builder-pool-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.builder-token {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--red);
  border: 3px solid rgba(255, 255, 255, 0.72);
  box-shadow: inset -7px -7px 0 rgba(0, 0, 0, 0.12);
  cursor: grab;
  touch-action: none;
  position: relative;
  animation: pop 200ms ease both;
}

.builder-token.square {
  border-radius: 8px;
  background: var(--blue);
}

.builder-token.crossed {
  background: #b0392b;
}

.builder-token.crossed::after {
  content: "×";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 36px;
  font-weight: 950;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.builder-token.dragging-ghost {
  opacity: 0.85;
  cursor: grabbing;
  animation: none;
}

.builder-hint {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

/* ===== 复习卡片 ===== */
.review-board {
  min-height: auto;
  overflow: visible;
}

.review-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px;
}

.review-cards .choice-chip {
  touch-action: none;
  cursor: grab;
  transition: transform 140ms ease, background 140ms ease;
}

.choice-chip.quiz-active {
  transform: scale(1.28);
  background: var(--yellow);
  color: #5a3d08;
  border-color: #e0a92e;
  box-shadow: 0 6px 0 rgba(176, 108, 22, 0.22);
  z-index: 1;
}

.choice-chip.correct {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.choice-chip.wrong {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.review-prompt {
  font-size: 20px;
}

/* ===== 分与合 ===== */
.split-board-v {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: auto;
  padding: 16px;
}

.split-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 8px 0;
}

.split-dot {
  width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #c8d1df;
  cursor: pointer;
}

.split-dot.left {
  background: var(--blue);
  border-color: var(--blue);
}

.split-dot.right {
  background: var(--yellow);
  border-color: #e0b53e;
}

.split-heaps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.split-found strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}

.split-ways {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.split-way {
  padding: 6px 12px;
  border-radius: 8px;
  background: #eef2f7;
  color: #8a95a6;
  border: 1px dashed #c8d1df;
  font-weight: 800;
}

.split-way.hit {
  background: #eaf7ee;
  color: #276348;
  border: 1px solid #bde0c8;
}

/* ===== 认识数量：情境场景 + 表情物体 + 答对烟花 ===== */
.board.count-board {
  position: relative;
  background: linear-gradient(180deg, #dff1ff 0 58%, #d2eebb 58%);
  border-color: #bcd9ef;
}

/* A版保留松鼠装饰；B版去掉，避免干扰点数 */
.version-a .board.count-board::after {
  content: "🐿️";
  position: absolute;
  right: 16px;
  bottom: 10px;
  font-size: 36px;
  opacity: 0.92;
}

.count-grid {
  display: grid;
  gap: 14px;
  justify-items: center;
  align-content: center;
  min-height: 100%;
  padding: 28px;
}

.count-item {
  font-size: clamp(40px, 6vw, 58px);
  line-height: 1;
  display: grid;
  place-items: center;
  animation: pop 240ms ease both;
}

.celebrate {
  position: fixed;
  font-size: 26px;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  animation: burst 900ms ease-out forwards;
}

@keyframes burst {
  to {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.4);
    opacity: 0;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.72) translateY(16px);
  }
}

@media (max-width: 920px) {
  .hero,
  .control-strip,
  .lesson-frame,
  .place-board,
  .split-board {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: start;
  }

  .lesson-info {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .version-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-login,
  .review-form {
    grid-template-columns: 1fr;
  }
}

/* ===== M-a: T02 B版减法摘要 ===== */
.b-sub-summary {
  display: flex;
  gap: 20px;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 6px 0;
}
.b-sub-remain { color: #1a6fcf; }
.b-sub-taken  { color: #c0392b; }

/* ===== M-e: T17 比较数 tick ===== */
.tick.compare-tick {
  color: #e07b00;
}
.tick.compare-tick::before {
  background: #e07b00;
}
.line-current-box {
  background: #d8eaff;
  border-color: #2a7ce6;
  color: #1552b0;
}
.line-compare-box {
  background: #fff0d8;
  border-color: #e07b00;
  color: #8c4b00;
}

/* ===== M-i: T26 加法表 ===== */
.t26-table {
  width: 100%;
  border-collapse: collapse;
}
.t26-table tr + tr {
  border-top: 1px solid var(--line);
}
.t26-sum-cell {
  padding: 8px 12px;
  white-space: nowrap;
  color: #555;
  font-size: 0.9rem;
  width: 96px;
}
.t26-cells {
  padding: 6px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ===== H2/H3: 小方块摞 ===== */
.block-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}
.block-unit {
  width: 38px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(135deg, #7ec8e3 0%, #2a7ce6 100%);
  border: 1px solid #1a5ab4;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15);
  animation: pop 220ms ease both;
}

/* ===== H2/H3: 计数器（算盘）===== */
.counter-frame {
  display: flex;
  gap: 40px;
  justify-content: center;
  align-items: flex-end;
  padding: 16px 24px 8px;
}
.counter-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.counter-beads {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 140px;
  justify-content: flex-end;
  align-items: center;
}
.counter-pole {
  width: 6px;
  height: 10px;
  background: #8b5e3c;
  border-radius: 0 0 3px 3px;
  margin-top: 2px;
}
.counter-bead {
  width: 32px;
  height: 20px;
  border-radius: 50%;
  animation: pop 220ms ease both;
}
.counter-bead.ones {
  background: radial-gradient(circle at 35% 35%, #ffd7c8, var(--red));
  border: 2px solid #b04000;
}
.counter-bead.tens {
  background: radial-gradient(circle at 35% 35%, #d8eaff, var(--blue));
  border: 2px solid #1a5ab4;
}
.counter-col-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #555;
  margin-top: 6px;
}

/* ===== H5/H6: T21/T22 凑十法两行可视化 ===== */
.mt-board {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.mt-row-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mt-row-label {
  font-size: 1.5rem;
  font-weight: 900;
  min-width: 38px;
  text-align: right;
  flex-shrink: 0;
}
.mt-label-red   { color: var(--red); }
.mt-label-green { color: var(--green); }
.mt-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.mt-cell {
  width: 46px;
  height: 46px;
  border: 2px solid #c8d1df;
  border-radius: 8px;
  background: #f8f9fb;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.mt-cell.red::before {
  content: "";
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffb3ae, var(--red));
}
.mt-cell.green {
  cursor: pointer;
  background: #f0fff4;
  border-color: #7ec8a0;
  transition: transform 120ms, border-color 120ms;
}
.mt-cell.green::before {
  content: "";
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #b8f5cc, var(--green));
}
.mt-cell.green:hover { transform: scale(1.12); border-color: var(--green); }
.mt-cell.green.moved {
  background: #eef4ff;
  border-color: var(--blue);
}
.mt-cell.green.moved::before {
  background: radial-gradient(circle at 35% 35%, #c8daff, var(--blue));
}
.mt-cell.empty {
  background: #fff;
  border-style: dashed;
  border-color: #d0d8e4;
}
.mt-hint {
  font-size: 1rem;
  color: #666;
  font-weight: 600;
  margin: 4px 0 8px;
}
.mt-decomp-line {
  font-size: 1.4rem;
  color: #555;
  margin-top: 6px;
}
.mt-decomp-line .formula-box {
  min-width: 50px;
  min-height: 44px;
  padding: 0 8px;
}
.mt-result-box {
  background: #d4f7d4 !important;
  border-color: var(--green) !important;
  color: #1a6030 !important;
}
.mt-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.mt-selector-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: #555;
  white-space: nowrap;
}

/* ===== H7: T12 B版加法/减法表 ===== */
.t12-table {
  border-collapse: collapse;
  font-size: 0.85rem;
  font-weight: 700;
}
.t12-op {
  background: #e0e8ff;
  font-size: 1rem;
}
.t12-hdr {
  padding: 5px 8px;
  background: #eef2ff;
  color: #1a2a4a;
  font-weight: 900;
  text-align: center;
  border: 1px solid #c8d4f0;
}
.t12-cell {
  padding: 0;
  width: 34px;
  height: 34px;
  text-align: center;
  border: 1px solid #d8e0f0;
  cursor: pointer;
  transition: background 120ms, color 120ms;
  font-size: 0.85rem;
}
.t12-cell:hover {
  background: #d8e8ff;
}
.t12-cell.t12-active {
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}
.t12-empty {
  width: 34px;
  height: 34px;
  background: #f4f4f6;
  border: 1px solid #e4e8f0;
}
.version-b .t12-cell:hover  { background: #fff0cc; }
.version-b .t12-cell.t12-active { background: #ef7a56; color: #fff; border-color: #d65d39; }
.version-b .t12-hdr { background: #fff3d4; border-color: #f0c868; }

/* ===== H4: T17 具象比较（两排小方块） ===== */
.cmp-board {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.cmp-row-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cmp-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 320px;
}
.cmp-block {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  flex-shrink: 0;
}
.cmp-block.cmp-left  { background: var(--blue); }
.cmp-block.cmp-right { background: var(--red); }
.cmp-block.cmp-extra {
  opacity: 0.55;
  box-shadow: 0 0 0 2px currentColor;
}
.cmp-block.cmp-left.cmp-extra  { background: #a0c0f8; }
.cmp-block.cmp-right.cmp-extra { background: #f8b0b0; }
.cmp-count {
  font-size: 1.4rem;
  font-weight: 900;
  min-width: 32px;
}
.cmp-left-label  { color: var(--blue); }
.cmp-right-label { color: var(--red); }

/* ===== H1: T13 立体图形改版 ===== */
.solid-display {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px;
  background: #f6f8fc;
  border-radius: 10px;
  border: 1px solid #dce4f0;
  margin-bottom: 14px;
}
.solid-display-shape {
  flex-shrink: 0;
  width: 150px;
  display: grid;
  place-items: center;
}
.solid-display-shape svg { width: 100%; height: auto; }
.solid-display-info { flex: 1; }
.solid-display-name {
  font-size: 1.5rem;
  font-weight: 900;
  margin: 0 0 6px;
  color: #1a2a3a;
}
.solid-display-desc {
  font-size: 0.95rem;
  color: #444;
  line-height: 1.5;
  margin: 0 0 8px;
}
.solid-roll-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 700;
}
.solid-roll-badge.can  { background: #d4f7d4; color: #1a6030; }
.solid-roll-badge.no   { background: #fde8e8; color: #802020; }
.solid-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.solid-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border: 2px solid #c8d4e4;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  transition: border-color 120ms, background 120ms;
  min-width: 72px;
}
.solid-mini:hover { border-color: var(--blue); background: #eef4ff; }
.solid-mini.active { border-color: var(--blue); background: #ddeeff; }
.solid-mini-svg { width: 64px; height: auto; }
.solid-mini-svg svg { width: 100%; height: auto; }
.version-b .solid-mini { border-color: #f0c868; background: #fff8df; }
.version-b .solid-mini.active { border-color: #e07020; background: #ffe8c0; }
/* Roll animations */
@keyframes roll-ball {
  0%   { transform: translateX(0)    rotate(0deg); }
  40%  { transform: translateX(55px) rotate(360deg); }
  100% { transform: translateX(0)    rotate(720deg); }
}
@keyframes roll-cylinder {
  0%   { transform: rotate(0deg)   translateX(0); }
  18%  { transform: rotate(88deg)  translateX(8px); }
  50%  { transform: rotate(88deg)  translateX(55px); }
  82%  { transform: rotate(88deg)  translateX(8px); }
  100% { transform: rotate(0deg)   translateX(0); }
}
@keyframes roll-tumble {
  0%   { transform: translateX(0)    rotate(0deg); }
  20%  { transform: translateX(18px) rotate(90deg); }
  40%  { transform: translateX(36px) rotate(180deg) translateY(4px); }
  60%  { transform: translateX(22px) rotate(270deg); }
  80%  { transform: translateX(8px)  rotate(320deg); }
  100% { transform: translateX(0)    rotate(360deg); }
}
.roll-ball     { animation: roll-ball     1.1s ease-in-out; }
.roll-cylinder { animation: roll-cylinder 1.2s ease-in-out; }
.roll-tumble   { animation: roll-tumble   1.3s ease-in-out; }

/* ===== C版（教参版）全局背景 ===== */
body[data-version="c"] {
  background:
    radial-gradient(circle at 8% 8%, rgba(168, 220, 168, 0.35), transparent 20%),
    linear-gradient(180deg, #e4f4e4 0, #f4fbf4 46%, #f8fff6 100%);
}

/* ===== C版 通用组件 ===== */
.c-story-box {
  padding: 12px 16px;
  background: #fffbe6;
  border-left: 4px solid #f5c84c;
  border-radius: 0 8px 8px 0;
  margin-bottom: 12px;
}
.c-story-text {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #5c4000;
  line-height: 1.5;
}
.c-prompt {
  font-size: 18px;
  color: #555;
  margin: 8px 0;
}

/* ===== T01 C版：散乱摆放（基数）===== */
.c-scatter-board {
  position: relative;
  width: 100%;
  height: 200px;
  border: 2px dashed #86c486;
  border-radius: 12px;
  background: #f0f9ee;
  margin: 12px 0;
  overflow: hidden;
}
.c-scatter-item {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  cursor: pointer;
  user-select: none;
  transition: transform 150ms;
}
.c-scatter-item:hover { transform: translate(-50%, -50%) scale(1.18); }
.c-scatter-item.c-counted { opacity: 0.55; }
.c-scatter-icon { font-size: 40px; display: block; }
.c-count-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  font-size: 13px;
  font-weight: 900;
  background: #2f8d68;
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  line-height: 1;
}
.c-result-line {
  font-size: 24px;
  font-weight: 900;
  color: #1a6030;
  text-align: center;
  margin: 10px 0;
}
.c-big-num {
  font-size: 48px;
  color: var(--red);
}

/* ===== T01 C版：序数模式 ===== */
.c-ord-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
  padding: 14px 18px;
  border: 2px dashed #86c486;
  border-radius: 12px;
  background: #f0f9ee;
  justify-content: center;
  align-items: center;
}
.c-ord-item { font-size: 44px; }
.c-ord-target {
  outline: 3px solid var(--red);
  border-radius: 8px;
  background: rgba(239, 107, 87, 0.12);
  padding: 3px 5px;
}

/* ===== T02 C版：三层递进 ===== */
.c-layers {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.c-layer-btn {
  padding: 7px 16px;
  border: 2px solid #8ec88e;
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  color: #2a6030;
  transition: all 120ms;
  font-family: inherit;
}
.c-layer-btn:hover  { background: #e4f4e4; }
.c-layer-btn.active { background: #2a7a3b; color: #fff; border-color: #2a7a3b; }
.c-scene {
  display: flex;
  gap: 18px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 16px;
  background: #f0f9f0;
  border-radius: 12px;
  border: 2px solid #b0d8b0;
  min-height: 110px;
  margin: 10px 0;
}
.c-scene-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.c-scene-objs {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  font-size: 36px;
  min-height: 44px;
  align-items: center;
}
.c-scene-label {
  font-size: 14px;
  font-weight: 700;
  color: #2a5020;
  background: #c4ecc4;
  border-radius: 6px;
  padding: 2px 8px;
}
.c-op-symbol {
  font-size: 44px;
  font-weight: 900;
  color: #2a6030;
  align-self: center;
  line-height: 1;
  padding-bottom: 22px;
}
/* Dot frames (点子图) */
.c-dot-frames {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  padding: 16px;
  background: #f8f8ff;
  border-radius: 12px;
  border: 2px solid #c8c8e8;
  margin: 10px 0;
}
.c-dot-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.c-dot-frame {
  display: grid;
  grid-template-columns: repeat(5, 18px);
  gap: 5px;
  padding: 10px;
  border: 2px solid #666;
  border-radius: 8px;
  background: #fff;
  min-height: 38px;
}
.c-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #333;
}
.c-dot.c-dot-cross {
  background: transparent;
  border: 2px solid var(--red);
  position: relative;
}
.c-dot.c-dot-cross::before,
.c-dot.c-dot-cross::after {
  content: '';
  position: absolute;
  width: 120%;
  height: 2px;
  background: var(--red);
  top: 50%;
  left: -10%;
  transform-origin: center;
}
.c-dot.c-dot-cross::before { transform: translateY(-50%) rotate(45deg); }
.c-dot.c-dot-cross::after  { transform: translateY(-50%) rotate(-45deg); }
.c-dot-label {
  font-size: 14px;
  font-weight: 700;
  color: #446;
  background: #e0e0f8;
  border-radius: 6px;
  padding: 2px 8px;
}
/* Counting methods (算式+方法) */
.c-method-box {
  padding: 10px 14px;
  border: 2px solid #b0d8b0;
  border-radius: 8px;
  background: #f4fbf4;
  margin: 6px 0;
}
.c-method-label {
  font-size: 14px;
  font-weight: 900;
  color: #1a5020;
  margin-bottom: 4px;
}
.c-method-text {
  font-size: 17px;
  color: #333;
  line-height: 1.5;
}

/* ===== T03 C版 ===== */
.c-angle-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.c-angle-btn {
  padding: 7px 14px;
  border: 2px solid #a8b8d8;
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  color: #334;
  transition: all 120ms;
  font-family: inherit;
}
.c-angle-btn:hover  { background: #eef0ff; }
.c-angle-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.c-zero-board {
  min-height: 130px;
  padding: 18px;
  border: 2px dashed #a8b8d8;
  border-radius: 12px;
  background: #f4f6ff;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin: 12px 0;
}
.c-zero-item {
  font-size: 44px;
  display: inline-block;
  transition: opacity 300ms, transform 300ms;
}
.c-zero-empty {
  font-size: 20px;
  color: #99a;
  font-style: italic;
  text-align: center;
}
.c-big-zero {
  font-size: 72px;
  font-weight: 900;
  color: var(--red);
  text-align: center;
  line-height: 1;
  margin: 8px 0;
}
/* Number line C版 */
.c-numberline-c {
  display: flex;
  align-items: flex-start;
  overflow-x: auto;
  padding: 10px 0 18px;
  margin: 10px 0;
}
.c-nl-tick {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
}
.c-nl-num {
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 4px;
}
.c-nl-num.c-zero-star {
  font-size: 28px;
  color: var(--red);
  background: #ffeae8;
  border-radius: 8px;
  padding: 2px 8px;
}
.c-nl-bar {
  width: 44px;
  height: 4px;
  background: #888;
  flex-shrink: 0;
}
.c-nl-arrow {
  font-size: 22px;
  font-weight: 900;
  color: #888;
  align-self: flex-end;
  padding-bottom: 2px;
}
/* Operation pattern cards */
.c-pattern-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}
.c-pattern-card {
  padding: 14px 10px;
  border-radius: 10px;
  background: #f4f6ff;
  border: 2px solid #c4cef8;
  text-align: center;
}
.c-pattern-title {
  font-size: 14px;
  font-weight: 900;
  color: #334;
  margin-bottom: 6px;
}
.c-pattern-formula {
  font-size: 26px;
  font-weight: 900;
  color: #114;
}
.c-pattern-eg {
  font-size: 14px;
  color: #668;
  margin-top: 4px;
}
