/* ===== PeptideMass 样式（独立一份；骨架与 GRAVYCalc / PepFragCalc 同一套，色板换青绿 teal/emerald） =====
   本页主角是「一条蛋白序列 → 蛋白摘要卡片 + 酶切肽段表」：
   ① 质量数字一律 tabular-nums，等宽字体逐行对齐；
   ② 肽段表限高、表头吸顶，长蛋白上万条肽也不把页面撑爆；
   ③ 含 B/Z/X 的肽段用 amb-box 与主表分开，带警示色。 */
:root {
  --bg: #f3f7f6;
  --bg-card: #ffffff;
  --bg-hover: #edf3f1;
  --text: #22343a;
  --text-sub: #6b807d;
  --border: #e2eae7;
  --accent: #0d9488;
  --accent-soft: rgba(13, 148, 136, .1);
  --accent-text: #fff;
  --danger: #d4526a;
  --ok: #2f9e5f;
  --shadow: 0 2px 8px rgba(20, 50, 45, .06);
  --bar-bg: #f5f9f8;
  --code-bg: #f0f6f4;
  --tag-bg: #e7f1ee;
  --group-line: #d6e4e0;
}

html[data-theme="dark"] {
  --bg: #04110f;
  --bg-card: #0a1a17;
  --bg-hover: #142823;
  --text: #d8e6e2;
  --text-sub: #7f9a94;
  --border: #16332d;
  --accent: #2dd4bf;
  --accent-soft: rgba(45, 212, 191, .13);
  --danger: #ff7d93;
  --ok: #4ade80;
  --shadow: 0 2px 10px rgba(0, 0, 0, .5);
  --bar-bg: #071512;
  --code-bg: #0c201c;
  --tag-bg: #12302a;
  --group-line: #1d423a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  transition: background .25s, color .25s;
}
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }

