/* ============================================================
 * 化学学习空间 · 样式
 * 复用上级 assets/css/style.css 的设计变量与配色（纸感 / 墨色 / 朱砂），
 * 布局独立：子界面外壳（顶栏面包屑 + 侧栏模块导航 + 内容舞台），
 * 舞台内：周期表 / 方程式 / 配平 / 纸上实验室 / 速查手册
 * ============================================================ */

/* ---------- 0. 主题微调：化学用青绿主色 ---------- */
:root {
  --chem: #3E6F63;
  --chem-deep: #2F554C;
  --chem-soft: #E4F0EA;
  --chem-line: rgba(62, 111, 99, 0.18);

  --c-alkali: #C2543B;
  --c-alkaline: #D07C4E;
  --c-transition: #9C7A3C;
  --c-post: #6F8A5E;
  --c-metalloid: #7F8F3B;
  --c-nonmetal: #3E6F63;
  --c-halogen: #2F7183;
  --c-noble: #3C5C8C;
  --c-lanth: #855E9B;
  --c-actin: #A5576A;
}

.chem-mark { background: linear-gradient(150deg, #4C8577, #2F554C); box-shadow: 0 6px 14px -8px rgba(47, 85, 76, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.18); }

/* ---------- 1. 子界面外壳：顶栏 / 侧栏 / 舞台 ---------- */
body.chem-subpage { overflow: hidden; }

.chem-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

/* --- 顶栏（面包屑） --- */
.subbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 56px;
  padding: 0 clamp(14px, 2.6vw, 30px);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 243, 236, 0.92);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
}
.crumb {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}
.crumb:hover .crumb-here { color: var(--chem); border-color: var(--chem-line); }
.crumb-t { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.crumb-t strong { font-family: var(--font-serif); font-size: 15px; letter-spacing: 0.06em; }
.crumb-t em { font-style: normal; font-size: 9px; color: var(--muted); letter-spacing: 0.22em; text-transform: uppercase; }
.crumb-sep { color: var(--muted); display: inline-flex; }
.crumb-sep .ico { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.crumb-here {
  font-size: 12px;
  color: var(--ink-2);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  transition: all .2s var(--ease);
}
.subbar-mid {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.subbar-mid .dot-sep { margin: 0 4px; opacity: 0.5; }
.subbar-right { display: flex; align-items: center; gap: 12px; }
.subbar-clock {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-2);
  letter-spacing: 0.04em;
}
.subbar-clock .clock-sec {
  font-size: 10px;
  color: var(--muted);
  margin-left: 3px;
}
.subbar-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
  transition: all .2s var(--ease);
}
.subbar-home:hover { color: var(--chem); border-color: var(--chem-line); background: #fff; }
.subbar-home .ico { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.6; }

/* --- 主体两栏 --- */
.shell-main {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 0;
}

/* --- 左栏：模块导航 --- */
.sidenav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 12px 14px;
  border-right: 1px solid var(--line);
  background: rgba(241, 237, 228, 0.55);
  scrollbar-width: thin;
}
.sidenav::-webkit-scrollbar { width: 6px; }
.sidenav::-webkit-scrollbar-thumb { background: rgba(28, 32, 39, 0.14); border-radius: 99px; }
.nav-cap {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.2em;
  margin: 10px 8px 6px;
}
.nav-cap:first-child { margin-top: 0; }
.nav-list { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  --mc: var(--chem);
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  text-align: left;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .18s var(--ease);
}
.nav-item .no {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  flex: none;
  width: 18px;
}
.nav-item .nm { font-size: 13px; font-family: var(--font-serif); letter-spacing: 0.02em; flex: 1; min-width: 0; white-space: nowrap; }
.nav-item em {
  font-style: normal;
  font-size: 9.5px;
  color: var(--muted);
  flex: none;
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(28, 32, 39, 0.06);
}
.nav-item:hover { background: rgba(255, 255, 255, 0.8); color: var(--ink); }
.nav-item.is-on {
  background: #fff;
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--mc);
  box-shadow: var(--shadow-sm), inset 3px 0 0 var(--mc);
}
.nav-item.is-on .no, .nav-item.is-on em { color: var(--mc); background: rgba(255, 255, 255, 0.9); }
.nav-item.is-on em { background: color-mix(in srgb, var(--mc) 10%, white); }

/* --- 左栏底部小卡 --- */
.side-block {
  position: relative;
  margin: 14px 2px 0;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 12px);
  background: rgba(255, 255, 255, 0.72);
}
.side-quote blockquote {
  font-family: var(--font-serif);
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--ink-2);
  margin: 6px 0 4px;
}
.side-quote figcaption { font-size: 10.5px; color: var(--muted); text-align: right; }
.side-quote .sq-cap, .eod-cap {
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.2em;
}
.side-quote .quote-mark {
  position: absolute;
  right: 10px;
  bottom: 2px;
  font-family: var(--font-serif);
  font-size: 44px;
  line-height: 1;
  color: rgba(62, 111, 99, 0.14);
  pointer-events: none;
}
.side-foot {
  margin-top: auto;
  padding: 14px 8px 2px;
  font-size: 10.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.side-foot b { color: var(--chem); font-weight: 600; }
.sf-sep { opacity: 0.45; }

/* --- 右侧：内容舞台 --- */
.stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background:
    radial-gradient(circle at 100% 0%, rgba(62, 111, 99, 0.05), transparent 34%),
    radial-gradient(rgba(28, 32, 39, 0.03) 0.6px, transparent 0.6px);
  background-size: auto, 4px 4px;
}
.stage-head {
  --mc: var(--chem);
  flex: none;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px clamp(16px, 2.6vw, 30px);
  border-bottom: 1px dashed var(--line);
  background: rgba(246, 243, 236, 0.6);
}
.sh-no {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--mc) 12%, white);
  color: var(--mc);
  font-family: var(--font-mono);
  font-size: 12px;
  flex: none;
}
.sh-t h2 { font-family: var(--font-serif); font-size: 18px; color: var(--ink); }
.sh-t p { font-size: 11px; color: var(--muted); letter-spacing: 0.05em; margin-top: 2px; }
.stage-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  position: relative;
}

/* --- 今日元素（侧栏紧凑版） --- */
.eod { cursor: pointer; transition: border-color .2s var(--ease), box-shadow .2s var(--ease); }
.eod:hover { border-color: var(--chem-line); box-shadow: var(--shadow-sm); }
.eod-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.eod-symbol {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 19px;
  color: #FBF7EF;
  flex: none;
}
.eod-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.eod-info b { font-family: var(--font-serif); font-size: 15px; }
.eod-info i { font-style: normal; font-size: 10px; color: var(--muted); }
.eod > p {
  font-size: 11px;
  line-height: 1.75;
  color: var(--ink-3, var(--ink-2));
  margin: 8px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.eod-go {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--chem);
}

