/* ==================== 虚拟实验教室 · 通用样式 ==================== */
:root {
  --lab-bg: #f5f9f8;
  --lab-card: #ffffff;
  --lab-ink: #1c2b2a;
  --lab-ink-soft: #5a6f6d;
  --lab-line: #e0ecea;
  --lab-teal: #0e9f8f;
  --lab-teal-soft: #e4f7f4;
  --lab-blue: #2b7de9;
  --lab-blue-soft: #eaf2fe;
  --lab-orange: #f2913d;
  --lab-orange-soft: #fef3e7;
  --lab-red: #e5484d;
  --lab-red-soft: #fdecec;
  --lab-purple: #7048e8;
  --lab-purple-soft: #f0ecfe;
  --lab-green: #12b886;
  --lab-green-soft: #e6f8f1;
  --lab-radius: 18px;
  --lab-shadow: 0 6px 24px rgba(28, 43, 42, 0.07);
}

* { box-sizing: border-box; }

body.lab-body {
  margin: 0;
  background: var(--lab-bg);
  color: var(--lab-ink);
  font-family: "Nunito", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.lab-container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ==================== 顶部导航 ==================== */
.lab-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--lab-line);
}
.lab-nav-inner {
  max-width: 1120px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.lab-logo {
  font-weight: 800; font-size: 17px; color: var(--lab-ink);
  text-decoration: none; display: flex; align-items: center; gap: 8px;
}
.lab-logo .logo-badge {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--lab-teal), var(--lab-blue));
  color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}
