/* ==========================================================
   会动的数学 —— 数学游乐场，轻松不挫败
   莫兰迪配色体系 · Morandi Palette
   ========================================================== */

:root {
  /* 背景与文字 */
  --bg: #ded9ce;
  --bg-soft: #d3cec2;
  --ink: #3b3a36;
  --muted: #7d7a72;

  /* 莫兰迪主色 */
  --brand: #7c8d99;        /* 雾蓝 */
  --brand-deep: #5f7382;
  --sage: #9aac97;         /* 鼠尾草绿 */
  --sage-deep: #6b8267;
  --rose: #c0a5a2;         /* 灰粉 */
  --rose-deep: #8a625e;
  --sand: #c9b08a;         /* 燕麦色 */
  --sand-deep: #8a6e45;
  --lavender: #a79fb4;     /* 灰紫 */
  --lavender-deep: #766985;

  --card: #f5f2ec;
  --line: #cfc9bd;
  --radius: 22px;
  --shadow: 0 10px 28px rgba(59, 58, 54, 0.07);
  --shadow-lg: 0 20px 48px rgba(59, 58, 54, 0.12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶部品牌栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(150%) blur(12px);
  background: rgba(222, 217, 206, 0.9);
  border-bottom: 1px solid rgba(225, 220, 212, 0.9);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--sage));
  display: grid; place-items: center; color: #fdfcfa; font-size: 18px;
  box-shadow: 0 6px 16px rgba(95, 115, 130, 0.28);
}
.brand-name { font-size: 18px; letter-spacing: 0.5px; }
.topbar-note { font-size: 15.5px; color: var(--muted); }

/* ---------- 首页 Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 68px 0 44px; text-align: center; }
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.42; pointer-events: none;
}
.hero::before { width: 340px; height: 340px; background: #ccd5d9; top: -110px; left: -80px; }
.hero::after { width: 300px; height: 300px; background: #d5cec0; top: -40px; right: -90px; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); color: var(--brand-deep);
  padding: 6px 16px; border-radius: 999px; font-size: 15.5px; font-weight: 700;
  box-shadow: 0 6px 16px rgba(59, 58, 54, 0.05); position: relative; z-index: 1;
}

.hero-title {
  position: relative; z-index: 1;
  margin: 20px 0 6px;
  font-size: clamp(44px, 9vw, 84px);
  font-weight: 900; letter-spacing: 4px; line-height: 1.15;
  background: linear-gradient(120deg, #556e7d 0%, #6c8269 38%, #a07b76 72%, #82779a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.hero-sub {
  position: relative; z-index: 1;
  margin: 0; font-size: clamp(16px, 2.8vw, 22px);
  color: #5d5b54; letter-spacing: 6px; font-weight: 600;
}

.hero-desc {
  position: relative; z-index: 1;
  max-width: 560px; margin: 18px auto 26px; color: var(--muted); font-size: 17.5px;
}

.btn-primary {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 15px 34px; border-radius: 999px;
  background: linear-gradient(135deg, #5f7382, #6e8290);
  color: #f5f2ec; font-weight: 800; font-size: 17.5px;
  box-shadow: 0 14px 30px rgba(95, 115, 130, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 20px 38px rgba(95, 115, 130, 0.34); }
.btn-primary:active { transform: translateY(0); }

/* ---------- 通用区块 ---------- */
.section { padding: 40px 0; }
.section-head { margin-bottom: 22px; }
.section-head h2 {
  margin: 0 0 6px; font-size: 26px; letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 10px;
}
.section-head h2::before {
  content: ""; width: 6px; height: 26px; border-radius: 4px;
  background: linear-gradient(180deg, var(--brand), var(--sage));
}
.section-head p { margin: 0; color: var(--muted); font-size: 16.5px; }

.book-group { margin-top: 28px; }
.book-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 16.5px; font-weight: 800; color: #57544d; margin: 0 0 12px;
}
.book-title span {
  background: #e6eaec; color: var(--brand-deep); font-size: 14.5px;
  padding: 2px 10px; border-radius: 999px; font-weight: 700;
}