/* --- 移动端：侧栏变顶部横排 --- */
@media (max-width: 860px) {
  .chem-shell { height: auto; min-height: 100vh; min-height: 100dvh; }
  body.chem-subpage { overflow: auto; }
  .shell-main { grid-template-columns: minmax(0, 1fr); }
  .sidenav {
    flex-direction: column;
    gap: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px 12px 10px;
    overflow: visible;
  }
  .nav-cap, .side-block, .side-foot { display: none; }
  /* 两组导航合并成一条横向可滑动的标签条 */
  .sidenav {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .sidenav::-webkit-scrollbar { display: none; }
  .nav-list { display: contents; }
  .nav-item { flex: 0 0 auto; width: auto; padding: 7px 12px; }
  .nav-item em { display: none; }
  .nav-item.is-on { box-shadow: var(--shadow-sm), inset 0 -2.5px 0 var(--mc); }
  .subbar-mid { display: none; }
  .subbar { height: 50px; }
  .stage-head { padding: 10px 14px; }
  .sh-no { width: 30px; height: 30px; }
  .sh-t h2 { font-size: 16px; }
  .sh-t p { display: none; }
  .stage-body { overflow: visible; }
}

/* ---------- 3. 速查 ---------- */
.cheat-view { padding: 26px clamp(16px, 3vw, 40px) 60px; max-width: 1200px; margin: 0 auto; }
.cheat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 1.8vw, 22px);
  margin-bottom: 64px;
}
.cheat-card {
  padding: 24px 24px 22px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(28, 32, 39, 0.09);
  box-shadow: var(--shadow-xs);
}
.cheat-card h3 { font-family: var(--font-serif); font-size: 19px; }
.cheat-sub { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.6; }
.ion-lists { margin-top: 16px; display: grid; gap: 12px; }
.ion-lists b { font-size: 11px; letter-spacing: 0.12em; color: var(--chem); text-transform: uppercase; }
.ion-lists p {
  font-family: "Times New Roman", var(--font-serif), serif;
  font-size: 15px;
  line-height: 2;
  color: var(--ink-2);
  margin-top: 2px;
}
.mini-table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.mini-table th {
  text-align: left;
  width: 62px;
  font-family: "Times New Roman", serif;
  font-size: 13px;
  color: var(--chem);
  font-weight: 600;
  padding: 7px 0;
  vertical-align: top;
  border-top: 1px dashed var(--line);
}
.mini-table td {
  font-size: 12.5px;
  color: var(--ink-2);
  padding: 7px 0;
  border-top: 1px dashed var(--line);
  line-height: 1.7;
}
.mnemonic { margin-top: 16px; }
.mnemonic p {
  font-family: var(--font-serif);
  font-size: 14.5px;
  line-height: 2.1;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.mnemonic p + p { border-top: 0; }

/* 速查补充：经验规律三卡 */
.cheat-law {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.cheat-law > div {
  padding: 14px 16px;
  border-radius: var(--radius-md, 12px);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
}
.cheat-law b { font-size: 12px; color: var(--chem-deep); display: block; margin-bottom: 5px; }
.cheat-law p { font-size: 11.5px; line-height: 1.8; color: var(--ink-3, var(--ink-2)); }
@media (max-width: 1000px) { .cheat-law { grid-template-columns: 1fr; } }

/* 今日元素符号色 */
.eod-symbol[data-cat="alkali"] { background: var(--c-alkali); }
.eod-symbol[data-cat="alkaline"] { background: var(--c-alkaline); }
.eod-symbol[data-cat="transition"] { background: var(--c-transition); }
.eod-symbol[data-cat="post"] { background: var(--c-post); }
.eod-symbol[data-cat="metalloid"] { background: var(--c-metalloid); }
.eod-symbol[data-cat="nonmetal"] { background: var(--c-nonmetal); }
.eod-symbol[data-cat="halogen"] { background: var(--c-halogen); }
.eod-symbol[data-cat="noble"] { background: var(--c-noble); }
.eod-symbol[data-cat="lanth"] { background: var(--c-lanth); }
.eod-symbol[data-cat="actin"] { background: var(--c-actin); }

/* ---------- 4. 通用小组件 ---------- */
/* 通用小组件 */
.chip-btn {
  height: 32px;
  padding: 0 13px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all .2s var(--ease);
}
.chip-btn:hover { background: #fff; border-color: var(--chem-line); color: var(--chem); }
.chip-btn.is-on { background: var(--chem); border-color: var(--chem); color: #fff; }
.chip-btn .ico { width: 14px; height: 14px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  transition: border-color .2s, box-shadow .2s;
}
.search-box:focus-within { border-color: var(--chem-line); box-shadow: 0 0 0 3px rgba(62, 111, 99, 0.08); }
.search-box .ico { width: 15px; height: 15px; color: var(--muted); }
.search-box input {
  border: 0;
  outline: 0;
  background: none;
  font: inherit;
  font-size: 12.5px;
  width: 156px;
  color: var(--ink);
}
.search-box input::placeholder { color: var(--muted); }

/* ============================================================
 * 5. 元素周期表
 * ============================================================ */
.pt-view { padding: 22px clamp(14px, 2.4vw, 30px) 40px; }

.pt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.pt-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.pt-legend button {
  --lc: var(--chem);
  height: 28px;
  padding: 0 11px;
  border-radius: 99px;
  font-size: 11.5px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .2s var(--ease);
}
.pt-legend button i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lc);
  flex: none;
}
.pt-legend button:hover { background: #fff; border-color: rgba(28, 32, 39, 0.16); }
.pt-legend button.is-on { background: var(--lc); border-color: var(--lc); color: #fff; }
.pt-legend button.is-on i { background: rgba(255, 255, 255, 0.85); }

.pt-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.pt-layout.has-detail { grid-template-columns: minmax(0, 1fr) 316px; }

.pt-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 10px;
  scrollbar-width: thin;
}
.pt-scroll::-webkit-scrollbar { height: 8px; }
.pt-scroll::-webkit-scrollbar-thumb { background: rgba(28, 32, 39, 0.18); border-radius: 99px; }

.pt-grid {
  --cell: 54px;
  --gap: 3px;
  display: grid;
  grid-template-columns: repeat(18, var(--cell));
  grid-template-rows: repeat(7, calc(var(--cell) * 0.94)) 16px repeat(2, calc(var(--cell) * 0.94));
  gap: var(--gap);
  width: max-content;
  margin: 0 auto;
  padding-bottom: 4px;
}

.pt-cell {
  --cc: var(--chem);
  position: relative;
  border-radius: 7px;
  border: 1px solid rgba(28, 32, 39, 0.09);
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: transform .18s var(--ease-out), box-shadow .18s var(--ease), border-color .18s;
}
.pt-cell::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--cc);
  opacity: 0.85;
}
.pt-cell:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--cc); z-index: 3; }
.pt-cell .z {
  position: absolute;
  top: 3px;
  left: 6px;
  font-size: 8px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.pt-cell .sym {
  font-family: "Times New Roman", serif;
  font-size: 19px;
  line-height: 1;
  color: var(--ink);
  margin-top: 2px;
}
.pt-cell .cn {
  font-size: 9.5px;
  color: var(--ink-3);
  line-height: 1.2;
  margin-top: 2px;
}
.pt-cell .ms { display: none; }

.pt-cell.is-dim { opacity: 0.22; filter: saturate(0.2); }
.pt-cell.is-hit { box-shadow: 0 0 0 2px var(--accent) inset; }
.pt-cell.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(194, 84, 59, 0.28); z-index: 4; }

