:root {
  --bg: #faf7fc;
  --panel: #ffffff;
  --panel-2: #fcfaff;
  --text: #1f1830;
  --text-2: #443a58;
  --muted: #6a6078;
  --faint: #918aa3;
  --border: #ece3f5;
  --axis: #ded3ec;
  --accent: #7a4bc8;
  --accent-deep: #3f2170;
  --accent-soft: #f6f0fe;
  --chip: #efe4fb;
  --danger: #d9534f;
  --warning: #c9871a;
  --ok: #2e7d5b;
  --shadow: 0 1px 2px rgba(38,22,66,.06), 0 8px 24px rgba(38,22,66,.06);
  --plot-bg: #ffffff;

  /* —— 主题相关的中性色阶 ——
     --solid 用于「深色底 + 白字」的实心按钮：--accent 在淡色主题下撑不住白字，
     魔法模式里直接换成深玫色。
     --hdr-* 是顶栏专用变量：顶栏在魔法模式要改成浅底深字，不能跟着 accent 走。 */
  --solid: #5e33a0;
  --hdr-bg: linear-gradient(135deg,#3f2170 0%,#7a4bc8 56%,#b06bc9 100%);
  --hdr-fg: #ffffff;
  --hdr-btn-fg: rgba(255,255,255,.86);
  --hdr-btn-bg: rgba(255, 255, 255, .12);
  --hdr-btn-bd: rgba(255, 255, 255, .32);
  --hdr-btn-hover: rgba(255, 255, 255, .26);
  --hdr-tab-on-bg: #ffffff;
  --hdr-tab-on-fg: #3f2170;
  --hdr-logo-bd: rgba(255, 255, 255, .5);
  --hdr-shadow: 0 2px 12px rgba(63,33,112,.18);
}

body.dark {
  --bg: #130d1e;
  --panel: #1e1630;
  --panel-2: #191227;
  --text: #efe9f8;
  --text-2: #d2c8e6;
  --muted: #a79dc0;
  --faint: #857ba0;
  --border: #342a4a;
  --axis: #453a5e;
  --accent: #b98cf0;
  --accent-deep: #dcc0ff;
  --accent-soft: #271c3c;
  --chip: #302448;
  --danger: #e57373;
  --warning: #d9a441;
  --ok: #5fbf94;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 28px rgba(0,0,0,.3);
  --plot-bg: #1e1630;
  /* 夜间顶栏用深紫罗兰：浅紫压白字同样发虚 */
  --hdr-bg: linear-gradient(135deg,#1b0f2e 0%,#3d1f66 58%,#5b2a7d 100%);
  --hdr-tab-on-fg: #2a1450;
}

/* 魔法模式：魔法少女小圆 · 鹿目圆印象色（淡樱粉 + 奶油白 + 星金）
   顶栏刻意改成浅樱底 + 深玫字：白字压在淡粉上对比度只有 2.2，字号再大也发虚。 */
body.magic {
  --bg: #fff6fa;
  --panel: #ffffff;
  --panel-2: #fffafc;
  --text: #3b1526;
  --text-2: #5f2a42;
  --muted: #8c5c72;
  --faint: #b38d9e;
  --border: #f8dce8;
  --axis: #f1c9d9;
  --accent: #ec6e9c;
  --accent-deep: #a83a64;
  --accent-soft: #ffeff6;
  --chip: #ffdcea;
  --danger: #d9534f;
  --warning: #c9871a;
  --ok: #2e7d5b;
  --shadow: 0 1px 2px rgba(122,28,66,.06), 0 8px 24px rgba(122,28,66,.07);
  --plot-bg: #fffdfe;
  --solid: #a83a64;
  --hdr-bg: linear-gradient(135deg,#ffd9e8 0%,#f7bcd4 52%,#e8a8c6 100%);
  --hdr-fg: #7b2f4d;
  --hdr-btn-fg: #8a4260;
  --hdr-btn-bg: rgba(255, 255, 255, .62);
  --hdr-btn-bd: rgba(214, 120, 155, .36);
  --hdr-btn-hover: rgba(255, 255, 255, .95);
  --hdr-tab-on-bg: #ffffff;
  --hdr-tab-on-fg: #a83a64;
  --hdr-logo-bd: rgba(255, 255, 255, .9);
  --hdr-shadow: 0 1px 3px rgba(122,28,66,.07), inset 0 -2px 0 #e8b84b;
}

/* 用淡粉作 accent-color 时，Chrome 为保证对比度会把「未填充轨道」压成深灰，
   滑块看着像一根黑棒；换成深玫色后轨道回到浅灰，整页才统一。 */
body.magic input[type="range"],
body.magic input[type="checkbox"] { accent-color: var(--accent-deep); }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background .25s, color .25s;
  font-size: 13px;
}
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
/* 去掉数字框的上下箭头，避免窄框里数字被挤掉 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* ================= 顶栏 ================= */
header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  height: 46px;
  background: var(--hdr-bg);
  color: var(--hdr-fg);
  box-shadow: var(--hdr-shadow);
  z-index: 5;
  flex: none;
}
.brand { font-size: 16px; font-weight: 700; letter-spacing: .4px; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
/* 站标：与 CIF 晶体结构查看器统一，粉色底 + 白描边圆角 */
.brand .brand-ico {
  width: 1.55em; height: 1.55em; flex: none;
  border-radius: 8px; object-fit: cover;
  border: 1px solid var(--hdr-logo-bd);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .22);
  background: #ffd7e6;
}
.brand .sig {
  font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 20px;
  background: var(--hdr-btn-bg); border: 1px solid var(--hdr-btn-bd);
  letter-spacing: .3px;
}
nav.tabs { display: flex; gap: 2px; margin-left: 8px; }
nav.tabs button {
  border: 1px solid transparent; background: transparent; color: var(--hdr-btn-fg);
  font-size: 12.5px; padding: 6px 12px; border-radius: 7px; transition: .15s;
}
nav.tabs button:hover { background: var(--hdr-btn-hover); color: var(--hdr-fg); }
nav.tabs button.active {
  background: var(--hdr-tab-on-bg); color: var(--hdr-tab-on-fg); font-weight: 700;
}
.head-actions { margin-left: auto; display: flex; gap: 7px; align-items: center; position: relative; }
.head-btn {
  border: 1px solid var(--hdr-btn-bd);
  background: var(--hdr-btn-bg);
  color: var(--hdr-btn-fg); font-size: 12px; padding: 6px 11px; border-radius: 7px;
  transition: background .15s; white-space: nowrap;
}
.head-btn:hover { background: var(--hdr-btn-hover); }
.head-btn.icon { padding: 6px 9px; }

/* —— 三档主题控件 ——
   桌面：日间模式 / 夜间模式 / 魔法模式 三段并列，当前档白底高亮；
   手机：收起成「圆点 + 当前档 + ▾」一个按钮，点开是浮层菜单（绝对定位，不挤动顶栏）。 */
.tseg { position: relative; display: flex; align-items: center; }
.tseg-menu { display: flex; align-items: center; gap: 2px; padding: 2px 3px;
             border: 1px solid var(--hdr-btn-bd); background: var(--hdr-btn-bg); border-radius: 8px; }
.tseg-menu button {
  border: 0; background: transparent; color: var(--hdr-btn-fg); font-size: 12px;
  padding: 4px 9px; border-radius: 6px; transition: .15s; white-space: nowrap;
}
.tseg-menu button:hover { background: var(--hdr-btn-hover); }
.tseg-menu button.on { background: var(--hdr-tab-on-bg); color: var(--hdr-tab-on-fg); font-weight: 700; }
.tseg-cur { display: none; }
@media (max-width: 900px) {
  .tseg-menu { display: none; }
  .tseg.open .tseg-menu {
    display: flex; flex-direction: column; align-items: stretch; gap: 2px;
    position: absolute; right: 0; top: calc(100% + 7px); min-width: 92px; padding: 4px;
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 10px 26px rgba(34, 26, 48, .18); z-index: 90;
  }
  .tseg.open .tseg-menu button { color: var(--text); padding: 7px 10px; }
  .tseg.open .tseg-menu button.on { background: var(--accent-soft); color: var(--accent-deep); }
  .tseg-cur {
    display: flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 7px;
    border: 1px solid var(--hdr-btn-bd); background: var(--hdr-btn-bg);
    color: var(--hdr-btn-fg); font-size: 11px; white-space: nowrap;
  }
  .tseg-cur::before { content: ""; width: 9px; height: 9px; border-radius: 50%;
                      background: var(--accent); box-shadow: 0 0 0 1.5px var(--hdr-tab-on-bg); }
  .tseg-cur::after { content: "▾"; font-size: 9px; opacity: .8; }
}

/* ================= 参数条 ================= */
.parambar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 9px 12px;
  flex: none;
  z-index: 4;
  grid-area: bar;
}
.prow { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.prow + .prow { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.ptitle {
  font-size: 10.5px; color: var(--faint); font-weight: 600;
  letter-spacing: .8px; text-transform: uppercase;
  display: flex; align-items: center; gap: 5px;
}
.ptitle::before { content: ""; width: 3px; height: 10px; background: var(--accent); border-radius: 2px; }

.ctrl { display: flex; align-items: center; gap: 7px; }
.ctrl > label {
  font-size: 11.5px; color: var(--muted); white-space: nowrap;
  min-width: 26px; text-align: right;
}
.ctrl > label.wide { min-width: 62px; text-align: left; }
.ctrl input[type="range"] {
  width: 76px; height: 4px; -webkit-appearance: none; appearance: none;
  background: var(--chip); border-radius: 3px; outline: none;
}
.ctrl input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--accent); cursor: grab;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.ctrl input[type="range"]::-moz-range-thumb {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--accent); cursor: grab;
}
.ctrl input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; }