.lab-nav-links { display: flex; gap: 6px; flex-wrap: wrap; }
.lab-nav-links a {
  color: var(--lab-ink-soft); text-decoration: none; font-weight: 700;
  font-size: 14px; padding: 7px 13px; border-radius: 10px; transition: all .2s;
}
.lab-nav-links a:hover { background: var(--lab-teal-soft); color: var(--lab-teal); }
.lab-nav-links a.active { background: var(--lab-teal); color: #fff; }

/* ==================== Hero ==================== */
.lab-hero { padding: 34px 0 10px; }
.lab-hero h1 { font-size: 30px; line-height: 1.35; margin: 0 0 12px; letter-spacing: -0.3px; }
.lab-hero .lead { color: var(--lab-ink-soft); font-size: 15.5px; margin: 0; max-width: 900px; }
.lab-hero .lead strong { color: var(--lab-teal); }
.lab-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.lab-tag {
  font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 999px;
  background: var(--lab-teal-soft); color: #0b7d70;
}
.lab-tag.blue { background: var(--lab-blue-soft); color: #1c5fbe; }
.lab-tag.orange { background: var(--lab-orange-soft); color: #c9701f; }
.lab-tag.purple { background: var(--lab-purple-soft); color: #5533c7; }
.lab-tag.red { background: var(--lab-red-soft); color: #c03337; }

/* ==================== 分类标题 ==================== */
.cat-head {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 40px 0 18px; scroll-margin-top: 80px;
}
.cat-head .cat-icon {
  width: 44px; height: 44px; flex: 0 0 44px; border-radius: 13px;
  background: linear-gradient(135deg, var(--lab-teal), var(--lab-blue));
  color: #fff; font-size: 21px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(14, 159, 143, 0.28);
}
.cat-head h2 { margin: 0; font-size: 22px; }
.cat-head .cat-sub { color: var(--lab-ink-soft); font-size: 14px; }

/* ==================== 卡片网格 ==================== */
.lab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }

.lab-card {
  background: var(--lab-card); border-radius: var(--lab-radius);
  border: 1px solid var(--lab-line); box-shadow: var(--lab-shadow);
  padding: 20px; text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 10px;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  position: relative; overflow: hidden;
}
.lab-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(28,43,42,.12); border-color: #cfe7e3; }
.lab-card .lc-head { display: flex; align-items: center; gap: 10px; }
.lab-card .lc-emoji {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 42px;
  display: flex; align-items: center; justify-content: center; font-size: 21px;
  background: var(--lab-teal-soft);
}
.lab-card .lc-title { font-weight: 800; font-size: 16.5px; }
.lab-card .lc-sub { font-size: 12.5px; color: var(--lab-ink-soft); font-weight: 600; }
.lab-card .lc-desc { font-size: 14px; color: var(--lab-ink-soft); margin: 0; }
.lab-card .lc-steps { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--lab-ink-soft); }
.lab-card .lc-steps li { margin: 3px 0; }
.lab-card .lc-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.chip {
  font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 8px;
  background: #f1f5f4; color: var(--lab-ink-soft); white-space: nowrap;
}
.chip.new { background: var(--lab-teal-soft); color: #0b7d70; }
.chip.blue { background: var(--lab-blue-soft); color: #1c5fbe; }
.chip.orange { background: var(--lab-orange-soft); color: #c9701f; }
.chip.purple { background: var(--lab-purple-soft); color: #5533c7; }
.chip.red { background: var(--lab-red-soft); color: #c03337; }

/* ==================== 知识点 ==================== */
.kp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.kp-card {
  background: var(--lab-card); border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius); padding: 18px 20px; box-shadow: var(--lab-shadow);
}
.kp-card h3 { margin: 0 0 10px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.kp-card h3 .kpi {
  width: 28px; height: 28px; border-radius: 9px; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--lab-teal-soft); color: var(--lab-teal);
}
.kp-card p { margin: 6px 0; font-size: 14px; color: var(--lab-ink-soft); }
.kp-card ul { margin: 6px 0; padding-left: 20px; font-size: 14px; color: var(--lab-ink-soft); }
.kp-card li { margin: 4px 0; }
.kp-card .hl { color: var(--lab-ink); font-weight: 700; }

.formula-box {
  background: #f8fbfb; border: 1px dashed #cfe7e3; border-radius: 12px;
  padding: 10px 14px; margin: 8px 0; font-size: 14.5px; font-weight: 700;
  color: #0b7d70; text-align: center; letter-spacing: .3px;
}
.formula-box.blue { background: #f5f9ff; border-color: #cfe0fa; color: #1c5fbe; }
.formula-box .note { display: block; font-size: 12.5px; font-weight: 600; color: var(--lab-ink-soft); margin-top: 4px; letter-spacing: 0; }

/* 方程式表 */
.eq-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.eq-table th, .eq-table td { padding: 9px 10px; border-bottom: 1px solid var(--lab-line); text-align: left; vertical-align: top; }
.eq-table th { font-size: 12.5px; color: var(--lab-ink-soft); font-weight: 800; background: #f8fbfb; }
.eq-table td.eq { font-weight: 700; color: #0b7d70; white-space: nowrap; }
.eq-table tr:last-child td { border-bottom: none; }
.eq-wrap { background: #fff; border: 1px solid var(--lab-line); border-radius: var(--lab-radius); box-shadow: var(--lab-shadow); overflow-x: auto; }

/* 安全须知 */
.safe-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.safe-item {
  background: #fff; border: 1px solid var(--lab-line); border-left: 4px solid var(--lab-orange);
  border-radius: 12px; padding: 12px 14px; font-size: 13.5px; color: var(--lab-ink-soft);
  box-shadow: 0 2px 10px rgba(28,43,42,.04);
}
.safe-item b { color: var(--lab-ink); display: block; margin-bottom: 2px; font-size: 14px; }
.safe-item.danger { border-left-color: var(--lab-red); }

.note {
  background: var(--lab-blue-soft); border-radius: 14px; padding: 14px 18px;
  font-size: 14px; color: #1c5fbe; margin: 18px 0;
}
.note strong { color: #14479b; }

/* ==================== 实验台页面 ==================== */
.bench-wrap { padding: 18px 0 60px; }
.bench-titlebar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.bench-titlebar h1 { font-size: 22px; margin: 0; }
.bench-titlebar .sub { font-size: 13.5px; color: var(--lab-ink-soft); }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--lab-line); color: var(--lab-ink);
  font-family: inherit; font-weight: 800; font-size: 13.5px;
  padding: 9px 15px; border-radius: 11px; cursor: pointer; transition: all .16s;
  text-decoration: none;
}
.btn:hover { border-color: var(--lab-teal); color: var(--lab-teal); }
.btn.primary { background: var(--lab-teal); border-color: var(--lab-teal); color: #fff; }
.btn.primary:hover { background: #0b8478; color: #fff; }
.btn.warn { color: var(--lab-red); }
.btn.warn:hover { border-color: var(--lab-red); background: var(--lab-red-soft); }
.btn.on { background: var(--lab-orange); border-color: var(--lab-orange); color: #fff; }

.bench-grid { display: grid; grid-template-columns: 262px minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
@media (max-width: 1140px) { .bench-grid { grid-template-columns: 240px minmax(0,1fr); } .bench-side { grid-column: 1 / -1; } }
@media (max-width: 820px) { .bench-grid { grid-template-columns: 1fr; } }

.panel {
  background: #fff; border: 1px solid var(--lab-line); border-radius: var(--lab-radius);
  box-shadow: var(--lab-shadow); padding: 14px 15px; margin-bottom: 14px;
}
.panel-title {
  font-weight: 800; font-size: 14px; margin: 0 0 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.panel-title .pt-sub { font-size: 11.5px; font-weight: 700; color: var(--lab-ink-soft); }

/* 试剂架 */
.reagent-list { display: flex; flex-direction: column; gap: 8px; }
.rg-card {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--lab-line); border-radius: 12px; padding: 9px 11px;
  cursor: grab; background: #fdfefe; transition: all .16s; user-select: none;
}
.rg-card:hover { border-color: var(--lab-teal); background: var(--lab-teal-soft); transform: translateX(2px); }
.rg-card:active { cursor: grabbing; }
.rg-card.picked { border-color: var(--lab-teal); background: var(--lab-teal-soft); box-shadow: 0 0 0 3px rgba(14,159,143,.14); }
.rg-card .rg-bottle {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  background: #f1f5f4;
}
.rg-card .rg-name { font-weight: 800; font-size: 13.5px; line-height: 1.3; }
.rg-card .rg-formula { font-size: 11.5px; color: var(--lab-ink-soft); font-weight: 600; }
.rg-card .rg-amt { margin-left: auto; font-size: 11px; font-weight: 800; color: var(--lab-teal); white-space: nowrap; }
.rg-shelf-tip { font-size: 12px; color: var(--lab-ink-soft); margin: 8px 0 0; }

/* 仪器按钮 */
.inst-row { display: flex; gap: 8px; flex-wrap: wrap; }
.inst-btn {
  flex: 1 1 46%; display: flex; align-items: center; gap: 7px; justify-content: center;
  border: 1px solid var(--lab-line); background: #fdfefe; border-radius: 11px;
  padding: 9px 8px; font-family: inherit; font-weight: 800; font-size: 12.5px;
  color: var(--lab-ink); cursor: pointer; transition: all .16s;
}
.inst-btn:hover { border-color: var(--lab-teal); }
.inst-btn.active { background: var(--lab-orange); border-color: var(--lab-orange); color: #fff; }
.inst-btn.active.stir { background: var(--lab-blue); border-color: var(--lab-blue); }

/* 画布 */
.stage {
  position: relative; background: #fff; border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius); box-shadow: var(--lab-shadow); overflow: hidden;
}
.stage canvas { display: block; width: 100%; height: auto; }
.stage-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  background: rgba(28,43,42,.86); color: #fff; font-size: 13px; font-weight: 700;
  padding: 7px 16px; border-radius: 999px; opacity: 0; transition: opacity .25s;
  pointer-events: none; white-space: nowrap; max-width: 92%;
}
.stage-hint.show { opacity: 1; }
.stage-drop {
  position: absolute; inset: 0; border: 3px dashed var(--lab-teal);
  border-radius: var(--lab-radius); background: rgba(14,159,143,.06);
  opacity: 0; transition: opacity .18s; pointer-events: none;
}
.stage-drop.show { opacity: 1; }

/* 数据行 */
.kv { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--lab-line); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--lab-ink-soft); font-weight: 700; }
.kv .v { font-weight: 800; font-variant-numeric: tabular-nums; }
.kv .v.teal { color: var(--lab-teal); }
.kv .v.blue { color: var(--lab-blue); }
.kv .v.orange { color: #d9761e; }
.kv .v.red { color: var(--lab-red); }
.kv .v.purple { color: var(--lab-purple); }

.swatch {
  display: inline-block; width: 26px; height: 14px; border-radius: 4px;
  border: 1px solid rgba(0,0,0,.12); vertical-align: -2px; margin-right: 6px;
}

/* 反应列表 */
.rx-list { display: flex; flex-direction: column; gap: 6px; }
.rx-item {
  border: 1px solid var(--lab-line); border-radius: 10px; padding: 7px 10px; font-size: 13px;
  background: #fdfefe;
}
.rx-item.on { border-color: #b7e6df; background: var(--lab-teal-soft); }
.rx-item .rx-eq { font-weight: 800; color: #0b7d70; }
.rx-item .rx-meta { font-size: 11.5px; color: var(--lab-ink-soft); margin-top: 2px; }
.rx-item .bar { height: 4px; border-radius: 3px; background: #e8f1f0; margin-top: 5px; overflow: hidden; }
.rx-item .bar > i { display: block; height: 100%; background: var(--lab-teal); width: 0; }

/* 现象日志 */
#logList { list-style: none; margin: 0; padding: 0; max-height: 210px; overflow-y: auto; }
#logList li {
  font-size: 13px; padding: 7px 0; border-bottom: 1px dashed var(--lab-line);
  color: var(--lab-ink-soft); display: flex; gap: 8px;
}
#logList li:last-child { border-bottom: none; }
#logList li .t { color: #9db3b0; font-variant-numeric: tabular-nums; font-weight: 700; flex: 0 0 44px; }
#logList li.event .m { color: var(--lab-ink); font-weight: 700; }
#logList li.obs .m { color: #0b7d70; }
#logList li.heat .m { color: #c9701f; }
#logList li.gas .m { color: #1c5fbe; }
#logList li.prec .m { color: var(--lab-purple); }
.log-empty { font-size: 13px; color: #9db3b0; }

/* 记录表 */
.rec-table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.rec-table th, .rec-table td { padding: 6px 6px; border-bottom: 1px solid var(--lab-line); text-align: right; }
.rec-table th { color: var(--lab-ink-soft); font-size: 11.5px; font-weight: 800; }
.rec-table th:first-child, .rec-table td:first-child { text-align: left; }
.rec-table td .ratio { color: var(--lab-blue); font-weight: 800; }

/* 任务清单 */
.task-list { display: flex; flex-direction: column; gap: 9px; }
.task-item {
  border: 1px solid var(--lab-line); border-radius: 12px; padding: 10px 12px;
  background: #fdfefe; transition: all .2s;
}
.task-item.done { border-color: #9fe0d5; background: linear-gradient(135deg, #eafaf7, #f5fdfb); }
.task-item .tk-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13.5px; }
.task-item .tk-check {
  width: 19px; height: 19px; flex: 0 0 19px; border-radius: 6px; border: 2px solid #cfe0dd;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: #fff;
}
.task-item.done .tk-check { background: var(--lab-green); border-color: var(--lab-green); }
.task-item .tk-desc { font-size: 12.5px; color: var(--lab-ink-soft); margin: 4px 0 0; }
.task-item .tk-goal { font-size: 12px; color: var(--lab-teal); font-weight: 700; margin-top: 3px; }

/* 侧栏可折叠 */
details.acc { border: 1px solid var(--lab-line); border-radius: 12px; padding: 10px 12px; background: #fdfefe; }
details.acc + details.acc { margin-top: 8px; }
details.acc summary { font-weight: 800; font-size: 13.5px; cursor: pointer; outline: none; }
details.acc[open] summary { margin-bottom: 8px; color: var(--lab-teal); }
details.acc .acc-body { font-size: 13px; color: var(--lab-ink-soft); }
details.acc .acc-body p { margin: 6px 0; }
details.acc .acc-body ul { margin: 6px 0; padding-left: 20px; }

/* 页脚 */
.lab-foot { text-align: center; color: #9db3b0; font-size: 13px; padding: 30px 0 40px; }
.lab-foot a { color: var(--lab-teal); font-weight: 700; text-decoration: none; }

/* 平板以下 */
@media (max-width: 640px) {
  .lab-hero h1 { font-size: 23px; }
  .lab-card { padding: 16px; }
}
