/* =========================================================
   话题播放统计 · 移动端样式
   手机优先；同时兼顾桌面预览（居中窄栏）
   ========================================================= */

:root {
  --bg: #f4f6fb;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --card-2: #f7f9fd;
  --text: #101725;
  --text-2: #5b6577;
  --text-3: #98a1b3;
  --line: #e6e9f2;
  --brand: #ff3b6b;
  --brand-soft: #ffe9ef;
  --up: #12a76d;
  --up-soft: #e6f7f0;
  --down: #e5484d;
  --down-soft: #fdeced;
  --accent: #4d7dff;
  --shadow: 0 1px 2px rgba(16, 23, 37, .04), 0 8px 24px rgba(16, 23, 37, .06);
  --radius: 16px;
  --tap: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17;
    --bg-soft: #111726;
    --card: #141b29;
    --card-2: #1a2233;
    --text: #eef2f9;
    --text-2: #9fabc0;
    --text-3: #6b7688;
    --line: #232c3e;
    --brand: #ff5b85;
    --brand-soft: #3a1622;
    --up: #35d391;
    --up-soft: #12301f;
    --down: #ff6b6f;
    --down-soft: #361a1c;
    --accent: #6f97ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

body { min-height: 100vh; }

svg.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 22px; height: 22px; display: block; }