.pt-cell[data-cat="alkali"] { --cc: var(--c-alkali); }
.pt-cell[data-cat="alkaline"] { --cc: var(--c-alkaline); }
.pt-cell[data-cat="transition"] { --cc: var(--c-transition); }
.pt-cell[data-cat="post"] { --cc: var(--c-post); }
.pt-cell[data-cat="metalloid"] { --cc: var(--c-metalloid); }
.pt-cell[data-cat="nonmetal"] { --cc: var(--c-nonmetal); }
.pt-cell[data-cat="halogen"] { --cc: var(--c-halogen); }
.pt-cell[data-cat="noble"] { --cc: var(--c-noble); }
.pt-cell[data-cat="lanth"] { --cc: var(--c-lanth); }
.pt-cell[data-cat="actin"] { --cc: var(--c-actin); }

.pt-hint {
  grid-column: 1 / -1;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  padding-left: 2px;
}
.pt-fseries-label {
  font-size: 9px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.04em;
}

.pt-note {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

/* 周期律提示 */
.pt-law {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}
.pt-law > div {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
}
.pt-law b {
  font-size: 12px;
  color: var(--chem-deep);
  display: block;
  margin-bottom: 5px;
}
.pt-law p { font-size: 11.5px; line-height: 1.8; color: var(--ink-3); }
@media (max-width: 1000px) { .pt-law { grid-template-columns: 1fr; } }

/* 元素详情 */
.pt-detail {
  position: sticky;
  top: 0;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(28, 32, 39, 0.1);
  background: #FFFDF9;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: detailIn .3s var(--ease-out);
}
@keyframes detailIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

.ptd-head {
  padding: 18px 20px;
  color: #fff;
  background: var(--dc, var(--chem));
  position: relative;
  overflow: hidden;
}
.ptd-head::after {
  content: "";
  position: absolute;
  right: -34px;
  top: -34px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 70%);
}
.ptd-z { font-size: 10.5px; letter-spacing: 0.18em; opacity: 0.85; }
.ptd-title { display: flex; align-items: flex-end; gap: 12px; margin-top: 4px; }
.ptd-sym { font-family: "Times New Roman", serif; font-size: 44px; line-height: 0.95; }
.ptd-name { font-family: var(--font-serif); font-size: 21px; }
.ptd-pinyin { font-size: 11px; opacity: 0.8; letter-spacing: 0.08em; margin-left: 2px; }
.ptd-cat { font-size: 11px; opacity: 0.9; margin-top: 8px; }