.ctrl input[type="number"], .ctrl select {
  width: 58px; padding: 3px 4px; font-size: 11.5px;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--panel-2); color: var(--text);
  text-align: center; outline: none;
}
.ctrl input[type="number"]:focus, .ctrl select:focus { border-color: var(--accent); }
.ctrl select { width: auto; min-width: 58px; text-align: left; padding-right: 3px; }
.ctrl .unit { font-size: 10.5px; color: var(--faint); min-width: 18px; }
.ctrl.off > label, .ctrl.off .unit { opacity: .4; }
.ctrl input:disabled, .ctrl select:disabled { opacity: .4; cursor: not-allowed; }

.seg { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button {
  border: none; background: var(--panel-2); color: var(--muted);
  font-size: 11px; padding: 5px 4px; transition: .15s; white-space: nowrap;
  flex: 1;
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--solid); color: #fff; font-weight: 600; }

.chk { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-2); cursor: pointer; user-select: none; }
.chk input { accent-color: var(--accent); width: 13px; height: 13px; cursor: pointer; }

/* 核列表 */
.nucleus-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; border: 1px solid var(--border);
  border-radius: 7px; background: var(--panel-2);
}
.nucleus-row select { width: 62px; }
.nucleus-row input[type="number"] { width: 46px; }
.nucleus-row .lbl { font-size: 10.5px; color: var(--faint); }
.nucleus-row button.del {
  border: none; background: transparent; color: var(--faint);
  font-size: 14px; line-height: 1; padding: 2px 4px; border-radius: 4px;
}
.nucleus-row button.del:hover { color: var(--danger); background: var(--accent-soft); }
button.add-nuc {
  border: 1px dashed var(--axis); background: transparent; color: var(--accent-deep);
  font-size: 11.5px; padding: 5px 11px; border-radius: 7px;
}
button.add-nuc:hover { background: var(--accent-soft); border-style: solid; }