/* ---------- 课程卡片 ---------- */
.grid-cards {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.course-card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 16px 14px; box-shadow: 0 4px 14px rgba(59, 58, 54, 0.04);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  min-height: 130px;
}
.course-card.is-soon { opacity: 0.68; }
.course-card.is-ready {
  border-color: #cfd8dc;
  box-shadow: 0 12px 26px rgba(95, 115, 130, 0.14);
  background: linear-gradient(160deg, #fdfcfa, #efebe2);
}
.course-card.is-ready:hover { transform: translateY(-4px); box-shadow: 0 18px 34px rgba(95, 115, 130, 0.2); }
.cc-book { font-size: 14.5px; font-weight: 800; color: var(--brand-deep); letter-spacing: 1px; }
.cc-title { font-size: 17.5px; font-weight: 700; line-height: 1.4; }
.cc-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.tag {
  font-size: 13.5px; font-style: normal; font-weight: 700;
  padding: 1px 8px; border-radius: 999px; background: #e7e2d8; color: #5c5952;
}
.tag-3d { background: #e7e3ec; color: var(--lavender-deep); }
.cc-status { margin-top: auto; font-size: 14.5px; color: var(--muted); padding-top: 8px; }
.course-card.is-ready .cc-status { color: var(--brand-deep); font-weight: 700; }

/* ---------- 课程页 ---------- */
.lesson-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 6px; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 15.5px; color: var(--muted); font-weight: 600;
  padding: 6px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line);
  transition: color 0.15s, border-color 0.15s;
}
.back-link:hover { color: var(--brand-deep); border-color: #cfd8dc; }

.lesson-hero { padding: 18px 0 10px; }
.lesson-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.meta-chip {
  font-size: 14.5px; font-weight: 700; color: var(--brand-deep);
  background: #e6eaec; padding: 3px 12px; border-radius: 999px;
}
.meta-chip.plain { background: #e7e2d8; color: #5c5952; }
.lesson-title { margin: 0 0 8px; font-size: clamp(32px, 6.4vw, 48px); letter-spacing: 1px; }
.lesson-lead { margin: 0; color: var(--muted); font-size: 17.5px; max-width: 640px; }

.goal-card {
  margin-top: 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 18px 22px; box-shadow: var(--shadow);
}
.goal-card h3 { margin: 0 0 8px; font-size: 16.5px; color: var(--brand-deep); }
.goal-card ul { margin: 0; padding-left: 20px; color: #57544d; font-size: 16.5px; }
.goal-card li + li { margin-top: 4px; }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 18px; }

.exp-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.exp-num {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; color: #f5f2ec; font-weight: 800; font-size: 16.5px;
  background: linear-gradient(135deg, var(--brand), var(--sage));
  box-shadow: 0 6px 14px rgba(95, 115, 130, 0.24);
}
.exp-head h3 { margin: 0; font-size: 20px; }
.exp-desc { margin: 0 0 14px; color: var(--muted); font-size: 16.5px; }

.controls { display: flex; flex-wrap: wrap; gap: 16px 26px; align-items: center; margin: 6px 0 16px; }
.control { display: inline-flex; align-items: center; gap: 10px; font-size: 15.5px; font-weight: 600; color: #57544d; }
.control output {
  min-width: 26px; text-align: center; font-weight: 800; color: var(--brand-deep);
  background: #e6eaec; border-radius: 8px; padding: 1px 8px;
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 150px; height: 6px; border-radius: 999px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, var(--brand), var(--sage));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: #f5f2ec; border: 3px solid var(--brand-deep);
  box-shadow: 0 2px 8px rgba(95, 115, 130, 0.3); cursor: grab;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #f5f2ec; border: 3px solid var(--brand-deep);
  box-shadow: 0 2px 8px rgba(95, 115, 130, 0.3); cursor: grab;
}

.canvas-box {
  position: relative; border-radius: 18px; border: 1px solid #e0ddd6; padding: 8px;
  background: linear-gradient(180deg, #f5f2ec, #e9e5db);
}
canvas { display: block; width: 100%; border-radius: 12px; touch-action: none; }
#exp1-canvas, #exp2-canvas { aspect-ratio: 1 / 1; max-width: 440px; margin: 0 auto; }
#exp3-canvas { aspect-ratio: 4 / 3; }
#balance-canvas { aspect-ratio: 4 / 3; max-width: 620px; margin: 0 auto; }
#q-canvas { aspect-ratio: 4 / 3; }
#l-canvas { aspect-ratio: 4 / 3; }
#c-canvas { aspect-ratio: 4 / 3; }
#crit-canvas { aspect-ratio: 4 / 3; max-width: 620px; margin: 0 auto; }

/* 七上新课：数轴类画布要宽扁，图形类画布用 4:3 */
#nl1-canvas, #nl2-canvas, #nl3-canvas,
#abs1-canvas, #abs2-canvas, #abs3-canvas,
#ra1-canvas, #ra2-canvas, #ra3-canvas { aspect-ratio: 16 / 7; }
#lt1-canvas, #lt2-canvas { aspect-ratio: 16 / 10; max-width: 620px; margin: 0 auto; }
#pl1-canvas, #pl2-canvas { aspect-ratio: 16 / 10; max-width: 620px; margin: 0 auto; }
#cp1-canvas, #cp2-canvas { aspect-ratio: 1 / 1; max-width: 460px; margin: 0 auto; }
#sq1-canvas { aspect-ratio: 1 / 1; max-width: 360px; margin: 0 auto; }
#sq2-canvas { aspect-ratio: 16 / 9; max-width: 620px; margin: 0 auto; }
#ls1-canvas { aspect-ratio: 1 / 1; max-width: 460px; margin: 0 auto; }
#ie1-canvas, #ie2-canvas { aspect-ratio: 16 / 7; max-width: 620px; margin: 0 auto; }
#dv1-canvas, #dv2-canvas { aspect-ratio: 4 / 3; max-width: 520px; margin: 0 auto; }
#ta1-canvas { aspect-ratio: 1 / 1; max-width: 440px; margin: 0 auto; }
#ta2-canvas, #sym2-canvas { aspect-ratio: 16 / 7; max-width: 620px; margin: 0 auto; }
#sym1-canvas { aspect-ratio: 4 / 3; max-width: 460px; margin: 0 auto; }
#fm1-canvas, #fm2-canvas, #fc1-canvas, #fc2-canvas { aspect-ratio: 4 / 3; max-width: 520px; margin: 0 auto; }
#pg1-canvas, #pg2-canvas { aspect-ratio: 4 / 3; max-width: 500px; margin: 0 auto; }
#rd1-canvas { aspect-ratio: 4 / 3; max-width: 460px; margin: 0 auto; }
#rd2-canvas { aspect-ratio: 16 / 9; max-width: 560px; margin: 0 auto; }
#qe1-canvas, #rot1-canvas, #inv1-canvas, #sim1-canvas { aspect-ratio: 4 / 3; max-width: 500px; margin: 0 auto; }
#qe2-canvas, #rot2-canvas, #inv2-canvas, #sim2-canvas, #proj1-canvas, #proj2-canvas { aspect-ratio: 16 / 7; max-width: 620px; margin: 0 auto; }
#sq2b-canvas { aspect-ratio: 16 / 9; max-width: 560px; margin: 0 auto; }
#tr1-canvas, #tr2-canvas { aspect-ratio: 1 / 1; max-width: 460px; margin: 0 auto; }
#solid-canvas, #net-canvas, #view-canvas { aspect-ratio: 4 / 3; max-width: 620px; margin: 0 auto; }

/* ---------- 判定条件按钮 ---------- */
.criteria { display: flex; flex-wrap: wrap; gap: 8px; }
.crit-btn {
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--card);
  font-family: inherit; font-size: 15px; font-weight: 700; color: #57544d;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.crit-btn:hover { border-color: #cfd8dc; background: #efebe2; }
.crit-btn.is-active { border-color: #5f7382; background: #5f7382; color: #f5f2ec; }
.crit-btn.is-warn { color: #8a625e; border-color: #d9c3c0; }
.crit-btn.is-warn.is-active { background: #8a625e; border-color: #8a625e; color: #f5f2ec; }

.readout { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.chip {
  background: #e6eaec; color: #4f6270; border-radius: 12px;
  padding: 8px 14px; font-size: 15.5px; font-weight: 700;
}
.chip.green { background: #e4ece2; color: #4e6649; }
.chip.amber { background: #f0e7d6; color: #85683c; }
.chip.plain { background: #e7e2d8; color: #56534c; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 20px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid #cfd8dc; background: var(--card); color: var(--brand-deep);
  font-weight: 700; font-size: 15.5px; font-family: inherit;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.btn-ghost:hover { background: #edf1f2; box-shadow: 0 6px 16px rgba(95, 115, 130, 0.14); }
.btn-ghost:active { transform: scale(0.97); }
.btn-ghost:disabled { opacity: 0.55; cursor: default; box-shadow: none; }

/* ---------- 结论卡 ---------- */
.conclusion {
  background: linear-gradient(135deg, #5b6d76 0%, #687970 55%, #776e68 100%);
  color: #f7f4ef; border-radius: 26px; padding: 38px 26px; text-align: center;
  box-shadow: 0 24px 55px rgba(78, 90, 96, 0.28);
}
.conclusion h2 { margin: 0; font-size: 20px; letter-spacing: 3px; opacity: 0.82; font-weight: 700; }
.formula { font-size: clamp(34px, 8vw, 62px); font-weight: 900; letter-spacing: 2px; margin: 12px 0 6px; }
.conclusion p { margin: 0 auto; max-width: 560px; font-size: 16.5px; opacity: 0.92; }
.conclusion .kicker { margin-top: 14px; font-size: 15.5px; opacity: 0.78; }

.warn {
  margin-top: 18px; border-left: 4px solid var(--sand);
  background: #f2ebdd; color: #7a5f38; padding: 14px 18px;
  border-radius: 4px 14px 14px 4px; font-size: 16.5px;
}
.warn strong { color: #6b5230; }
.warn ul { margin: 6px 0 0; padding-left: 20px; }
.warn li + li { margin-top: 3px; }

.triple-list {
  margin-top: 18px; background: #f5f3ee; border: 1px solid var(--line);
  border-radius: 18px; padding: 18px 22px;
}
.triple-list h3 { margin: 0 0 8px; font-size: 16.5px; color: #57544d; }
.triple-list .nums { display: flex; flex-wrap: wrap; gap: 8px; }
.triple-list .nums span {
  background: var(--card); border: 1px solid #e2ded7; border-radius: 10px;
  padding: 4px 12px; font-weight: 700; color: #57544d; font-size: 15.5px;
}

/* ---------- 练习 ---------- */
.exercise {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; box-shadow: 0 6px 18px rgba(59, 58, 54, 0.04);
}
.exercise + .exercise { margin-top: 16px; }
.ex-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ex-level { padding: 3px 12px; border-radius: 999px; font-size: 14.5px; font-weight: 800; }
.easy { background: #e4ece2; color: #4e6649; }
.mid { background: #e2e9ed; color: #4f6270; }
.hard { background: #f0e6e4; color: #8a5f5a; }
.ex-q { margin: 0 0 12px; font-size: 17.5px; color: #45433d; }
.ex-q b { color: var(--brand-deep); }

.ex-steps { margin: 4px 0 14px; }
.step {
  display: none;
  border-left: 3px solid #cfd8dc; padding: 8px 0 8px 14px;
  margin: 6px 0; color: #4a4842; font-size: 16.5px;
}
.step.show {
  display: block;
  animation: stepIn 0.34s ease both;
}
@keyframes stepIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.step.final {
  border-left-color: #7e9a79; background: #e9f0e7;
  border-radius: 0 10px 10px 0; font-weight: 700; color: #475f42;
}
.ex-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 家长提示 ---------- */
.parent-tip {
  background: linear-gradient(150deg, #f4eee4, #f3ece0 60%, #efe7d9);
  border: 1px solid #ddd0ba; border-radius: 24px; padding: 28px;
}
.parent-tip h2 { margin: 0 0 4px; font-size: 22px; color: #7d6244; display: flex; gap: 8px; align-items: center; }
.parent-tip .tip-lead { margin: 0 0 16px; color: #8a6b4a; font-size: 15.5px; }
.tip-block { background: rgba(251, 250, 247, 0.72); border-radius: 14px; padding: 16px 18px; }
.tip-block + .tip-block { margin-top: 12px; }
.tip-block h3 { margin: 0 0 6px; font-size: 16.5px; color: #7d6244; }
.tip-block ol, .tip-block ul { margin: 0; padding-left: 20px; color: #5c5850; font-size: 16.5px; }
.tip-block li + li { margin-top: 4px; }
.tip-block .motto {
  margin: 0; font-weight: 800; color: #8a5f3a; font-size: 16.5px;
  background: #f6efe2; border-radius: 10px; padding: 10px 14px;
}

/* ---------- 小挑战 ---------- */
.quiz { display: flex; flex-direction: column; gap: 10px; }
.quiz-option {
  text-align: left; padding: 12px 16px; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--card);
  font-family: inherit; font-size: 16.5px; font-weight: 600; color: #45433d;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.quiz-option:hover { border-color: #cfd8dc; background: #efebe2; }
.quiz-option.correct { border-color: #7e9a79; background: #e9f0e7; color: #475f42; }
.quiz-option.wrong { border-color: #c9a29d; background: #f0e6e4; color: #8a5f5a; }
.quiz-feedback { margin: 10px 0 0; font-size: 15.5px; color: var(--muted); min-height: 22px; }

/* ---------- 页脚 ---------- */
footer {
  margin-top: 60px; padding: 34px 0 44px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 15.5px; text-align: center;
}
footer .foot-brand { font-weight: 800; color: #57544d; letter-spacing: 1px; }
footer .foot-sub { margin-top: 4px; }

/* ---------- 引导条 ---------- */
.next-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--card); border: 1px dashed #cfd8dc; border-radius: 18px;
  padding: 18px 22px; margin-top: 18px; flex-wrap: wrap;
}
.next-strip p { margin: 0; color: var(--muted); font-size: 15.5px; }
.next-strip strong { color: var(--ink); }

/* ---------- 响应式 ---------- */
@media (max-width: 560px) {
  .panel { padding: 20px 16px; border-radius: 18px; }
  .hero { padding: 44px 0 30px; }
  .hero-sub { letter-spacing: 3px; }
  input[type="range"] { width: 118px; }
  .controls { gap: 12px 18px; }
  .conclusion { padding: 28px 18px; border-radius: 20px; }
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .course-card { min-height: 88px; padding: 12px; border-radius: 14px; }
  .cc-title { font-size: 15.5px; }
  .cc-book { font-size: 13.5px; }
  .cc-status { font-size: 13.5px; }
  .topbar-note { display: none; }
}