.app {
  max-width: 560px;
  margin: 0 auto;
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid transparent;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #ff8659);
  color: #fff; box-shadow: 0 4px 12px rgba(255, 59, 107, .3);
  flex: none;
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text b { font-size: 15.5px; letter-spacing: .2px; }
.brand-text small { color: var(--text-3); font-size: 11.5px; }
.topbar-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--text-2); display: grid; place-items: center;
  cursor: pointer; transition: transform .12s ease, color .12s ease;
  flex: none;
}
.icon-btn:active { transform: scale(.93); color: var(--brand); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------------- 布局 ---------------- */
.content { padding: 4px 14px 20px; }
.tab-panel { display: flex; flex-direction: column; gap: 12px; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 10px;
}
.card-head h2 { font-size: 14.5px; margin: 0; letter-spacing: .2px; }
.card-hint { color: var(--text-3); font-size: 11.5px; }

.mini-btn {
  border: 1px solid var(--line); background: var(--card-2); color: var(--text-2);
  border-radius: 9px; padding: 5px 10px; font-size: 12.5px; cursor: pointer;
  font-family: inherit;
}
.mini-btn:active { transform: scale(.96); color: var(--brand); }

.tip { color: var(--text-3); font-size: 11.5px; margin: 10px 0 0; line-height: 1.6; }
.version { text-align: center; color: var(--text-3); font-size: 11.5px; margin: 4px 0 0; }

/* ---------------- 示例数据横幅 ---------------- */
.demo-banner {
  display: flex; gap: 10px; align-items: flex-start;
  background: linear-gradient(135deg, var(--brand-soft), transparent);
  border: 1px solid var(--line); border-radius: 14px; padding: 11px 12px;
}
.demo-banner svg { width: 18px; height: 18px; color: var(--brand); flex: none; margin-top: 2px; }
.demo-banner > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.demo-banner b { font-size: 13px; }
.demo-banner span { color: var(--text-2); font-size: 11.5px; line-height: 1.55; }

/* ---------------- 话题卡 ---------------- */
.topic-card { display: flex; flex-direction: column; gap: 12px; }
.topic-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.topic-id { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.topic-dot {
  width: 10px; height: 10px; border-radius: 3px; background: var(--brand);
  margin-top: 7px; flex: none;
}
.topic-name {
  font-size: 20px; margin: 0; letter-spacing: .3px; line-height: 1.25;
  word-break: break-all;
}
.topic-sub { margin: 3px 0 0; color: var(--text-3); font-size: 12px; }

/* ---------------- 话题下拉框（词条列表 + ❌ 删除） ---------------- */
.topic-dd {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 12px; border-top: 1px dashed var(--line);
  animation: fade .16s ease;
}
.topic-dd .search-box {
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 0 12px;
}
.topic-dd-list {
  display: flex; flex-direction: column;
  max-height: 46vh; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.dd-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; border-bottom: 1px solid var(--line);
}
.dd-row:last-child { border-bottom: 0; }
.dd-pick {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px;
  background: transparent; border: 0; color: var(--text);
  font-family: inherit; text-align: left; padding: 8px 4px;
  border-radius: 10px; cursor: pointer;
}
.dd-pick:active { background: var(--card-2); }
.dd-row.is-on .dd-pick { background: var(--brand-soft); }
.dd-row.is-on .dd-name { color: var(--brand); font-weight: 600; }
.dd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dd-name {
  font-size: 14.5px; line-height: 1.3; word-break: break-all;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dd-hint { color: var(--text-3); font-size: 11.5px; }
.dd-cur {
  flex: none; font-size: 10.5px; color: var(--brand);
  background: var(--card); border: 1px solid currentColor;
  border-radius: 6px; padding: 1px 6px;
}
/* ❌ 删除词条：够大好点，按下去有反馈 */
.dd-del {
  flex: none; width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid transparent; background: transparent;
  font-size: 15px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
}
.dd-del:active { background: var(--down-soft); border-color: var(--down); transform: scale(.92); }
.dd-new {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  background: var(--card-2); border: 1px dashed var(--line);
  border-radius: 10px; padding: 10px 12px; margin-top: 2px;
  color: var(--brand); font-family: inherit; font-size: 13.5px;
  cursor: pointer;
}
.dd-new .dd-hint { color: var(--text-3); }

/* ---------------- 统计卡 ---------------- */
.stats { display: flex; flex-direction: column; gap: 10px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px;
  position: relative; overflow: hidden;
}
.stat-primary {
  background: linear-gradient(140deg, #ff3b6b, #ff7a4d 92%);
  border-color: transparent; color: #fff;
  box-shadow: 0 10px 26px rgba(255, 59, 107, .28);
}
.stat-label { font-size: 12.5px; color: var(--text-2); }
.stat-primary .stat-label { color: rgba(255, 255, 255, .85); }
.stat-value {
  font-size: 30px; font-weight: 700; letter-spacing: -.6px; line-height: 1.15;
  font-variant-numeric: tabular-nums; word-break: break-all;
}
.stat-foot { font-size: 11.5px; color: var(--text-3); }
.stat-primary .stat-foot { color: rgba(255, 255, 255, .9); }
.stat-value.is-up { color: var(--up); }
.stat-value.is-down { color: var(--down); }
.stat-primary .stat-value.is-up,
.stat-primary .stat-value.is-down { color: #fff; }

/* ---------------- 走势图 ---------------- */
.chart-wrap { position: relative; height: 150px; }
.chart { width: 100%; height: 150px; display: block; overflow: visible; }
.chart-empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--text-3); font-size: 12.5px;
}
.chart-tip {
  position: absolute; top: 0; transform: translateX(-50%);
  background: rgba(16, 23, 37, .92); color: #fff; border-radius: 9px;
  padding: 6px 9px; font-size: 11.5px; line-height: 1.45; pointer-events: none;
  white-space: nowrap; z-index: 5;
}
@media (prefers-color-scheme: dark) { .chart-tip { background: rgba(255, 255, 255, .94); color: #101725; } }
.chart-legend {
  display: flex; align-items: center; gap: 12px; margin-top: 8px;
  color: var(--text-3); font-size: 11.5px; flex-wrap: wrap;
}
.chart-legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.lg-line { background: var(--accent); }
.lg-bar { background: color-mix(in srgb, var(--brand) 55%, transparent); }
.chart-meta { margin-left: auto; }

/* ---------------- 月度表 ---------------- */
.month-list { display: flex; flex-direction: column; }
.month-row {
  display: grid; grid-template-columns: 62px 1fr auto; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.month-row:last-child { border-bottom: 0; }
.month-label { font-size: 13px; font-weight: 600; }
.month-label small { display: block; color: var(--text-3); font-weight: 400; font-size: 11px; }
.month-bar { height: 6px; border-radius: 4px; background: var(--card-2); overflow: hidden; }
.month-bar span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brand), #ff8659); }
.month-delta { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13.5px; }
.month-delta small { display: block; font-weight: 400; color: var(--text-3); font-size: 10.5px; }

/* ---------------- 记录列表 ---------------- */
.snap-list { display: flex; flex-direction: column; }
.snap-row {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 10px;
  padding: 11px 0; border-bottom: 1px solid var(--line); align-items: center;
}
.snap-row:last-child { border-bottom: 0; }
.snap-main { min-width: 0; }
.snap-date { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.snap-date em {
  font-style: normal; font-size: 10.5px; color: var(--text-3);
  background: var(--card-2); border-radius: 6px; padding: 1px 6px;
}
.snap-note { color: var(--text-3); font-size: 11.5px; margin-top: 2px; word-break: break-all; }
/* 录入时间：与上面的「数据日期」刻意区分 —— 那个是数据属于哪天，这个是实际存进电脑的时刻 */
.snap-entry {
  color: var(--text-3); font-size: 11px; margin-top: 3px;
  font-variant-numeric: tabular-nums;
  opacity: .85;
}
.tm-entry {
  color: var(--text-3); font-size: 11px; margin-top: 3px;
  font-variant-numeric: tabular-nums;
  opacity: .85;
}
.snap-right { text-align: right; font-variant-numeric: tabular-nums; }
.snap-value { font-size: 15px; font-weight: 600; }
.snap-delta { font-size: 11.5px; color: var(--text-3); }
.snap-delta.up { color: var(--up); }
.snap-delta.down { color: var(--down); }
.snap-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.snap-list-compact .snap-row { grid-template-columns: 1fr auto auto; }
.snap-list-compact .snap-actions { grid-column: auto; }
.snap-list-compact .snap-actions .mini-btn.only-edit { display: none; }
.empty { color: var(--text-3); font-size: 12.5px; text-align: center; padding: 18px 6px; }

/* ---------------- 表单 ---------------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-size: 12.5px; color: var(--text-2); }
.field-label em { font-style: normal; color: var(--text-3); font-size: 11px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-hint { font-size: 11px; color: var(--text-3); }
.field-hint.ok { color: var(--up); }
.field-hint.warn { color: var(--down); }

/* 记录页 · 话题输入框的下拉（搜过的词条 + ❌） */
.combo { position: relative; }
.combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 35;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 6px 8px;
  max-height: 52vh; overflow-y: auto; overscroll-behavior: contain;
  animation: fade .15s ease;
}
.combo-list .dd-row { padding: 3px 0; }
.combo-list .dd-pick { padding: 7px 4px; }
.combo-list .dd-name { font-size: 14px; }

input[type="text"], input[type="date"], input[type="search"], select, textarea {
  width: 100%; font-family: inherit; font-size: 15px; color: var(--text);
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; min-height: var(--tap); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  appearance: none; -webkit-appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) 20px, calc(100% - 11px) 20px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
  cursor: pointer;
}
.filter-row select { flex: none; width: 130px; }
textarea { min-height: 78px; line-height: 1.6; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }

.input-with-unit { position: relative; }
.input-with-unit input { padding-right: 58px; font-variant-numeric: tabular-nums; }
.unit-badge {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 11.5px; color: var(--text-3); pointer-events: none;
}

.btn {
  flex: 1; min-height: var(--tap); border-radius: 12px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--text); font-family: inherit; font-size: 14.5px;
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; padding: 0 14px;
  transition: transform .12s ease, opacity .12s ease;
}
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), #ff7a4d);
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px rgba(255, 59, 107, .26);
}
.btn-ghost { background: var(--card); color: var(--text-2); }
.btn-ghost.danger { color: var(--down); border-color: color-mix(in srgb, var(--down) 30%, var(--line)); }
.form-actions { display: flex; gap: 10px; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-grid .btn { width: 100%; }

.paste-box { margin-bottom: 10px; }
.paste-result {
  background: var(--card-2); border: 1px dashed var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: 12.5px; line-height: 1.7; margin-bottom: 10px;
}
.paste-result b { color: var(--brand); }
.paste-result .cand { color: var(--text-3); font-size: 11px; }

.filter-row { display: flex; gap: 10px; margin-bottom: 8px; }
.filter-row .grow { flex: 1; }

/* ---------------- 话题管理 ---------------- */
.topic-manage { display: flex; flex-direction: column; }
.tm-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.tm-row:last-child { border-bottom: 0; }
.tm-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.tm-main { flex: 1; min-width: 0; }
.tm-name { font-size: 14px; font-weight: 600; word-break: break-all; }
.tm-sub { color: var(--text-3); font-size: 11.5px; }

/* ---------------- 数据页 ---------------- */
.kv-list { display: flex; flex-direction: column; }
.kv-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.kv-row:last-child { border-bottom: 0; }
.kv-row span { color: var(--text-2); }
.kv-row b { font-variant-numeric: tabular-nums; }
.backup-list { display: flex; flex-direction: column; }
.backup-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.backup-row:last-child { border-bottom: 0; }

/* ---------------- 设置 ---------------- */
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.switch-row:last-child { border-bottom: 0; }
.switch-row select { width: 130px; min-height: 38px; padding: 8px 30px 8px 10px; font-size: 13.5px; }
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 48px; height: 28px; border-radius: 999px; background: var(--card-2);
  border: 1px solid var(--line); position: relative; cursor: pointer; flex: none;
  transition: background .18s ease;
}
input[type="checkbox"]::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .18s ease;
}
input[type="checkbox"]:checked { background: var(--brand); border-color: transparent; }
input[type="checkbox"]:checked::after { transform: translateX(20px); }

