/* ============ 数学实验室 · 全局样式（深色 Material） ============ */
:root {
  --bg: #0f1216;
  --surface: #171c22;
  --card: #1d242c;
  --card-hi: #232b35;
  --border: #2b3540;
  --text: #e8eaed;
  --muted: #9aa5b1;
  --blue: #4d9fff;
  --blue-dim: rgba(77, 159, 255, .14);
  --green: #34c98e;
  --orange: #ffab40;
  --red: #ff5f5f;
  --purple: #b388ff;
  --yellow: #ffd54f;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); }
body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 15px; line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
b, strong { color: #fff; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar .back {
  color: var(--muted); font-size: 14px; white-space: nowrap;
}
.topbar .back:hover { color: var(--blue); text-decoration: none; }
.crumb {
  font-size: 12.5px; color: var(--blue);
  background: var(--blue-dim);
  border: 1px solid rgba(77,159,255,.35);
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}
.topbar .spacer { flex: 1; }
.done-badge {
  font-size: 12.5px; color: var(--green);
  background: rgba(52,201,142,.12);
  border: 1px solid rgba(52,201,142,.4);
  padding: 2px 10px; border-radius: 999px;
}

/* ---------- 模块页布局 ---------- */
.module-main {
  max-width: 1280px; margin: 0 auto; padding: 22px;
}
.module-head { margin-bottom: 16px; }
.module-head h1 { font-size: 24px; font-weight: 650; }
.module-head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.module-layout {
  display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr);
  gap: 18px; align-items: start;
}
@media (max-width: 980px) {
  .module-layout { grid-template-columns: 1fr; }
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card + .card { margin-top: 14px; }
.card h3 { font-size: 15px; margin-bottom: 8px; color: #fff; }
.card .hint { color: var(--muted); font-size: 13px; }

/* ---------- 画布 ---------- */
.canvas-box {
  position: relative; width: 100%; height: 460px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #12161c;
  border: 1px solid var(--border);
}
.canvas-box.short { height: 340px; }
.canvas-box.tall { height: 540px; }
.canvas-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- 控件区 ---------- */
.controls {
  display: flex; flex-wrap: wrap; gap: 10px 18px;
  margin-top: 12px; align-items: center;
}
.ctl { min-width: 200px; flex: 1; }
.ctl label {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--muted); margin-bottom: 2px;
}
.ctl label .val { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
input[type="range"] {
  width: 100%; appearance: none; -webkit-appearance: none;
  height: 4px; border-radius: 2px; background: #333d49; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--blue); border: 2px solid #0f1216;
  cursor: pointer; box-shadow: 0 0 0 3px rgba(77,159,255,.25);
}
input[type="text"], input[type="number"] {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 14px; outline: none; font-family: inherit;
}
input[type="text"]:focus { border-color: var(--blue); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card-hi); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 14px; font-size: 13.5px; cursor: pointer;
  font-family: inherit; transition: all .15s;
  user-select: none;
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--border); color: var(--text); }
.btn-primary {
  background: var(--blue); border-color: var(--blue); color: #0b1420; font-weight: 600;
}
.btn-primary:hover { background: #6cb2ff; color: #0b1420; }
.btn-green { background: var(--green); border-color: var(--green); color: #06281c; font-weight: 600; }
.btn-green:hover { background: #52dba4; color: #06281c; }
.btn.active { border-color: var(--blue); color: var(--blue); background: var(--blue-dim); }

/* ---------- 数据读出 ---------- */
.readouts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.term-btn { appearance:none; border:0; padding:0; background:none; color:inherit; font:inherit; cursor:pointer; border-bottom:1px dashed rgba(77,159,255,.7); }
.term-btn::after { content:' ?'; color:var(--blue); font-weight:800; font-size:11px; }
.term-btn:hover,.term-btn:focus-visible { color:var(--blue); outline:none; border-bottom-style:solid; }
.concept-popover[hidden] { display:none; }
.concept-popover { position:fixed; inset:0; z-index:1000; display:grid; place-items:center; padding:20px; background:rgba(4,8,13,.72); backdrop-filter:blur(5px); }
.concept-card { position:relative; width:min(480px,100%); padding:22px; border:1px solid rgba(77,159,255,.42); border-radius:16px; background:#1b2430; box-shadow:0 24px 70px rgba(0,0,0,.48); }
.concept-card h2 { margin:5px 35px 16px 0; font-size:22px; }
.concept-kicker { color:var(--blue); font-size:12px; font-weight:750; }
.concept-close { position:absolute; right:13px; top:11px; width:34px; height:34px; border:0; border-radius:9px; background:#293543; color:#dbe6f2; font-size:23px; cursor:pointer; }
.concept-close:hover,.concept-close:focus-visible { background:#37485b; outline:2px solid var(--blue); }
.concept-section { margin-top:11px; }.concept-section b { display:block; color:#fff; font-size:13px; margin-bottom:3px; }
.concept-section p { margin:0; color:#cbd5df; line-height:1.65; }
.concept-example { margin-top:13px; padding:10px 12px; border-radius:9px; background:rgba(255,171,64,.09); color:#ffd29b; }
.concept-ai { margin-top:12px; padding:11px 12px; border:1px solid rgba(179,136,255,.35); border-radius:9px; color:#d9caef; background:rgba(179,136,255,.08); }
.concept-ai b { color:var(--purple); margin-right:6px; }
.feedback-fab { position:fixed; right:18px; bottom:18px; z-index:90; min-height:44px; padding:10px 15px; border:1px solid rgba(77,159,255,.5); border-radius:999px; background:#2464a5; color:#fff; font:600 13px inherit; cursor:pointer; box-shadow:0 10px 30px rgba(0,0,0,.35); }
.feedback-fab:hover,.feedback-fab:focus-visible { background:#3279c3; outline:2px solid rgba(77,159,255,.55); }
.feedback-panel[hidden] { display:none; }.feedback-panel { position:fixed; inset:0; z-index:1100; display:grid; place-items:center; padding:18px; background:rgba(4,8,13,.76); backdrop-filter:blur(5px); }
.feedback-card { position:relative; width:min(520px,100%); padding:22px; border:1px solid rgba(77,159,255,.42); border-radius:16px; background:#1b2430; box-shadow:0 24px 70px rgba(0,0,0,.5); }
.feedback-card h2 { margin:4px 35px 14px 0; font-size:21px; }.feedback-card label { display:block; color:#d7e0e9; font-size:13px; margin-top:12px; }
.feedback-card select,.feedback-card textarea { width:100%; margin-top:5px; padding:10px; border:1px solid var(--border); border-radius:9px; background:#121820; color:var(--text); font:inherit; }
.feedback-card textarea { min-height:120px; resize:vertical; }.feedback-close { position:absolute; right:13px; top:11px; width:34px; height:34px; border:0; border-radius:9px; background:#293543; color:#fff; font-size:23px; cursor:pointer; }
.feedback-submit { width:100%; justify-content:center; margin-top:12px; }.feedback-status { min-height:24px; margin-top:8px; color:var(--green); font-size:13px; }
.feedback-privacy { color:var(--muted); font-size:11.5px; margin-top:8px; text-align:center; }.feedback-trap { position:absolute!important; left:-10000px!important; }
.readout {
  flex: 1; min-width: 110px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px;
}
.readout .k { font-size: 12px; color: var(--muted); }
.readout .v {
  font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums;
  font-family: Consolas, "Cascadia Mono", monospace;
}
.meter {
  height: 8px; border-radius: 4px; background: #2a333d;
  overflow: hidden; margin-top: 6px;
}
.meter > i { display: block; height: 100%; background: var(--blue); border-radius: 4px; transition: width .2s; }

/* ---------- 公式 ---------- */
.fx {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic; font-size: 1.06em;
  white-space: nowrap;
}
.fx b { font-style: italic; }
.formula-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; margin: 10px 0;
  font-size: 16px; text-align: center; overflow-x: auto;
}
.c-blue { color: var(--blue); } .c-green { color: var(--green); }
.c-orange { color: var(--orange); } .c-red { color: var(--red); }
.c-purple { color: var(--purple); } .c-yellow { color: var(--yellow); }
.c-muted { color: var(--muted); }

/* ---------- 引导系统 ---------- */
.guide {
  background: linear-gradient(160deg, #1e2733, #1a2028);
  border: 1px solid rgba(77,159,255,.35);
  border-radius: var(--radius);
  padding: 16px;
  position: sticky; top: 68px;
}
.guide-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.guide-top .tag { font-size: 12.5px; color: var(--blue); font-weight: 600; letter-spacing: .5px; }
.guide-dots { display: flex; gap: 5px; }
.guide-dots i {
  width: 8px; height: 8px; border-radius: 50%;
  background: #333d49;
}
.guide-dots i.on { background: var(--blue); }
.guide-dots i.past { background: rgba(77,159,255,.45); }
.guide h3 { font-size: 16.5px; margin: 4px 0 8px; color: #fff; }
.guide-body { font-size: 14px; color: #cdd5de; }
.guide-body p { margin: 8px 0; }
.guide-body ul { margin: 8px 0 8px 18px; }
.guide-body li { margin: 3px 0; }
.reality-brief { margin: 10px 0 12px; padding: 12px 13px; border: 1px solid rgba(52,201,142,.38); border-radius: 11px; background: linear-gradient(135deg,rgba(52,201,142,.1),rgba(77,159,255,.055)); }
.reality-kicker { color: var(--green); font-size: 12px; font-weight: 750; letter-spacing: .35px; margin-bottom: 5px; }
.reality-goal { color: #eef5f2; font-size: 14px; line-height: 1.55; }
.reality-math { margin-top: 7px; padding-top: 7px; border-top: 1px solid rgba(255,255,255,.08); color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.reality-math b { color: #b8e8d6; }
.task-box {
  margin-top: 12px; padding: 10px 12px;
  border-radius: 10px; font-size: 13.5px;
  background: rgba(255,171,64,.08);
  border: 1px dashed rgba(255,171,64,.5);
  color: var(--orange);
}
.task-box.ok {
  background: rgba(52,201,142,.1);
  border: 1px solid rgba(52,201,142,.5);
  color: var(--green);
  animation: pop .35s ease;
}
.quiz-box { margin-top: 12px; }
.quiz-q { font-size: 14px; color: var(--yellow); margin-bottom: 8px; }
.quiz-opt {
  display: block; width: 100%; text-align: left;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 12px; margin: 6px 0; font-size: 13.5px;
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.quiz-opt:hover { border-color: var(--blue); }
.quiz-opt.right { border-color: var(--green); color: var(--green); background: rgba(52,201,142,.08); }
.quiz-opt.wrong { border-color: var(--red); color: var(--red); animation: shake .3s; }
.quiz-explain {
  font-size: 13px; color: var(--green); margin-top: 6px;
  padding: 8px 10px; background: rgba(52,201,142,.08); border-radius: 8px;
}
.ai-tip {
  margin-top: 12px; padding: 9px 11px; border-radius: 9px;
  background: rgba(179,136,255,.08); border: 1px solid rgba(179,136,255,.3);
  color: #cdd5de; font-size: 13px; line-height: 1.5;
}
.ai-tip span { color: var(--purple); font-weight: 700; margin-right: 7px; }
.drag-help { color: var(--blue); font-size: 13px; margin: 8px 0 0; }
.guide-nav { display: flex; gap: 10px; margin-top: 14px; }
.guide-nav .btn { flex: 1; justify-content: center; }
.guide-finish { text-align: center; padding: 10px 0; }
.guide-finish .big { font-size: 40px; animation: pop .5s ease; }
.guide-finish h3 { margin: 6px 0 10px; }
.guide-finish .btn { margin: 4px; }

@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(77,159,255,.4); } 50% { box-shadow: 0 0 0 8px rgba(77,159,255,0); } }

/* ---------- 知识点便签 ---------- */
.note {
  border-left: 3px solid var(--purple);
  background: var(--card);
  border-radius: 0 10px 10px 0;
  padding: 10px 14px; margin-top: 14px;
  font-size: 13.5px; color: #cdd5de;
}
.note .t { color: var(--purple); font-weight: 600; font-size: 13px; }

/* ---------- 首页 · 学习地图 ---------- */
.map-main { max-width: 900px; margin: 0 auto; padding: 30px 22px 80px; }
.hero { text-align: center; padding: 30px 0 10px; }
.hero h1 { font-size: 32px; font-weight: 700; }
.hero h1 .grad {
  background: linear-gradient(90deg, var(--blue), var(--purple));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); max-width: 620px; margin: 12px auto 0; }
.overall {
  max-width: 460px; margin: 22px auto 0;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 18px;
}
.overall .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.overall .row b { color: var(--blue); }
.chapter { margin-top: 34px; }
.chapter-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.chapter-head .num {
  font-size: 12.5px; color: var(--blue); font-weight: 700;
  background: var(--blue-dim); border: 1px solid rgba(77,159,255,.35);
  padding: 1px 10px; border-radius: 999px;
}
.chapter-head h2 { font-size: 19px; }
.chapter-head .why { font-size: 13px; color: var(--muted); }
.mod-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .mod-grid { grid-template-columns: 1fr; } }
.mod-card {
  display: flex; gap: 13px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px;
  color: var(--text); transition: all .15s;
  position: relative;
}
.mod-card:hover { border-color: var(--blue); transform: translateY(-2px); text-decoration: none; }
.mod-card .icon {
  font-size: 26px; width: 48px; height: 48px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border-radius: 12px;
}
.mod-card h3 { font-size: 15px; margin-bottom: 3px; }
.mod-card p { font-size: 12.8px; color: var(--muted); line-height: 1.55; }
.mod-card .status {
  position: absolute; top: 10px; right: 12px; font-size: 12px;
}
.mod-card.done { border-color: rgba(52,201,142,.45); }
.mod-card.done .status { color: var(--green); }
.mod-card.next { border-color: rgba(77,159,255,.6); animation: pulse 2s infinite; }
.mod-card.next .status { color: var(--blue); }
.map-foot { text-align: center; margin-top: 40px; color: var(--muted); font-size: 13px; }
.map-foot .btn { margin-top: 10px; }

/* ---------- 通用小组件 ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 7px; padding: 3px 9px; font-size: 13px;
  font-family: Consolas, monospace;
}
.chip.hl { border-color: var(--blue); color: var(--blue); }
.flow-steps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0; font-size: 13px; }
.flow-steps .fstep {
  background: var(--surface); border: 1px solid var(--border);
  padding: 5px 11px; border-radius: 8px; color: var(--muted);
}
.flow-steps .fstep.on { border-color: var(--blue); color: var(--blue); background: var(--blue-dim); font-weight: 600; }
.flow-steps .arr { color: #4a5560; }
.log-panel {
  background: #12161c; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; font-size: 13.5px; max-height: 420px; overflow-y: auto;
}
.log-item { padding: 8px 10px; border-radius: 9px; margin: 6px 0; animation: pop .3s ease; }
.log-think { background: rgba(179,136,255,.1); border-left: 3px solid var(--purple); }
.log-tool { background: rgba(255,171,64,.1); border-left: 3px solid var(--orange); font-family: Consolas, monospace; font-size: 12.5px; }
.log-obs { background: rgba(77,159,255,.08); border-left: 3px solid var(--blue); }
.log-final { background: rgba(52,201,142,.1); border-left: 3px solid var(--green); }
.log-item .who { font-size: 11.5px; font-weight: 700; letter-spacing: .5px; opacity: .8; display: block; margin-bottom: 2px; }

/* ---------- 场景实验室 · 0→1 搭建简报 ---------- */
.scene-is-briefing { filter: saturate(.55) brightness(.55); pointer-events: none; user-select: none; }
.scene-briefing {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  padding: 22px; background: rgba(8,11,16,.78); backdrop-filter: blur(8px);
}
.scene-brief-card {
  width: min(760px, 100%); max-height: calc(100vh - 44px); overflow-y: auto;
  background: linear-gradient(155deg, #202a36, #171d25); border: 1px solid rgba(77,159,255,.45);
  border-radius: 18px; padding: 24px; box-shadow: 0 24px 80px rgba(0,0,0,.45);
}
.scene-brief-top { display:flex; justify-content:space-between; gap:12px; color:var(--blue); font-size:12.5px; font-weight:650; }
.scene-brief-top span:last-child { color:var(--muted); font-weight:400; }
.scene-brief-meter { height:5px; margin:10px 0 20px; border-radius:5px; overflow:hidden; background:#303946; }
.scene-brief-meter i { display:block; height:100%; background:linear-gradient(90deg,var(--blue),var(--purple)); transition:width .25s; }
.scene-brief-card h2 { font-size:23px; margin-bottom:7px; }
.scene-question { color:#cfd7e2; margin-bottom:18px; }
.scene-system { display:flex; align-items:stretch; gap:8px; margin:16px 0; }
.scene-part { flex:1; display:flex; gap:9px; align-items:flex-start; padding:12px; border:1px dashed #3a4552; border-radius:11px; opacity:.25; }
.scene-part.on { opacity:1; border-style:solid; border-color:rgba(77,159,255,.42); background:rgba(77,159,255,.07); animation:pop .25s ease; }
.scene-part-icon { font-size:22px; }
.scene-part b,.scene-part small { display:block; }
.scene-part b { font-size:14px; color:#fff; }
.scene-part small { color:var(--muted); margin-top:3px; line-height:1.45; }
.scene-arrow { align-self:center; color:#566372; }
.scene-insight { border-left:3px solid var(--orange); background:rgba(255,171,64,.07); border-radius:0 10px 10px 0; padding:11px 14px; color:#d6dde6; font-size:14px; }
.scene-insight b { display:block; color:var(--orange); margin-bottom:3px; }
.scene-brief-nav { display:flex; gap:10px; justify-content:flex-end; margin-top:20px; }
.scene-briefing-ready { animation: sceneReady .55s ease; }
@keyframes sceneReady { from { opacity:.45; transform:translateY(8px); } to { opacity:1; transform:none; } }
@media (max-width:700px) {
  .scene-system { flex-direction:column; }
  .scene-arrow { transform:rotate(90deg); align-self:center; }
  .scene-brief-card { padding:18px; }
  .scene-brief-top span:last-child { display:none; }

  body { font-size:14px; }
  .topbar { padding:10px 12px; gap:8px; overflow-x:auto; }
  .module-main { padding:14px 10px 28px; }
  .module-head { margin-bottom:12px; }
  .module-head h1 { font-size:21px; line-height:1.35; }
  .module-head .sub { font-size:13px; line-height:1.55; margin-top:5px; }
  .module-layout { gap:12px; }
  .card { padding:11px; }
  .canvas-box { height:310px; border-radius:10px; }
  .canvas-box.short { height:270px; }
  .canvas-box.tall { height:390px; }
  .controls { gap:12px; }
  .ctl { min-width:100%; }
  input[type="range"] { height:8px; }
  input[type="range"]::-webkit-slider-thumb { width:24px; height:24px; }
  .readouts { display:grid; grid-template-columns:1fr; gap:7px; }
  .readout { min-width:0; }
  .btn,.quiz-opt { min-height:44px; }
  .guide { padding:14px; }
  .guide-nav { position:sticky; bottom:6px; z-index:3; padding-top:8px; background:linear-gradient(transparent,var(--card) 28%); }
  .guide-nav .btn { padding-inline:8px; }
  .reality-brief { padding:10px 11px; }
  .concept-popover { padding:10px; align-items:end; }
  .concept-card { max-height:88vh; overflow-y:auto; padding:18px 16px 20px; border-radius:16px 16px 10px 10px; }
  .concept-card h2 { font-size:20px; }
  .term-btn { min-height:32px; }
  .feedback-fab { right:10px; bottom:10px; }
  .feedback-panel { padding:9px; align-items:end; }
  .feedback-card { max-height:92vh; overflow-y:auto; padding:18px 15px; border-radius:16px 16px 9px 9px; }
  .feedback-card textarea { min-height:105px; }
}
