/* ============================================================
   安徽（蚌埠）中考化学 · 交互实验室 —— 设计系统
   ============================================================ */
:root {
  --bg: #eef3f9;
  --panel: #ffffff;
  --ink: #1e2a3a;
  --ink-2: #33465e;
  --muted: #6b7a90;
  --brand: #2563eb;
  --brand-2: #0ea5a9;
  --line: #e3eaf3;
  --ok: #16a34a;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --shadow: 0 10px 28px rgba(24, 55, 96, .09);
  --shadow-sm: 0 4px 14px rgba(24, 55, 96, .07);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 500px at 100% -10%, #e0ebff 0%, transparent 55%),
    radial-gradient(900px 500px at -10% 110%, #e2f7f4 0%, transparent 50%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

.app { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 252px; flex: 0 0 252px;
  background: linear-gradient(180deg, #0e2440 0%, #123457 55%, #10314f 100%);
  color: #eaf2fb; padding: 20px 14px 14px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 16px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-badge {
  width: 44px; height: 44px; border-radius: 13px;
  background: linear-gradient(135deg, #22d3ee, #2563eb);
  display: grid; place-items: center; font-weight: 800; font-size: 21px; color: #062033;
  box-shadow: 0 6px 16px rgba(34,211,238,.35);
}
.brand-text h1 { font-size: 15px; margin: 0; font-weight: 700; letter-spacing: .3px; }
.brand-text p { margin: 3px 0 0; font-size: 11.5px; color: #9fb8d4; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; overflow-y: auto; flex: 1; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: 0; color: #cfe0f2;
  padding: 10px 11px; border-radius: 11px; cursor: pointer;
  text-align: left; font-size: 13px; line-height: 1.35; transition: .16s;
  font-family: inherit;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active {
  background: linear-gradient(135deg, rgba(34,211,238,.24), rgba(37,99,235,.30));
  color: #fff; box-shadow: inset 0 0 0 1px rgba(120,200,255,.28);
}
.nav-no { font-size: 11px; color: #8fb0d0; font-variant-numeric: tabular-nums; width: 20px; flex: 0 0 20px; }
.nav-item.active .nav-no { color: #7ee7ff; }
.nav-label { flex: 1; }
.nav-ico { font-size: 14px; opacity: .85; }
.sidebar-foot {
  font-size: 11px; color: #8fb0d0; padding: 12px 8px 4px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 7px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 8px #34d399; }

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 26px; border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.72); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.crumbs { font-size: 13px; color: var(--muted); font-weight: 600; }
.pill { font-size: 12px; color: var(--brand); background: #e8f0ff; padding: 5px 12px; border-radius: 999px; font-weight: 600; }

.stage { padding: 26px; max-width: 1120px; width: 100%; margin: 0 auto; }

.module-head .module-kicker { font-size: 12px; color: var(--brand-2); font-weight: 700; letter-spacing: .5px; }
.module-title { font-size: 26px; margin: 6px 0 4px; letter-spacing: .3px; }
.module-sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; line-height: 1.6; }
.module-body { display: flex; flex-direction: column; gap: 18px; }

/* ---------- 布局 ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.split-main { min-width: 0; }
.split-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; transform: translateX(-100%); transition: .25s; }
  .sidebar.open { transform: none; }
  .stage { padding: 16px; }
}

/* ---------- 画布 ---------- */
.canvas-wrap {
  background: linear-gradient(180deg, #fbfdff, #f3f8ff);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 8px; overflow: hidden;
}
.lab-canvas { display: block; width: 100%; border-radius: 10px; }

/* ---------- 面板 ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel-title {
  font-weight: 700; font-size: 13.5px; color: var(--ink-2);
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; background: #fafcff;
}
.panel-title::before { content: ""; width: 4px; height: 15px; border-radius: 3px; background: linear-gradient(180deg, #22d3ee, #2563eb); }
.panel-body { padding: 14px; font-size: 13px; color: var(--ink-2); line-height: 1.65; }
.panel-body p { margin: 0 0 8px; }
.panel-body p:last-child { margin-bottom: 0; }

/* ---------- 控件 ---------- */
.btn {
  font-family: inherit; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 8px 14px; border-radius: 10px; cursor: pointer; transition: .15s;
}
.btn:hover { border-color: #c3d3ec; background: #f7faff; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, #2563eb, #1d4ed8); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(37,99,235,.28); }
.btn-primary:hover { background: linear-gradient(135deg, #1d4ed8, #1e40af); }
.btn-ghost { background: transparent; }
.btn-teal { background: linear-gradient(135deg, #0ea5a9, #0d9488); border-color: transparent; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 9px; }
.btn.active { background: #e8f0ff; border-color: #9cc0ff; color: var(--brand); }
.ui-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ui-row.tight { gap: 7px; }

.slider-ctrl { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.slider-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: var(--ink-2); }
.slider-top label { font-weight: 600; }
.slider-val { color: var(--brand); font-weight: 700; font-variant-numeric: tabular-nums; }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
  border-radius: 999px; background: #dbe6f6; outline: none; margin: 2px 0;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 3px solid var(--brand); cursor: pointer;
  box-shadow: 0 2px 7px rgba(37,99,235,.35);
}

.select-ctrl { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.select-ctrl label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
select {
  font-family: inherit; font-size: 13px; color: var(--ink-2);
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; outline: none;
}
select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }

/* ---------- 标签 / 提示 / 统计 ---------- */
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #eef3fb; color: #4a5d78; }
.tag-brand { background: #e8f0ff; color: var(--brand); }
.tag-ok { background: #e7f7ed; color: #15803d; }
.tag-warn { background: #fdf3e2; color: #b45309; }
.tag-danger { background: #fdecec; color: #dc2626; }

.hint {
  background: #f4f8ff; border: 1px dashed #c6d8f5; border-radius: 12px;
  padding: 11px 13px; font-size: 12.5px; color: #3f5878; line-height: 1.65;
}
.hint.warn { background: #fff8ec; border-color: #f4d9a6; color: #8a5a12; }
.hint b { color: var(--brand); }
.hint code, .mono { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; }
.formula { font-style: italic; }

.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; box-shadow: var(--shadow-sm); }
.stat-label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 20px; font-weight: 800; color: var(--brand); margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat-value.small { font-size: 15px; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--ink-2); }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 13px; height: 13px; border-radius: 50%; border: 1px solid rgba(0,0,0,.08); }

.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.kv:last-child { border-bottom: 0; }
.kv b { color: var(--ink); }

.result-line { font-size: 13px; padding: 9px 12px; border-radius: 10px; margin-top: 8px; line-height: 1.55; }
.result-ok { background: #e9f9ef; color: #137a3b; border: 1px solid #b9ebc9; }
.result-no { background: #fdeeee; color: #b91c1c; border: 1px solid #f6c9c9; }
.result-info { background: #eef4ff; color: #29508f; border: 1px solid #c9dbf7; }

canvas.lab-canvas { cursor: default; }
.clickable { cursor: pointer; }

/* 窄屏侧栏唤出按钮 */
.menu-btn {
  display: none; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 18px; cursor: pointer; margin-right: 10px;
}
@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .topbar { gap: 8px; }
  .crumbs { font-size: 12px; }
}

/* ============ 精细化升级：库容器与动效 ============ */
.chart-wrap, .three-wrap {
  background: linear-gradient(160deg, #fbfdff 0%, #eef5ff 70%, #e9f3fb 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  width: 100%;
}
.chart-wrap { padding: 6px; }
.three-wrap { position: relative; touch-action: none; }
.three-wrap .three-canvas { display: block; width: 100% !important; height: 100% !important; }

.module-body { animation: fadeUp .38s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.three-tip {
  position: absolute; right: 12px; bottom: 10px; z-index: 3;
  font-size: 11px; color: #5a6b82; background: rgba(255,255,255,.72);
  border: 1px solid var(--line); padding: 3px 9px; border-radius: 999px;
  backdrop-filter: blur(4px); pointer-events: none;
}
.lib-note { font-size: 11px; color: var(--muted); }
.powered {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: #4a5d78;
  background: #eef3fb; border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px;
}
.powered b { color: var(--brand); font-weight: 700; }