.doc-list { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 12.5px; line-height: 1.75; }
.doc-list b { color: var(--text); }
.doc-list code {
  background: var(--card-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 6px; font-size: 12px; color: var(--text);
}

.path { padding: 10px 0; border-bottom: 1px solid var(--line); }
.path:first-of-type { padding-top: 0; }
.path:last-of-type { border-bottom: 0; padding-bottom: 0; }
.path b { font-size: 13.5px; }
.path p { margin: 4px 0 0; color: var(--text-2); font-size: 12.5px; line-height: 1.7; }

/* 「要复制的是这一行」示例块 */
.copy-sample {
  background: var(--card-2); border: 1px dashed color-mix(in srgb, var(--brand) 40%, var(--line));
  border-radius: 12px; padding: 12px; margin: 10px 0;
  font-size: 15px; font-weight: 600; text-align: center;
  color: var(--text); word-break: break-all; line-height: 1.6;
}
.copy-sample.bad {
  border-style: solid; border-color: var(--line);
  font-weight: 400; font-size: 12px; color: var(--text-3); text-align: left;
}

/* ---------------- 截图识别 ---------------- */
.drop-zone {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 2px dashed var(--line); border-radius: 14px; padding: 18px 14px;
  text-align: center; cursor: pointer; background: var(--card-2);
  transition: border-color .15s ease, background .15s ease;
}
.drop-zone svg { width: 24px; height: 24px; color: var(--text-3); }
.drop-zone b { font-size: 14px; }
.drop-zone span { color: var(--text-2); font-size: 12px; }
.drop-zone small { color: var(--text-3); font-size: 11px; margin-top: 2px; }
.drop-zone.on {
  border-color: var(--brand); background: var(--brand-soft);
}
.drop-zone.on svg { color: var(--brand); }
.drop-zone.busy { opacity: .7; pointer-events: none; }

.ocr-result {
  margin-top: 10px; background: var(--card-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 12px; font-size: 12.5px; line-height: 1.7;
}
.ocr-result .big { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ocr-result .ok { color: var(--up); }
.ocr-result .warn { color: var(--down); }
.ocr-result pre {
  margin: 8px 0 0; padding: 8px 10px; background: var(--card); border-radius: 8px;
  font-size: 11px; line-height: 1.6; max-height: 130px; overflow: auto;
  white-space: pre-wrap; color: var(--text-2);
}
.ocr-service {
  display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3);
}
.ocr-service i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); display: inline-block;
}
.ocr-service.up i { background: var(--up); }
.ocr-service.down i { background: var(--down); }