/* 子谱行（多组分页） */
.comp-list { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.comp-row {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 8px; border: 1px solid var(--border);
  border-radius: 7px; background: var(--panel-2);
}
.comp-row select { width: 88px; }
.comp-row input[type="number"] { width: 62px; }
.comp-row input[type="number"]::-webkit-inner-spin-button,
.comp-row input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.comp-row input[type="number"] { -moz-appearance: textfield; }
.comp-row .lbl { font-size: 10.5px; color: var(--faint); }
.comp-row button.del {
  border: none; background: transparent; color: var(--faint);
  font-size: 14px; line-height: 1; padding: 2px 4px; border-radius: 4px;
}
.comp-row button.del:hover { color: var(--danger); background: var(--accent-soft); }
.hint-inline { font-size: 10.5px; color: var(--faint); }

.adv-toggle {
  border: 1px solid var(--border); background: var(--panel-2);
  color: var(--muted); font-size: 11px; padding: 4px 10px; border-radius: 20px;
  display: flex; align-items: center; gap: 4px;
}
.adv-toggle:hover { border-color: var(--accent); color: var(--accent-deep); }
.adv-toggle .arr { transition: transform .2s; font-size: 9px; }
.adv-toggle.open .arr { transform: rotate(90deg); }

/* ================= 主区 ================= */
main {
  flex: 1; display: grid; gap: 10px; padding: 10px;
  grid-template-columns: minmax(0, 1fr) 208px;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "bar bar"
    "plot set";
  min-height: 0;
}
.plotcard {
  background: var(--plot-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  position: relative;
  min-height: 0;
  overflow: hidden;
  display: flex; flex-direction: column;
  grid-area: plot;
}
.plot-wrap { position: relative; flex: 1; min-height: 0; }
.resid-wrap {
  flex: none; height: 88px; border-top: 1px dashed var(--border);
  position: relative; background: var(--panel-2);
}
#resid { width: 100%; height: 100%; display: block; }
#plot { width: 100%; height: 100%; display: block; cursor: crosshair; }
.plot-badge {
  position: absolute; top: 10px; left: 66px;
  display: flex; gap: 6px; pointer-events: none;
}
.badge {
  font-size: 11px; padding: 3px 8px; border-radius: 5px;
  background: var(--accent-soft); color: var(--accent-deep);
  border: 1px solid transparent; white-space: nowrap;
}
.badge.dim { background: transparent; color: var(--faint); border-color: var(--border); }
.plot-hint {
  position: absolute; right: 12px; bottom: 8px;
  font-size: 10.5px; color: var(--faint); pointer-events: none;
}

/* 右侧设置 */
.settings {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 11px 11px 13px;
  overflow-y: auto;
  min-height: 0;
  grid-area: set;
}
.settings h4 {
  font-size: 10.5px; color: var(--faint); font-weight: 600;
  letter-spacing: .8px; text-transform: uppercase;
  margin-bottom: 6px; display: flex; align-items: center; gap: 5px;
}
.settings h4::before { content: ""; width: 3px; height: 10px; background: var(--accent); border-radius: 2px; }
.setrow { display: flex; flex-direction: column; gap: 6px; }
.setrow + h4 { margin-top: 11px; }
.setbtn {
  width: 100%; text-align: left; font-size: 11.5px; padding: 5px 9px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--panel-2); color: var(--text-2);
  transition: .15s; display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.setbtn:hover { border-color: var(--accent); color: var(--accent-deep); }
.setbtn.primary { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-deep); font-weight: 600; }
.setbtn .k { font-size: 10px; opacity: .65; }
.divider { height: 1px; background: var(--border); margin: 10px 0; }

.saved-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 3px 6px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--panel-2);
}
.saved-item .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.saved-item .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-item button { border: none; background: transparent; color: var(--faint); font-size: 13px; padding: 0 2px; }
.saved-item button:hover { color: var(--danger); }

/* ================= 状态栏 ================= */
.statusbar {
  flex: none; height: 26px; display: flex; align-items: center; gap: 16px;
  padding: 0 14px; font-size: 10.5px; color: var(--muted);
  background: var(--panel); border-top: 1px solid var(--border);
  white-space: nowrap; overflow: hidden;
}
.statusbar b { color: var(--accent-deep); font-weight: 600; }

/* 页脚署名：左侧开发者，右下角单位（与 CIF 晶体结构查看器一致） */
.creditbar {
  flex: none; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; padding: 7px 18px;
  font-size: 11.5px; color: var(--muted);
  background: var(--panel); border-top: 1px solid var(--border);
}
.creditbar .foot-author {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent-deep); font-weight: 600; letter-spacing: .2px;
  padding: 2px 11px; border-radius: 20px;
  background: var(--accent-soft); border: 1px solid var(--border);
}
.creditbar .foot-author::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); flex: none;
}

/* ================= 弹层 ================= */
.mask {
  position: fixed; inset: 0; background: rgba(22, 18, 31, .42);
  display: none; align-items: center; justify-content: center; z-index: 50;
  padding: 24px;
}
.mask.show { display: flex; }
.modal {
  background: var(--panel); border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
  width: min(720px, 100%); max-height: 82vh; display: flex; flex-direction: column;
  border: 1px solid var(--border);
}
.modal header {
  background: transparent; box-shadow: none; height: auto;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  color: var(--text);
}
.modal header h3 { font-size: 14.5px; font-weight: 600; }
.modal header button {
  border: none; background: transparent; color: var(--muted); font-size: 18px; line-height: 1;
}
.modal .body { padding: 16px 20px; overflow-y: auto; line-height: 1.75; font-size: 13px; color: var(--text-2); }
.modal .body p { margin-bottom: 9px; }
.modal .body ul { margin: 6px 0 10px 20px; }
.modal .body li { margin-bottom: 4px; }
.modal .body .fml {
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  padding: 8px 12px; border-radius: 0 6px 6px 0; color: var(--accent-deep);
  font-family: "Cambria", "Times New Roman", serif; font-size: 13.5px;
  margin: 10px 0;
}
body.dark .modal .body .fml { color: var(--text); }
.modal .body b { color: var(--text); }

/* 预设菜单 */
.ex-wrap { position: relative; }
.ex-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 14px 38px rgba(0, 0, 0, .2);
  width: 300px; max-height: 70vh; overflow-y: auto; padding: 6px; display: none; z-index: 60;
}
.ex-menu.show { display: block; }
.ex-group { font-size: 10px; color: var(--faint); font-weight: 600; letter-spacing: .6px; text-transform: uppercase; padding: 8px 8px 4px; }
.ex-item {
  display: block; width: 100%; text-align: left; border: none; background: transparent;
  padding: 6px 9px; border-radius: 6px; color: var(--text);
}
.ex-item:hover { background: var(--accent-soft); }
.ex-item .t { font-size: 12px; }
.ex-item .h { font-size: 10.5px; color: var(--faint); margin-top: 1px; }