.ptd-body { padding: 16px 20px 20px; }
.ptd-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line);
}
.ptd-facts div {
  background: #fff;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ptd-facts em { font-style: normal; font-size: 9.5px; color: var(--muted); letter-spacing: 0.08em; }
.ptd-facts b { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ptd-facts b.mono { font-family: var(--font-mono); font-size: 11px; }

.ptd-sec { margin-top: 16px; }
.ptd-sec h4 {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--chem);
  text-transform: uppercase;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
}
.ptd-sec h4::before { content: ""; width: 12px; height: 1px; background: currentColor; }
.ptd-sec p { font-size: 12.5px; line-height: 1.85; color: var(--ink-2); margin-top: 7px; }
.ptd-eq { font-size: 12.5px; color: var(--ink-2); font-family: "Times New Roman", serif; }

.ptd-shell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.ptd-shell span {
  font-size: 10.5px;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(62, 111, 99, 0.08);
  color: var(--chem-deep);
  font-variant-numeric: tabular-nums;
}

.ptd-nav {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.ptd-nav button {
  flex: 1;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-2);
  background: #fff;
  transition: all .2s;
}
.ptd-nav button:hover { border-color: var(--chem-line); color: var(--chem); background: var(--chem-soft); }

/* 手机端：横向紧凑 */
@media (max-width: 1120px) {
  .pt-layout.has-detail { grid-template-columns: minmax(0, 1fr); }
  .pt-detail { position: static; }
  .pt-grid { --cell: 46px; }
  .pt-cell .sym { font-size: 15px; }
  .pt-cell .cn { font-size: 8px; }
}

/* ============================================================
 * 6. 化学方程式
 * ============================================================ */
.eq-view { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100%; }

.eq-side {
  border-right: 1px solid var(--line);
  padding: 18px 12px 30px 18px;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: calc(100vh - 62px);
  overflow-y: auto;
}
.eq-side h4 {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
  margin: 16px 0 6px 6px;
}
.eq-side h4:first-child { margin-top: 0; }
.eq-side button {
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background .18s, color .18s;
}
.eq-side button:hover { background: rgba(28, 32, 39, 0.04); }
.eq-side button.is-on { background: var(--chem-soft); color: var(--chem-deep); font-weight: 600; }
.eq-side button em {
  font-style: normal;
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.eq-main { padding: 20px clamp(16px, 2.4vw, 30px) 50px; min-width: 0; }
.eq-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.eq-toolbar .search-box input { width: 220px; }
.eq-count { font-size: 11.5px; color: var(--muted); margin-left: auto; }
.eq-hint {
  flex-basis: 100%;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.7;
  margin-top: -2px;
}

.eq-list { display: grid; gap: 10px; }
.eq-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(28, 32, 39, 0.08);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.eq-item:hover { border-color: var(--chem-line); box-shadow: var(--shadow-xs); background: #fff; }
.eq-item-main { min-width: 0; }
.eq-name { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.eq-name .lv {
  font-size: 9.5px;
  padding: 1px 7px;
  border-radius: 99px;
  letter-spacing: 0.04em;
  background: rgba(60, 92, 140, 0.1);
  color: var(--blue);
}
.eq-name .lv.hs { background: rgba(133, 94, 155, 0.12); color: var(--c-lanth); }
.eq-name .tp {
  font-size: 9.5px;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(62, 111, 99, 0.1);
  color: var(--chem-deep);
}
.eq-render {
  margin-top: 8px;
  font-size: 17px;
  color: var(--ink);
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}
.eq-note { font-size: 11.5px; color: var(--muted); margin-top: 7px; line-height: 1.7; }
.eq-acts { display: flex; flex-direction: column; gap: 6px; }
.eq-acts button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #fff;
  transition: all .2s;
}
.eq-acts button:hover { color: var(--chem); border-color: var(--chem-line); background: var(--chem-soft); }
.eq-acts .ico { width: 14px; height: 14px; }

.eq-src {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  background: rgba(28, 32, 39, 0.04);
  border-radius: 7px;
  padding: 7px 10px;
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-all;
  display: none;
}
.eq-item.show-src .eq-src { display: block; }

.eq-empty { padding: 60px 0; text-align: center; color: var(--muted); font-size: 13px; }

@media (max-width: 1080px) {
  .eq-view { grid-template-columns: minmax(0, 1fr); }
  .eq-side {
    position: static;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding: 10px 16px;
    scrollbar-width: none;
  }
  .eq-side::-webkit-scrollbar { display: none; }
  .eq-side h4 { display: none; }
  /* 让两组按钮直接成为一条横向标签带 */
  .eq-side [data-group] { display: contents; }
  .eq-side button {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.7);
  }
  .eq-side button em { display: none; }
}

/* ============================================================
 * 7. 化学式 LaTeX 渲染
 * ============================================================ */
.ct {
  font-family: "Times New Roman", "Cambria Math", var(--font-serif), serif;
  line-height: 1.55;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}
.ct-sub { font-size: 0.66em; vertical-align: -0.26em; margin-left: 0.02em; line-height: 0; }
.ct-sup { font-size: 0.66em; vertical-align: 0.44em; margin-left: 0.02em; line-height: 0; }
.ct-coef { font-style: normal; }
.ct-plus { opacity: 0.65; padding: 0 0.3em; font-size: 0.92em; }
.ct-el { display: inline; }
.ct-text { font-family: var(--font-sans); font-size: 0.86em; }
.ct-space { display: inline-block; width: 0.16em; }
.ct-vec { line-height: 1; }
.ct-state { font-size: 0.68em; opacity: 0.62; letter-spacing: 0.02em; }

.ct-arrow {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 2.5em;
  margin: 0 0.3em;
  padding: 0 2px;
}
.ct-arrow-line {
  position: relative;
  width: 100%;
  height: 0.42em;
  display: block;
}
.ct-arrow-line::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid currentColor;
}
.ct-arrow-line::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  width: 0.34em;
  height: 0.34em;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
  transform-origin: center;
  margin-top: -0.02em;
}
.ct-arrow.is-eq .ct-arrow-line::after {
  right: auto;
  left: -1px;
  border-top: 1px solid currentColor;
  border-right: 0;
  border-left: 1px solid currentColor;
  transform: translateY(-50%) rotate(-45deg);
}
.ct-arrow.is-eq .ct-arrow-line::before { border-top-style: double; border-top-width: 3px; }
.ct-cond {
  font-family: var(--font-sans);
  font-size: 0.6em;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
}
.ct-cond.top { margin-bottom: 0.18em; }
.ct-cond.bot { margin-top: -0.05em; }

.ct-vec {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  margin: 0 0.1em;
}
.ct-arrow-heat { font-size: 0.72em; }

/* 需要完整数学排版时的兜底 */
.ct-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  font-size: 0.86em;
  line-height: 1.05;
  margin: 0 0.12em;
}
.ct-frac .num { border-bottom: 1px solid currentColor; padding: 0 0.18em 0.05em; }
.ct-frac .den { padding: 0.05em 0.18em 0; }

/* ============================================================
 * 8. 配平工具
 * ============================================================ */
.bal-view { padding: 24px clamp(16px, 3vw, 40px) 60px; max-width: 1080px; margin: 0 auto; }

.bal-input-wrap {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(28, 32, 39, 0.1);
  background: #FFFDF9;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.bal-input-wrap textarea {
  width: 100%;
  min-height: 92px;
  border: 0;
  outline: 0;
  resize: vertical;
  padding: 18px 20px;
  font-family: "Times New Roman", var(--font-serif), serif;
  font-size: 20px;
  line-height: 1.7;
  color: var(--ink);
  background: none;
  letter-spacing: 0.01em;
}
.bal-input-wrap textarea::placeholder { color: var(--muted); font-family: var(--font-sans); font-size: 14px; }

.bal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: rgba(246, 243, 236, 0.5);
}
.bal-bar .spacer { flex: 1; }
.bal-run {
  height: 34px;
  padding: 0 20px;
  border-radius: 99px;
  background: var(--chem);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all .2s var(--ease);
  box-shadow: 0 8px 18px -12px rgba(47, 85, 76, 0.9);
}
.bal-run:hover { background: var(--chem-deep); transform: translateY(-1px); }
.bal-run .ico { width: 15px; height: 15px; }

.bal-samples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.bal-samples button {
  font-size: 11.5px;
  font-family: "Times New Roman", serif;
  padding: 5px 11px;
  border-radius: 99px;
  border: 1px dashed var(--line-strong);
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.6);
  transition: all .2s;
}
.bal-samples button:hover { border-style: solid; border-color: var(--chem-line); color: var(--chem-deep); background: var(--chem-soft); }

.bal-out { margin-top: 22px; display: grid; gap: 16px; }

.bal-card {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(28, 32, 39, 0.09);
  background: #fff;
  box-shadow: var(--shadow-xs);
  padding: 20px 22px;
}
.bal-card h3 {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--chem);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.bal-card h3::before { content: ""; width: 14px; height: 1px; background: currentColor; }