/* 记录页顶部的「截图识别结果」卡 */
.ocr-pending { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.ocr-pending .pending-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px;
}
.ocr-pending .pending-value {
  font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.5px;
}
.ocr-pending .pending-row { color: var(--text-2); font-size: 12.5px; }
.ocr-pending .pending-actions { display: flex; gap: 8px; margin-top: 12px; }
.ocr-pending .pending-actions .btn { min-height: 40px; font-size: 13.5px; }

/* 识别失败时的提示条 */
.parse-warn {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
  border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; font-size: 12.5px; line-height: 1.65;
}
.parse-warn svg { width: 16px; height: 16px; color: var(--brand); flex: none; margin-top: 2px; }
.parse-warn b { color: var(--text); }
.parse-warn code {
  background: var(--card); border-radius: 5px; padding: 0 5px; font-size: 11.5px;
  word-break: break-all; color: var(--text-2);
}

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around;
  max-width: 560px; margin: 0 auto;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--line);
}
.tab-item {
  flex: 1; border: 0; background: transparent; color: var(--text-3);
  font-family: inherit; font-size: 10.5px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border-radius: 12px; transition: color .15s ease;
}
.tab-item svg { width: 21px; height: 21px; }
.tab-item.is-on { color: var(--brand); }
.tab-item:active { transform: scale(.94); }