/* ===== 顶栏 ===== */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px; background: var(--bar-bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar .back { color: var(--accent); text-decoration: none; font-size: 14px; white-space: nowrap; }
.topbar .back:hover { text-decoration: underline; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; flex: none; }
.brand-mark img { width: 26px; height: 26px; }
.brand-text h1 { font-size: 17px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text p { font-size: 12px; color: var(--text-sub); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.icon-btn {
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 15px; line-height: 1;
}
.icon-btn:hover { background: var(--bg-hover); }
.lang-switch { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.lang-btn {
  border: none; background: var(--bg-card); color: var(--text-sub);
  padding: 6px 10px; font-size: 13px; cursor: pointer; text-decoration: none;
}
.lang-btn + .lang-btn { border-left: 1px solid var(--border); }
.lang-btn.active { background: var(--accent); color: var(--accent-text); }

/* ===== 面板 ===== */
.ptm { max-width: 1080px; margin: 0 auto; padding: 14px 16px 4px; }
.panel {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px 16px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.sec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.sec-head h2 { font-size: 16px; margin-right: auto; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  border-radius: 8px; padding: 6px 13px; cursor: pointer; font-size: 13.5px;
}
.btn:hover { background: var(--bg-hover); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn-sm { padding: 3px 9px; font-size: 12px; border-radius: 6px; }

/* ===== 序列输入区 ===== */
.seq-box { position: relative; }
textarea#seqInput {
  width: 100%; min-height: 130px; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px; line-height: 1.6; letter-spacing: .02em;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  white-space: pre; overflow-wrap: normal; overflow-x: auto;
}
textarea#seqInput:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.hint { font-size: 12.5px; color: var(--text-sub); margin: 8px 0 0; }

/* ===== 选项区 ===== */
.opt-grid {
  display: flex; flex-wrap: wrap; gap: 12px 26px; align-items: flex-start;
  font-size: 13px;
}
.opt { display: flex; flex-direction: column; gap: 5px; }
.opt-wide { flex-basis: 100%; }
.opt-label { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--text); font-weight: 600; font-size: 13px; }
.opt-note { font-size: 12px; color: var(--text-sub); max-width: 560px; }
.opt-ctrls { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.opt-ctrls label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.opt-ctrls input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
.opt .radio input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; }
.opt select, .opt input[type="text"], .opt input[type="number"] {
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: 7px; padding: 4px 8px; font-size: 13px;
}
.opt select { cursor: pointer; max-width: 300px; }
.opt select:focus, .opt input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

/* ===== 结果区 ===== */
.empty-note { font-size: 13px; color: var(--text-sub); padding: 10px 2px; }
.proteinsum { margin: 2px 0 6px; }
.sub-head { font-size: 14px; margin: 12px 0 6px; display: flex; align-items: baseline; gap: 8px; }
.sub-head .count { font-size: 11.5px; color: var(--text-sub); font-weight: 400; }

/* 蛋白摘要卡片 */
.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 8px; margin: 4px 0 2px;
}
.card { border: 1px solid var(--border); border-radius: 10px; padding: 7px 11px; background: var(--code-bg); min-width: 0; }
.card.hl { border-color: var(--accent-soft); background: var(--accent-soft); }
.card .k { font-size: 11.5px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .v {
  font-size: 15px; font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  word-break: break-all; line-height: 1.35;
}
.card .v .u { font-size: 11px; color: var(--text-sub); font-family: inherit; }

/* B/Z/X 肽段独立区 */
.amb-box {
  border: 1px dashed var(--border); border-radius: 10px;
  padding: 4px 12px 10px; margin-top: 12px; background: var(--code-bg);
}
.amb-box .sub-head { color: var(--text-sub); }

/* ===== 数据表 ===== */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.table-wrap.tall { max-height: 440px; overflow-y: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 4.5px 9px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
table.data th {
  background: var(--bar-bg); color: var(--text-sub); font-weight: 600; font-size: 12px;
  position: sticky; top: 0; z-index: 1;
}
table.data th.center, table.data td.center { text-align: center; }
table.data th.left, table.data td.left { text-align: left; }
table.data td.mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
table.data td.strong { font-weight: 600; }
table.data td.mods { color: var(--accent); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--bg-hover); }
table.data tr.bad-row td { background: rgba(212, 82, 106, .06); }
table.data td.num { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
.note { font-size: 12px; color: var(--text-sub); margin-top: 8px; }
.note.warn { color: var(--danger); }

/* ===== 参考折叠 ===== */
details summary { cursor: pointer; font-size: 15px; font-weight: 600; }
details[open] summary { margin-bottom: 10px; }
details + details { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; }

/* ===== 说明区（SEO 主体） ===== */
.doc { max-width: 1080px; margin: 10px auto 40px; padding: 18px 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.doc h2 { font-size: 16px; margin: 18px 0 6px; }
.doc h2:first-child { margin-top: 0; }
.doc p { font-size: 14px; margin-bottom: 8px; }
.doc ul, .doc ol { margin: 0 0 8px 20px; font-size: 14px; }
.doc li { margin-bottom: 5px; }
.doc dl.faq dt { font-weight: 600; font-size: 14px; margin-top: 10px; }
.doc dl.faq dd { font-size: 14px; color: var(--text-sub); margin-left: 0; }
.doc .rel-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.doc .rel-links a {
  display: inline-block; padding: 4px 12px; background: var(--tag-bg);
  border-radius: 999px; color: var(--accent); text-decoration: none; font-size: 13px;
}
.doc .rel-links a:hover { background: var(--accent-soft); text-decoration: none; }
.doc .ver { font-size: 12px; color: var(--text-sub); border-top: 1px solid var(--border); padding-top: 10px; margin-top: 14px; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(12px);
  background: var(--text); color: var(--bg-card); padding: 8px 18px; border-radius: 999px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .topbar .back { font-size: 13px; }
  .brand { flex: 1 1 auto; }
  .brand-text p { display: none; }
  .spacer { display: none; }
  .ptm { padding: 10px 10px 0; }
  .panel { padding: 12px; }
  .sec-head h2 { font-size: 15px; }
  .opt-grid { gap: 12px 16px; }
  textarea#seqInput { min-height: 110px; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
  .table-wrap.tall { max-height: 340px; }
}