/* 习题 */
.exq { padding: 13px 0; border-bottom: 1px dashed var(--border); }
.exq:last-child { border-bottom: none; }
.exq .qn { font-size: 11px; color: var(--accent-deep); font-weight: 600; margin-bottom: 5px; }
.exq .qt { font-size: 13px; color: var(--text); margin-bottom: 8px; }
.exq .qa { display: none; font-size: 12.5px; color: var(--text-2); background: var(--accent-soft); padding: 10px 12px; border-radius: 7px; margin-top: 8px; line-height: 1.7; }
.exq.open .qa { display: block; }
.exq .qbtns { display: flex; gap: 8px; }
.mini {
  font-size: 11px; padding: 3px 10px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--muted);
}
.mini:hover { border-color: var(--accent); color: var(--accent-deep); }

/* 数据表 */
table.data { width: 100%; border-collapse: collapse; font-size: 11px; font-family: ui-monospace, Consolas, monospace; }
table.data th, table.data td { padding: 4px 8px; border-bottom: 1px solid var(--border); text-align: right; }
table.data th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--panel); }

/* ============================================================
   响应式：电脑 / 平板 / 手机双端
   ============================================================ */
html { -webkit-text-size-adjust: 100%; }
canvas#plot, canvas#resid { touch-action: none; }
.hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .hint-desk { display: none; }
  .hint-touch { display: inline; }
}

/* 中等宽度：收窄右侧面板 */
@media (max-width: 1080px) {
  main { grid-template-columns: minmax(0, 1fr) 186px; }
  .ctrl input[type="range"] { width: 72px; }
  .ctrl input[type="number"] { width: 56px; }
}