/* ---------------- 弹层 ---------------- */
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; }
.sheet-mask { position: absolute; inset: 0; background: rgba(8, 12, 20, .45); animation: fade .18s ease; }
.sheet-body {
  position: relative; width: 100%; max-width: 560px; margin: 0 auto;
  background: var(--bg-soft); border-radius: 20px 20px 0 0;
  padding: 14px 14px calc(20px + env(safe-area-inset-bottom, 0px));
  max-height: 82vh; overflow: auto; animation: slideUp .22s cubic-bezier(.2, .8, .3, 1);
}
.sheet-body-sm { max-height: 88vh; }
@keyframes slideUp { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head b { font-size: 15.5px; }
.search-box {
  display: flex; align-items: center; gap: 8px; background: var(--card-2);
  border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; margin-bottom: 10px;
}
.search-box svg { width: 18px; height: 18px; color: var(--text-3); flex: none; }
.search-box input { border: 0; background: transparent; padding-left: 0; }
.search-box input:focus { box-shadow: none; }

/* ---------------- Toast / Confirm ---------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); z-index: 90;
  background: rgba(16, 23, 37, .94); color: #fff; border-radius: 12px;
  padding: 10px 16px; font-size: 13.5px; max-width: 82vw; text-align: center;
  animation: fade .18s ease;
}
@media (prefers-color-scheme: dark) { .toast { background: rgba(238, 242, 249, .95); color: #101725; } }

.confirm { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 24px; }
.confirm-mask { position: absolute; inset: 0; background: rgba(8, 12, 20, .5); }
.confirm-box {
  position: relative; width: 100%; max-width: 320px; background: var(--card);
  border-radius: 18px; padding: 18px; box-shadow: var(--shadow);
  animation: fade .18s ease;
}
.confirm-box b { font-size: 15.5px; }
.confirm-box p { color: var(--text-2); font-size: 13px; margin: 8px 0 16px; line-height: 1.6; }
.confirm-actions { display: flex; gap: 10px; }

.hidden, [hidden] { display: none !important; }

@media (min-width: 600px) {
  :root { font-size: 15.5px; }
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  .tabbar { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