.bal-eq-out {
  margin-top: 14px;
  font-size: 24px;
  color: var(--ink);
  overflow-x: auto;
  padding-bottom: 4px;
}
.bal-verdict {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--chem-deep);
  background: var(--chem-soft);
  border-radius: 99px;
  padding: 5px 14px;
}
.bal-verdict.bad { color: var(--accent-deep); background: var(--accent-soft); }
.bal-verdict .ico { width: 14px; height: 14px; }

.bal-steps { margin-top: 10px; }
.bal-step {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-top: 1px dashed var(--line);
}
.bal-step:first-child { border-top: 0; }
.bal-step-idx {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  background: rgba(62, 111, 99, 0.1);
  color: var(--chem-deep);
  margin-top: 2px;
}
.bal-step b { font-size: 13px; display: block; }
.bal-step p { font-size: 12.5px; color: var(--ink-3); line-height: 1.8; margin-top: 3px; }
.bal-step code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: rgba(28, 32, 39, 0.05);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--ink-2);
}

.bal-matrix { width: 100%; border-collapse: collapse; margin-top: 12px; font-variant-numeric: tabular-nums; }
.bal-matrix th, .bal-matrix td {
  padding: 7px 8px;
  font-size: 12px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.bal-matrix th {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 500;
}
.bal-matrix th:first-child, .bal-matrix td:first-child {
  text-align: left;
  font-family: "Times New Roman", serif;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
}
.bal-matrix td.zero { color: rgba(28, 32, 39, 0.2); }
.bal-matrix tr.is-sum td { font-weight: 600; color: var(--chem-deep); border-top: 1px solid var(--line-strong); }
.bal-matrix .side-sep { border-left: 1px solid var(--line-strong); }

.bal-err {
  font-size: 12.5px;
  color: var(--accent-deep);
  background: rgba(194, 84, 59, 0.07);
  border: 1px solid rgba(194, 84, 59, 0.18);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  line-height: 1.8;
}
.bal-err code { font-family: var(--font-mono); font-size: 11.5px; background: rgba(194,84,59,.09); padding: 1px 5px; border-radius: 4px; }
/* ============================================================
 * 9. 纸上实验室（原创：版画仪器 · 微观视窗 · 图鉴 · 挑战）
 * ============================================================ */
.only-mobile { display: none !important; }

.at-view {
  --at-ink: #2F3439;
  --at-ink-soft: #8A8378;
  --at-line: rgba(47, 52, 57, 0.16);
  --at-paper: #F8F4E9;
  --at-paper-2: #F1EBDC;
  --at-seal: #A6432D;
  --at-seal-soft: #F4E4DE;
  --font-hand: "KaiTi", "STKaiti", "楷体", "SimKai", var(--font-serif);
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr) 322px;
  grid-template-rows: minmax(560px, calc(100vh - 160px));
  gap: 12px;
  color: var(--at-ink);
  font-size: 12.5px;
}

/* ---------- 器物柜 / 药橱 ---------- */
.at-rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--at-paper-2);
  border: 1px solid var(--at-line);
  border-radius: var(--radius-md);
}
.at-tabs {
  display: flex;
  padding: 10px 10px 0;
  gap: 6px;
}
.at-tabs button {
  flex: 1;
  height: 30px;
  border: 1px dashed var(--at-line);
  border-radius: 8px;
  background: transparent;
  color: var(--at-ink-soft);
  font-size: 12px;
  font-family: var(--font-hand);
  cursor: pointer;
  transition: all .18s ease;
}
.at-tabs button.is-on {
  background: #FFFFFF;
  border: 1px solid var(--at-ink);
  color: var(--at-ink);
  box-shadow: 2px 2px 0 rgba(47, 52, 57, 0.14);
}
.at-cab {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  border-top: 1px dashed var(--at-line);
  margin-top: 10px;
}
.cab-note {
  font-size: 10.5px;
  color: var(--at-ink-soft);
  font-family: var(--font-hand);
  margin-bottom: 8px;
}
.cab-group {
  font-size: 11px;
  font-family: var(--font-hand);
  color: var(--at-seal);
  margin: 10px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--at-line);
}
.cab-row { display: flex; flex-wrap: wrap; gap: 5px; }
.cab-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.cab-grid .cab-item { width: 100%; }
.cab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 62px;
  padding: 6px 4px 5px;
  background: #FFFFFF;
  border: 1px solid var(--at-line);
  border-radius: 8px;
  cursor: grab;
  transition: all .15s ease;
  user-select: none;
}
.cab-item svg { width: 38px; height: 44px; }
.cab-item span {
  font-size: 10px;
  color: var(--at-ink);
  line-height: 1.25;
  text-align: center;
}
.cab-item:hover {
  border-color: var(--at-ink);
  box-shadow: 2px 2px 0 rgba(47, 52, 57, 0.14);
  transform: translateY(-1px);
}
.cab-item.is-drag { opacity: 0.45; }
.cab-item.is-rg {
  flex-direction: row;
  width: 100%;
  padding: 5px 8px;
  justify-content: flex-start;
  gap: 6px;
}
.cab-item.is-rg svg { display: none; }
.cab-item.is-rg .cab-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(47, 52, 57, 0.4);
  flex: 0 0 auto;
}
.cab-item.is-rg span { text-align: left; flex: 0 1 auto; }
.cab-item.is-rg em {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-style: normal;
  color: var(--at-ink-soft);
  margin-left: auto;
}
.at-rail-foot {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px dashed var(--at-line);
}
.at-rail-foot button {
  flex: 1;
  height: 28px;
  border: 1px solid var(--at-line);
  border-radius: 7px;
  background: transparent;
  font-size: 11px;
  color: var(--at-ink);
  cursor: pointer;
  transition: all .15s ease;
}
.at-rail-foot button:hover {
  border-color: var(--at-seal);
  color: var(--at-seal);
  background: var(--at-seal-soft);
}