/* 平板 / 手机：单列纵向流（图 → 参数 → 设置） */
@media (max-width: 900px) {
  body {
    display: block; height: auto; min-height: 100vh; min-height: 100dvh;
    overflow-x: hidden; overflow-y: auto;
  }

  header {
    flex-wrap: wrap; height: auto; padding: 7px 11px; gap: 6px 9px;
  }
  .brand { font-size: 14.5px; gap: 6px; }
  .brand .brand-ico { width: 1.5em; height: 1.5em; border-radius: 7px; }
  .brand .sig { display: none; }
  nav.tabs {
    order: 3; width: 100%; margin-left: 0; gap: 1px;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  nav.tabs::-webkit-scrollbar { display: none; }
  nav.tabs button { flex: 0 1 auto; font-size: 11.5px; padding: 7px 6px; white-space: nowrap; }
  .head-actions { gap: 5px; }
  .head-btn { font-size: 11.5px; padding: 6px 9px; }
  .head-btn.icon { padding: 6px 8px; }

  main { display: flex; flex-direction: column; gap: 8px; padding: 8px; min-height: 0; }
  /* 图吸顶：向下翻参数与设置时仍能看到谱线变化 */
  .plotcard {
    flex: none; height: min(38vh, 370px); min-height: 180px;
    position: sticky; top: 0; z-index: 6;
  }
  .resid-wrap { height: 62px; }
  .parambar { flex: none; padding: 8px 10px; }
  .settings { flex: none; max-height: none; overflow: visible; padding: 9px 10px 11px; }

  /* 触控友好的控件尺寸；参数区用自适应网格，列宽随屏宽变化 */
  .prow {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
    gap: 7px 10px; align-items: center;
  }
  .prow > .ptitle, .prow > .hint-inline, .prow > .comp-list { grid-column: 1 / -1; }
  .ctrl { min-width: 0; gap: 6px; }
  .ctrl > label { font-size: 11px; min-width: 20px; }
  .ctrl input[type="range"] { flex: 1 1 auto; width: auto; min-width: 42px; height: 5px; }
  .ctrl input[type="range"]::-webkit-slider-thumb { width: 17px; height: 17px; }
  .ctrl input[type="range"]::-moz-range-thumb { width: 15px; height: 15px; }
  .ctrl input[type="number"], .ctrl select { width: 64px; min-height: 32px; font-size: 12px; }
  .seg button { min-height: 34px; font-size: 11.5px; }
  .chk { min-height: 30px; font-size: 12px; }
  .chk input { width: 17px; height: 17px; }
  .setbtn { min-height: 36px; }
  .mini { min-height: 30px; padding: 4px 12px; }
  .ex-menu { width: min(320px, calc(100vw - 20px)); max-height: 62vh; }

  /* 子谱行占满整行，避免挤成一条 */
  .comp-row { flex: 1 1 100%; max-width: 560px; flex-wrap: wrap; gap: 5px 7px; }
  .comp-row select { flex: 1 1 92px; width: auto; min-height: 32px; }
  .comp-row input[type="number"] { width: 52px; min-height: 32px; }
  .comp-row button.del { margin-left: auto; font-size: 17px; padding: 2px 8px; }
  .nucleus-row { flex-wrap: wrap; gap: 5px 7px; }
  .nucleus-row select { flex: 1 1 84px; width: auto; min-height: 32px; }
  .nucleus-row input[type="number"] { width: 52px; min-height: 32px; }
  .nucleus-row button.del { margin-left: auto; font-size: 17px; padding: 2px 8px; }
  button.add-nuc { min-height: 34px; }

  /* 设置区按钮两列排布，缩短页面 */
  .settings .setrow { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .settings .setrow > #savedList { grid-column: 1 / -1; }
  .settings h4 + .setrow + h4 { margin-top: 10px; }

  /* 绘图区标注 */
  .plot-badge { left: 48px; right: 8px; top: 6px; flex-wrap: wrap; gap: 4px; }
  .badge { font-size: 10px; padding: 2px 6px; }
  .plot-hint { font-size: 9.5px; right: 8px; bottom: 3px; }

  /* 状态栏允许换行 */
  .statusbar {
    height: auto; min-height: 28px; flex-wrap: wrap;
    padding: 5px 11px; gap: 4px 10px; white-space: normal; font-size: 10px;
  }
  .statusbar > div:first-child { flex-wrap: wrap; row-gap: 2px; }

  .creditbar { padding: 6px 11px; font-size: 10.5px; gap: 6px; }
  .creditbar .foot-author { padding: 2px 9px; }

  /* 弹层：底部抽屉式 */
  .mask { padding: 10px; align-items: flex-end; }
  .modal { width: 100%; max-height: 86vh; max-height: 86dvh; border-radius: 14px 14px 0 0; }
  .modal header { padding: 11px 14px; }
  .modal .body { padding: 12px 14px; font-size: 12.5px; }
}

/* 窄屏手机：单列，图更矮一些 */
@media (max-width: 430px) {
  .prow { grid-template-columns: 1fr; }
  /* 解谱练习的参数栏：按钮两列排布，避免每题都占满一整行 */
  main.puzz-on .parambar .prow { grid-template-columns: 1fr 1fr; }
  main.puzz-on .parambar .prow > .ptitle,
  main.puzz-on .parambar .prow > .seg,
  main.puzz-on .parambar .prow > .chk { grid-column: 1 / -1; }
  main.puzz-on .parambar .prow > .nuc-tag { justify-self: center; align-self: center; }
  .ctrl input[type="number"] { width: 68px; }
  .plotcard { height: 32vh; min-height: 170px; }
  .resid-wrap { height: 56px; }
  .plot-hint { display: none; }
  .brand { font-size: 13.5px; }
  .head-btn { font-size: 11px; padding: 6px 8px; }
  .creditbar { flex-direction: column; align-items: flex-start; }
  /* 子谱行：类型下拉独占一行，参数排在下一行 */
  .comp-row select { flex: 1 1 100%; }
}

/* 手机横屏：顶栏压成一行，绘图区不吸顶 */
@media (max-height: 500px) and (orientation: landscape) {
  header { flex-wrap: nowrap; padding: 4px 10px; }
  nav.tabs { order: 0; width: auto; margin-left: 6px; overflow: visible; }
  .brand .sig { display: inline; }
  .plotcard { position: static; height: 52vh; min-height: 150px; max-height: none; }
  .ctrl input[type="range"] { min-width: 52px; }
}

/* ============================================================
   核磁共振专用组件
   ============================================================ */

/* 位点行（一维谱） */
.line-row {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 7px; border: 1px solid var(--border);
  border-radius: 7px; background: var(--panel-2);
}
.line-row .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.line-row .lbl { font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.line-row input.num {
  width: 52px; padding: 3px 4px; font-size: 11.5px; text-align: center;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--panel); color: var(--text); outline: none;
}
.line-row input.num:focus { border-color: var(--accent); }
.line-row input.num.w4 { width: 44px; }
.line-row select {
  padding: 3px 3px; font-size: 11.5px; border: 1px solid var(--border);
  border-radius: 5px; background: var(--panel); color: var(--text);
  outline: none; max-width: 76px;
}
.line-row select:focus { border-color: var(--accent); }
.line-row .coup {
  display: flex; align-items: center; gap: 4px;
  padding: 2px 5px; border-radius: 5px;
  background: var(--accent-soft); border: 1px solid transparent;
}
.line-row .coup.none { background: transparent; border-color: var(--border); }
.line-row .coup.none .lbl { opacity: .7; }
.line-row button.mini2 {
  border: 1px solid var(--border); background: var(--panel); color: var(--muted);
  font-size: 11px; padding: 2px 7px; border-radius: 5px; line-height: 1.4;
}
.line-row button.mini2:hover { border-color: var(--accent); color: var(--accent-deep); }
.line-row button.del {
  border: none; background: transparent; color: var(--faint);
  font-size: 14px; line-height: 1; padding: 2px 5px; border-radius: 4px; margin-left: auto;
}
.line-row button.del:hover { color: var(--danger); background: var(--accent-soft); }

/* 核选择器 */
.nuc-pick { display: flex; align-items: center; gap: 6px; }
.nuc-pick select {
  padding: 4px 5px; font-size: 12px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--panel-2); color: var(--text);
  outline: none; min-width: 112px;
}
.nuc-pick select:focus { border-color: var(--accent); }
.nuc-tag {
  font-size: 10.5px; color: var(--accent-deep); background: var(--accent-soft);
  padding: 2px 7px; border-radius: 20px; white-space: nowrap;
}

/* 峰表 */
table.peaks { width: 100%; border-collapse: collapse; font-size: 11.5px; }
table.peaks th, table.peaks td { padding: 5px 7px; border-bottom: 1px solid var(--border); text-align: right; }
table.peaks th { color: var(--muted); font-weight: 500; background: var(--panel); position: sticky; top: 0; }
table.peaks td:first-child, table.peaks th:first-child { text-align: left; }
table.peaks .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
table.peaks tr.total td { font-weight: 600; color: var(--text); border-top: 1px solid var(--axis); }

/* 能级图 */
.level-wrap { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin: 10px 0; }
#levelCanvas { width: 100%; height: 300px; display: block; }
.legend-note { font-size: 11.5px; color: var(--faint); margin-top: 6px; }

/* 参数说明小字 */
.pnote { font-size: 10.5px; color: var(--faint); }

/* 手机端：位点行整行排布 */
@media (max-width: 900px) {
  .line-row { flex-wrap: wrap; gap: 5px 6px; }
  .line-row input.num { width: 56px; min-height: 30px; font-size: 12px; }
  .line-row select { min-height: 30px; font-size: 12px; max-width: 92px; }
  .line-row .coup { flex: 1 1 100%; max-width: 420px; }
  .line-row button.mini2 { min-height: 30px; }
  .line-row button.del { margin-left: 0; font-size: 17px; padding: 2px 9px; margin-left: auto; }
  .nuc-pick select { min-height: 32px; }
  #levelCanvas { height: 240px; }
  table.peaks { font-size: 11px; }
  table.peaks th, table.peaks td { padding: 4px 5px; }
}

/* 提示文字下移并弱化，避免与横轴标题打架 */
.plot-hint { bottom: 2px; font-size: 10px; opacity: .85; }
@media (max-width: 900px) { .plot-hint { display: none; } }

/* 设置区两列按钮组 */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.grid2 .setbtn { justify-content: center; }

/* 手机端谱线行：耦合块自适应宽度，按钮紧随其后 */
@media (max-width: 900px) {
  .line-row .coup { flex: 1 1 auto; max-width: none; }
  .line-row button.mini2 { flex: none; }
  .line-row button.del { margin-left: 0; }
}

/* 桌面端：位点很多时参数栏自身滚动，避免把谱图压扁 */
@media (min-width: 901px) {
  .parambar { max-height: 44vh; overflow-y: auto; }
  .plotcard { min-height: 240px; }
}

/* ============================================================
   DEPT 编辑谱
   ============================================================ */

/* 位点行里的碳类型下拉 */
.line-row select.dtype { width: 58px; min-width: 52px; }

/* 强度曲线图（弹层内） */
.dept-curve-wrap {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 6px 2px; margin: 10px 0 6px;
}
.dept-curve-wrap svg { width: 100%; height: auto; display: block; }
.dept-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); padding: 0 6px 6px; }
.dept-legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }

