:root {
  /* 时习之 · 视觉体系 */
  --bg: #F7F6F3;
  --card: #ffffff;
  --ink: #1F2937;
  --muted: #6B7280;
  --line: #E6E8EB;
  --primary: #4F5DFF;
  --primary-d: #3B49DB;
  --primary-soft: #EDF0FF;
  --accent: #F59E0B;
  --accent-soft: #FEF3C7;
  --danger: #E54545;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 6px 18px rgba(0,0,0,.04);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; height: 56px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 16px; margin-right: 12px; display: inline-flex; align-items: center; gap: 8px; letter-spacing: 0.5px; }
.brand-logo { width: 28px; height: 28px; flex: none; }
.brand-text { font-weight: 700; }
.tabs { display: flex; gap: 6px; flex: 1; overflow: hidden; }
.tab {
  border: none; background: transparent; cursor: pointer;
  padding: 8px 14px; border-radius: 8px; color: var(--muted);
  font-size: 14px; font-weight: 600; flex: none; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab .ic { width: 16px; height: 16px; }
.tab.active { background: var(--primary-soft); color: var(--primary); }
.tab-hidden { display: none !important; }

/* 顶栏溢出菜单：窄屏把放不下的 tab 收进「☰ 更多」 */
.tab-overflow {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  border: 1px solid var(--line); background: var(--bg); cursor: pointer;
  padding: 7px 12px; border-radius: 8px; color: var(--ink); font-size: 14px; font-weight: 600;
}
.tab-overflow.hidden { display: none; }
.tab-overflow-menu {
  position: absolute; top: calc(100% - 1px); right: 12px; min-width: 184px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px; z-index: 40;
}
.tab-overflow-menu.hidden { display: none; }
.tab-menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  border: none; background: transparent; cursor: pointer;
  padding: 9px 12px; border-radius: 8px; font-size: 14px; color: var(--ink);
}
.tab-menu-item .ic { width: 16px; height: 16px; }
.tab-menu-item:hover { background: var(--bg); }

/* 登录态：顶栏用户条 + 下拉菜单 */
.user-bar {
  display: flex; align-items: center; gap: 8px;
  padding-left: 14px;
  font-weight: 600; font-size: 13px;
  color: var(--muted);
  border-left: 1px solid var(--line);
}
.user-bar #user-name { color: var(--ink); }

/* 用户名下拉菜单 */
.user-menu { position: relative; }
.user-menu-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: transparent; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--ink);
  padding: 6px 8px; border-radius: 8px;
}
.user-menu-trigger:hover { background: var(--bg); }
.caret { font-size: 10px; color: var(--muted); }
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 184px; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 30;
}
.menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  border: none; background: transparent; cursor: pointer;
  padding: 9px 12px; border-radius: 8px; font-size: 14px; color: var(--ink);
}
.menu-item:hover { background: var(--bg); }
.menu-item.danger { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-item .ic { width: 16px; height: 16px; }
.user-menu-trigger .ic { width: 16px; height: 16px; color: var(--muted); }
.tab-overflow { display: inline-flex; align-items: center; gap: 6px; }
.tab-overflow .ic { width: 16px; height: 16px; }

/* 通用 SVG 图标（与品牌色绑定，dark mode 自动反色） */
.ic {
  width: 18px; height: 18px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -3px;
}
.kb-tab .ic { width: 16px; height: 16px; vertical-align: -4px; margin-right: 6px; }

/* 通用横排工具类：筛选行/工具栏复用 */
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row > * { min-width: 0; flex: 0 1 auto; width: auto; }
.row input { flex: 1 1 200px; }
@media (max-width: 520px) {
  .row { gap: 6px; }
}

/* 深色模式 */
:root[data-theme="dark"] {
  --bg: #0F172A; --card: #1E293B; --ink: #E2E8F0; --muted: #94A3B8;
  --line: #334155; --primary: #818CF8; --primary-d: #6366F1;
  --primary-soft: #1E1B4B; --accent: #FBBF24; --accent-soft: #422006;
  --danger: #F87171; --shadow: 0 1px 3px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.35);
}
:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select { background: #0f172a; }
:root[data-theme="dark"] .preview { background: #0b1220; }
:root[data-theme="dark"] .img-thumb { background: #0f172a; }
:root[data-theme="dark"] .tok-cfg { background: #0b1220; color: #cbd5e1; border-color: #334155; }

/* 实时连接指示灯 */
.live-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: #b9bfc8; flex: none;
}
.live-dot.on { background: #2ec26b; box-shadow: 0 0 0 3px rgba(46,194,107,.18); }
.live-dot.connecting { background: #f0a020; animation: live-pulse 1s ease-in-out infinite; }
.live-dot.off { background: #e0533d; }
@keyframes live-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* 有未读更新的视图 tab 红点 */
.tab.has-new::after {
  content: ""; display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; background: #e0533d; margin-left: 6px; vertical-align: middle;
}

/* 登录 / 注册 全屏遮罩 */
body.locked { overflow: hidden; }
.auth-screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #eef3ff, #f5f6f8);
  padding: 16px;
}
.auth-card { width: 100%; max-width: 360px; }
.auth-card h2 { text-align: center; }
.auth-toggle-line { text-align: center; margin-top: 12px; }
.auth-toggle-line a { color: var(--primary); font-size: 13px; text-decoration: none; }
.auth-beian { text-align: center; font-size: 12px; color: var(--muted); margin-top: 14px; }
.auth-beian a { color: var(--muted); text-decoration: none; }
.auth-beian a:hover { color: var(--primary); text-decoration: underline; }

main { max-width: 920px; margin: 20px auto; padding: 0 16px; }
.view { display: none; }
.view.active { display: block; }

/* ---------- 备案号页脚 ---------- */
.site-footer {
  text-align: center;
  padding: 16px 12px 22px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--primary); text-decoration: underline; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 16px; font-size: 18px; }

label { display: block; margin-bottom: 14px; font-weight: 600; }
label .hint, small.hint { display: block; font-weight: 400; color: var(--muted); margin-top: 4px; }
input, textarea, select {
  width: 100%; margin-top: 6px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 8px;
  font: inherit; color: var(--ink); background: #fff;
}
textarea { resize: vertical; font-family: "SFMono-Regular", Consolas, monospace; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); }

.grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 720px) { .grid { grid-template-columns: 1fr 1fr; } }

.preview {
  margin: -6px 0 14px; padding: 10px 12px;
  background: #fafbfc; border: 1px dashed var(--line); border-radius: 8px;
  min-height: 20px; font-size: 15px;
}
.muted { color: var(--muted); }

.actions { display: flex; align-items: center; gap: 12px; }
.btn {
  border: none; cursor: pointer; padding: 9px 18px; border-radius: 8px;
  font-size: 14px; font-weight: 600;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn.danger { background: var(--danger); color: #fff; }
.msg { font-size: 13px; }
.msg.ok { color: #1a9c5b; }
.msg.err { color: var(--danger); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filters select, .filters input { width: auto; min-width: 110px; margin: 0; }

.bank-list { display: grid; gap: 12px; }
.q-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); cursor: pointer;
}
.q-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.chip { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: #eef3ff; color: var(--primary); font-weight: 600; }
.chip.kp { background: #eef9f1; color: #1a9c5b; }
.chip.tag { background: #f3f4f6; color: #6b7280; font-weight: 500; }
.chip.diff { background: #fff4e5; color: #c77700; }
.q-content { font-size: 15px; line-height: 1.55; }
.q-actions { margin-top: 12px; display: flex; gap: 8px; }

/* ---- P9：拍照识别 ---- */
.ocr-box {
  border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px;
  margin-bottom: 16px; background: #fafbfc;
}
.ocr-box .msg { margin-left: 10px; }
.ocr-box #ocr-btn:disabled { opacity: .6; cursor: default; }

/* ---- 录入首屏：拍照 / 打开图片 双入口 ---- */
.entry-hero { padding: 20px 22px; margin-bottom: 16px; }
.entry-hero h2 { margin: 0 0 4px; }
.entry-sub { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.capture-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.capture-btn {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); cursor: pointer; color: var(--ink);
  transition: border-color .15s, box-shadow .15s, transform .05s;
}
.capture-btn:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.capture-btn:active { transform: translateY(1px); }
.capture-btn:disabled { opacity: .55; cursor: default; }
.capture-btn .cap-ic { font-size: 26px; line-height: 1; }
.capture-btn .cap-tx { display: flex; flex-direction: column; gap: 2px; }
.capture-btn .cap-tx b { font-size: 15px; font-weight: 700; }
.capture-btn .cap-tx small { font-size: 12px; color: var(--muted); }
.capture-btn.cap-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.capture-btn.cap-primary:hover { background: var(--primary-d); border-color: var(--primary-d); box-shadow: 0 6px 16px rgba(47,107,255,.28); }
.capture-btn.cap-primary .cap-tx small { color: rgba(255,255,255,.82); }
/* 识别流程用户设定（一条龙 / 分步）
   覆盖全局 `label{display:block;margin-bottom:14px;font-weight:600}` */
.ocr-flow-row { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 12px 0 4px; font-size: 13px; }
.ocr-flow-lbl { flex: none; font-size: 13px; }
.ocr-flow-opt {
  display: inline-flex; align-items: center; gap: 0;
  color: var(--text); cursor: pointer; white-space: nowrap;
  font-size: 13px; font-weight: normal; margin: 0;
}
.ocr-flow-opt input {
  accent-color: var(--primary);
  width: auto; min-width: 0; margin: 0 5px 0 0; padding: 0; border: 0;
  background: transparent; flex: none;
}

.entry-hero #ocr-msg { display: block; margin-top: 12px; }

/* ---- 手动填写 / 核对：次要折叠区 ---- */
details.manual-entry { margin-bottom: 16px; }
details.manual-entry > summary {
  cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted);
  padding: 12px 16px; border: 1px dashed var(--line); border-radius: var(--radius);
  background: var(--card); list-style: none; user-select: none;
}
details.manual-entry > summary::-webkit-details-marker { display: none; }
details.manual-entry > summary:hover { color: var(--ink); border-color: var(--primary); }
details.manual-entry[open] > summary { margin-bottom: 12px; border-style: solid; color: var(--ink); }
@media (max-width: 560px) { .capture-actions { grid-template-columns: 1fr; } }

/* ---- P5：题目配图 ---- */
.img-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.img-thumb {
  position: relative; width: 88px; height: 88px; border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; background: #fafbfc;
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-thumb .img-del {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px;
  border: none; border-radius: 50%; background: rgba(15,18,25,.6); color: #fff;
  cursor: pointer; font-size: 13px; line-height: 20px; padding: 0;
}
.img-thumb .img-del:hover { background: var(--danger); }
.q-imgs { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.q-imgs img {
  max-width: 100%; max-height: 420px; border-radius: 8px; border: 1px solid var(--line);
  object-fit: contain; background: #fff; cursor: zoom-in;
  transition: transform .15s ease;
}
.q-imgs img:hover { transform: scale(1.02); }
.lightbox {
  position: fixed; inset: 0; background: rgba(15,18,25,.85);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  z-index: 200; cursor: zoom-out;
}
.lightbox.hidden { display: none; }
.lightbox { touch-action: none; }
.lightbox .lb-wrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.lightbox img { width: auto; height: auto; transform-origin: center center; touch-action: none; will-change: transform; cursor: zoom-in; }
.lightbox img.zoomed { cursor: grab; }
.lightbox .lb-close { position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; border-radius: 50%; border: none; background: rgba(255,255,255,.16); color: #fff; font-size: 22px; line-height: 1; z-index: 2; cursor: pointer; }
.lightbox img {
  max-width: 92vw; max-height: 92vh; object-fit: contain; border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35); cursor: default;
}
.lightbox .lb-caption {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 13px; text-shadow: 0 1px 3px rgba(0,0,0,.5); max-width: 80vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
:root[data-theme="dark"] .lightbox { background: rgba(0,0,0,.9); }
:root[data-theme="dark"] .q-imgs img { background: #0f172a; }

.modal { position: fixed; inset: 0; background: rgba(15,18,25,.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal.hidden { display: none; }
.modal-box { width: 100%; max-width: 720px; max-height: 88vh; overflow: auto; position: relative; }
.modal-content { width: 100%; max-width: 480px; max-height: 88vh; overflow: auto; position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: 0 12px 40px rgba(0,0,0,.22); }
.modal-content .modal-header { margin-bottom: 12px; }
.modal-content .modal-body { font-size: 14px; }
.modal-close { position: absolute; top: 12px; right: 16px; border: none; background: transparent; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.detail-block { margin-bottom: 16px; }
.detail-block h4 { margin: 0 0 6px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.detail-block .body { font-size: 15px; line-height: 1.6; }
.hidden { display: none; }

/* ---- 状态徽标 ---- */
.chip.st-collected { background: #fff0e6; color: #c77700; }
.chip.st-review    { background: #fff7e0; color: #b8860b; }
.chip.st-mastered  { background: #e6f7ec; color: #1a9c5b; }

/* ---- 体系树 ---- */
.tax-subject { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.tax-node { margin-top: 8px; }
.tax-children { margin-left: 22px; border-left: 2px solid #eef0f3; padding-left: 12px; }
.tax-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tax-name { font-weight: 600; }
.tax-path { font-size: 12px; }
.tax-acts { margin-left: auto; display: flex; gap: 6px; }
.btn.mini { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn.mini.ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn.mini.danger { background: var(--danger); color: #fff; }

/* ---- 薄弱看板表格 ---- */
table.stats { width: 100%; border-collapse: collapse; font-size: 14px; }
table.stats th, table.stats td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.stats th { color: var(--muted); font-weight: 600; font-size: 13px; }
table.stats td { vertical-align: middle; }
.bar { display: inline-block; width: 90px; height: 10px; background: #eef0f3; border-radius: 6px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.bar-fill { height: 100%; background: linear-gradient(90deg,#ff8a65,#e54545); }
.bar-num { font-size: 12px; color: var(--muted); }

/* ---- P4：复习计划 + 错因诊断 ---- */
.review-summary { font-size: 14px; }
.q-err { margin: 8px 0 2px; padding: 8px 10px; background: #fff4f4; border-left: 3px solid var(--danger); border-radius: 6px; font-size: 13px; line-height: 1.5; }
.err-group { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.err-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.err-samples { margin: 6px 0 8px; padding-left: 18px; }
.err-samples li { font-size: 13px; line-height: 1.55; color: #5a3b3b; margin-bottom: 4px; }
.err-group .btn.mini { margin-top: 2px; }

/* ---- P3：从 AI 对话导入 ---- */
details.ai-import {
  margin-bottom: 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow);
}
details.ai-import summary { cursor: pointer; font-weight: 700; font-size: 15px; }
details.ai-import > p { margin: 10px 0 12px; line-height: 1.5; }
details.ai-import textarea {
  width: 100%; margin: 0 0 12px; font-size: 13px;
  font-family: "SFMono-Regular", Consolas, monospace; line-height: 1.5;
}

/* ---- 用户设定页 ---- */
.settings-block { border-top: 1px solid var(--line); padding: 16px 0 4px; margin-top: 6px; }
.quota-box { background: var(--card-2, #f6f7f9); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-top: 8px; }
.quota-tier { font-size: 14px; margin-bottom: 8px; }
.quota-row { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; font-size: 14px; }
.quota-num { font-weight: 700; font-size: 16px; margin-left: auto; font-variant-numeric: tabular-nums; }
.quota-box .muted { margin: 0; font-size: 12px; }
.settings-block:first-of-type { border-top: none; padding-top: 4px; }
.settings-block h3 { margin: 0 0 10px; font-size: 15px; }
.settings-block .actions { margin-top: 10px; }
.settings-block label { display: block; margin: 10px 0 0; font-weight: 600; font-size: 14px; }
.settings-block input { width: 100%; margin-top: 6px; }

/* ---- 访问令牌弹层（用户自助复制 token） ---- */
.token-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.token-row input {
  flex: 1; margin: 0; font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px; color: #b45309; background: #fffbeb;
  border: 1px solid #fde68a; padding: 8px 10px; border-radius: 8px;
}
.tok-cfg {
  width: 100%; margin-top: 6px; font-size: 12px;
  font-family: "SFMono-Regular", Consolas, monospace; line-height: 1.5;
  background: #0f172a; color: #e2e8f0; border: 1px solid #334155;
  border-radius: 8px; padding: 10px;
}
#modal-body label { display: block; margin: 12px 0 0; font-weight: 600; font-size: 14px; }
#modal-body code {
  background: #eef2ff; color: #4338ca; padding: 1px 6px; border-radius: 4px;
  font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px;
}
#modal-body h3 { margin: 0 0 4px; }

/* ----- 好友 / 分享 ----- */
.badge {
  display: none; min-width: 18px; height: 18px; padding: 0 5px;
  background: #e0533d; color: #fff; border-radius: 9px;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  margin-left: 6px; vertical-align: middle;
}
.badge.show { display: inline-block; }
.social-add { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.social-add input { flex: 1; min-width: 160px; }
.social-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.social-row:last-child { border-bottom: none; }
.social-name { font-weight: 600; }
.social-acts { display: flex; gap: 8px; }
.inbox-row { display: block; }
.inbox-row .inbox-head { margin-bottom: 6px; }
.inbox-row .q-content {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; margin-bottom: 8px; white-space: pre-wrap;
}
.share-friends { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; max-height: 240px; overflow: auto; }
.share-friend { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.share-friend input { width: 16px; height: 16px; }

/* 收件箱子 tab */
.sub-tabs { display: flex; gap: 8px; }
.sub-tab { border: none; background: transparent; cursor: pointer; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.sub-tab.active { background: #eef3ff; color: var(--primary); }
.status-badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--line); color: var(--muted); margin-left: 6px; }
.status-badge.ok { background: #e6f9ed; color: #1f8b38; }
.history-row { opacity: .98; }

/* ---- 拍照识别·多题勾选面板 ---- */
.ocr-multi { margin: 12px 0 4px; padding: 14px; border: 1px dashed var(--line); border-radius: 12px; background: var(--card-soft, #fafbff); }
.ocr-multi h3 { margin: 0 0 6px; font-size: 15px; }
.ocr-multi h3 .hint { font-weight: 400; font-size: 12px; }
#ocr-multi-list { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.ocr-card { border: 1px solid var(--line); border-radius: 10px; background: var(--card); overflow: hidden; }
.ocr-card-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; background: var(--card-soft, #f5f7ff); }
.ocr-box-tag { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #eef2ff; color: #3b5bdb; border: 1px solid #c7d2fe; }
.ocr-pick-wrap { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; cursor: pointer; }
.ocr-card-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.ocr-card-body.collapsed { display: none; }
.ocr-card-body label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.ocr-card-body input, .ocr-card-body textarea, .ocr-card-body select { font-size: 14px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.ocr-card-body textarea { resize: vertical; font-family: inherit; }
.ocr-multi-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn.sm { padding: 4px 10px; font-size: 12px; }

/* 多题卡片：本题配图 + 重新裁剪 */
.ocr-card-imgrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.oc-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--card-soft, #f5f7ff); }

/* 裁剪 + 旋转弹层 */
.crop-rot { display: flex; gap: 8px; }
.crop-stage { position: relative; max-width: 100%; margin: 4px 0; display: flex; justify-content: center; }
#crop-canvas { max-width: 100%; border-radius: 10px; display: block; touch-action: none; background: #000; }
.crop-rect { position: absolute; border: 2px dashed #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); cursor: move; box-sizing: border-box; }
.crop-rect .ch { position: absolute; width: 16px; height: 16px; background: #fff; border-radius: 50%; border: 2px solid var(--primary, #3b82f6); }
.crop-rect .ch.tl { left: -8px; top: -8px; cursor: nwse-resize; }
.crop-rect .ch.tr { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-rect .ch.bl { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-rect .ch.br { right: -8px; bottom: -8px; cursor: nwse-resize; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
/* 预处理（多框裁剪）弹层 */
#pre-stage { position: relative; max-width: 100%; margin: 4px 0; display: flex; justify-content: center; }
#pre-canvas { max-width: 100%; border-radius: 10px; display: block; touch-action: none; background: #000; }
#pre-rects { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
#pre-rects > .pre-rect { pointer-events: auto; }
.pre-rect { position: absolute; border: 2px solid var(--primary, #3b82f6); background: rgba(59,130,246,.14); cursor: move; box-sizing: border-box; }
.pre-rect .pre-badge { position: absolute; left: 0; top: 0; min-width: 18px; height: 18px; padding: 0 4px; background: var(--primary, #3b82f6); color: #fff; font-size: 12px; line-height: 18px; text-align: center; border-radius: 0 0 6px 0; }
.pre-rect .pre-del { position: absolute; right: -9px; top: -9px; width: 18px; height: 18px; background: #ef4444; color: #fff; font-size: 13px; line-height: 18px; text-align: center; border-radius: 50%; cursor: pointer; }
.pre-rect .ch { position: absolute; width: 16px; height: 16px; background: #fff; border-radius: 50%; border: 2px solid var(--primary, #3b82f6); }
.pre-rect .ch.tl { left: -8px; top: -8px; cursor: nwse-resize; }
.pre-rect .ch.tr { right: -8px; top: -8px; cursor: nesw-resize; }
.pre-rect .ch.bl { left: -8px; bottom: -8px; cursor: nesw-resize; }
.pre-rect .ch.br { right: -8px; bottom: -8px; cursor: nwse-resize; }
.pre-foot { flex-wrap: wrap; gap: 8px; }

/* ---------- 知识库 ---------- */
.kb-layout { display: flex; gap: 16px; align-items: flex-start; }
.kb-side { flex: 0 0 300px; max-height: 72vh; overflow: auto; border-right: 1px solid var(--line); padding-right: 12px; }
.kb-tree { margin-top: 10px; }
.kb-main { flex: 1 1 auto; min-width: 0; }
.kb-subject-row { font-weight: 700; font-size: 15px; margin: 12px 0 6px; color: var(--ink); }
.kb-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 3px 0; }
.kb-name { cursor: pointer; flex: 1; line-height: 1.5; }
.kb-name:hover { color: var(--primary); }
.kb-badge { font-size: 12px; margin-left: 4px; }
.kb-children { margin-left: 8px; border-left: 2px solid var(--line); padding-left: 10px; }
.kb-collapsed > .kb-children { display: none; }
.kb-toggle { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; color: var(--muted); font-size: 11px; cursor: pointer; user-select: none; transition: transform .15s; transform: rotate(90deg); }
.kb-collapsed > .kb-row .kb-toggle { transform: rotate(0deg); }
.kb-tabs { display: flex; gap: 6px; margin: 8px 0 6px; }
.kb-tab { flex: 1; padding: 6px 4px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--muted); }
.kb-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.kb-bar { display: flex; gap: 6px; align-items: center; margin: 4px 0 8px; }
.kb-search { flex: 1; box-sizing: border-box; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; min-width: 0; }
.kb-subject-filter { padding: 5px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: 12px; color: var(--ink); cursor: pointer; max-width: 110px; }
/* ---------- 知识库：卡片 ---------- */
.kb-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 12px 0;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.kb-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.06); }
.kb-card h4 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.kb-summary { color: var(--muted); margin: 6px 0 2px; line-height: 1.5; }
.kb-detail-head { margin-bottom: 16px; }
.kb-detail-head h3 { margin: 0; font-size: 20px; line-height: 1.4; color: var(--ink); }

/* 速记卡 */
.kb-formula {
  overflow-x: auto;
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
}
.kb-f-line { margin: 8px 0; text-align: center; padding: 6px 0; }
.kb-f-line:empty::before { content: "（无核心公式）"; color: var(--muted); font-size: 13px; }

/* 例题 */
.kb-examples { display: flex; flex-direction: column; gap: 8px; }
.kb-ex {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  padding: 10px 12px;
  overflow: hidden;
}
.kb-ex[open] { border-left: 3px solid var(--primary); }
.kb-ex summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kb-ex summary::-webkit-details-marker { display: none; }
.kb-ex summary::before {
  content: "▶";
  font-size: 10px;
  color: var(--muted);
  transition: transform .15s;
}
.kb-ex[open] summary::before { transform: rotate(90deg); }
.kb-ex-q { margin: 8px 0; color: var(--ink); line-height: 1.6; }
.kb-ex-a {
  background: var(--card);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  margin: 8px 0 2px;
  line-height: 1.6;
}

/* 讲义正文（Markdown） */
.kb-body {
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink);
}
.kb-body h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--primary);
}
.kb-body h3:first-child { margin-top: 0; }
.kb-body h4, .kb-body h5, .kb-body h6 {
  font-size: 15px;
  font-weight: 600;
  margin: 18px 0 8px;
  color: var(--ink);
}
.kb-body p { margin: 10px 0; }
.kb-body ul, .kb-body ol {
  padding-left: 1.6em;
  margin: 10px 0;
}
.kb-body li { margin: 6px 0; }
.kb-body li > p { margin: 0; }
.kb-body strong { color: var(--primary); font-weight: 600; }
.kb-body table { width: 100%; border-collapse: collapse; font-size: 13px; }
.kb-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 12px 0;
}
.kb-body th, .kb-body td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.kb-body th {
  background: var(--bg);
  font-weight: 600;
  color: var(--ink);
}
.kb-body tr:nth-child(even) td { background: rgba(0,0,0,0.02); }
.kb-body blockquote {
  border-left: 4px solid var(--primary);
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 0 10px 10px 0;
  color: var(--muted);
}
.kb-body hr {
  margin: 18px 0;
  border: none;
  border-top: 1px solid var(--line);
}
.kb-body code {
  background: var(--bg);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

/* 讲义中的高亮块（易错点/注意/关键） */
.kb-pitfall, .kb-note {
  border-radius: 10px;
  padding: 12px 14px;
  margin: 14px 0;
}
.kb-pitfall {
  background: rgba(229, 69, 69, 0.06);
  border: 1px solid rgba(229, 69, 69, 0.14);
  border-left: 4px solid var(--danger);
}
.kb-note {
  background: rgba(47, 107, 255, 0.06);
  border: 1px solid rgba(47, 107, 255, 0.14);
  border-left: 4px solid var(--primary);
}
.kb-pitfall-title, .kb-note-title {
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kb-pitfall-title { color: var(--danger); }
.kb-note-title { color: var(--primary); }
.kb-pitfall ul, .kb-note ul, .kb-pitfall ol, .kb-note ol {
  margin: 0;
  padding-left: 1.4em;
}
.kb-pitfall li, .kb-note li { margin: 4px 0; }

/* 左侧树（已有） */
.kb-stage { background: rgba(47,107,255,0.06); border-radius: 8px; font-weight: 600; padding: 5px 8px; margin: 4px 0; border: 1px solid rgba(47,107,255,0.12); }
.kb-leaf { font-weight: 400; padding: 3px 0 3px 2px; margin: 1px 0; }
.kb-leaf .kb-name { font-size: 13px; }
.rel-kp { margin: 4px 0 8px; }
.rel-kp summary { cursor: pointer; font-weight: 600; }

/* 深色模式补充 */
:root[data-theme="dark"] .kb-body tr:nth-child(even) td { background: rgba(255,255,255,0.03); }
:root[data-theme="dark"] .kb-ex { background: var(--card); }
:root[data-theme="dark"] .kb-ex-a { background: rgba(255,255,255,0.04); }

/* ============ 单词本 / 单词学习（P1，复用错题 study 视觉） ============ */
.subbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.subbar .back { background: none; border: none; color: var(--primary); font-size: 15px; cursor: pointer; }
.subbar .subtitle { font-weight: 700; }
.word-stat-row { display: flex; gap: 12px; margin: 14px 0; }
.word-stat { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.word-stat .ws-num { font-size: 24px; font-weight: 800; color: var(--primary); }
.word-stat .ws-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.word-list { display: flex; flex-direction: column; gap: 10px; }
.word-list-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.word-list-item:active { transform: scale(0.99); }
.word-list-item .wl-main { flex: 1; min-width: 0; }
.word-list-item .wl-name { font-weight: 700; font-size: 16px; }
.word-list-item .wl-name::before { content: "🌐 "; }
.word-list-item.wl-custom .wl-name::before { content: "👤 "; }
.word-list-item .wl-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.word-list-item .wl-arrow { color: var(--muted); font-size: 20px; }
.study-head { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.study-bar { flex: 1; height: 8px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.study-bar > i { display: block; height: 100%; background: var(--primary); border-radius: 6px; transition: width .3s; }
.study-bar-num { font-size: 12px; color: var(--muted); white-space: nowrap; }
.study-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px 18px; box-shadow: 0 4px 16px rgba(0,0,0,.06); text-align: center; max-width: 560px; margin: 0 auto; }
:root[data-theme="dark"] .study-card { box-shadow: 0 4px 16px rgba(0,0,0,.4); }
.study-card .term { font-size: 32px; font-weight: 800; letter-spacing: .5px; word-break: break-word; }
.study-card .term .audio-btn { font-size: 18px; vertical-align: middle; margin-left: 8px; }
.study-card .phon { color: var(--muted); margin-top: 8px; font-size: 15px; }
.study-card .pos { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--primary); border: 1px solid var(--primary); border-radius: 6px; padding: 1px 8px; }
.study-card .meaning { font-size: 18px; margin-top: 14px; line-height: 1.6; }
.study-card .examples { margin-top: 14px; text-align: left; border-top: 1px dashed var(--line); padding-top: 12px; }
.study-card .examples .ex { font-size: 14px; line-height: 1.55; margin: 6px 0; }
.study-card .examples .ex .en { font-weight: 600; }
.study-card .examples .ex .zh { color: var(--muted); }
.audio-btn { cursor: pointer; user-select: none; }
.audio-btn:active { opacity: .6; }
.grade-row { display: flex; gap: 10px; margin-top: 18px; }
.grade-row .btn { flex: 1; }
.btn-know { background: #e7f7ec; color: #1a8a3c; border: 1px solid #bfe8cb; }
.btn-vague { background: #fff4e0; color: #b9791a; border: 1px solid #f3dcaa; }
.btn-forgot { background: #fdeaea; color: #c33; border: 1px solid #f3c4c4; }
:root[data-theme="dark"] .btn-know { background: #16331f; color: #7fe0a0; border-color: #234d33; }
:root[data-theme="dark"] .btn-vague { background: #382c12; color: #e0b060; border-color: #5a451d; }
:root[data-theme="dark"] .btn-forgot { background: #3a1818; color: #f09090; border-color: #5a2424; }
.flip-btn { margin-top: 16px; }
.spell-prompt { font-size: 18px; line-height: 1.6; text-align: center; }
.spell-phon { color: var(--muted); font-size: 14px; text-align: center; margin: 4px 0 16px; }
.spell-input { width: 100%; box-sizing: border-box; padding: 14px; font-size: 20px; border: 2px solid var(--line); border-radius: 12px; text-align: center; background: var(--card); color: inherit; max-width: 560px; margin: 0 auto; }
.spell-input:focus { outline: none; border-color: var(--primary); }
.spell-result { margin-top: 14px; text-align: center; font-size: 15px; line-height: 1.6; }
.spell-result.ok { color: #1a8a3c; }
.spell-result.no { color: #c33; }
.spell-result .correct { font-weight: 800; }
:root[data-theme="dark"] .spell-result.ok { color: #7fe0a0; }
:root[data-theme="dark"] .spell-result.no { color: #f09090; }
.mode-select { display: flex; gap: 10px; margin: 16px 0; }
.mode-select .mode-opt { flex: 1; padding: 14px 10px; border: 1px solid var(--line); border-radius: 12px; text-align: center; font-size: 14px; background: var(--card); cursor: pointer; }
.mode-select .mode-opt.active { border-color: var(--primary); background: rgba(37,99,235,.08); color: var(--primary); font-weight: 700; }
.study-start-btn { margin-top: 10px; }
.study-done { text-align: center; padding: 40px 20px; }
.study-done .big { font-size: 40px; }
.study-done .done-title { font-size: 20px; font-weight: 800; margin: 12px 0 6px; }
.study-done .done-sub { color: var(--muted); margin-bottom: 20px; }

/* === 单词 P2：工具行 / 词单操作 / 错词本 === */
.word-tools { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.word-tools .btn { flex: 1; min-width: 120px; }
.wl-acts { display: flex; gap: 6px; margin-left: 8px; flex-wrap: wrap; justify-content: flex-end; }
.wl-acts .act { font-size: 12px; padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; }
.wl-acts .act.danger { color: #c33; border-color: #e3b3b3; }
.wl-acts .act:active { opacity: .6; }
.word-list-item.wl-custom { flex-wrap: wrap; }
.spell-phon { color: var(--muted); font-size: 14px; text-align: center; margin-bottom: 16px; }
.recall-hint, .dict-hint {
  font-size: 13px; color: var(--muted); margin-top: 10px; padding: 6px 10px;
  background: var(--bg); border-radius: 8px; border: 1px dashed var(--line); text-align: left;
}
.audio-only { margin: 14px 0; }
.btn-know { background: #1a8a3c; border-color: #1a8a3c; color: #fff; }
.btn-vague { background: #c79100; border-color: #c79100; color: #fff; }
.btn-forgot { background: #c33; border-color: #c33; color: #fff; }
:root[data-theme="dark"] .btn-know { background: #2e9e57; border-color: #2e9e57; }
:root[data-theme="dark"] .btn-vague { background: #d9a400; border-color: #d9a400; }
:root[data-theme="dark"] .btn-forgot { background: #e05a5a; border-color: #e05a5a; }
.weak-list { display: flex; flex-direction: column; gap: 8px; }
.weak-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.weak-item .weak-term { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.weak-item .weak-meta { font-size: 12px; color: var(--muted); }
.weak-imp-item { display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.weak-imp-item input { width: 18px; height: 18px; }
.weak-imp-item .weak-term { font-weight: 600; }
#weak-list .muted { display: block; padding: 8px 2px; }

/* ===== P3：复习单词区 / 统计看板 / 本题单词 ===== */
.review-words { border-top: 1px dashed var(--line); padding-top: 12px; }
.rw-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rw-head .muted { font-size: 13px; }
.rw-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.word { background: #eef5ff; color: #2b6cff; border: 1px solid #d4e4ff; }
.bulk-box { margin: 12px 0 4px; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; }
.bulk-box summary { cursor: pointer; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.bulk-box textarea { width: 100%; box-sizing: border-box; min-height: 90px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.stat-rate { margin: 6px 0 10px; font-size: 14px; }
.stat-bars { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: #f0f2f5; }
.stat-seg { height: 100%; }
.stat-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
.stat-legend span { white-space: nowrap; }
.daily-bars { display: flex; align-items: flex-end; gap: 4px; height: 72px; padding: 4px 0; overflow-x: auto; }
.db-cell { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 22px; }
.db-bar { width: 14px; background: linear-gradient(180deg, #4f9d7, #2b6cff); border-radius: 3px 3px 0 0; min-height: 1px; }
.db-d { font-size: 9px; color: var(--muted); margin-top: 2px; transform: rotate(-30deg); white-space: nowrap; }
.modes { display: flex; flex-wrap: wrap; gap: 6px; }
.top-mistakes { display: flex; flex-direction: column; gap: 6px; }
.tw-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.tw-row .audio-btn { flex: 0 0 auto; }
.tw-row b { color: #2b6cff; }
.tw-term { flex: 0 0 auto; }
.qword { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.qword .audio-btn { flex: 0 0 auto; }
.qword b { color: #2b6cff; }

/* ============ AI 辅导（tutor） ============ */
.tutor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 600; }
.tutor-sessions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.tutor-sess { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--bg-soft); }
.tutor-sess:hover { border-color: var(--accent, #2b6cff); }
.tutor-sess .ts-title { font-weight: 600; }
.tutor-sess .ts-meta { font-size: 12px; margin-top: 2px; }
.tutor-chat { max-height: 56vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 8px; }
.tm { max-width: 86%; padding: 9px 12px; border-radius: 12px; line-height: 1.55; font-size: 14px; word-break: break-word; }
.tm.user { align-self: flex-end; background: var(--accent, #2b6cff); color: #fff; border-bottom-right-radius: 3px; }
.tm.ai { align-self: flex-start; background: var(--bg-soft); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.tm.ai.err { background: #fff3f3; color: #c0392b; border-color: #f0c5c5; }
.tm.ai.loading { color: var(--muted); font-style: italic; }
.tutor-input { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.tutor-input textarea { flex: 1; resize: vertical; min-height: 44px; }

/* ===== 数据导出 / 备份 ===== */
.export-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 6px 0 10px; }
.export-row label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.export-row select { min-width: 220px; }

/* ===== 复习提醒横幅 ===== */
.reminder-banner { display: flex; align-items: center; gap: 12px; margin: 12px auto; max-width: 1100px; padding: 12px 16px; background: linear-gradient(90deg, #fff4e0, #fff9f0); border: 1px solid #f2d29a; border-radius: 12px; color: #8a5a00; }
.reminder-banner.hidden { display: none; }
.reminder-banner .rb-ic { font-size: 20px; }
.reminder-banner .rb-text { flex: 1; font-weight: 600; }
.reminder-banner .btn.mini { padding: 5px 14px; font-size: 13px; }
.reminder-banner .rb-close { background: none; border: none; font-size: 20px; line-height: 1; cursor: pointer; color: #b07d2a; padding: 0 4px; }

/* ===== 排行榜 / 学习小组 ===== */
.lb-controls { display: flex; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.lb-list { display: flex; flex-direction: column; gap: 4px; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 8px; background: var(--bg-soft); }
.lb-row.me { background: #eaf1ff; border: 1px solid #b9cffb; }
.lb-rank { width: 28px; text-align: center; font-weight: 700; }
.lb-name { flex: 1; }
.lb-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-hint { margin-top: 8px; }
.group-actions { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; align-items: center; }
.group-actions input { max-width: 200px; }
.group-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.group-item .gi-name { font-weight: 600; }
.group-item .gi-code code { background: var(--bg-soft); padding: 1px 6px; border-radius: 4px; }

/* ===== 汉字字卡 / 报默写 / 笔顺描红 ===== */
.hz-grades { display: flex; gap: 6px; flex-wrap: wrap; }
.hz-grade { border: 1px solid var(--line); background: var(--bg); color: var(--muted); cursor: pointer;
  padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.hz-grade i { font-style: normal; opacity: .7; margin-left: 3px; }
.hz-grade.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.hz-progress { display: flex; gap: 6px; flex-wrap: wrap; }
.hz-progress .chip { margin: 0; }

.hz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
.hz-unit { margin-bottom: 18px; }
.hz-unit-h { font-size: 15px; font-weight: 700; color: var(--ink); margin: 4px 0 10px; padding-left: 10px; border-left: 3px solid var(--primary); }
.hz-lesson { margin: 10px 0; }
.hz-lesson-h { font-size: 13px; color: var(--muted); margin: 6px 0 8px; font-weight: 600; }
.hz-lesson .hz-grid { margin-bottom: 4px; }
.hz-cell { position: relative; aspect-ratio: 1 / 1; border: 1px solid var(--line); background: var(--card);
  border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; padding: 2px; transition: border-color .15s, transform .1s; }
.hz-cell:hover { border-color: var(--primary); transform: translateY(-1px); }
.hz-cell .hz-c { font-size: 34px; line-height: 1.1; font-weight: 700; color: var(--ink); }
.hz-cell .hz-p { font-size: 12px; color: var(--muted); margin-top: 3px; }
.hz-cell.done .hz-c { color: var(--primary); }
.hz-cell.done { border-color: #b9d2ff; background: rgba(47,107,255,.06); }
.hz-cell .hz-ok { position: absolute; top: 4px; right: 6px; font-size: 12px; color: var(--primary); }
/* 会认字：虚线边框 + 角标"认"（孩子知道这个字还不用写） */
.hz-cell.is-read { border-style: dashed; border-color: #d4d4d4; background: #fafafa; }
.hz-cell.is-read .hz-c { color: #888; }
.hz-cell .hz-tag { position: absolute; top: 4px; left: 6px; font-size: 11px; color: #999; background: #eee; border-radius: 3px; padding: 0 4px; }

.hz-writer { width: 240px; height: 240px; max-width: 80vw; margin: 0 auto; background:
  repeating-linear-gradient(0deg, transparent 0 31px, #eef1f6 31px 32px),
  repeating-linear-gradient(90deg, transparent 0 31px, #eef1f6 31px 32px);
  border: 1px solid var(--line); border-radius: 12px; }
.hanzi-panel .hz-top { display: flex; gap: 16px; align-items: center; margin: 4px 0 14px; }
.hz-meta { flex: 1; min-width: 0; }
.hz-pinyin { font-size: 22px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.hz-line { font-size: 14px; color: var(--muted); margin: 3px 0; }
.hz-line b { color: var(--ink); }
.hz-acts { display: flex; gap: 8px; margin-bottom: 12px; }
.hz-mean { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
.hz-mean summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.hz-mean-body { font-size: 15px; line-height: 1.6; margin-top: 8px; }
.hz-words { margin-bottom: 12px; }
.hz-words h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.hz-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.hz-foot { display: flex; gap: 10px; margin-top: 8px; }
.hz-foot .btn { flex: 1; }

.dict-box { text-align: center; padding: 20px 8px; }
.dict-step { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.dict-step b { color: var(--primary); }
.dict-speak { width: 96px; height: 96px; border-radius: 50%; border: none; background: var(--primary); color: #fff;
  font-size: 32px; cursor: pointer; box-shadow: 0 6px 16px rgba(47,107,255,.35); margin-bottom: 12px; }
.dict-speak:active { transform: scale(.96); }
.dict-pinyin { font-size: 28px; font-weight: 700; color: var(--ink); margin-bottom: 14px; }
.dict-acts { margin-top: 8px; }
.dict-acts .btn.block { display: block; width: 100%; max-width: 320px; margin: 0 auto; }
.dict-answer { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.dict-char { font-size: 60px; font-weight: 700; color: var(--primary); line-height: 1.1; }
.dict-mean { font-size: 14px; color: var(--muted); margin: 8px 0 16px; line-height: 1.6; }
.dict-self { display: flex; gap: 10px; justify-content: center; }
.dict-self .btn { flex: 1; max-width: 160px; }

.trace-box { text-align: center; padding: 20px 8px; }
.trace-step { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.trace-step b { color: var(--primary); }
.trace-writer { width: 260px; height: 260px; max-width: 82vw; }
.trace-acts { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.trace-acts .btn { flex: 1; max-width: 160px; }

.study-done { text-align: center; padding: 24px 8px; }
.study-done .big { font-size: 56px; margin: 12px 0 8px; }
.study-done .done-title { font-weight: 700; font-size: 18px; margin-bottom: 16px; }
.study-done .btn { margin: 0 auto; display: block; }

.poem-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }
.poem-toolbar select,
.poem-toolbar input { width: auto; margin-top: 0; flex-shrink: 0; }
.poem-toolbar input { flex: 1 1 160px; min-width: 0; }
@media (max-width: 720px) {
  .poem-toolbar { flex-wrap: wrap; }
  .poem-toolbar select { flex: 1 1 calc(50% - 8px); }
  .poem-toolbar input { flex: 1 1 100%; }
}

/* ===== 化学元素周期表 ===== */
:root {
  --el-alkali: #FBE3D0; --el-alkali-b: #E0A878;
  --el-alkaline: #FCEFCF; --el-alkaline-b: #E3BE6A;
  --el-transition: #DCE7FB; --el-transition-b: #7FA3DD;
  --el-post: #D9EFE2; --el-post-b: #6FB98C;
  --el-metalloid: #E6E1F2; --el-metalloid-b: #9A8FD6;
  --el-nonmetal: #D8EFF4; --el-nonmetal-b: #5FB6C4;
  --el-halogen: #F6DCE8; --el-halogen-b: #D07BA6;
  --el-noble: #E9E0F4; --el-noble-b: #9B82D0;
  --el-fblock: #F3DAC9; --el-fblock-b: #D69A6E;
}
:root[data-theme="dark"] {
  --el-alkali: #3a2a1c; --el-alkali-b: #C98F5C;
  --el-alkaline: #38301a; --el-alkaline-b: #C9A955;
  --el-transition: #1e2c45; --el-transition-b: #6E93D6;
  --el-post: #1c3328; --el-post-b: #5FA77E;
  --el-metalloid: #2c2740; --el-metalloid-b: #8C7FCB;
  --el-nonmetal: #173035; --el-nonmetal-b: #54A6B4;
  --el-halogen: #3a2330; --el-halogen-b: #C06F9A;
  --el-noble: #2a2240; --el-noble-b: #8C73C4;
  --el-fblock: #382a20; --el-fblock-b: #C98C5C;
}
.el-grid {
  display: grid;
  grid-template-columns: repeat(18, var(--el-cell, 46px));
  gap: 3px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.el-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 0.5px solid var(--cc-b);
  background: var(--cc-bg);
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 1px;
  transition: transform .08s ease, box-shadow .08s ease;
  color: #1f2937;
}
.el-cell:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.el-cell.active { outline: 2px solid var(--primary); outline-offset: -1px; }
:root[data-theme="dark"] .el-cell { color: #e2e8f0; }
.el-num { position: absolute; top: 1px; left: 3px; font-size: calc(var(--el-cell, 46px) * 0.18); opacity: .65; line-height: 1; }
.el-sym { font-size: calc(var(--el-cell, 46px) * 0.32); font-weight: 600; line-height: 1; }
.el-name { font-size: calc(var(--el-cell, 46px) * 0.18); opacity: .8; line-height: 1.1; margin-top: 1px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.el-detail { padding: 16px 18px; }
.el-detail .ed-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.el-detail .ed-num { font-size: 26px; font-weight: 600; color: var(--cc-b); }
.el-detail .ed-sym { font-size: 22px; font-weight: 600; }
.el-detail .ed-name { font-size: 15px; color: var(--muted); }
.el-detail hr { border: none; border-top: 0.5px solid var(--line); margin: 12px 0; }
.el-detail .ed-row { font-size: 14px; margin: 6px 0; }
.el-detail .ed-row b { color: var(--muted); font-weight: 400; margin-right: 6px; }
.el-detail .ed-note { font-size: 14px; line-height: 1.7; color: var(--ink); margin-top: 10px; }
.el-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.el-legend .lg { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
.el-legend .lg .sw { width: 12px; height: 12px; border-radius: 3px; border: 0.5px solid var(--cc-b); background: var(--cc-bg); }
.el-legend .lg.active { color: var(--primary); font-weight: 600; }

/* 元素周期表 v2：突出搜索 + chips 高亮分类 + Bohr 模型 */
.el-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}
.el-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 93, 255, .12);
}
.el-search svg.ic {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}
.el-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--ink);
  padding: 0;
  width: auto;
  min-width: 0;
}
.el-search input::placeholder { color: var(--muted); }

.el-cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.el-cat-chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: all .15s ease;
}
.el-cat-chips .chip .sw {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--cc-bg);
  border: 0.5px solid var(--cc-b);
}
.el-cat-chips .chip.all { background: var(--card); }
.el-cat-chips .chip:hover { transform: translateY(-1px); }
.el-cat-chips .chip.active {
  background: var(--cc-bg);
  border-color: var(--cc-b);
  color: var(--cc-b);
  font-weight: 600;
}
.el-cat-chips .chip.active .sw { border-width: 1.5px; }

.el-table {
  --el-cell: 46px;
  display: grid;
  grid-template-columns: 22px 1fr;
  grid-template-rows: 18px 1fr;
  gap: 5px;
}
.el-corner { grid-column: 1; grid-row: 1; }
/* 滚动/平移容器：列头与网格同处一个滚动区，列头随网格一起移动，永不脱节
   居中策略：justify/align-content: safe center —— 内容比容器小则居中（以一边为基准、另一边居中），
   比容器大则回退到起点（拖拽平移从顶部开始、不会裁切）。
   平移方式：CSS transform（不再依赖 native scroll），确保内容既能缩放也能上下左右拖动；
   配合 scrollbar-width: none 完全去掉滚动条。 */
.el-scroll {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-auto-rows: max-content;
  justify-content: safe center;       /* 水平：内容有余量时居中、溢出时回退起点（左对齐，符合阅读顺序） */
  align-content: start;             /* 垂直：永远贴顶（紧贴 .el-col-head 下沿，无空隙）。fix：缩小后 col-head 与网格错开 */
  min-width: 0;
  /* native overflow:hidden（panning 用 transform，不用 scrollbar） */
  overflow: hidden;
  cursor: grab;
  touch-action: none;            /* 全权托管：自实现缩放/平移 */
  overscroll-behavior: contain;
  scrollbar-width: none;         /* Firefox */
  -ms-overflow-style: none;      /* IE/旧 Edge */
}
.el-scroll::-webkit-scrollbar { display: none; }  /* Chrome/Safari */
.el-scroll.is-panning { cursor: grabbing; }
.el-scroll:fullscreen { display: none; } /* 不再以 .el-scroll 为全屏目标；保留规则以避免样式裸奔 */
.el-col-head {
  grid-column: 2;
  grid-row: 1;
  flex: 0 0 auto;
  width: max-content;
  display: grid;
  grid-template-columns: repeat(18, var(--el-cell, 46px));
  justify-content: safe center;     /* 与 .el-scroll 的水平对齐同步：缩小后族号与列仍对齐 */
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  align-items: center;
  overflow: hidden;                 /* 溢出（pan 时）裁切、不影响 .el-grid 的 translate */
}
.el-row-head {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(7, var(--el-cell, 46px)) 12px repeat(2, var(--el-cell, 46px));
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
  align-items: center;
  justify-items: center;
  align-content: start;                /* 与 .el-scroll 同策略：缩小时不居中，与 .el-col-head 一起贴顶 */
  will-change: transform;
}
.el-row-head .lbl-f { font-size: 10px; opacity: .8; }

.el-grid {
  flex: 1 1 auto;
  min-width: 0;
  width: max-content;
  display: grid;
  grid-template-columns: repeat(18, var(--el-cell, 46px));
  grid-template-rows: repeat(7, var(--el-cell, 46px)) 12px repeat(2, var(--el-cell, 46px));
  gap: 3px;
  padding-bottom: 6px;
}
.el-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 0.5px solid var(--cc-b);
  background: var(--cc-bg);
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 1px;
  transition: transform .08s ease, box-shadow .08s ease, opacity .15s ease;
  color: #1f2937;
}
.el-cell:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.el-cell.active { outline: 2px solid var(--primary); outline-offset: -1px; z-index: 1; }
.el-cell.in-cat {
  box-shadow: 0 0 0 2px var(--cc-b), 0 4px 14px rgba(0,0,0,.2);
  transform: translateY(-1px);
  z-index: 2;
}
.el-cell.dim { opacity: .18; }
.el-cell.dim:hover { opacity: .55; }
:root[data-theme="dark"] .el-cell { color: #e2e8f0; }
.el-num { position: absolute; top: 1px; left: 3px; font-size: calc(var(--el-cell, 46px) * 0.18); opacity: .65; line-height: 1; }
.el-sym { font-size: calc(var(--el-cell, 46px) * 0.32); font-weight: 600; line-height: 1; }
.el-name { font-size: calc(var(--el-cell, 46px) * 0.18); opacity: .8; line-height: 1.1; margin-top: 1px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 详情面板 v3：hero(周期表格子瓦片) + 卡片网格(概览/原子结构/大小/深入了解) */
.el-detail { padding: 0; overflow: visible; scroll-margin-top: 56px; }
.el-detail .ed-hero {
  position: sticky;
  top: 56px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--cc-bg) 0%, var(--card) 72%);
  border-bottom: 1px solid var(--cc-b);
  border-radius: var(--radius) var(--radius) 0 0;
  transition: padding .2s ease, gap .2s ease;
}
.el-detail .ed-hero .ed-tile {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  border-radius: 12px;
  background: var(--cc-bg);
  border: 1.5px solid var(--cc-b);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--cc-b); line-height: 1;
}
.el-detail .ed-hero .ed-tile-num { font-size: 10px; font-weight: 600; opacity: .85; margin-bottom: 2px; }
.el-detail .ed-hero .ed-tile-sym { font-size: 26px; font-weight: 800; letter-spacing: -1px; }
.el-detail .ed-hero .ed-meta { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.el-detail .ed-hero .ed-name-big {
  font-size: 20px; font-weight: 600; color: var(--ink);
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
.el-detail .ed-hero .ed-name-big .pinyin {
  font-size: 13px; color: var(--muted); font-weight: 400;
  letter-spacing: .5px; margin-left: 2px;
  font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}
.el-detail .ed-hero .ed-name-big .en { font-size: 14px; color: var(--muted); font-weight: 400; }
.el-detail .ed-hero .ed-num-big { font-size: 12px; color: var(--cc-b); font-weight: 700; letter-spacing: 1px; }
.el-detail .ed-hero .ed-cat-badge {
  display: inline-block; align-self: flex-start;
  padding: 3px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--cc-b); color: var(--cc-b);
  font-size: 12px; font-weight: 600;
}
.el-detail .ed-hero.shrink { padding: 7px 18px; gap: 10px; }
.el-detail .ed-hero.shrink .ed-tile { width: 40px; height: 40px; border-radius: 9px; }
.el-detail .ed-hero.shrink .ed-tile-sym { font-size: 18px; }
.el-detail .ed-hero.shrink .ed-name-big { font-size: 15px; }
.el-detail .ed-hero.shrink .ed-name-big .en,
.el-detail .ed-hero.shrink .ed-name-big .pinyin,
.el-detail .ed-hero.shrink .ed-num-big,
.el-detail .ed-hero.shrink .ed-cat-badge { display: none; }

.el-detail .ed-body { padding: 16px 18px 24px; }
.el-detail .ed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 16px;
  align-items: start;
}
.el-detail .ed-read { grid-column: 1 / -1; }

.el-detail .ed-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px 15px 13px;
  min-width: 0;
}
.el-detail .ed-card-h {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--ink);
  letter-spacing: .5px; margin-bottom: 12px;
}
.el-detail .ed-card-h .ed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cc-b); flex: 0 0 auto; }

.el-detail .ed-sub { margin-top: 14px; }
.el-detail .ed-sub:first-of-type { margin-top: 0; }
.el-detail .ed-sub-h {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px;
}
.el-detail .ed-sub-h .ed-sub-hint { font-size: 11px; color: var(--muted); opacity: .8; font-weight: 400; }
.el-detail .ed-sub-h .orb-fill-btn {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--cc-b); background: var(--cc-bg); color: var(--cc-b);
  cursor: pointer; font-weight: 600;
}

.el-detail .ed-bohr {
  display: flex; align-items: center; justify-content: center;
  width: 100%; aspect-ratio: 1 / 1; height: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
}
.el-detail .ed-bohr svg { width: 100%; height: 100%; }

.el-detail .ed-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.el-detail .ed-facts .fact {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
}
.el-detail .ed-facts .fact .lbl { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.el-detail .ed-facts .fact .val { font-size: 15px; color: var(--ink); font-weight: 500; word-break: break-all; }

.el-detail .ov-size { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.el-detail .ov-size-h { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.el-detail .ov-size-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.el-detail .ov-size-item { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.el-detail .ov-size-dot { display: block; width: var(--d); height: var(--d); border-radius: 50%; background: var(--primary-soft); border: 2px solid var(--primary); }
.el-detail .ov-size-item.cur .ov-size-dot { background: var(--primary); }
.el-detail .ov-size-lab { font-size: 11px; color: var(--muted); white-space: nowrap; }
.el-detail .ov-size-item.cur .ov-size-lab { color: var(--ink); font-weight: 600; }

.el-detail .ed-read-block { padding: 11px 0; border-top: 1px solid var(--line); }
.el-detail .ed-read-block:first-of-type { padding-top: 0; border-top: none; }
.el-detail .ed-read-label { font-size: 12px; font-weight: 700; color: var(--cc-b); letter-spacing: .5px; margin-bottom: 4px; }
.el-detail .ed-read-body { font-size: 14px; line-height: 1.75; color: var(--ink); white-space: pre-line; }
.el-detail .ed-empty { color: var(--muted); font-size: 13px; font-style: italic; }

/* ===== 物态热力图控制条 ===== */
.el-phase-bar { gap: 8px; }
.el-phase-bar .btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.el-temp { display: flex; align-items: center; gap: 8px; }
.el-temp input[type=range] { width: 220px; accent-color: var(--primary); }
.el-temp #el-temp-val { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 64px; }
.el-zoom { display: flex; align-items: center; gap: 6px; }
.el-zoom input[type=range] { width: 120px; accent-color: var(--primary); }
.el-zoom #el-zoom-val { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); min-width: 38px; text-align: right; }
.el-legend { display: flex; gap: 12px; align-items: center; font-size: 12px; color: var(--muted); }
.el-legend span { display: inline-flex; align-items: center; gap: 5px; }
.el-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 0.5px solid rgba(0,0,0,.15); }

/* ===== 3D 立体周期表（嵌入表区，作为 2D/3D 切换） ===== */
.el-stage {
  position: relative;
  /* 2D/3D 公用的固定视口：非全屏给定高度，表格与 3D 都在其中缩放/平移 */
  height: clamp(360px, 58vh, 680px);
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.el-stage .el-table { height: 100%; }
.el-stage .el-scroll { height: 100%; }
.el-stage .el-3d-area {
  position: absolute; inset: 0;
  background: #0B1220;
  border-radius: 8px;
  overflow: hidden;
  z-index: 1;
}
.el-stage .el-3d-area canvas { display: block; width: 100% !important; height: 100% !important; }
.el-stage.mode-3d > .el-table { visibility: hidden; pointer-events: none; }
#el-3d-btn[data-mode="3d"] { background: var(--primary); color: #fff; border-color: var(--primary); }
.el-3d-area .el-3d-hint {
  position: absolute; bottom: 8px; left: 8px; right: 8px;
  text-align: center; color: rgba(255,255,255,.55); font-size: 12px; pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}

/* ===== 元素周期表整体全屏（含工具栏 + 表格 + 详情） ===== */
.el-widget:fullscreen, .el-widget:-webkit-full-screen {
  background: var(--bg);
  width: 100vw; height: 100vh;
  padding: 14px 18px;
  display: flex; flex-direction: column;
  overflow: auto;
}
.el-widget:fullscreen > .card, .el-widget:-webkit-full-screen > .card { flex: 0 0 auto; }
.el-widget:fullscreen > .el-stage, .el-widget:-webkit-full-screen > .el-stage { flex: 1 1 auto; min-height: 0; margin-top: 12px; }
.el-widget:fullscreen > #el-detail, .el-widget:-webkit-full-screen > #el-detail { flex: 0 0 auto; }
.el-widget:fullscreen #el-empty, .el-widget:-webkit-full-screen #el-empty { flex: 0 0 auto; }
.el-widget:fullscreen .el-stage .el-table { height: 100%; }
.el-widget:fullscreen .el-stage .el-scroll { height: 100%; }

/* ===== 发射光谱卡片 ===== */
.el-detail .ed-spec { padding-top: 4px; }
.el-detail .ed-spec-bar { position: relative; height: 46px; border-radius: 10px; border: 1px solid var(--line); overflow: hidden;
  background: linear-gradient(180deg, #0a0a14 0%, #14142b 50%, #0a0a14 100%); }
.el-detail .ed-spec-line { position: absolute; top: -2px; bottom: -2px; width: 4px; transform: translateX(-50%); border-radius: 2px;
  box-shadow: 0 0 6px currentColor, 0 0 12px currentColor; }
.el-detail .ed-spec-scale { display: flex; justify-content: space-between; margin-top: 5px; font-size: 11px; color: var(--muted); }
.el-detail .ed-spec-flame { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.el-detail .ed-spec-flame-dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); }
.el-detail .ed-spec-flame-lbl { font-size: 13px; color: var(--ink); }

/* ===== 吸收光谱卡片 ===== */
.el-detail .ed-abs { padding-top: 4px; }
.el-detail .ed-abs-bar { position: relative; height: 46px; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; }
.el-detail .ed-abs-line { position: absolute; top: 0; bottom: 0; width: 3px; transform: translateX(-50%); background: rgba(0,0,0,.72); box-shadow: 0 0 2px rgba(0,0,0,.5); }
.el-detail .ed-abs-scale { display: flex; justify-content: space-between; margin-top: 5px; font-size: 11px; color: var(--muted); }
.el-detail .ed-abs-note { margin-top: 8px; font-size: 12px; line-height: 1.6; color: var(--muted); }
.el-detail .ed-spec-group + .ed-spec-group { margin-top: 16px; }
.el-detail .ed-spec-sub-h { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 7px; }
.el-detail .ed-spec-sub-h .ed-sub-hint { font-weight: 400; }
.el-detail .ed-ladder { background: var(--primary-soft); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.el-detail .ed-ladder svg { display: block; width: 100%; height: auto; }
.el-detail .ladder-rung { stroke: var(--muted); stroke-width: 1.5; opacity: .65; transition: stroke .15s, stroke-width .15s, opacity .15s; }
.el-detail .ladder-rung.on { stroke: var(--primary); stroke-width: 3.5; opacity: 1; animation: ladderRungPulse 1.2s ease-in-out infinite; }
.el-detail .ladder-lbl { fill: var(--muted); font-size: 10px; }
.el-detail .ladder-sub-lbl { font-family: ui-monospace, SFMono-Regular, monospace; }
.el-detail .ladder-orb-box { transition: stroke-width .15s, fill-opacity .15s, stroke-opacity .15s; }
.el-detail .ladder-orb-box.src { fill: rgba(245, 158, 11, 0.18) !important; stroke-width: 2; stroke-dasharray: 2 2; animation: ladderOrbPulse 1.2s ease-in-out infinite; }
.el-detail .ladder-orb-box.dst { fill: rgba(79, 93, 255, 0.22) !important; stroke-width: 2.4; animation: ladderOrbPulse 1.2s ease-in-out infinite; }
/* 悬停强调时，未参与本次跃迁的壳层/轨道/标签淡化（保持位置不变，只改强调） */
.el-detail .ladder-rung.dim { opacity: .16; }
.el-detail .ladder-lbl.dim { opacity: .22; }
.el-detail .ladder-orbs.dim { opacity: .16; }
.el-detail .ladder-arrow { stroke: #F59E0B; stroke-width: 2.5; }
.el-detail .ladder-arrow-lbl { fill: #F59E0B; font-size: 10px; font-weight: 600; }
/* 同壳内跃迁：参与轨道框上的「电子到达」脉冲光环（与光子弧线同步） */
.el-detail .ladder-orb-halo { pointer-events: none; }
.el-detail #ed-ladder-photon { filter: drop-shadow(0 0 4px currentColor); }
.el-detail #ed-ladder-photon-halo { filter: blur(1px); }
.el-detail .ed-trans-cap { margin-top: 6px; font-size: 12px; line-height: 1.6; color: var(--ink); min-height: 36px; }
.el-detail .ed-spec-line, .el-detail .ed-abs-line { cursor: pointer; }
@keyframes ladderRungPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}
@keyframes ladderOrbPulse {
  0%, 100% { stroke-width: 2; }
  50% { stroke-width: 3; }
}

/* 光谱说明 "?" 气泡 */
.el-detail .ed-spectrum { position: relative; }
.el-detail .ed-info-btn { margin-left: auto; width: 20px; height: 20px; flex: 0 0 auto; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card, var(--bg)); color: var(--muted); font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; line-height: 1; user-select: none; }
.el-detail .ed-info-btn.active { border-color: var(--primary); color: var(--primary); }
.el-detail .ed-info-pop { display: none; position: absolute; top: 34px; right: 0; z-index: 30; width: min(340px, 100%);
  background: var(--card, var(--bg)); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.16);
  padding: 14px 16px; font-size: 13px; line-height: 1.65; color: var(--ink); }
.el-detail .ed-info-pop.open { display: block; }
.el-detail .ed-info-pop p { margin: 0 0 9px; }
.el-detail .ed-info-pop p:last-child { margin-bottom: 0; }
.el-detail .ed-info-pop b { color: var(--primary); }

/* 轨道能级 "?" 气泡（电子层 ↔ 轨道） */
.el-detail .ed-sub.ed-sub-orb { position: relative; }
.el-detail .ed-sub-h .ed-sub-acts { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.el-detail .ed-sub-h .ed-info-btn.orb-info { margin-left: 0; }
.el-detail .ed-info-pop-orb { width: min(440px, 100%); max-height: min(72vh, 540px); overflow: auto; }
.el-detail .ed-so-svg { margin: 8px 0 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.el-detail .ed-so-cap { font-size: 11px; color: var(--muted); line-height: 1.5; margin: 0; }

/* 电子层 ↔ 轨道 关系图（HTML/CSS 渲染） */
.el-detail .ed-so { display: flex; flex-direction: column; gap: 12px; }
.el-detail .ed-so-col { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.el-detail .ed-so-col-h { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 8px; letter-spacing: .3px; }
.el-detail .ed-so-col-cap { font-size: 10px; color: var(--muted); margin-top: 6px; text-align: center; opacity: .8; }

/* 玻尔截面：同心圆 + 电子点 */
.el-detail .ed-so-bohr-wrap { display: flex; align-items: center; justify-content: center; padding: 12px 0; }
.el-detail .ed-so-bohr { position: relative; display: flex; align-items: center; justify-content: center; }
.el-detail .ed-so-bohr .ed-so-ring-bg { position: absolute; inset: 0; border: 1px dashed var(--line); border-radius: 50%; opacity: .6; }
.el-detail .ed-so-bohr .ed-so-ring { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); border-style: solid; border-width: 1px; border-radius: 50%; opacity: .55; pointer-events: none; }
.el-detail .ed-so-bohr .ed-so-ring-lbl { position: absolute; top: -2px; left: 100%; margin-left: 4px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.el-detail .ed-so-bohr .ed-so-dot { position: absolute; top: 50%; left: 50%; width: 6px; height: 6px; border-radius: 50%; box-shadow: 0 0 3px currentColor; }
.el-detail .ed-so-bohr .ed-so-nucleus { position: relative; z-index: 2; width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-d)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; box-shadow: 0 0 8px rgba(79,93,255,.45); }

/* 亚层 → 轨道方框 */
.el-detail .ed-so-shell-block { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.el-detail .ed-so-shell-block:last-child { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.el-detail .ed-so-shell-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.el-detail .ed-so-shell-name { font-size: 12px; font-weight: 700; letter-spacing: .3px; }
.el-detail .ed-so-shell-cap { font-size: 10.5px; color: var(--muted); }
.el-detail .ed-so-sub-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.el-detail .ed-so-sub-lbl { width: 22px; font-size: 11px; font-weight: 700; font-family: ui-monospace, SFMono-Regular, monospace; }
.el-detail .ed-so-boxes { display: flex; gap: 3px; }
.el-detail .ed-so-box { width: 18px; height: 18px; border: 1px solid; border-radius: 3px; display: flex; align-items: center; justify-content: center; gap: 2px; opacity: .85; }
.el-detail .ed-so-box.has { opacity: 1; }
.el-detail .ed-so-box-dot { width: 4px; height: 4px; border-radius: 50%; box-shadow: 0 0 2px currentColor; }

/* ===== 诗词模块 ===== */
.poem-grades { display: flex; gap: 6px; flex-wrap: wrap; }
.poem-grade { border: 1px solid var(--line); background: var(--bg); color: var(--muted); cursor: pointer;
  padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.poem-grade i { font-style: normal; opacity: .7; margin-left: 3px; }
.poem-grade.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.poem-progress { display: flex; gap: 6px; flex-wrap: wrap; }
.poem-list { display: grid; gap: 10px; }
.poem-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; box-shadow: var(--shadow); cursor: pointer;
  position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: start;
}
.poem-card:hover { border-color: var(--primary); transform: translateY(-1px); transition: border-color .15s, transform .1s; }
.poem-card .pc-thumb {
  width: 64px; height: 64px; border-radius: 10px;
  object-fit: cover; background: #f3f4f6; border: 1px solid var(--line);
  display: block; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.poem-card .pc-thumb-empty { background: linear-gradient(135deg, #eef2f7, #f8fafc); }
.poem-card .pc-body { min-width: 0; }
.poem-card .pc-title { font-size: 16px; font-weight: 700; }
.poem-card .pc-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.poem-card .pc-snippet { margin-top: 6px; font-size: 14px; line-height: 1.6; color: var(--ink); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.poem-card .pc-tag { position: absolute; top: 10px; right: 12px; font-size: 12px; }
/* 诗详弹窗：更宽 + 标题/作者固定在顶部，只有正文可滚动 */
/* 注：.poem-d-head 实际被注入在 #modal-body 内部，所以用 sticky 固定在滚动容器顶部 */
.poem-detail .modal-box {
  /* 桌面端随视口变宽（之前 1100px cap 偏窄，中间宽度有"空档感"） */
  max-width: min(1400px, calc(100vw - 40px));
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;        /* 自身不滚；由 #modal-body 滚动 */
  padding: 18px 20px 16px;
}
.poem-detail .modal-box.has-overflow .poem-d-illu { display: none; }  /* 内容超长时隐藏插图，给文字更多高度 */
.poem-detail .modal-box .modal-close { z-index: 4; }
.poem-detail #modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;        /* 真正滚动的是正文 */
  padding-right: 6px;
  scrollbar-width: thin;
}
.poem-detail .poem-d-head {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--card); /* 不透明，盖住滚上来的正文 */
  margin: 0 0 12px;
  padding: 0 34px 10px 0;  /* 给右上角 × 留位 */
  border-bottom: 1px solid var(--line);
}
.poem-d-head { margin-bottom: 6px; }
.poem-d-title { font-size: 22px; font-weight: 800; line-height: 1.3; }
.poem-d-illu { width: 100%; max-height: 260px; object-fit: contain; border-radius: 14px; margin: 6px 0 12px; background: linear-gradient(135deg,#f7f4ee,#efe9dd); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.poem-d-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.poem-d-acts { display: flex; gap: 8px; margin: 12px 0; }
.poem-d-acts .btn { flex: 1; min-width: 84px; gap: 6px; }
.poem-d-acts .btn .ic { width: 18px; height: 18px; flex-shrink: 0; }

/* ---- 解读弹窗：与诗详弹窗一致——宽度更宽、头部固定、正文滚动 ---- */
.poem-notes-box {
  max-width: min(900px, calc(100vw - 40px));
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.poem-notes-box .modal-head {
  flex-shrink: 0;
  margin-bottom: 0;
  padding-right: 28px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.poem-notes-box .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
}
.poem-notes-title { font-size: 18px; font-weight: 700; line-height: 1.4; color: var(--ink); }
.poem-notes-body { padding: 0; }
.poem-notes-section { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.poem-notes-section:last-child { margin-bottom: 0; }
.pn-h { font-size: 14px; font-weight: 700; color: var(--primary); margin-bottom: 4px; letter-spacing: .02em; }
.pn-body { font-size: 14px; line-height: 1.8; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.pn-body.pn-plain { white-space: pre-wrap; }
.poem-notes-empty { padding: 36px 12px; text-align: center; color: var(--muted); font-size: 14px; }
.poem-notes-empty::before { content: "📭"; display: block; font-size: 36px; margin-bottom: 8px; }
:root[data-theme="dark"] .pn-h { color: #a5b4fc; }
:root[data-theme="dark"] .poem-notes-section { background: #1e293b; border-color: #334155; }
.poem-body { font-size: 19px; line-height: 2.4; text-align: center; }
.poem-body rt { font-size: 12px; color: var(--primary); font-weight: 600; }
.poem-body .pc-line { margin: 4px 0; }
.poem-body ruby { display: inline-block; margin-right: 0.3em; }
.poem-body ruby:last-child { margin-right: 0; }
.poem-body .pc-zi { display: inline-flex; flex-direction: column; align-items: center; vertical-align: baseline; margin: 0 .14em; line-height: 1.1; }
.poem-body .pc-py { font-size: 12px; color: var(--primary); font-weight: 600; line-height: 1.2; margin-bottom: 1px; white-space: nowrap; }
.poem-body .pc-char { display: inline-block; transition: color 0.15s ease, opacity 0.15s ease; }
.poem-body.reading .pc-char { color: var(--muted); opacity: .45; }
.poem-body.reading .pc-char.read { color: var(--primary); opacity: 1; }
.poem-body.reading .pc-char.current { color: var(--primary); opacity: 1; font-weight: 700; transform: scale(1.12); }
.poem-body.recite-blur { filter: blur(9px); opacity: .2; user-select: none; -webkit-user-select: none; transition: filter 0.25s ease; }
/* 原文行内注释：点击字/词弹出小卡片 */
.poem-note-trig {
  cursor: pointer;
  text-decoration: underline dotted var(--primary);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  transition: color .15s ease, text-decoration-style .15s ease;
}
.poem-note-trig:hover, .poem-note-trig:focus-visible {
  text-decoration-style: solid;
  color: var(--primary);
  outline: none;
}
.poem-note-num {
  font-size: 0.55em;
  color: var(--primary);
  margin-left: 1px;
  font-weight: 700;
  vertical-align: super;
  line-height: 1;
  pointer-events: none;
}
.poem-note-pop {
  position: absolute;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 12px 16px;
  max-width: 360px;
  width: max-content;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 8px 24px rgba(15,23,42,.22);
  z-index: 1100;
  white-space: normal;
  word-break: break-word;
}
.poem-note-pop.hidden { display: none; }
.poem-note-pop-kw {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
  font-size: 15px;
}
.poem-note-pop-kw sup { font-size: 0.7em; margin-left: 2px; opacity: .85; }
.poem-note-pop-body { color: var(--ink); }
.poem-notes { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-top: 12px; }
.poem-notes summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.poem-notes-body { font-size: 14px; line-height: 1.7; margin-top: 8px; white-space: pre-wrap; }
.poem-score { font-size: 13px; color: var(--muted); margin-top: 8px; }
.poem-score b { color: var(--primary); font-size: 15px; }
.poem-latest { font-size: 12px; color: var(--muted); margin-top: 4px; }
.poem-recite { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 14px; }
.poem-recite .pr-status { font-size: 14px; margin: 8px 0; }
.poem-recite .pr-textarea { width: 100%; min-height: 110px; box-sizing: border-box; border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-size: 16px; line-height: 1.6; background: var(--card); color: var(--text); resize: vertical; margin: 8px 0; }
.poem-recite .pr-unsupported { font-size: 14px; color: var(--danger); line-height: 1.6; }
.poem-recite .pr-unsupported .btn { margin-top: 8px; }
.poem-recite .pr-live { font-size: 16px; line-height: 1.8; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; min-height: 44px; color: var(--text); white-space: pre-wrap; word-break: break-all; }
.poem-recite .pr-big { font-size: 40px; font-weight: 800; }
.poem-recite .pr-ok { color: #1a9c5b; }
.poem-recite .pr-no { color: #e54545; }
.poem-recite .pr-listen { color: var(--primary); font-weight: 600; }
.pr-cmp { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.pr-col { flex: 1; min-width: 240px; }
.pr-col h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.pr-text { font-size: 16px; line-height: 2; text-align: center; }
.pr-text .ok { color: #1a9c5b; font-weight: 600; }
.pr-text .no { color: var(--danger); text-decoration: underline; }
.pr-recog { font-size: 15px; line-height: 1.8; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; }
.pr-unsupported { color: var(--danger); font-size: 13px; line-height: 1.6; }

/* 背诵结果弹层（情绪价值） */
.recite-pop { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); padding: 24px; box-sizing: border-box; animation: rp-fade .2s ease; }
.recite-pop-card { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: var(--card);
  border-radius: 18px; padding: 26px 26px 20px; box-shadow: 0 20px 56px rgba(0,0,0,.35); text-align: center;
  animation: rp-pop .28s cubic-bezier(.18,.89,.32,1.28); }
.rp-emoji { font-size: 60px; line-height: 1; margin-bottom: 6px; animation: rp-bounce .6s ease; }
.rp-score { margin: 2px 0 4px; }
.rp-num { font-size: 52px; font-weight: 800; color: var(--muted); }
.rp-num.pr-ok { color: #1a9c5b; }
.rp-num.pr-no { color: #e54545; }
.rp-unit { font-size: 18px; color: var(--muted); }
.rp-msg { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 18px; }
.rp-cmp { display: flex; gap: 14px; flex-wrap: wrap; text-align: left; margin-bottom: 18px; }
.rp-cmp .pr-col { flex: 1; min-width: 200px; }
.rp-cmp .pr-col h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.rp-acts { display: flex; gap: 12px; justify-content: center; }
.rp-acts .btn { min-width: 130px; }
@keyframes rp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rp-pop { from { opacity: 0; transform: translateY(16px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes rp-bounce { 0%,100% { transform: translateY(0); } 30% { transform: translateY(-8px); } 60% { transform: translateY(-3px); } }

.hint { color: var(--muted); font-size: 13px; }

/* ===== 汉字「对对翻」趣味挑战 ===== */
.hz-game { max-width: 720px; margin: 0 auto; }
.hg-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.hg-best { font-size: 13px; color: var(--muted); }
.hg-hud { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: 14px; }
.hg-hud b { color: var(--primary); }
.hg-hud .btn { margin-left: auto; }
.hg-grid { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 520px; }
.hg-tile { perspective: 600px; background: none; border: none; padding: 0; aspect-ratio: 1 / 1; cursor: pointer; -webkit-tap-highlight-color: transparent; will-change: transform; }
.hg-tile .hg-inner { position: relative; width: 100%; height: 100%; display: block; transition: transform .4s; transform-style: preserve-3d; }
.hg-tile .hg-inner.flipped { transform: rotateY(180deg); }
.hg-face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden; font-size: 32px; font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,.12); user-select: none; }
/* 牌背面：蓝色渐变 + 波点图案 + 中心徽标 */
.hg-back {
  background-color: #2563eb;
  background-image:
    radial-gradient(rgba(255,255,255,.24) 1.6px, transparent 2px),
    radial-gradient(rgba(255,255,255,.15) 1.6px, transparent 2px),
    linear-gradient(135deg,#3b6de8,#1a4fd6);
  background-size: 20px 20px, 20px 20px, 100% 100%;
  background-position: 0 0, 10px 10px, 0 0;
  color: #fff; border: 2px solid #144bb8; font-size: 26px;
  text-shadow: 0 1px 3px rgba(0,0,0,.28);
}
.hg-back::after { content: "✦"; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 40px; opacity: .16; }
.hg-front { background: #fff; color: #1f2937; transform: rotateY(180deg); border: 2px solid #e5e7eb; }
/* 配对成功：先相向移动对碰，再消失（视觉由 JS 内联 transform 驱动） */
.hg-tile.matched { cursor: default; pointer-events: none; }
.hg-spark {
  position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  pointer-events: none; z-index: 60;
  background: radial-gradient(circle, #fff 0 28%, rgba(255,255,255,.55) 44%, rgba(255,255,255,0) 72%);
  box-shadow: 0 0 12px 6px rgba(255,255,255,.75), 0 0 24px 12px rgba(74,222,128,.5);
  animation: hgSpark .52s ease-out forwards;
}
@keyframes hgSpark {
  0% { transform: scale(0); opacity: 1; }
  55% { transform: scale(1.7); opacity: 1; }
  100% { transform: scale(3.4); opacity: 0; }
}
.hg-hint { }
.hg-hud button:disabled { opacity: .45; cursor: not-allowed; color: var(--muted); background: transparent; border-color: transparent; }
.hg-history { margin-top: 18px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; max-width: 520px; }
.hg-history-title { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.hg-history-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.hg-history-row:last-child { border-bottom: none; }
.hg-h-stars { color: #f59e0b; letter-spacing: 1px; }
.hg-h-num { color: var(--muted); font-size: 12px; }
.hg-msg { margin-top: 12px; color: var(--muted); font-size: 13px; text-align: center; }
.hg-hud.hidden, .hg-grid.hidden { display: none; }
@media (max-width: 480px) { .hg-grid { gap: 8px; } .hg-face { font-size: 24px; } }

/* =========== 🧮 乘法口诀 =========== */
.mul-table-scroll { overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.mul-table-scroll::-webkit-scrollbar { height: 6px; }
.mul-table-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.mul-table { display: flex; flex-direction: column; gap: 6px; min-width: min-content; }
.mul-row { display: flex; gap: 6px; align-items: stretch; }
.mul-cell {
  flex: 0 0 86px; min-width: 86px; padding: 8px 6px; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-variant-numeric: tabular-nums; border-radius: 10px; position: relative;
  background: rgba(var(--rc), .08); border: 1px solid rgba(var(--rc), .22); color: var(--text);
  transition: transform .12s ease, box-shadow .12s ease;
}
.mul-cell .mul-eq { font-size: 12px; opacity: .7; }
.mul-cell .mul-val { font-size: 18px; font-weight: 800; line-height: 1; }
.mul-cell.sq { background: rgba(var(--rc), .18); border-color: rgba(var(--rc), .5); box-shadow: inset 0 0 0 1.5px rgba(var(--rc), .35); }
.mul-sq { position: absolute; top: 3px; right: 5px; font-size: 9px; color: rgb(var(--rc)); }
.mul-cell:hover { transform: translateY(-2px); box-shadow: 0 5px 14px rgba(var(--rc), .28); }
.mul-axis {
  flex: 0 0 42px; min-width: 42px; border-radius: 10px; border: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; color: #fff; background: rgb(var(--rc));
}
.mul-sub { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.mul-question { text-align: center; padding: 14px 0 4px; }
.mul-big { font-size: 44px; font-weight: 800; letter-spacing: 2px; font-variant-numeric: tabular-nums; }
.mul-feedback { min-height: 24px; font-size: 15px; }
.mul-input-row input[type="number"] {
  font-size: 20px; text-align: center; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: inherit;
}
.mul-timer { color: #2563eb; font-variant-numeric: tabular-nums; }
.mul-wrong-item:last-child { border-bottom: none !important; }
.mul-question { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.mul-replay { font-size: 12px; }
.mul-mic { font-size: 18px; padding: 8px 12px; border-radius: 10px; line-height: 1; }
.mul-mic.listening { background: #dc2626; color: #fff; border-color: #dc2626; animation: mulPulse 1s infinite; }
.mul-mic.va-on { border-color: #2563eb; color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.25); }
.mul-vp-toggle.on { background: rgba(37,99,235,.12); color: #2563eb; border-color: rgba(37,99,235,.4); }
@keyframes mulPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.mul-rank-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.mul-rank-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.mul-rank-item.me { background: rgba(37,99,235,.08); border-color: rgba(37,99,235,.35); }
.mul-rank-left { width: 32px; text-align: center; font-size: 20px; }
.mul-rank-num { font-size: 14px; font-weight: 700; color: var(--muted); }
.mul-rank-info { flex: 1; min-width: 0; }
.mul-rank-name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.mul-rank-name .badge { font-size: 10px; background: #2563eb; color: #fff; padding: 2px 6px; border-radius: 999px; }
.mul-rank-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mul-rank-score { font-size: 22px; font-weight: 700; color: #2563eb; }
.mul-rank-score span { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; }
@media (max-width: 640px) {
  .mul-big { font-size: 34px; }
  .mul-cell { flex-basis: 60px; min-width: 60px; padding: 6px 3px; }
  .mul-cell .mul-eq { font-size: 10px; }
  .mul-cell .mul-val { font-size: 15px; }
  .mul-axis { flex-basis: 30px; min-width: 30px; font-size: 13px; }
  .mul-row { gap: 4px; }
  .mul-table { gap: 4px; }
}

/* 打印：只打印口诀表 */
@media print {
  body.printing-mul * { visibility: hidden !important; }
  body.printing-mul #mul-table, body.printing-mul #mul-table * { visibility: visible !important; }
  body.printing-mul #mul-table { position: absolute; left: 0; top: 0; width: 100%; }
  body.printing-mul .mul-cell { border-color: #999 !important; color: #000 !important; background: #fff !important; }
  body.printing-mul .mul-axis { border: 1px solid #999 !important; color: #000 !important; background: #eee !important; }
  body.printing-mul .mul-sq { display: none !important; }
  body.printing-mul .mul-eq { opacity: 1 !important; }
}

/* 选中态：描边图标 → 实心图标（与主题色强绑定、更醒目） */
.ic-f { fill: currentColor; stroke: none; display: none !important; }
.tab.has-f.active .ic:not(.ic-f) { display: none !important; }
.tab.has-f.active .ic-f { display: inline-block !important; }

/* ===== 元素详情：玻尔动画 / 能级图 / 半径对比 ===== */
/* 元素详情：原子结构卡片内的玻尔/能级/半径对比（布局由 .ed-grid 卡片网格统一负责） */
.bohr-ctl { display: flex; align-items: center; gap: 8px; padding: 0 2px; }
.bohr-ctl .lbl { font-size: 12px; color: var(--muted); white-space: nowrap; }
.bohr-ctl input[type="range"] { flex: 1; min-width: 0; }
.bohr-ctl .val { font-size: 12px; color: var(--muted); width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.bohr-hint { font-size: 11px; color: var(--muted); line-height: 1.5; }
.bh-orbit { cursor: pointer; }
.bh-orbit .bh-ring { fill: none; stroke: currentColor; stroke-width: 0.7; opacity: 0.4; transition: stroke-width .15s ease, opacity .15s ease; }
.bh-orbit:hover .bh-ring, .bh-orbit.hl .bh-ring { stroke-width: 1.8; opacity: 1; }
.bh-orbit .bh-e { fill: currentColor; transition: fill .15s ease; }
.bh-orbit.hl .bh-e { fill: var(--accent); }
.bh-orbit .bh-lbl { font-size: 5.5px; fill: currentColor; opacity: 0.55; pointer-events: none; }
.bh-spin { transform-origin: 60px 60px; animation: bh-rot linear infinite; }
@keyframes bh-rot { to { transform: rotate(360deg); } }
.orb-chart { display: flex; align-items: stretch; gap: 5px; height: 150px; overflow-x: auto; padding: 8px 6px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.orb-col { flex: 0 0 30px; display: flex; flex-direction: column; align-items: center; cursor: pointer; border-radius: 8px 8px 0 0; padding: 2px 0 0; }
.orb-col:hover { background: var(--primary-soft); }
.orb-col.hl { background: var(--primary-soft); }
.orb-col .orb-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; min-height: 0; }
.orb-col .orb-fill { width: 18px; height: 0; border-radius: 4px 4px 0 0; background: var(--primary); opacity: 0.75; transition: height .3s ease; }
.orb-col.filled .orb-fill { height: var(--h); }
.orb-col.hl .orb-fill { opacity: 1; background: var(--accent); }
.orb-col .orb-num { font-size: 10px; color: var(--muted); line-height: 1.3; }
.orb-col .orb-lbl { font-size: 11px; color: var(--ink); font-weight: 500; line-height: 1.3; margin-bottom: 2px; }
.orb-note { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.orb-fill-btn { margin-left: auto; font-size: 11px; padding: 3px 10px; border-radius: 999px; border: 0.5px solid var(--line); background: var(--bg); color: var(--primary); cursor: pointer; }
.orb-fill-btn:hover { border-color: var(--primary); }
.el-rad { display: block; width: 100%; max-width: 360px; margin: 0 auto; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.rad-compare { display: flex; flex-direction: column; gap: 6px; }
.rad-atoms { display: flex; align-items: flex-end; justify-content: space-around; gap: 8px; min-height: 116px; padding: 4px 0 0; }
.rad-atom { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 0 0 auto; }
.rad-circle { width: var(--d, 40px); height: var(--d, 40px); border-radius: 50%; background: var(--cc-b, var(--primary)); opacity: 0.32; display: block; transition: width .18s ease, height .18s ease; }
.rad-atom.cur .rad-circle { opacity: 0.92; box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--cc-b, var(--primary)); }
.rad-sym { font-size: 12px; font-weight: 600; color: var(--ink); }
.rad-atom.cur .rad-sym { color: var(--primary-d, var(--primary)); }
.rad-pm { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rad-ruler { position: relative; height: 20px; margin: 2px 1px 0; border-bottom: 1px solid var(--line); }
.rad-ruler .tk { position: absolute; top: 0; width: 1px; height: 6px; background: var(--muted); opacity: 0.6; }
.rad-ruler .tv { position: absolute; top: 7px; transform: translateX(-50%); font-size: 9px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rad-ruler .tv:first-of-type { transform: none; }
.rad-ruler .tv:last-of-type { transform: translateX(-100%); }
.rad-ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 10px; }
.rad-ticks #rad-cur-val { color: var(--primary-d, var(--primary)); font-weight: 600; font-variant-numeric: tabular-nums; }
.rad-note { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.rad-trend { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.rad-trend-block { }
.rad-trend-note { font-size: 11px; color: var(--muted); }
.rad-trend-title { font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.rad-trend-row { display: flex; flex-wrap: wrap; gap: 4px; }
.rad-trend-cell { display: inline-flex; flex-direction: column; align-items: center; min-width: 32px; padding: 3px 4px; border-radius: 7px; background: var(--bg); border: 1px solid var(--line); }
.rad-trend-cell.cur { background: var(--primary-soft); border-color: var(--primary); }
.rad-trend-cell b { font-size: 11px; color: var(--ink); font-weight: 600; }
.rad-trend-cell i { font-size: 9px; color: var(--muted); font-style: normal; font-variant-numeric: tabular-nums; }

/* ===== 能级跃迁：📖 三态讲解按钮 + 三态讲解弹窗 ===== */
.el-detail .ed-spec-sub-h .ladder-3state-btn {
  margin-left: auto;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card, var(--bg));
  color: var(--ink);
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex; align-items: center; gap: 3px;
}
.el-detail .ed-spec-sub-h .ladder-3state-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-d, var(--primary));
}
.el-detail .ed-spec-sub-h .ladder-3state-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
/* 光谱卡片「全屏」按钮（放在标题栏 ? 旁） */
.el-detail .ed-card-h .ed-fs-btn {
  margin-left: 6px;
  width: 22px; height: 22px; flex: 0 0 auto;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--card, var(--bg));
  color: var(--muted);
  font-size: 13px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; user-select: none; padding: 0;
  transition: all .15s ease;
}
.el-detail .ed-card-h .ed-fs-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-d, var(--primary));
}
.el-detail .ed-card-h .ed-fs-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* 光谱全屏 modal（整张卡片克隆放大） */
.spec-fs-box { max-width: min(1040px, 96vw) !important; }
.spec-fs-body { padding: 18px 22px 22px; }
/* 克隆进来的整张卡片：去掉外层卡片描边，融入弹窗 */
.spec-fs-body .ed-spectrum-fs {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
}
.spec-fs-body .ed-spectrum-fs .ed-card-h { padding-left: 0; padding-right: 0; }
/* 放大光谱条与标尺 */
.spec-fs-body .ed-spectrum-fs .ed-spec-bar,
.spec-fs-body .ed-spectrum-fs .ed-abs-bar { height: 140px; }
.spec-fs-body .ed-spectrum-fs .ed-spec-scale,
.spec-fs-body .ed-spectrum-fs .ed-abs-scale { font-size: 13px; }
.spec-fs-body .ed-spectrum-fs .ed-spec-line { width: 5px; }
.spec-fs-body .ed-spectrum-fs .ed-abs-line { width: 9px; }
.spec-fs-body .ed-spectrum-fs .ed-ladder svg { width: 100% !important; height: auto !important; max-height: 60vh; }
.spec-fs-body .ed-spectrum-fs .ed-info-pop { display: none !important; }
.spec-fs-head { margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.spec-fs-title { font-size: 18px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.spec-fs-sub { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.spec-fs-section { margin-top: 16px; }
.spec-fs-section:first-of-type { margin-top: 0; }
.spec-fs-sub-h { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.spec-fs-sub-h .ed-sub-hint { font-weight: 400; font-size: 12px; }
.spec-fs-bar { position: relative; height: 200px; border-radius: 12px; border: 1px solid var(--line); overflow: visible; }
.spec-fs-bar-emit { background: linear-gradient(180deg, #0a0a14 0%, #14142b 50%, #0a0a14 100%); }
.spec-fs-bar-abs { overflow: hidden; }
.spec-fs-mark { position: absolute; top: 10px; bottom: 10px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; pointer-events: none; min-width: 0; }
.spec-fs-wl { font-size: 12px; font-weight: 700; line-height: 1; margin-bottom: 5px; white-space: nowrap; text-shadow: 0 1px 3px rgba(0,0,0,0.6); letter-spacing: 0.3px; }
.spec-fs-line { width: 7px; flex: 1; border-radius: 4px; box-shadow: 0 0 12px currentColor, 0 0 28px currentColor; min-height: 40px; }
.spec-fs-abs-line { position: absolute; top: 0; bottom: 0; width: 8px; transform: translateX(-50%); background: rgba(0,0,0,0.78); box-shadow: 0 0 3px rgba(0,0,0,0.5); border-radius: 1px; }
.spec-fs-scale { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.spec-fs-flame { margin-top: 12px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink); }
.spec-fs-flame-dot { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.12); flex: 0 0 auto; }
.spec-fs-note { margin-top: 10px; font-size: 12px; line-height: 1.6; color: var(--muted); }
.spec-fs-head-title { font-weight: 600; font-size: 15px; }

/* 真全屏（浏览器 Fullscreen API）：弹层铺满整屏、隐藏遮罩与圆角 */
#spec-fs-modal:fullscreen {
  background: #0b0e14;
  padding: 0;
  align-items: stretch;
}
#spec-fs-modal:fullscreen .modal-mask { display: none; }
#spec-fs-modal:fullscreen .spec-fs-box {
  max-width: min(1180px, 100vw);
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}
#spec-fs-modal:fullscreen .spec-fs-body {
  flex: 1 1 auto;
  overflow: auto;
  height: auto;
  padding: 26px 30px 34px;
}
#spec-fs-modal:fullscreen .ed-spectrum-fs .ed-ladder svg { max-height: 66vh; }

/* 三态讲解 modal */
.ts-box { max-width: 1080px !important; }
.ts-body { padding: 14px 18px 18px; }
.ts-intro {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.ts-intro .ts-title-line { line-height: 1.5; }
.ts-intro .ts-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.55;
}
.ts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
@media (max-width: 880px) {
  .ts-grid { grid-template-columns: 1fr; }
}
.ts-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 10px 8px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ts-panel.ts-excited {
  background: var(--accent-soft, #FEF3C7);
  border-color: var(--accent, #F59E0B);
  border-style: dashed;
}
.ts-panel-title {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.ts-panel.ts-excited .ts-panel-title { color: #B45309; }
.ts-config {
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  color: var(--ink);
  background: var(--card, var(--bg));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 6px;
  letter-spacing: 0.3px;
}
.ts-photon {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 6px;
}
.ts-photon.ts-abs {
  color: var(--primary-d, var(--primary));
  background: var(--primary-soft);
  border: 1px dashed var(--primary);
}
.ts-photon.ts-emi {
  color: #B45309;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.ts-svg { width: 100%; height: auto; display: block; }
.ts-key {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--primary-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink);
}
.ts-key b { color: var(--primary-d, var(--primary)); font-size: 13px; }
/* 非共振线「跃迁档案」提示块 */
.ts-archive-note {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--primary-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink);
}
.ts-archive-note strong { color: var(--primary-d, var(--primary)); }
.ts-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
/* 三态 panel 内的 ladder 元素复用 .ladder-* 样式，无须重复 */

/* ---------- 3D 原子结构模型卡片 ---------- */
.ed-atom3d .atom3d-toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 8px 2px 10px; }
.ed-atom3d .tg { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); cursor: pointer; user-select: none; }
.ed-atom3d .tg input { accent-color: var(--primary); width: 15px; height: 15px; }
.ed-atom3d .atom3d-reset { margin-left: auto; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 4px 10px; font-size: 12px; cursor: pointer; transition: .15s; }
.ed-atom3d .atom3d-reset:hover { border-color: var(--primary); color: var(--primary); }
.ed-atom3d .atom3d-mode-row { display: flex; align-items: center; gap: 10px; padding: 2px 2px 4px; }
.ed-atom3d .atom3d-mode-row .lbl { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.ed-atom3d .atom3d-mode { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 5px 28px 5px 10px; font-size: 12.5px; cursor: pointer; transition: .15s; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.4'/%></svg>"); background-repeat: no-repeat; background-position: right 10px center; }
.ed-atom3d .atom3d-mode:hover { border-color: var(--primary); color: var(--primary); }
.atom3d-canvas-wrap { width: 100%; height: clamp(360px, 56vh, 560px); border-radius: 12px; overflow: hidden; background: linear-gradient(160deg, #0b1020, #141a33); border: 1px solid var(--line); }
.atom3d-canvas-wrap canvas { width: 100% !important; height: 100% !important; display: block; }
.atom3d-status { margin-top: 10px; font-size: 12.5px; line-height: 1.6; color: var(--muted); background: var(--primary-soft, rgba(79, 93, 255, .08)); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.atom3d-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.atom3d-legend .lg { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); background: var(--card); }
.atom3d-legend .lg-p { border-color: rgba(229, 69, 69, .55); color: #E54545; }
.atom3d-legend .lg-n { border-color: rgba(154, 163, 175, .55); color: #6B7280; }
.atom3d-legend .lg-e { border-color: rgba(245, 158, 11, .55); color: #B45309; }
.atom3d-legend .lg-shell { border-color: rgba(79, 93, 255, .55); color: #4F5DFF; }
.atom3d-legend .lg-orb { border-color: rgba(178, 102, 255, .7); color: #9B4DFF; }
.atom3d-legend .lg-act { border-color: rgba(255, 255, 255, .7); color: #C9D2DD; background: #2a3350; }
.atom3d-legend .lg-val { border-color: rgba(110, 231, 183, .7); color: #2fae7a; }
.atom3d-legend .lg-cloud { border-color: rgba(178, 102, 255, .7); color: #b98bff; }
.atom3d-legend .lg-orbitline { border-color: rgba(100, 116, 139, .6); color: #64748B; }
.ed-atom3d .atom3d-demo { margin-left: 4px; border: 1px solid rgba(79, 93, 255, .5); background: linear-gradient(180deg, #4F5DFF, #3B49DB); color: #fff; border-radius: 8px; padding: 4px 12px; font-size: 12px; font-weight: 600; cursor: pointer; transition: .15s; }
.ed-atom3d .atom3d-demo:hover { filter: brightness(1.08); }
.ed-atom3d .atom3d-demo:active { transform: translateY(1px); }
.atom3d-disclaimer { margin-top: 8px; font-size: 11.5px; line-height: 1.55; color: var(--muted); background: rgba(245, 158, 11, .07); border: 1px dashed rgba(245, 158, 11, .4); border-radius: 8px; padding: 7px 10px; }
.atom3d-err { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* 原子结构合并卡：2D/3D 切换 segmented control（标题栏右侧） */
.el-detail .ed-atom .ed-card-h .atom-mode-toggle { margin-left: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex: 0 0 auto; }
.el-detail .ed-atom .ed-card-h .ed-info-btn.atom3d-info { margin-left: 6px; }
.el-detail .ed-atom .ed-card-h .ed-fs-btn.atom-fs-btn { margin-left: 6px; }
.atom-mode-btn {
  font-size: 11.5px; line-height: 1;
  padding: 5px 11px; border: none;
  background: var(--card, var(--bg)); color: var(--muted);
  cursor: pointer; transition: .15s; border-right: 1px solid var(--line);
}
.atom-mode-btn:last-child { border-right: none; }
.atom-mode-btn.active { background: linear-gradient(180deg, #4F5DFF, #3B49DB); color: #fff; }
.atom-mode-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* 2D/3D 面板互斥显隐 */
.atom-pane[hidden] { display: none !important; }
/* 全屏阅读态：隐藏卡内 ? / 全屏 按钮与气泡 */
.atom-fs-hidden { display: none !important; }

/* 原子结构全屏 modal（整张合并卡放大，支持浏览器真全屏） */
.atom-fs-box { max-width: min(1080px, 96vw) !important; }
.atom-fs-body { padding: 18px 22px 22px; }
.atom-fs-body .ed-atom { background: transparent !important; border: none !important; box-shadow: none !important; padding: 0 !important; margin: 0 !important; }
.atom-fs-body .ed-atom .ed-card-h { padding-left: 0; padding-right: 0; }
.atom-fs-head-title { font-weight: 600; font-size: 15px; }
#atom-fs-modal:fullscreen { background: #0b0e14; padding: 0; align-items: stretch; }
#atom-fs-modal:fullscreen .modal-mask { display: none; }
#atom-fs-modal:fullscreen .atom-fs-box { max-width: none; width: 100%; height: 100%; max-height: none; border-radius: 0; display: flex; flex-direction: column; }
#atom-fs-modal:fullscreen .atom-fs-body { flex: 1 1 auto; overflow: auto; height: auto; padding: 26px 30px 34px; }

/* ===== 3D 分子实验室 Hero 入口（顶部） ===== */
.ed-molecule-hero {
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 16px;
  cursor: pointer;
}
.ed-molecule-hero .mol-hero-inner { display: flex; align-items: center; gap: 12px; }
.ed-molecule-hero .mol-hero-icon {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 40px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.ed-molecule-hero .mol-hero-text { flex: 1; min-width: 0; }
.ed-molecule-hero .mol-hero-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.ed-molecule-hero .mol-hero-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.ed-molecule-hero .mol-hero-arrow { color: var(--primary); font-size: 18px; flex: 0 0 auto; }
.ed-molecule-hero .mol-hero-chips { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.ed-molecule-hero .mol-hero-chip {
  font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--primary); background: var(--card); color: var(--ink);
}
.ed-molecule-hero .mol-hero-chip:hover { background: var(--primary); color: #fff; }

/* ===== 常见物质 / 分子 3D 卡片 ===== */
.ed-molecule .mol-filter { display: flex; gap: 6px; margin: 0 0 10px; flex-wrap: wrap; }
.ed-molecule .mol-filter button { font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; }
.ed-molecule .mol-filter button.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.ed-molecule .mol-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ed-molecule .mol-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font: inherit; text-align: left; transition: .15s; }
.ed-molecule .mol-chip:hover { border-color: var(--primary); }
.ed-molecule .mol-chip.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.ed-molecule .mol-chip-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.ed-molecule .mol-chip-f { font-size: 11px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ed-molecule .mol-chip.elemental { border-left: 3px solid #F59E0B; }
.ed-molecule .mol-chip.compound { border-left: 3px solid #4F5DFF; }
.ed-molecule .mol-viewer { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.ed-molecule .mol-toolbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); background: var(--bg); }
.ed-molecule .mol-mode { display: inline-flex; gap: 10px; font-size: 12.5px; color: var(--muted); margin-right: auto; }
.ed-molecule .mol-mode label { cursor: pointer; }
.ed-molecule .mol-toolbar button { font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.ed-molecule .mol-toolbar button:hover { border-color: var(--primary); color: var(--primary); }
.mol-3d { width: 100%; height: clamp(340px, 52vh, 520px); overflow: hidden; background: linear-gradient(160deg, #0b1020, #141a33); border: 1px solid var(--line); }
.mol-3d canvas { width: 100% !important; height: 100% !important; display: block; transition: opacity .25s; }
.mol-info-box { padding: 8px 12px; font-size: 13px; color: var(--ink); min-height: 20px; border-top: 1px solid var(--line); }
.mol-info-box b { color: var(--primary); }
.mol-isomers { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 0 12px 8px; }
.mol-iso-lbl { font-size: 12px; color: var(--muted); }
.mol-iso-btn { font: inherit; font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px dashed var(--primary); background: var(--primary-soft); color: var(--primary); cursor: pointer; }
.mol-note { padding: 8px 12px 12px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.mol-err { padding: 18px; text-align: center; color: var(--muted); }
.ed-molecule .mol-open-btn { display: none; } /* 仅移动端显示 */
.ed-molecule .ed-info-btn { margin-left: auto; width: 20px; height: 20px; flex: 0 0 auto; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; font: inherit; font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.ed-molecule .mol-pop { display: none; position: absolute; top: 38px; right: 0; z-index: 40; width: min(340px, 100%); padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); box-shadow: 0 8px 24px rgba(0,0,0,.18); font-size: 12.5px; line-height: 1.55; color: var(--ink); }
.ed-molecule .mol-pop p { margin: 0 0 8px; }
.ed-molecule .mol-pop p:last-child { margin-bottom: 0; }
.ed-molecule .mol-pop b { color: var(--primary); }
.ed-molecule .mol-pop.show { display: block; }

/* ---- 模式四：振动模式 / 红外光谱 ---- */
.ed-molecule .mol-vib { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.ed-molecule .mol-vib-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 7px; }
.ed-molecule .mol-vib-play { font: inherit; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 8px; border: 1px solid var(--primary); background: var(--primary-soft); color: var(--primary); cursor: pointer; }
.ed-molecule .mol-vib-play:hover { background: var(--primary); color: #fff; }
.ed-molecule .mol-ir { width: 100%; }
.ed-molecule .ir-svg { width: 100%; height: auto; display: block; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.ed-molecule .ir-peak { cursor: pointer; transition: opacity .12s; }
.ed-molecule .ir-peak:hover { opacity: 1 !important; stroke: #fff; stroke-width: 1; }
.ed-molecule .mol-modes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.ed-molecule .mol-mode-chip { display: inline-flex; align-items: baseline; gap: 5px; font: inherit; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; transition: .15s; }
.ed-molecule .mol-mode-chip:hover { border-color: var(--primary); }
.ed-molecule .mol-mode-chip.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); background: var(--primary-soft); color: var(--primary); }
.ed-molecule .mol-mode-cm { font-size: 10.5px; opacity: .7; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ed-molecule .mol-vib-note { font-size: 12.5px; color: var(--muted); padding: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; line-height: 1.5; }

/* ===== 化学反应演示（3D 微观机理）===== */
.ed-reactions .rx-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 10px; }
.rx-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--card); cursor: pointer; transition: .15s; }
.rx-card:hover { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.rx-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rx-eq { font-size: 14px; font-weight: 600; color: var(--ink); }
.rx-type { font-size: 11px; color: var(--primary); background: var(--primary-soft); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.rx-name { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.rx-note { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.rx-card .rx-play { margin-top: 9px; }
.rx-modal { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; }
.rx-modal.hidden { display: none; }
.rx-modal-mask { position: absolute; inset: 0; background: rgba(10, 14, 26, .55); }
.rx-modal-box { position: relative; width: min(680px, 94vw); max-height: 92vh; overflow: auto; background: var(--card); border-radius: 14px; padding: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.rx-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.rx-modal-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.rx-modal-close { font-size: 22px; line-height: 1; color: var(--muted); background: none; border: none; cursor: pointer; }
.rx-3d { width: 100%; height: 360px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #0b1020; position: relative; }
/* 关键：dpr=2 时 setSize(646,360)*2 = 1292×720 的 canvas 属性会撑爆 646×358 容器，
   overflow:hidden 裁掉 4/6 原子。强制 canvas 跟随容器尺寸，与元素/分子模块一致。
   注：reaction.js 在 .rx-3d 里又套了一层 div(canvasWrap)，canvas 是其孙元素，用后代选择器。*/
.rx-3d canvas { display: block; width: 100% !important; height: 100% !important; }
.rx-3d-tip { position: absolute; left: 8px; bottom: 8px; font-size: 11px; color: #cbd5e1; background: rgba(11,16,32,.65); padding: 4px 10px; border-radius: 8px; pointer-events: none; z-index: 2; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,.08); white-space: nowrap; }
.rx-atom-info { font-size: 12.5px; color: var(--ink); padding: 7px 12px; background: var(--primary-soft); border-radius: 8px; display: none; }
.rx-atom-info:not(.hidden) { display: block; }
.rx-atom-info b { color: var(--primary-d); }
.rx-energy svg { width: 100%; height: auto; display: block; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; margin-top: 10px; }
.rx-ept { fill: var(--muted); }
.rx-ept.on { fill: var(--primary); stroke: #fff; stroke-width: 1; }
.rx-step-text { font-size: 13px; line-height: 1.7; color: var(--ink); margin-top: 10px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.rx-spec { font-size: 12.5px; color: #b45309; background: #fef3c7; border: 1px solid #fcd34d; padding: 8px 12px; border-radius: 8px; margin-top: 8px; }
.rx-note { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.rx-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.rx-controls .btn { font-size: 12.5px; }
.rx-progress { font-size: 12px; color: var(--muted); margin-left: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