/* ---------- 实验台 ---------- */
.at-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.at-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 10px;
  flex-wrap: wrap;
}
.at-head .t {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-hand);
  font-size: 15px;
  font-weight: 700;
}
.at-head .t i {
  position: relative;
  width: 13px;
  height: 13px;
  background: var(--at-seal);
  border-radius: 3px;
  display: inline-block;
  transform: rotate(-4deg);
}
.at-head .t i::after {
  content: "";
  position: absolute;
  inset: 3.5px;
  background: #FFFDF6;
  border-radius: 1px;
}
.at-held {
  font-size: 11px;
  color: var(--at-seal);
  font-family: var(--font-hand);
}
.at-head .spacer { flex: 1; }
.at-tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--at-ink);
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--at-ink);
  font-size: 11.5px;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: 2px 2px 0 rgba(47, 52, 57, 0.12);
}
.at-tool .ico { width: 13px; height: 13px; fill: none; stroke: var(--at-ink); stroke-width: 2; }
.at-tool:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(47, 52, 57, 0.16); }
.at-tool.is-on {
  background: var(--at-seal);
  border-color: var(--at-seal);
  color: #FFF;
}
.at-tool.is-on .ico { stroke: #FFF; }
.at-tool.is-seal {
  background: var(--at-seal);
  border-color: var(--at-seal);
  color: #FFF;
  font-family: var(--font-hand);
  font-weight: 700;
}
.at-tool.is-seal:hover { background: #8F3524; }

.at-bench {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 253, 246, 0.8), transparent 70%),
    var(--at-paper);
  border: 1.5px solid var(--at-ink);
  border-radius: 10px;
  box-shadow: 4px 4px 0 rgba(47, 52, 57, 0.1);
}
.at-bench-grid {
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 27px, rgba(47, 52, 57, 0.05) 27px, rgba(47, 52, 57, 0.05) 28px),
    repeating-linear-gradient(90deg, transparent, transparent 27px, rgba(47, 52, 57, 0.05) 27px, rgba(47, 52, 57, 0.05) 28px);
  pointer-events: none;
}
.at-bench-tip {
  position: absolute;
  left: 50%;
  top: 26%;
  transform: translate(-50%, -50%);
  width: min(400px, 82%);
  text-align: center;
  font-family: var(--font-hand);
  font-size: 13px;
  line-height: 2;
  color: var(--at-ink-soft);
}
.at-bench-tip b {
  display: block;
  font-size: 16px;
  color: var(--at-ink);
  margin-bottom: 8px;
}
.at-bench-tip .tip-lens {
  color: var(--at-seal);
  border-bottom: 1px dashed var(--at-seal);
}
.at-bench.is-empty .at-bench-tip { display: block; }
.at-bench:not(.is-empty) .at-bench-tip { display: none; }

.at-flash {
  position: absolute;
  inset: 0;
  background: #FFFFFF;
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s ease;
}
.at-flash.on { opacity: .35; }

/* 台面上的器物 */
.at-obj {
  position: absolute;
  width: 146px;
  height: 182px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.at-obj svg { width: 100%; height: 100%; filter: drop-shadow(1.5px 2px 0 rgba(47, 52, 57, 0.1)); }
.at-obj.is-sel::after {
  content: "";
  position: absolute;
  inset: -2px -2px -22px -2px;
  border: 2px dashed var(--at-seal);
  border-radius: 12px;
  pointer-events: none;
}
.at-obj.is-drop::after {
  content: "";
  position: absolute;
  inset: -2px -2px -22px -2px;
  border: 2px dashed #3B7EA1;
  border-radius: 12px;
  pointer-events: none;
}
.at-obj-label {
  position: absolute;
  left: 50%;
  bottom: -21px;
  transform: translateX(-50%);
  font-family: var(--font-hand);
  font-size: 11px;
  color: var(--at-ink);
  background: rgba(255, 255, 255, 0.9);
  padding: 0 6px;
  border: 1px solid var(--at-line);
  border-radius: 6px;
  white-space: nowrap;
}
.at-obj.is-moving { cursor: grabbing; z-index: 5; }

.at-ghost {
  position: fixed;
  z-index: 1000;
  width: 64px;
  height: 74px;
  margin-left: -32px;
  margin-top: -37px;
  pointer-events: none;
  opacity: .85;
}
.at-ghost svg { width: 100%; height: 100%; }

/* 现象动画 */
.bub { animation: at-bub 1.6s linear infinite; }
@keyframes at-bub {
  0% { transform: translateY(0); opacity: 0; }
  15% { opacity: .9; }
  100% { transform: translateY(-52px); opacity: 0; }
}
.smoke { animation: at-smoke 2.6s ease-out infinite; }
@keyframes at-smoke {
  0% { transform: translateY(0) scale(.6); opacity: 0; }
  30% { opacity: .6; }
  100% { transform: translateY(-34px) scale(1.5); opacity: 0; }
}
.flame-flick { animation: at-flick 0.55s ease-in-out infinite alternate; transform-origin: 50% 100%; }
@keyframes at-flick {
  from { transform: scale(1, 1); }
  to { transform: scale(1.07, 0.93); }
}

/* ---------- 新创：微观视窗 ---------- */
.at-lens {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 148px;
  z-index: 6;
  text-align: center;
}
.at-lens-body {
  position: relative;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  border: 3.5px solid var(--at-ink);
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.95), rgba(240, 236, 222, 0.92) 55%, rgba(214, 208, 188, 0.9)),
    #F4F0E2;
  box-shadow:
    inset 0 0 0 5px rgba(47, 52, 57, 0.07),
    inset 0 0 26px rgba(47, 52, 57, 0.12),
    3px 4px 0 rgba(47, 52, 57, 0.14);
  overflow: hidden;
  cursor: default;
}
.at-lens-body::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(47, 52, 57, 0.18);
  border-radius: 50%;
}
.at-lens.is-flash .at-lens-body {
  border-color: var(--at-seal);
  animation: at-lenspulse 0.7s ease-in-out 3;
}
@keyframes at-lenspulse {
  50% { box-shadow: inset 0 0 0 5px rgba(166, 67, 45, 0.25), inset 0 0 26px rgba(166, 67, 45, 0.3), 0 0 22px rgba(166, 67, 45, 0.35); }
}
.pt {
  position: absolute;
  left: 0;
  top: 0;
  min-width: 34px;
  height: 24px;
  line-height: 22px;
  padding: 0 5px;
  text-align: center;
  border-radius: 12px;
  border: 1.5px solid var(--at-ink);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  color: #2F3439;
  background: #EDEAE0;
  will-change: transform;
  pointer-events: none;
}
.at-lens.is-empty .at-lens-body::after {
  content: "取药后\A可见微粒";
  white-space: pre;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 11px;
  line-height: 1.9;
  color: rgba(47, 52, 57, 0.45);
  pointer-events: none;
}
.pt.is-seal {
  border-color: var(--at-seal);
  color: #6E2417;
  box-shadow: 1.5px 1.5px 0 rgba(166, 67, 45, 0.35);
}
.at-lens-cap {
  display: block;
  margin-top: 7px;
  font-family: var(--font-hand);
  font-size: 11px;
  color: var(--at-ink);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--at-line);
  border-radius: 999px;
  padding: 1px 10px;
}