table.depttab { width: 100%; border-collapse: collapse; font-size: 12px; margin: 8px 0 4px; }
table.depttab th, table.depttab td { padding: 5px 7px; border-bottom: 1px solid var(--border); text-align: center; }
table.depttab th { color: var(--muted); font-weight: 500; background: var(--panel); }
table.depttab td:first-child, table.depttab th:first-child { text-align: left; font-weight: 600; color: var(--text); }

/* ============================================================
   参数栏内的小按钮（解谱练习等）
   ============================================================ */
button.mini2 {
  border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text-2); font-size: 11px; padding: 4px 9px;
  border-radius: 6px; transition: .15s; white-space: nowrap; flex: none;
}
button.mini2:hover { border-color: var(--accent); color: var(--accent-deep); }

/* ============================================================
   解谱练习
   ============================================================ */

.puzz {
  display: none;
  grid-column: 1 / -1;
  grid-row: 2;
  gap: 10px;
  min-height: 0;
}
main.puzz-on .plotcard, main.puzz-on .settings { display: none; }
main.puzz-on .puzz { display: grid; grid-template-columns: minmax(0, 1fr) 384px; }

.pz-spectra { display: flex; flex-direction: column; gap: 10px; min-height: 0; }

.spec-card {
  background: var(--plot-bg); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden;
}
.spec-hd {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 4px; font-size: 11.5px;
  border-bottom: 1px dashed var(--border);
}
.spec-hd .spec-t { font-weight: 600; color: var(--accent-deep); letter-spacing: .3px; }
.spec-hd .spec-m { color: var(--faint); font-size: 10.5px; margin-left: auto; }
.spec-body { flex: 1; min-height: 0; position: relative; }
#plotH, #plotC { width: 100%; height: 100%; display: block; cursor: crosshair; }

/* ---- 作答区 ---- */
.pz-answer {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow);
  padding: 10px 11px 12px; overflow-y: auto; min-height: 0;
  display: flex; flex-direction: column; gap: 8px;
}
/* 右栏内的每个块都保持自身高度：判定结果出现时由整栏滚动，而不是把画板压扁 */
.pz-answer > * { flex: none; }
.pz-ans-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pz-diff {
  font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent-deep); border: 1px solid var(--border);
}
.pz-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.pz-prog { margin-left: auto; font-size: 10.5px; color: var(--faint); }

.ed-tools { display: flex; flex-wrap: wrap; gap: 5px; }
.ed-group {
  display: flex; gap: 2px; padding: 2px; border-radius: 7px;
  background: var(--panel-2); border: 1px solid var(--border);
}
.ed-btn {
  border: none; background: transparent; color: var(--text-2);
  font-size: 11px; padding: 4px 7px; border-radius: 5px; transition: .12s;
  min-width: 26px; line-height: 1.25;
}
.ed-btn:hover { background: var(--chip); color: var(--accent-deep); }
.ed-btn.on { background: var(--solid); color: #fff; font-weight: 600; }
.ed-btn.el { font-weight: 600; font-family: "Consolas", monospace; }

.ed-wrap {
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel-2); overflow: hidden;
}
#editor { width: 100%; height: 268px; display: block; touch-action: none; }
.ed-formula { font-size: 11px; color: var(--muted); min-height: 15px; }
.ed-formula b { color: var(--accent-deep); }

