/* ==========================================================================
   六年级数学 · 可视化实验室 —— 单页样式
   亮色 Keynote 风：白底、柔和卡片、蓝/橙/紫/绿四色强调
   ========================================================================== */

:root {
  --ink: #16223a;
  --ink2: #3a4763;
  --muted: #6f7d97;
  --faint: #93a0b8;
  --line: rgba(22, 34, 58, 0.10);
  --line2: rgba(22, 34, 58, 0.18);

  --blue: #2f6bff;
  --blue-soft: rgba(47, 107, 255, 0.10);
  --orange: #ff7a3d;
  --orange-soft: rgba(255, 122, 61, 0.12);
  --purple: #7c5cff;
  --purple-soft: rgba(124, 92, 255, 0.12);
  --green: #12b886;
  --green-soft: rgba(18, 184, 134, 0.12);
  --red: #e5484d;
  --red-soft: rgba(229, 72, 77, 0.10);

  --bg: #f2f7ff;
  --card: #ffffff;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(28, 52, 108, 0.08), 0 2px 6px rgba(28, 52, 108, 0.05);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SF Mono", Menlo, Consolas, "PingFang SC", monospace;
  --base: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: var(--base); scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 12% 0%, #eaf2ff 0%, rgba(234, 242, 255, 0) 60%),
    radial-gradient(900px 620px at 92% 6%, #fff2ea 0%, rgba(255, 242, 234, 0) 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
button { font-family: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(47, 107, 255, 0.5); outline-offset: 2px; border-radius: 10px; }

.wrap { max-width: 1520px; margin: 0 auto; padding: 0 28px; }

/* ------------------------------------------------------------------ 顶栏 --- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.02rem; color: var(--ink); }
.brand .logo {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue), #7aa6ff); color: #fff; font-weight: 800;
}
.brand small { font-weight: 600; color: var(--faint); font-size: 0.78rem; margin-left: 4px; letter-spacing: 0.06em; }
.spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px;
  font-size: 0.95rem; font-weight: 700; cursor: pointer;
  border: 1px solid var(--line2); background: #fff; color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(28, 52, 108, 0.10); }
.btn:active { transform: translateY(0); }
.btn-sm { min-height: 38px; padding: 0 13px; font-size: .9rem; border-radius: 10px; }
.btn-warm { background: linear-gradient(135deg, var(--orange), #ffa073); border-color: transparent; color: #fff; }
.btn-group { display: inline-flex; gap: 6px; }

/* ------------------------------------------------------------------ 首屏 --- */
.hero { padding: 46px 0 20px; }
.hero h1 { font-size: 2.3rem; line-height: 1.22; font-weight: 800; letter-spacing: .01em; }
.hero h1 em { font-style: normal; color: var(--blue); }
.hero p { margin-top: 14px; font-size: 1.05rem; color: var(--muted); line-height: 1.75; max-width: 900px; }

/* ------------------------------------------------------------------ 导航 --- */
.nav {
  position: sticky; top: 62px; z-index: 55;
  background: rgba(242, 247, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; gap: 10px; padding: 10px 28px; overflow-x: auto; }
.navlink {
  flex: none; padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: .94rem;
  color: var(--muted); border: 1px solid transparent; white-space: nowrap;
}
.navlink:hover { background: #fff; color: var(--ink); }
.navlink.on { background: #fff; color: var(--blue); border-color: rgba(47, 107, 255, 0.3); box-shadow: var(--shadow); }

/* ------------------------------------------------------------------ 课题 --- */
.modules { display: flex; flex-direction: column; gap: 26px; padding: 24px 0 40px; }

.module {
  background: var(--card); border-radius: 22px; box-shadow: var(--shadow);
  border: 1px solid rgba(28, 52, 108, 0.06);
  padding: 24px 26px 26px;
  scroll-margin-top: 130px;
}
.mod-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.mod-idx {
  flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  font-size: 1.3rem; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--blue), #7aa6ff);
  box-shadow: 0 8px 18px rgba(47, 107, 255, .25);
}
.mod-title { flex: 1; min-width: 0; }
.mod-title h2 { font-size: 1.5rem; font-weight: 800; line-height: 1.3; }
.mod-title p { margin-top: 6px; color: var(--muted); font-size: .98rem; line-height: 1.6; }
.badge {
  flex: none; padding: 6px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700;
  background: var(--blue-soft); color: var(--blue); white-space: nowrap;
}

.mod-grid { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 22px; align-items: start; }

/* 画布 */
.stage-frame {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border-radius: 16px; overflow: hidden;
  background: #fff; border: 1px solid var(--line);
}
.stage-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* 右栏 */
.panel { display: flex; flex-direction: column; gap: 14px; }
.params { display: flex; flex-direction: column; gap: 14px; }
.param { display: flex; flex-direction: column; gap: 6px; }
.param-label { font-size: .92rem; font-weight: 800; color: var(--ink2); }
.slider-row { display: flex; align-items: center; gap: 10px; }
.param-out {
  flex: none; min-width: 108px; text-align: right;
  font-family: var(--mono); font-weight: 800; color: var(--blue); font-size: .98rem;
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  flex: 1; min-width: 0; height: 38px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px; border-radius: 999px; background: #e6eeff; border: 1px solid var(--line);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%;
  background: #fff; border: 4px solid var(--blue);
  box-shadow: 0 3px 10px rgba(47, 107, 255, .3);
}
input[type="range"]::-moz-range-track { height: 8px; border-radius: 999px; background: #e6eeff; }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 4px solid var(--blue); }

.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  min-height: 40px; padding: 7px 14px; border-radius: 11px; cursor: pointer;
  border: 1.5px solid var(--line2); background: #fff;
  font-size: .88rem; font-weight: 700; color: var(--ink2);
  transition: border-color .12s ease, background .12s ease, transform .12s ease;
}
.choice:hover { border-color: rgba(47, 107, 255, .45); background: var(--blue-soft); color: var(--blue); transform: translateY(-1px); }
.act-row { display: flex; }
.act-row .btn { width: 100%; }

.readouts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric { padding: 10px 12px; border-radius: 12px; background: #f7faff; border: 1px solid var(--line); }
.metric .k { font-size: .76rem; color: var(--faint); font-weight: 700; letter-spacing: .02em; }
.metric .v { margin-top: 3px; font-family: var(--mono); font-size: 1.08rem; font-weight: 800; color: var(--ink); }
.metric.blue .v { color: var(--blue); }
.metric.purple .v { color: var(--purple); }
.metric.orange .v { color: var(--orange); }
.metric.green .v { color: var(--green); }
.metric.red .v { color: var(--red); }

.note-line {
  padding: 12px 14px; border-radius: 12px; background: var(--blue-soft);
  font-size: .93rem; font-weight: 700; line-height: 1.7; color: #23459c;
}
.note-line b { color: var(--blue); }

/* ------------------------------------------------------------------ 页脚 --- */
.footer { padding: 8px 0 60px; color: var(--faint); font-size: .86rem; line-height: 1.9; }

/* ---------------------------------------------------------------- 响应式 --- */
@media (max-width: 1240px) {
  .mod-grid { grid-template-columns: minmax(0, 1fr) 330px; }
}
@media (max-width: 1000px) {
  .mod-grid { grid-template-columns: 1fr; }
  .readouts { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 1.9rem; }
}
@media (max-width: 700px) {
  .wrap { padding: 0 16px; }
  .module { padding: 18px 16px 20px; }
  .mod-head { flex-wrap: wrap; }
  .badge { order: 3; }
  .readouts { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