/* ---------- 新创：墨签卡片（收入图鉴） ---------- */
.at-sealcard {
  position: absolute;
  right: 18px;
  bottom: 20px;
  z-index: 8;
  width: 300px;
  padding: 12px 14px 12px;
  overflow: hidden;
  background: #FFFDF6;
  border: 1.5px solid var(--at-seal);
  border-radius: 10px;
  box-shadow: 4px 4px 0 rgba(166, 67, 45, 0.2);
  opacity: 0;
  transform: translateX(24px) rotate(1.5deg);
  transition: all .38s var(--ease-out);
}
.at-sealcard.on {
  opacity: 1;
  transform: translateX(0) rotate(0deg);
}
.sealcard-kicker {
  display: block;
  font-family: var(--font-hand);
  font-size: 10.5px;
  color: var(--at-seal);
  margin-bottom: 6px;
}
.sealcard-eq {
  font-size: 11.6px;
  padding-right: 34px;
  margin-top: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.sealcard-eq::-webkit-scrollbar { display: none; }
.sealcard-eq .ct { font-size: 11.6px; }
.at-sealcard .stamp-seal.big {
  position: absolute;
  right: 10px;
  top: 10px;
}

/* ---------- 新创：现象挑战 ---------- */
.at-quiz {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(47, 52, 57, 0.18);
  backdrop-filter: blur(2px);
  border-radius: 10px;
}
.at-quiz:not([hidden]) { display: flex; }
.quiz-card {
  width: min(480px, 92%);
  max-height: 92%;
  overflow-y: auto;
  padding: 18px 20px 16px;
  background: #FFFDF6;
  border: 1.5px solid var(--at-ink);
  border-radius: 12px;
  box-shadow: 6px 6px 0 rgba(47, 52, 57, 0.18);
}
.quiz-card.is-shake { animation: at-shake .35s ease; }
@keyframes at-shake {
  20% { transform: translateX(-6px); }
  45% { transform: translateX(5px); }
  70% { transform: translateX(-3px); }
}
.quiz-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.quiz-head span {
  font-family: var(--font-hand);
  font-size: 16px;
  font-weight: 700;
  color: var(--at-seal);
}
.quiz-head b { font-size: 11px; color: var(--at-ink-soft); font-weight: 500; }
.quiz-head button {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border: 1px solid var(--at-line);
  border-radius: 50%;
  background: transparent;
  font-size: 14px;
  color: var(--at-ink-soft);
  cursor: pointer;
}
.quiz-note {
  margin: 12px 0 4px;
  font-family: var(--font-hand);
  font-size: 14.5px;
  line-height: 1.9;
  color: var(--at-ink);
  background: var(--at-paper-2);
  border-left: 3px solid var(--at-seal);
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
}
.quiz-sub { font-size: 11.5px; color: var(--at-ink-soft); margin: 10px 0 8px; }
.quiz-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.quiz-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--at-line);
  border-radius: 999px;
  background: #FFFFFF;
  font-size: 11px;
  color: var(--at-ink);
  cursor: pointer;
  transition: all .12s ease;
}
.quiz-chip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(47, 52, 57, 0.4);
}
.quiz-chip:hover { border-color: var(--at-ink); }
.quiz-chip.is-pick {
  border: 1.5px solid var(--at-seal);
  background: var(--at-seal-soft);
  color: #6E2417;
  font-weight: 600;
}
.quiz-hint {
  min-height: 18px;
  margin: 10px 0 4px;
  font-size: 11.5px;
  font-family: var(--font-hand);
  color: var(--at-ink-soft);
}
.quiz-hint.is-ok { color: #2E6B3F; font-weight: 700; }
.quiz-hint.is-no { color: var(--at-seal); }
.quiz-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}
.quiz-skip {
  height: 30px;
  padding: 0 14px;
  border: 1px solid var(--at-line);
  border-radius: 999px;
  background: transparent;
  font-size: 11.5px;
  color: var(--at-ink-soft);
  cursor: pointer;
}
.quiz-go {
  height: 30px;
  padding: 0 18px;
  border: 1px solid var(--at-seal);
  border-radius: 999px;
  background: var(--at-seal);
  color: #FFF;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(166, 67, 45, 0.3);
}
.quiz-go:hover { background: #8F3524; }

/* ---------- 右栏：手记 / 方案 / 图鉴 ---------- */
.at-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #FFFDF6;
  border: 1px solid var(--at-line);
  border-radius: var(--radius-md);
  box-shadow: 3px 3px 0 rgba(47, 52, 57, 0.06);
}
.at-panel-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px dashed var(--at-line);
}
.at-panel-head h3 {
  font-family: var(--font-hand);
  font-size: 15px;
  font-weight: 700;
  color: var(--at-ink);
  margin-right: auto;
}
.at-panel-tabs { display: flex; gap: 4px; align-items: center; }
.at-panel-tabs [data-panel] {
  height: 22px;
  padding: 0 9px;
  font-size: 10.5px;
  border: 1px solid var(--at-line);
  border-radius: 999px;
  background: transparent;
  color: var(--at-ink-soft);
  cursor: pointer;
}
.at-panel-tabs [data-panel].is-on {
  background: var(--at-ink);
  color: #FFF;
  border-color: var(--at-ink);
}
.at-panel-tabs [data-panel-close] {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--at-line);
  background: transparent;
  color: var(--at-ink-soft);
  font-size: 14px;
  line-height: 1;
}

.at-log {
  flex: 1.35;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px;
  background-image: repeating-linear-gradient(transparent, transparent 25px, rgba(47, 52, 57, 0.055) 25px, rgba(47, 52, 57, 0.055) 26px);
}
.log-item {
  position: relative;
  padding: 6px 8px 8px 0;
  margin-bottom: 4px;
  border-bottom: 1px dashed var(--at-line);
  line-height: 1.7;
}
.log-item .log-time {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--at-ink-soft);
  margin-right: 6px;
}
.log-item b {
  display: inline;
  font-family: var(--font-hand);
  font-size: 12.5px;
  color: var(--at-ink);
}
.log-item > span {
  display: block;
  font-size: 11px;
  color: #5E5A50;
  margin-top: 2px;
}
.log-item .ct { font-size: 13.5px; }
.log-item .ct-cond { font-size: 9px; }
.stamp-eq .ct-cond, .sealcard-eq .ct-cond { font-size: 8.2px; }
.log-item.warn b { color: var(--at-seal); }
.log-item.warn {
  background: rgba(166, 67, 45, 0.06);
  border-radius: 6px;
  padding-left: 8px;
}