.pz-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pz-btn {
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text-2);
  font-size: 12px; padding: 7px 10px; border-radius: 7px; transition: .15s;
}
.pz-btn:hover { border-color: var(--accent); color: var(--accent-deep); }
.pz-btn.primary { background: var(--solid); border-color: var(--solid); color: #fff; font-weight: 600; }
.pz-btn.primary:hover { background: var(--accent-deep); color: #fff; }
.pz-btn.ghost { font-size: 10.5px; color: var(--faint); }

/* ---- 结果区 ---- */
.pz-result { display: flex; flex-direction: column; gap: 8px; }
.pz-result.flash { animation: pzflash .6s ease; }
@keyframes pzflash {
  0% { box-shadow: 0 0 0 0 rgba(46, 125, 91, .55); }
  100% { box-shadow: 0 0 0 14px rgba(46, 125, 91, 0); }
}
.pz-empty { font-size: 11.5px; color: var(--faint); line-height: 1.7; padding: 4px 2px; }

.pz-hints { display: flex; flex-direction: column; gap: 5px; }
.pz-hint {
  font-size: 11.5px; line-height: 1.65; color: var(--text-2);
  background: var(--accent-soft); border: 1px dashed var(--border);
  border-radius: 8px; padding: 6px 9px;
}
.pz-hint b { color: var(--accent-deep); margin-right: 5px; font-size: 10.5px; }

.pz-verdict { font-size: 12px; line-height: 1.7; border-radius: 8px; padding: 7px 10px; }
.pz-verdict.ok { background: rgba(46, 125, 91, .1); color: var(--ok); border: 1px solid rgba(46, 125, 91, .3); }
.pz-verdict.bad { background: rgba(217, 83, 79, .09); color: var(--danger); border: 1px solid rgba(217, 83, 79, .28); }

.pz-reveal { display: flex; flex-direction: column; gap: 7px; }
.pz-ans-hd { font-size: 11.5px; color: var(--muted); }
.pz-ans-hd .mono { color: var(--text); font-weight: 600; }
.pz-ans-cv {
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--plot-bg); height: 178px; overflow: hidden;
}
#pzAnsCv { width: 100%; height: 100%; display: block; }
.pz-why { font-size: 11.5px; line-height: 1.75; color: var(--text-2); }
.pz-tbl summary {
  font-size: 11px; color: var(--accent-deep); cursor: pointer;
  padding: 4px 0; outline: none;
}
.pz-tbl table { font-size: 10.5px; margin-top: 4px; }
.pz-tbl table th, .pz-tbl table td { padding: 3px 5px; }

/* 手机端：谱图在上、作答区在下 */
@media (max-width: 900px) {
  main.puzz-on .puzz { display: flex; flex-direction: column; }
  .pz-spectra { flex: none; gap: 8px; }
  .spec-card { flex: none; height: 190px; }
  .pz-answer { overflow: visible; }
  #editor { height: 250px; }
  .ed-btn { min-height: 30px; padding: 5px 8px; font-size: 11.5px; }
  .pz-btn { min-height: 38px; font-size: 12.5px; }
}
@media (max-width: 430px) {
  .spec-card { height: 168px; }
}

/* ============================================================
   真题页（2026 年第 8 题 8.1）
   —— 整页独立排版，与解谱练习一样接管整个 main
   ============================================================ */
.tab-new {
  font-style: normal; font-size: 9px; font-weight: 800; letter-spacing: .3px;
  margin-left: 4px; padding: 0 4px; border-radius: 4px; vertical-align: 2px;
  background: var(--accent-soft); color: var(--accent-deep);
}

.real { display: none; grid-area: real; min-height: 0; }
main.real-on {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "real";
}
main.real-on .plotcard,
main.real-on .parambar,
main.real-on .settings,
main.real-on .puzz { display: none; }
main.real-on .real { display: block; overflow-y: auto; overscroll-behavior: contain; }
/* 真题页没有"当前谱"可报，状态条上的旧数值留着只会误导 */
main.real-on ~ .statusbar { display: none; }

.rl-wrap { max-width: 1120px; margin: 0 auto; padding: 2px 2px 26px; }

/* —— 题头 —— */
.rl-head {
  border: 1px solid var(--border); background: var(--panel);
  border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px 15px;
}
.rl-kicker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.rl-year {
  background: var(--solid); color: #fff; font-weight: 800; font-size: 11px;
  padding: 2px 8px; border-radius: 6px; letter-spacing: .6px;
}
.rl-score { border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; font-size: 10.5px; color: var(--faint); }
.rl-head h2 { font-size: 17.5px; margin: 9px 0 7px; letter-spacing: .2px; }
.rl-intro { font-size: 12.5px; line-height: 1.9; color: var(--text-2); }
.rl-intro b { color: var(--accent-deep); }
.rl-xref {
  margin-top: 10px; font-size: 11.5px; line-height: 1.75; color: var(--muted);
  background: var(--panel-2); border: 1px dashed var(--border); border-radius: 9px; padding: 7px 10px;
}
.rl-xref b { color: var(--text); margin-right: 4px; }

/* —— 左导航 + 题卡 —— */
.rl-body { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 12px; margin-top: 12px; align-items: start; }
.rl-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 5px; }
.rl-navbtn {
  display: grid; grid-template-columns: 1fr auto; gap: 1px 6px; text-align: left;
  border: 1px solid var(--border); background: var(--panel); border-radius: 9px;
  padding: 7px 9px; transition: .13s;
}
.rl-navbtn:hover { border-color: var(--accent); }
.rl-navbtn.on { background: var(--solid); border-color: var(--solid); }
.rl-nid {
  grid-column: 1; font-size: 10.5px; font-weight: 800; letter-spacing: .5px;
  color: var(--accent-deep);
}
.rl-nt { grid-column: 1 / -1; font-size: 11.5px; line-height: 1.5; color: var(--text-2); }
.rl-ns { grid-column: 2; grid-row: 1; font-size: 11px; font-weight: 800; color: var(--ok); text-align: right; }
.rl-navbtn.on .rl-nid,
.rl-navbtn.on .rl-nt,
.rl-navbtn.on .rl-ns { color: #fff; }
.rl-prog { margin-top: 4px; font-size: 11px; color: var(--muted); padding: 0 2px; }
.rl-prog b { color: var(--accent-deep); }
.rl-navbtn + .rl-prog { margin-top: 6px; }

.rl-card {
  border: 1px solid var(--border); background: var(--panel);
  border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px 16px;
}
.rl-qhd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rl-id {
  font-size: 11.5px; font-weight: 800; color: #fff; background: var(--solid);
  border-radius: 6px; padding: 2px 8px; letter-spacing: .4px;
}
.rl-qt { font-size: 13.5px; font-weight: 700; color: var(--text); }
.rl-meta { margin-left: auto; font-size: 10.5px; color: var(--faint); }
.rl-ask { font-size: 13px; line-height: 1.9; color: var(--text); margin: 10px 0 0; }
.rl-note {
  font-size: 11.5px; line-height: 1.8; color: var(--muted);
  margin: 6px 0 0; padding-left: 9px; border-left: 2px solid var(--border);
}

/* —— 选项卡片 —— */
.rl-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 8px; margin-top: 12px; }
.rl-opt {
  position: relative; display: flex; flex-direction: column; gap: 2px; text-align: left;
  border: 1px solid var(--border); background: var(--panel-2); border-radius: 10px;
  padding: 9px 10px 10px; transition: .13s;
}
.rl-opt:hover { border-color: var(--accent); background: var(--panel); transform: translateY(-1px); }
.rl-opt.on { border-color: var(--accent-deep); background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent-deep); }
.rl-lab { font-size: 11px; font-weight: 800; color: var(--accent-deep); letter-spacing: .3px; }
.rl-form {
  font-family: "Cambria Math", "Times New Roman", Georgia, serif;
  font-size: 14px; color: var(--text); line-height: 1.55;
}
.rl-oname { font-size: 11px; color: var(--muted); }
.rl-no {
  position: absolute; top: 7px; right: 7px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--solid); color: #fff; font-size: 10.5px; font-weight: 700;
  line-height: 17px; text-align: center; display: none;
}
.rl-opt.on .rl-no { display: block; }

