:root {
  --red: #ff2442;
  --red-soft: #ff6b81;
  --accent-tint: #fff0f2;
  --accent-line: #ffd9df;
  --hero1: #ff2442;
  --hero2: #ff5c75;
  --hero3: #ff8a5b;
  --ink: #1a1a1a;
  --gray: #8a8a8a;
  --line: #eee;
  --bg: #f6f7f9;
  --card: #fff;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 6px 20px rgba(255, 36, 66, 0.16);
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- Hero ---------------- */
.hero {
  background: linear-gradient(135deg, var(--hero1) 0%, var(--hero2) 55%, var(--hero3) 100%);
  color: #fff;
  padding: 28px 16px 22px;
}
.hero-inner { max-width: 1080px; margin: 0 auto; }

.brand { position: relative; display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.brand-text { min-width: 0; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.brand-logo {
  font-size: 28px; width: 48px; height: 48px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.18); border-radius: 12px; backdrop-filter: blur(4px);
}
.brand-text h1 { font-size: 22px; font-weight: 800; letter-spacing: 1px; }
.brand-text p { font-size: 13px; opacity: 0.9; }
.settings-btn {
  position: static; border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 12px; padding: 6px 12px;
  border-radius: 999px; cursor: pointer; transition: background 0.2s;
}
.settings-btn:hover { background: rgba(255, 255, 255, 0.26); }

.search-bar { display: flex; gap: 10px; }
.search-input-wrap {
  flex: 1; display: flex; align-items: center; background: #fff; border-radius: 12px;
  padding: 0 12px; height: 50px; box-shadow: var(--shadow);
}
.search-icon { font-size: 16px; opacity: 0.6; }
#keywordInput {
  flex: 1; border: none; outline: none; font-size: 15px; padding: 0 8px; color: var(--ink); background: transparent;
}
.clear-btn { border: none; background: transparent; color: var(--gray); cursor: pointer; font-size: 14px; padding: 4px; }
.search-btn {
  border: none; background: #1a1a1a; color: #fff; font-size: 15px; font-weight: 600;
  padding: 0 22px; height: 50px; border-radius: 12px; cursor: pointer; white-space: nowrap;
  transition: transform 0.12s, background 0.2s;
}
.search-btn:hover { background: #000; }
.search-btn:active { transform: scale(0.97); }
/* 深色平台主题（如抖音黑色）下，搜索按钮用品牌强调色 */
body.theme-dark .search-btn { background: var(--red); color: #fff; }
body.theme-dark .search-btn:hover { background: var(--red-soft); }

.search-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.platform-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.ptab {
  border: 1px solid rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.12);
  color: #fff; padding: 6px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 5px; transition: background 0.2s;
}
.ptab.active { background: #fff; color: var(--red); font-weight: 700; border-color: #fff; }
.ptab.locked { opacity: 0.55; cursor: not-allowed; }
.ptab small { font-size: 10px; opacity: 0.8; }

.time-range { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #fff; }
.time-range select {
  border: 1px solid rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.14);
  color: #fff; border-radius: 8px; padding: 5px 8px; font-size: 13px; outline: none;
}
.time-range select option { color: #1a1a1a; }
.auto-hint { font-size: 11px; opacity: 0.85; background: rgba(255, 255, 255, 0.16); padding: 2px 8px; border-radius: 999px; }

.hot-words { margin-top: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.hot-label { opacity: 0.9; }
.hot-word {
  border: 1px solid rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.1);
  color: #fff; padding: 4px 12px; border-radius: 999px; font-size: 12px; cursor: pointer; transition: background 0.2s;
}
.clear-history {
  margin-left: 6px; border: none; background: transparent; color: rgba(255,255,255,0.7);
  font-size: 12px; cursor: pointer; text-decoration: underline;
}
.clear-history:hover { color: #fff; }

/* ---------------- Container ---------------- */
.container { max-width: 1080px; margin: 0 auto; padding: 22px 16px 40px; }

.empty-state { text-align: center; padding: 60px 16px; color: var(--gray); }
.empty-emoji { font-size: 46px; margin-bottom: 12px; }
.empty-state h2 { font-size: 20px; color: var(--ink); margin-bottom: 8px; }
.empty-state p { font-size: 14px; line-height: 1.9; }

.loading { text-align: center; padding: 50px 0; color: var(--gray); }
.spinner {
  width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--red);
  border-radius: 50%; margin: 0 auto 12px; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* ---------------- Result ---------------- */
.result-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.result-head h2 { font-size: 20px; }
.result-sub { font-size: 13px; color: var(--gray); margin-top: 2px; }
.data-badge {
  font-size: 12px; padding: 4px 10px; border-radius: 999px; font-weight: 600;
  background: #fff0f2; color: var(--red); border: 1px solid #ffd9df;
}
.data-badge.mock { background: #fff7e6; color: #b26a00; border-color: #ffe0a3; }

.result-head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.export-btn {
  border: 1px solid var(--red); color: var(--red); background: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px; cursor: pointer; transition: background 0.2s, color 0.2s; white-space: nowrap;
}
.export-btn:hover { background: var(--red); color: #fff; }
.export-btn:disabled { opacity: 0.6; cursor: default; }

.few-tip { grid-column: 1 / -1; font-size: 13px; color: #b26a00; background: #fff7e6; border: 1px solid #ffe0a3; padding: 10px 12px; border-radius: 10px; margin-bottom: 4px; }

.related-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; font-size: 13px; }
.related-label { color: var(--gray); }
.related-word {
  border: 1px solid var(--line); background: #fff; color: var(--red); padding: 4px 12px;
  border-radius: 999px; font-size: 12px; cursor: pointer; transition: background 0.2s;
}
.related-word:hover { background: #f1eeff; }

.expanded-row { margin-bottom: 16px; }
.exp-chip {
  border: 1px solid var(--accent-line); background: var(--accent-tint); color: var(--red);
  padding: 4px 12px; border-radius: 999px; font-size: 12px; cursor: default;
}
.exp-chip.core { font-weight: 700; border-color: var(--red); }

.analytics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.analytic-card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.analytic-card h3 { font-size: 14px; margin-bottom: 12px; color: var(--ink); }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { font-size: 12px; }
.bar-row .bar-label { display: flex; justify-content: space-between; margin-bottom: 4px; color: #555; }
.bar-row .bar-label b { color: var(--ink); }
.bar-track { height: 8px; background: #f1f1f1; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--red), var(--red-soft)); border-radius: 999px; transition: width 0.6s ease; }
.bar-fill.alt { background: linear-gradient(90deg, #5b8def, #8fc0ff); }

/* ---------------- 结果筛选 ---------------- */
.filter-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 14px 20px;
  margin: 0 0 16px; padding: 10px 12px; background: #fff; border-radius: 12px;
  box-shadow: var(--shadow); font-size: 13px;
}
.filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-label { color: var(--gray); font-size: 12px; margin-right: 2px; }
.filter-chip {
  border: 1px solid var(--line); background: #fff; color: #555; padding: 5px 10px;
  border-radius: 999px; font-size: 12px; cursor: pointer; transition: 0.15s;
}
.filter-chip:hover { border-color: var(--red); color: var(--red); }
.filter-chip.active { background: var(--red); color: #fff; border-color: var(--red); font-weight: 600; }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.note-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; transition: transform 0.15s, box-shadow 0.15s; cursor: pointer;
  border: 1px solid transparent;
}
.note-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--accent-line); }
.note-cover { position: relative; width: 100%; aspect-ratio: 3 / 4; background: linear-gradient(135deg, var(--accent-tint), #fff); overflow: hidden; }
.note-cover .cover-bg {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 40px; font-weight: 800; color: var(--red); opacity: 0.16; letter-spacing: 2px;
}
.note-cover .cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; z-index: 1; }
.note-cover .cover-img.img-fail { display: none; }
.note-type {
  position: absolute; top: 8px; left: 8px; background: rgba(0, 0, 0, 0.6); color: #fff;
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
}
.note-rank {
  position: absolute; top: 8px; right: 8px; background: var(--red); color: #fff;
  font-size: 12px; font-weight: 700; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px;
}
.note-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.note-title {
  font-size: 15px; font-weight: 700; line-height: 1.45; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.note-author { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--gray); }
.note-author img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; background: #eee; }
.note-author .fans { color: #ff7a45; font-weight: 600; }
.note-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 6px; border-top: 1px solid var(--line); }
.note-stats { font-size: 12px; color: var(--red); font-weight: 600; }
.note-stats .sub { color: var(--gray); font-weight: 400; margin-left: 6px; }
.dissect-btn {
  border: 1px solid var(--red); color: var(--red); background: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px; cursor: pointer; transition: background 0.2s, color 0.2s;
}
.dissect-btn:hover { background: var(--red); color: #fff; }
.score-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.score-tags span { font-size: 11px; padding: 2px 7px; border-radius: 999px; }
.score-tags .rel { background: #e8f5e9; color: #2e7d32; }
.score-tags .pop { background: #fff3e0; color: #e65100; }
.score-tags .rec { background: #e3f2fd; color: #1565c0; }
.match-chip { display: inline-block; font-size: 11px; color: var(--gray); background: #f4f4f6; padding: 2px 8px; border-radius: 999px; }

.not-ready {
  margin-top: 18px; background: #fff7e6; border: 1px solid #ffe0a3; color: #b26a00;
  padding: 14px 16px; border-radius: var(--radius); font-size: 14px;
}

/* ---------------- 历史记录 ---------------- */
.history-section { margin-top: 20px; }
.history-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.history-head h3 { font-size: 15px; color: var(--ink); }
.history-clear { border: none; background: transparent; color: var(--gray); font-size: 12px; cursor: pointer; }
.history-clear:hover { color: var(--red); }
.history-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.history-card {
  background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s; border: 1px solid transparent;
}
.history-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--accent-line); }
.history-card .h-cover { width: 100%; aspect-ratio: 3 / 4; background: var(--accent-tint); position: relative; overflow: hidden; }
.history-card .h-cover img { width: 100%; height: 100%; object-fit: cover; }
.history-card .h-body { padding: 10px; }
.history-card .h-title { font-size: 12px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.history-card .h-meta { font-size: 11px; color: var(--gray); margin-top: 4px; }
.history-card .h-mode { font-size: 10px; color: var(--red); margin-top: 4px; font-weight: 600; }
.drawer-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 460px; max-width: 92vw;
  background: var(--bg); z-index: 50; box-shadow: -6px 0 30px rgba(0, 0, 0, 0.18);
  display: flex; flex-direction: column; animation: slideIn 0.25s ease;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); background: #fff; }
.drawer-head h3 { font-size: 16px; }
.icon-btn { border: none; background: #f1f1f1; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 14px; color: #555; }
.drawer-body { padding: 16px 18px 30px; overflow-y: auto; flex: 1; }

/* 返回搜索结果按钮（点2） */
.dz-back-btn {
  border: none; background: var(--accent-tint); color: var(--red);
  font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 8px;
  cursor: pointer; transition: background 0.15s; white-space: nowrap;
}
.dz-back-btn:hover { background: var(--accent-line); }

/* 笔记链接操作区（点1：复制链接） */
.dz-meta-actions { display: inline-flex; gap: 10px; align-items: center; }
.dz-copy-btn {
  border: none; background: transparent; color: var(--red);
  font-size: 12px; padding: 0; cursor: pointer;
  text-decoration: none;
}
.dz-copy-btn:hover { text-decoration: underline; }

/* 笔记卡片高亮闪烁（"返回搜索结果" 滚动到位时提示） */
@keyframes noteFlash {
  0% { box-shadow: 0 0 0 0 rgba(255, 36, 66, 0.55); border-color: var(--red); }
  60% { box-shadow: 0 0 0 10px rgba(255, 36, 66, 0); border-color: var(--red); }
  100% { box-shadow: 0 0 0 0 rgba(255, 36, 66, 0); border-color: transparent; }
}
.note-card-flash { animation: noteFlash 1.6s ease-out; }

.dz-note { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 16px; box-shadow: var(--shadow); }
.dz-note .dz-title { font-size: 15px; font-weight: 700; line-height: 1.5; margin-bottom: 8px; }
.dz-note .dz-meta { font-size: 12px; color: var(--gray); display: flex; gap: 10px; flex-wrap: wrap; }
.dz-mode-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.dz-mode-badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 6px;
}
.dz-mode-badge.mode-normal { background: #fff7e6; color: #b26a00; border: 1px solid #ffe0a3; }
.dz-mode-badge.mode-transcript { background: #eafaf0; color: #1a7f43; border: 1px solid #b7ebc8; }
.dz-mode-badge.mode-video { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }
.dz-cache-badge { font-size: 10px; color: #888; background: #f1f1f1; padding: 2px 6px; border-radius: 4px; }
.dz-mode-help {
  width: 18px; height: 18px; border-radius: 50%; background: #e8e8e8; color: #666; font-size: 11px;
  display: grid; place-items: center; cursor: help; font-weight: 700;
}
.dz-retry-btn {
  margin-left: auto; border: 1px solid var(--red); background: #fff; color: var(--red); font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 6px; cursor: pointer;
}
.dz-retry-btn:hover { background: var(--red); color: #fff; }

.dz-section { background: #fff; border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.dz-section h4 { font-size: 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.dz-section h4 .tag { font-size: 11px; background: var(--red); color: #fff; padding: 1px 7px; border-radius: 999px; font-weight: 600; }
.dz-summary { font-size: 13px; color: #444; line-height: 1.8; background: #fff7f8; border-left: 3px solid var(--red); padding: 10px 12px; border-radius: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { font-size: 12px; background: #f1f1f1; color: #444; padding: 4px 10px; border-radius: 999px; }
.chip.hot { background: var(--accent-tint); color: var(--red); }
.struct-list { list-style: none; counter-reset: step; }
.struct-list li { font-size: 13px; color: #444; padding: 7px 0 7px 30px; position: relative; border-bottom: 1px dashed var(--line); }
.struct-list li:last-child { border-bottom: none; }
.struct-list li::before {
  counter-increment: step; content: counter(step); position: absolute; left: 0; top: 7px;
  width: 20px; height: 20px; background: var(--red); color: #fff; border-radius: 50%; font-size: 11px;
  display: grid; place-items: center;
}
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.metric { background: #fafafa; border-radius: 8px; padding: 8px 10px; }
.metric .m-val { font-size: 16px; font-weight: 700; color: var(--red); }
.metric .m-lab { font-size: 11px; color: var(--gray); }
.dz-cta { position: sticky; bottom: 0; background: #fff; padding: 12px 0 0; margin-top: 6px; }
.primary-btn {
  width: 100%; border: none; background: var(--red); color: #fff; font-size: 15px; font-weight: 700;
  padding: 13px; border-radius: 12px; cursor: pointer; transition: background 0.2s, transform 0.1s;
}
.primary-btn:hover { background: #e51e3a; }
.primary-btn:active { transform: scale(0.99); }
.primary-btn:disabled { opacity: 0.6; cursor: default; }

/* ---------------- Modal (rewrite) ---------------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: #fff; border-radius: 16px; width: 100%; max-width: 640px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.rewrite-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.rewrite-options label { font-size: 12px; color: #555; display: flex; flex-direction: column; gap: 4px; }
.rewrite-options select { border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 13px; outline: none; }
.rewrite-options .primary-btn { grid-column: 1 / -1; }

.rewrite-result { margin-top: 8px; }
.rw-block { background: #fafafa; border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.rw-block h5 { font-size: 13px; color: var(--red); margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.rw-block .copy-mini { font-size: 11px; border: 1px solid var(--line); background: #fff; color: #555; padding: 2px 8px; border-radius: 6px; cursor: pointer; }
.rw-title-item { font-size: 14px; font-weight: 600; padding: 7px 0; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rw-title-item:last-child { border-bottom: none; }
.rw-title-item .copy-mini { flex-shrink: 0; }
.rw-outline { margin: 0; padding-left: 18px; font-size: 13px; color: #444; }
.rw-outline li { margin: 5px 0; }
.rw-body { white-space: pre-wrap; font-size: 13px; color: #333; line-height: 1.8; }
.rw-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.rw-tags span { font-size: 12px; background: var(--accent-tint); color: var(--red); padding: 3px 10px; border-radius: 999px; }
.rw-tip { font-size: 12px; color: #777; line-height: 1.8; }

/* ---------------- Settings modal ---------------- */
.settings-body { padding: 18px; }
.mode-tip { background: var(--accent-tint); color: var(--red); font-size: 13px; font-weight: 600; padding: 10px 12px; border-radius: 10px; margin-bottom: 16px; }
.quota-box { background: #fafafa; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.quota-row { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.quota-row:last-child { border-bottom: none; }
.quota-row span { color: var(--gray); }
.quota-row b { color: var(--red); font-size: 15px; }
.set-label { display: block; font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.set-desc { font-size: 12px; color: var(--gray); line-height: 1.7; margin-bottom: 8px; }
.key-input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 13px; outline: none; font-family: ui-monospace, Menlo, Consolas, monospace; resize: vertical;
}
textarea.key-input { min-height: 70px; }
.key-input:focus { border-color: var(--red); }
.set-actions { display: flex; gap: 10px; margin-top: 16px; }
.set-actions .primary-btn { flex: 1; }
.ghost-btn {
  border: 1px solid var(--line); background: #fff; color: #666; font-size: 13px; font-weight: 600;
  padding: 13px 18px; border-radius: 12px; cursor: pointer;
}
.ghost-btn:hover { background: #f6f6f6; }
.set-foot { font-size: 11px; color: #aaa; line-height: 1.7; margin-top: 14px; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.82); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; z-index: 80; animation: fade 0.3s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- Footer ---------------- */
.site-footer { text-align: center; padding: 24px 16px; color: #aaa; font-size: 12px; line-height: 1.9; }
.site-footer a { color: #777; }

/* ---------------- 响应式：手机端 ---------------- */
@media (max-width: 720px) {
  .hero { padding: 20px 14px 18px; }
  .brand-text h1 { font-size: 20px; }
  .brand { align-items: flex-start; flex-wrap: wrap; }
  .brand-logo { width: 40px; height: 40px; }
  .brand-text { flex: 1; }
  .header-actions { width: 100%; justify-content: flex-end; }
  .search-bar { flex-direction: column; }
  .search-btn { height: 46px; width: 100%; }
  .search-meta { flex-direction: column; align-items: stretch; }
  .time-range { justify-content: space-between; }
  .analytics { grid-template-columns: 1fr; }
  .notes-grid { grid-template-columns: 1fr; }
  .drawer { width: 100%; max-width: 100%; top: auto; bottom: 0; height: 92vh; border-radius: 18px 18px 0 0; animation: slideUp 0.28s ease; }
  @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .rewrite-options { grid-template-columns: 1fr; }
  .rewrite-options-extended { grid-template-columns: 1fr; }
  .rewrite-options-extended .full-row { grid-column: 1; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .container { padding: 16px 12px 30px; }
}

@media (min-width: 721px) and (max-width: 1024px) {
  .analytics { grid-template-columns: 1fr 1fr; }
  .notes-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------- 拆解三问（抽屉） ---------------- */
.dz-topline { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.tier-badge {
  flex: 0 0 auto; background: var(--red); color: #fff; font-size: 13px; font-weight: 700;
  padding: 5px 12px; border-radius: 999px; white-space: nowrap;
}
.tier-reason { font-size: 12px; color: #888; line-height: 1.5; }
.dz-summary-top {
  background: var(--accent-tint); border-left: 3px solid var(--red);
  padding: 11px 13px; font-size: 13px; color: #333; border-radius: 8px; line-height: 1.7; margin-bottom: 6px;
}
.dz-video {
  background: #fff; border: 1px solid #ffe1e1; border-radius: 12px; padding: 12px 14px; margin: 12px 0 4px;
  box-shadow: var(--shadow);
}
.dz-video-head { font-size: 14px; font-weight: 700; color: var(--red); margin-bottom: 4px; }
.dz-video-sub { font-size: 11.5px; color: #999; line-height: 1.5; margin-bottom: 10px; }
.dz-video-row { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.dz-video-row:last-child { margin-bottom: 0; }
.dz-video-input {
  flex: 1 1 200px; min-width: 160px; padding: 8px 10px; border: 1px solid #e2e2e2; border-radius: 8px;
  font-size: 12.5px; outline: none;
}
.dz-video-input:focus { border-color: var(--red); }
.dz-transcript {
  flex: 1 1 100%; width: 100%; min-height: 72px; padding: 8px 10px; border: 1px solid #e2e2e2; border-radius: 8px;
  font-size: 12.5px; line-height: 1.6; outline: none; resize: vertical; font-family: inherit;
}
.dz-transcript:focus { border-color: var(--red); }
.dz-btn { padding: 8px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; border: none; }
.dz-btn.primary { background: var(--red); color: #fff; }
.dz-btn.primary:hover { background: #e51e3a; }
.dz-btn.ghost { background: #fff; color: var(--red); border: 1px solid var(--red); }
.dz-btn.ghost:hover { background: #fff5f5; }
.dz-deep-badge {
  background: #eafaf0; border: 1px solid #b7ebc8; color: #1a7f43; border-radius: 8px;
  padding: 7px 12px; margin: 10px 0 2px; font-size: 12.5px; font-weight: 600;
}
.dz-video-hint { font-size: 11.5px; color: #888; margin-top: 8px; line-height: 1.5; min-height: 14px; }
.dz-video-obs { background: #fff7f7; border-left: 3px solid var(--red); border-radius: 8px; padding: 10px 12px; margin: 2px 0 8px; }
.dz-video-obs-tag { font-size: 11.5px; font-weight: 700; color: var(--red); }
.dz-video-obs p { font-size: 12.5px; color: #444; line-height: 1.7; margin: 6px 0 0; }
.dz-block { border-top: 1px solid #f0f0f0; margin-top: 16px; padding-top: 14px; }
.dz-block h4 {
  display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: #222; margin-bottom: 10px;
}
.dz-block h4 .q {
  background: #222; color: #fff; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 7px; letter-spacing: 1px;
}
.dz-block h4 .q-why { background: #e0568f; }
.dz-block h4 .q-what { background: #2e7d32; }
.dz-block h4 .q-how { background: #1565c0; }
.dz-block .sub { font-size: 13px; color: #444; margin-bottom: 14px; line-height: 1.6; }
.dz-block .sub > b {
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 68px; color: #2a2a40; font-weight: 700; font-size: 12.5px;
  background: #f8f8fb; padding: 4px 8px; border-radius: 6px;
  border-left: 3px solid var(--red); margin-right: 6px;
}
.dz-block .sub > b::before {
  content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--red);
}
.sub-note { display: inline; color: #555; font-size: 12.5px; }
.chip-row { display: inline-flex; flex-wrap: wrap; gap: 5px; vertical-align: middle; }
.chip {
  display: inline-flex; align-items: center; background: var(--accent-tint); color: var(--red); font-size: 11px;
  padding: 3px 9px; border-radius: 999px; font-weight: 600;
}
.chip.hot { background: var(--red); color: #fff; }
.dz-block .struct-list { margin: 6px 0 6px 4px; font-size: 13px; color: #444; line-height: 1.65; }
.dz-block .struct-list li { margin-bottom: 7px; padding-left: 34px; padding-top: 6px; padding-bottom: 6px; }
.dz-block .struct-list li::before { top: 6px; }
.rep-list { margin: 6px 0 6px 4px; font-size: 13px; color: #444; line-height: 1.65; }
.rep-list li { margin-bottom: 10px; }
.rep-list .how { display: inline-flex; align-items: center; font-size: 10px; padding: 2px 7px; border-radius: 4px; margin-right: 7px; color: #fff; font-weight: 600; }
.bd-row { font-size: 12px; color: #444; margin: 5px 0 5px 8px; padding-left: 8px; border-left: 2px solid var(--accent-line); line-height: 1.5; }
.bd-row > b { display: inline-block; min-width: 34px; color: var(--red); font-weight: 700; }
.kw-row { display: inline-flex; flex-wrap: wrap; gap: 5px; vertical-align: middle; }
.kw { display: inline-block; background: var(--accent-tint); color: var(--red); font-size: 11px; padding: 3px 8px; border-radius: 6px; margin: 0 4px 4px 0; font-weight: 600; }
.root { display: inline-block; background: #fff7e6; color: #b26a00; font-size: 11px; padding: 2px 7px; border-radius: 6px; margin: 0 4px 4px 0; }
.rate-row { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; font-size: 12px; color: #666; }
.rate-row b { color: var(--red); font-size: 13px; }
.dz-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; font-size: 12px; color: #888; }
.dz-link { color: var(--red); cursor: pointer; white-space: nowrap; }
.dz-link:hover { text-decoration: underline; }

/* 黑底主题（抖音）下，拆解区文字反白 */
body.theme-dark .dz-block h4,
body.theme-dark .dz-block .sub,
body.theme-dark .struct-list,
body.theme-dark .rep-list,
body.theme-dark .bd-row,
body.theme-dark .dz-summary-top { color: #e8e8ea; }
body.theme-dark .dz-summary-top { background: rgba(255,255,255,.07); border-left-color: var(--red); }
body.theme-dark .sub-note,
body.theme-dark .dz-block .sub > b { color: #9aa0a6; }
body.theme-dark .tier-reason,
body.theme-dark .rate-row { color: #9aa0a6; }

/* ---------------- 拆解升级区（点2,3,4,5） ---------------- */
.dz-upgrade-notice { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.dz-upgrade-warn { font-size: 13px; color: #92400e; line-height: 1.5; margin-bottom: 6px; }
.dz-upgrade-tip { font-size: 12px; color: #78350f; margin-bottom: 10px; }
.dz-upgrade-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.dz-upgrade-btn { flex: 1; min-width: 100px; padding: 10px 8px; border: 1px solid #d97706; background: #fff; color: #b45309; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.dz-upgrade-btn:hover { background: #fef3c7; border-color: #b45309; }
.dz-upgrade-limit { font-size: 11px; color: #92400e; margin-top: 8px; line-height: 1.4; }
.dz-upgrade-panel { margin-top: 10px; padding: 10px; background: #f9fafb; border-radius: 8px; }
.dz-upgrade-input { width: 100%; min-height: 100px; max-height: 500px; resize: vertical; border: 1px solid #d1d5db; border-radius: 8px; padding: 10px; font-size: 13px; line-height: 1.5; font-family: inherit; box-sizing: border-box; }
.dz-upgrade-input:focus { outline: none; border-color: #d97706; }
.dz-upgrade-hint { font-size: 12px; color: #666; margin-top: 6px; line-height: 1.5; }
.dz-deep-ok { background: #ecfdf5; border: 1px solid #6ee7b7; border-radius: 8px; padding: 10px 12px; margin: 12px 0; font-size: 13px; color: #065f46; overflow: hidden; }
.dz-deep-ok #backToNormalBtn { border: none; background: transparent; color: #047857; font-size: 12px; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.dz-deep-ok #backToNormalBtn:hover { background: #d1fae5; text-decoration: underline; }

/* B/C 升级模式下的 ASR 集成提示 */
.dz-upgrade-asr-tip { font-size: 12px; color: #92400e; background: #fffbeb; border: 1px solid #fcd34d; border-radius: 6px; padding: 8px 10px; margin-top: 6px; line-height: 1.5; }

/* 修改提示词（点9） */
.dz-prompt-edit { margin: 14px 0; border-top: 1px solid #f0f0f0; padding-top: 12px; }
.dz-prompt-edit summary { font-size: 13px; color: #6b7280; cursor: pointer; padding: 4px 0; }
.dz-prompt-edit summary:hover { color: #374151; }
.dz-prompt-input { width: 100%; min-height: 80px; resize: vertical; border: 1px solid #d1d5db; border-radius: 8px; padding: 8px; font-size: 12px; line-height: 1.5; margin-top: 8px; box-sizing: border-box; }

/* 操作按钮栏（点11） */
.dz-actions-bar { display: flex; gap: 8px; padding: 12px 0; border-top: 1px solid #f0f0f0; margin-top: 14px; align-items: center; }
.dz-action-btn { padding: 10px 14px; border: 1px solid #d1d5db; background: #fff; color: #374151; border-radius: 8px; font-size: 13px; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.dz-action-btn:hover { background: #f9fafb; border-color: #9ca3af; }

/* 仿写弹窗扩展（点10） */
.rewrite-options-extended { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.rewrite-options-extended label { font-size: 12px; color: #555; display: flex; flex-direction: column; gap: 4px; }
.rewrite-options-extended select { border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 13px; outline: none; }
.rewrite-options-extended .full-row { grid-column: 1 / -1; }
.rw-body-formatted { white-space: pre-wrap; line-height: 1.8; font-size: 14px; color: #333; }

/* 认证模态框 */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal.hidden { display: none; }
.modal-card { background: #fff; border-radius: 14px; padding: 28px 24px; max-width: 380px; width: 90%; position: relative; }
.modal-close { position: absolute; top: 10px; right: 14px; background: none; border: none; font-size: 20px; cursor: pointer; color: #999; }
.auth-tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 2px solid #eee; }
.auth-tab { flex: 1; text-align: center; padding: 8px; cursor: pointer; font-size: 14px; color: #666; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.auth-tab.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }

/* 手机适配 */
@media (max-width: 768px) {
  header.hero { padding: 16px 12px; }
  .hero-inner { flex-direction: column; gap: 12px; }
  .brand h1 { font-size: 18px; }
  .search-bar { flex-direction: column; gap: 8px; }
  .search-btn { width: 100%; }
  #detailDrawer { width: 100%; max-width: 100%; border-radius: 0; top: 0; right: 0; height: 100%; overflow-y: auto; }
  #detailDrawer .drawer-header { position: sticky; top: 0; background: #fff; z-index: 10; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .dz-deep-ok { padding: 16px; }
  .dz-metrics { grid-template-columns: 1fr 1fr; }
  .dz-actions-bar { flex-direction: column; }
  .dz-upgrade-cta { padding: 12px; }
  .modal-card { max-width: 95%; padding: 20px; }
  #refBar { font-size: 10px; padding: 6px 8px; }
  #refBar button { font-size: 10px; }
}