.at-props {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 14px 14px;
  border-top: 1px dashed var(--at-line);
}
.at-props h4, .at-plans h4 {
  font-family: var(--font-hand);
  font-size: 12.5px;
  color: var(--at-seal);
  margin-bottom: 8px;
}
.prop-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  padding: 3px 0;
  border-bottom: 1px dotted var(--at-line);
}
.prop-row span { color: var(--at-ink-soft); }
.prop-row b { font-weight: 600; color: var(--at-ink); }
.prop-empty, .plan-note {
  font-size: 10.5px;
  color: var(--at-ink-soft);
  line-height: 1.8;
}
.at-contents .cont-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  padding: 4px 0;
}
.cont-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--at-ink);
  flex: 0 0 auto;
}
.at-contents .cont-row em {
  margin-left: auto;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--at-ink-soft);
}

.at-plans, .at-stamps {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 16px;
}
.plan-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 7px;
  background: #FFFFFF;
  border: 1px solid var(--at-line);
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
  transition: all .15s ease;
}
.plan-btn span {
  font-size: 12px;
  font-family: var(--font-hand);
  color: var(--at-ink);
}
.plan-btn em {
  margin-left: auto;
  font-style: normal;
  font-size: 10px;
  color: var(--at-seal);
  background: var(--at-seal-soft);
  border: 1px solid rgba(166, 67, 45, 0.25);
  border-radius: 999px;
  padding: 1px 8px;
}
.plan-btn:hover {
  border-color: var(--at-ink);
  box-shadow: 2px 2px 0 rgba(47, 52, 57, 0.14);
}

/* 图鉴 */
.stamps-progress {
  font-family: var(--font-hand);
  font-size: 13px;
  color: var(--at-ink);
  margin-bottom: 4px;
}
.stamps-progress b { color: var(--at-seal); font-size: 16px; }
.stamps-progress span {
  display: block;
  font-family: var(--font-sans);
  font-size: 10.5px;
  color: var(--at-ink-soft);
  margin-top: 2px;
}
.stamps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  margin-top: 10px;
}
.stamp {
  position: relative;
  min-height: 46px;
  border: 1px dashed var(--at-line);
  border-radius: 9px;
  padding: 9px 10px 8px 12px;
  background: rgba(255, 255, 255, 0.45);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.stamp-unknown {
  font-family: var(--font-hand);
  font-size: 11px;
  color: var(--at-ink-soft);
  letter-spacing: .02em;
}
.stamp.is-on {
  border: 1.5px solid rgba(166, 67, 45, 0.55);
  background: #FFFDF6;
  box-shadow: 2px 2px 0 rgba(166, 67, 45, 0.12);
}
.stamp-eq {
  font-size: 13px;
  padding-right: 34px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.stamp-eq::-webkit-scrollbar { display: none; }
.stamp-eq .ct { font-size: 13px; }
.stamp-note { font-family: var(--font-hand); font-size: 12px; color: var(--at-ink); padding-right: 26px; }
.stamp p {
  font-size: 10px;
  color: var(--at-ink-soft);
  line-height: 1.6;
  margin-top: 3px;
  padding-right: 26px;
}
.stamp-seal {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 22px;
  height: 22px;
  line-height: 20px;
  text-align: center;
  border: 2px solid var(--at-seal);
  border-radius: 50%;
  color: var(--at-seal);
  font-family: var(--font-hand);
  font-size: 11px;
  font-weight: 700;
  transform: rotate(-12deg);
  background: rgba(166, 67, 45, 0.05);
}
.stamp-seal.big {
  width: 30px;
  height: 30px;
  line-height: 27px;
  font-size: 14px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1200px) {
  .at-view {
    grid-template-columns: 190px minmax(0, 1fr);
    grid-template-rows: minmax(520px, calc(100vh - 170px));
    padding-right: 14px;
  }
  .at-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 86%;
    max-width: 340px;
    z-index: 30;
    transform: translateX(102%);
    transition: transform .3s var(--ease-out);
    box-shadow: -16px 0 36px -22px rgba(47, 52, 57, 0.5);
  }
  .at-view.panel-open .at-panel { transform: none; }
  .only-mobile { display: inline-flex !important; }
  .at-lens { width: 118px; }
  .at-lens-body { width: 118px; height: 118px; }
}
@media (max-width: 980px) {
  .only-mobile { display: inline-flex !important; }
  .at-view {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(340px, 52vh) auto;
    gap: 8px;
    padding: 0 12px 12px;
  }
  /* 工具条改为两行折行，避免按钮被挤出视野 */
  .at-head {
    flex-wrap: wrap;
    row-gap: 6px;
    overflow: visible;
    padding-bottom: 8px;
  }
  .at-head .t { flex: 0 0 auto; width: 100%; }
  .at-tool { flex: 0 0 auto; }
  #atQuizBtn { margin-left: auto; }
  .at-rail {
    grid-row: 2;
    max-height: 250px;
  }
  .at-lens { width: 104px; }
  .at-lens-body { width: 104px; height: 104px; }
  .pt { min-width: 30px; height: 21px; line-height: 19px; font-size: 8.5px; }
  .at-bench-tip { font-size: 12px; }
  .at-sealcard { width: 210px; }
}


/* ---------- 10. 杂项 ---------- */
.stage-body::-webkit-scrollbar, .at-log::-webkit-scrollbar, .at-cab::-webkit-scrollbar,
.at-props::-webkit-scrollbar, .at-stamps::-webkit-scrollbar, .at-plans::-webkit-scrollbar, .quiz-card::-webkit-scrollbar { width: 8px; height: 8px; }

@media (prefers-reduced-motion: reduce) {
  .atom-dial, .liquid-anim, .bub, .flame-flick, .smoke, .spark { animation: none !important; }
}

/* 窄屏：图例单行横滑（放在末尾，确保覆盖基础规则） */
@media (max-width: 1200px) {
  .pt-note::after {
    content: "窄屏下可左右滑动查看整张表。";
    display: block;
    margin-top: 4px;
    color: var(--chem);
    opacity: 0.85;
  }
}
@media (max-width: 1200px) {
  .pt-legend {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .pt-legend::-webkit-scrollbar { display: none; }
  .pt-legend button { flex: 0 0 auto; }
  .pt-head { gap: 10px; }
}

/* 窄屏：速查三卡改为单列，避免被挤成细条 */
@media (max-width: 1000px) {
  .cheat-grid { grid-template-columns: 1fr; }
}