/* —— 作答条 —— */
.rl-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--border);
}
.rl-blab { font-size: 10.5px; letter-spacing: .8px; color: var(--faint); font-weight: 600; }
.rl-chips { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; min-height: 26px; }
.rl-empty { font-size: 11.5px; color: var(--faint); }
.rl-chip {
  border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent-deep);
  font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px;
}
.rl-chip:hover { background: var(--chip); }
.rl-gt { color: var(--faint); font-size: 11px; }
.rl-btn {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  font-size: 11.5px; padding: 5px 12px; border-radius: 7px; transition: .13s;
}
.rl-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-deep); }
.rl-btn:disabled { opacity: .45; cursor: not-allowed; }
.rl-btn.primary { background: var(--solid); border-color: var(--solid); color: #fff; font-weight: 700; }
.rl-btn.primary:hover:not(:disabled) { color: #fff; filter: brightness(1.08); }
.rl-btn.ghost { background: transparent; }

.rl-verdict { display: none; margin-top: 10px; font-size: 12.5px; line-height: 1.85; padding: 9px 12px; border-radius: 9px; }
.rl-verdict.ok { display: block; background: var(--accent-soft); color: var(--accent-deep); border-left: 3px solid var(--solid); }
.rl-verdict.no { display: block; background: rgba(217, 83, 79, .1); color: var(--danger); border-left: 3px solid var(--danger); }

/* —— 仿真解析 —— */
.rl-anal { margin-top: 12px; }
.rl-anal-hd {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; font-weight: 700; color: var(--text);
  padding-bottom: 7px; border-bottom: 1px solid var(--border);
}
.rl-anal-hd::before { content: ""; width: 3px; height: 12px; background: var(--accent); border-radius: 2px; align-self: center; }
.rl-anal-hd span { font-size: 10.5px; font-weight: 400; color: var(--faint); }
.rl-srow {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) 58px 42px;
  gap: 8px; align-items: center; padding: 3px 0;
}
.rl-srow canvas { width: 100%; height: 58px; display: block; }
.rl-slab { display: flex; flex-direction: column; line-height: 1.35; }
.rl-slab b { font-size: 11.5px; color: var(--accent-deep); }
.rl-slab i { font-style: normal; font-size: 10.5px; color: var(--muted); }
.rl-sval { font-size: 11.5px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }
.rl-load {
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  font-size: 10.5px; padding: 3px 0; border-radius: 6px;
}
.rl-load:hover { border-color: var(--accent); color: var(--accent-deep); }
.rl-shared {
  margin-top: 9px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--plot-bg); padding: 6px;
}
.rl-shared canvas { width: 100%; height: 132px; display: block; }
.rl-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 7px; font-size: 11px; color: var(--muted); }
.rl-legend b { color: var(--accent-deep); }
.rl-ansline { margin-top: 10px; font-size: 12.5px; color: var(--text); }
.rl-ansline b { font-size: 13px; color: var(--accent-deep); letter-spacing: .5px; }
.rl-why { margin: 9px 0 0; padding: 9px 12px 9px 28px; background: var(--accent-soft); border-radius: 9px; }
.rl-why li { font-size: 12px; line-height: 1.85; color: var(--text-2); margin: 3px 0; }
.rl-why li b { color: var(--accent-deep); }
.rl-memos { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.rl-memo b { color: var(--accent-deep); }
.rl-print {
  margin-top: 9px; font-size: 11.5px; line-height: 1.8; color: var(--muted);
  border-left: 3px solid var(--warning); padding: 6px 10px; background: var(--panel-2);
  border-radius: 0 8px 8px 0;
}
.rl-pager { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }

@media (max-width: 900px) {
  main.real-on { display: block; padding: 8px; }
  main.real-on .real { display: block; overflow: visible; }
  .rl-body { grid-template-columns: 1fr; gap: 8px; }
  .rl-nav { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 3px; scrollbar-width: none; }
  .rl-nav::-webkit-scrollbar { display: none; }
  .rl-navbtn { flex: none; min-width: 128px; }
  .rl-prog { flex: none; align-self: center; white-space: nowrap; margin: 0 0 0 4px; }
  .rl-head { padding: 12px 13px 13px; }
  .rl-head h2 { font-size: 15.5px; }
  .rl-intro { font-size: 12px; line-height: 1.85; }
  .rl-card { padding: 12px 12px 13px; }
  .rl-opts { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .rl-form { font-size: 13px; }
  .rl-bar { gap: 6px; }
  .rl-srow { grid-template-columns: 74px minmax(0, 1fr) 48px 34px; gap: 6px; }
  .rl-srow canvas { height: 52px; }
  .rl-slab b { font-size: 11px; }
  .rl-slab i { font-size: 9.5px; }
  .rl-sval { font-size: 11px; }
  .rl-load { font-size: 9.5px; padding: 3px 0; }
  .rl-shared canvas { height: 108px; }
  .rl-why li { font-size: 11.5px; }
}
/* 原题题干：默认收起，想看原文的再展开 */
.rl-stem {
  margin-top: 10px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel-2); padding: 0 11px;
}
.rl-stem summary {
  cursor: pointer; list-style: none; padding: 7px 0;
  font-size: 11.5px; font-weight: 600; color: var(--accent-deep);
}
.rl-stem summary::-webkit-details-marker { display: none; }
.rl-stem summary::before { content: "▸ "; font-size: 10px; }
.rl-stem[open] summary::before { content: "▾ "; }
.rl-stem p {
  font-size: 12px; line-height: 1.95; color: var(--text-2);
  padding: 0 0 10px; border-top: 1px dashed var(--border); margin-top: 0; padding-top: 9px;
}
