/* ===== WordCounter Pro - 国际化 Stripe 极简直白风 ===== */

:root {
  --primary: #635bff;          /* 国际级品牌紫：主色，辨识度高 */
  --primary-ink: #0a2540;      /* 深海军墨：主文字/标题/活跃元素 */
  --primary-light: #efefff;    /* 浅紫底：轻量高亮 */
  --accent: #0081a7;           /* 深海蓝点缀：数据可视化/重复检测统计 */
  --success: #00c48c;          /* 绿：通过/安全 */
  --warning: #ff8a00;          /* 橙：警告/注意 */
  --danger: #f9322c;           /* 红：危险/超标 */
  --bg: #ffffff;               /* 纯白底 */
  --surface: #ffffff;
  --bg-tertiary: #f7f8fa;      /* 次级灰底：工具栏/页签区 */
  --card-bg: #ffffff;
  --border: #e6e9ef;           /* 浅灰边框 */
  --text: #0a2540;             /* 主文字：近黑 */
  --text-secondary: #62646a;   /* 次要文字：中灰 */
  --placeholder: #a8aaaf;      /* 占位文字灰 */
  --shadow: none;              /* 扁平模式：无阴影 */
  --shadow-lg: none;
  --radius: 6px;
  --radius-sm: 3px;
  --list-max: 500px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans JP", "Noto Sans KR", sans-serif, "Apple Color Emoji","Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg, #ffffff);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ===== Header ===== */
.header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(99,91,255,0.22) 0%, rgba(99,91,255,0.10) 50%, transparent 100%);
  pointer-events: none;
  z-index: -1;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-img { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }

/* 站点标题：单行显示，字号由 JS(fitLogoTitle) 在头部剩余空间内等比缩放，
   任何语种/窄屏下都不换行、不截断 */
.logo span {
  white-space: nowrap;
}

/* ===== Privacy Safety Badge ===== */
.safety-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 24px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}
.safety-verify-btn {
  padding: 4px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.safety-verify-btn:hover { background: var(--primary-light); border-color: var(--primary); }
/* Safety Verify Modal */
.safety-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.safety-modal-overlay.open { display: flex; }
.safety-modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  position: relative;
}
.safety-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1;
  padding: 2px;
}
.safety-modal-close:hover { color: var(--text-primary); }
.safety-modal h3 { margin: 0 0 12px; font-size: 16px; color: var(--primary); }
.safety-modal p { margin: 0 0 16px; font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.safety-monitor {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
}
.safety-monitor-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-secondary);
  flex-shrink: 0;
}
.safety-monitor-dot.monitoring { background: #f59e0b; animation: pulse 1s infinite; }
.safety-monitor-dot.ok { background: #10b981; }
.safety-monitor-dot.warn { background: #ef4444; }
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:.4} }
/* Inline safety monitor bar at bottom of text editor */
.safety-inline {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: 0 0 var(--radius) var(--radius);
}
.safety-inline-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--text-secondary);
  padding: 0 4px;
}
.safety-inline-close:hover { color: var(--text-primary); }
.safety-modal-action {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.safety-modal-action button {
  padding: 6px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-safety-start {
  background: var(--primary);
  color: #fff;
  border: none;
}
.btn-safety-reset {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
@media (max-width: 640px) {
  .safety-badge { padding: 6px 16px; font-size: 12px; gap: 8px; flex-wrap: wrap; }
  .safety-verify-btn { padding: 3px 10px; font-size: 11px; }
  .safety-modal { padding: 18px; }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0; /* 右侧控件不压缩，窄屏空间不足时由左侧标题截断让位 */
}

/* 控件文字（如“自动保存”）保持单行 */
.header-actions > * { white-space: nowrap; }

/* ===== Language Dropdown ===== */
.lang-wrapper {
  position: relative;
}

.lang-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, border-color 0.15s;
}

.lang-toggle:hover {
  background: var(--bg-tertiary);
  border-color: var(--primary);
}

.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 90px;
  overflow: hidden;
}

.lang-dropdown.open {
  display: block;
  animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lang-dropdown .lang-btn {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s;
}

.lang-dropdown .lang-btn:hover {
  background: var(--primary-light);
  color: var(--primary-ink);
}

.lang-dropdown .lang-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.toggle-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.toggle-group input[type="checkbox"] { display: none; }

.toggle-track {
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
}

.toggle-track::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.toggle-group input:checked + .toggle-track {
  background: var(--primary);
}

.toggle-group input:checked + .toggle-track::after {
  transform: translateX(16px);
}

/* ===== Main Layout ===== */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px;
}

/* ===== Stats Cards Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: var(--primary); }

.stat-number {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-ink);
  line-height: 1.2;
}
.stat-number-short { display: none; }

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}
.stat-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 50;
}
.stat-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--text);
}
.stat-card { position: relative; }
.stat-card:hover .stat-tip { display: block; }

/* ===== Editor Area ===== */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

/* ===== Text Editor ===== */
.editor-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
  box-shadow: var(--shadow);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
/* toolbar-left 必须可收缩（flex-shrink:1），否则语种切换后按钮变长时
   max-content 超出容器会把页面撑宽；禁止换行，超宽时按钮文字截断省略 */
.toolbar-left { flex-wrap: nowrap; flex: 1 1 auto; min-width: 0; max-width: 100%; justify-content: center; }
/* 单行截断：按钮整体可收缩，文字 span 溢出显示省略号；图标不压缩 */
.toolbar-left > .btn,
.toolbar-left > .tb-target-wrap > .btn { min-width: 0; }
.toolbar-left > .btn > svg,
.toolbar-left > .tb-target-wrap > .btn > svg { flex-shrink: 0; }
.toolbar-left > .btn > span[data-i18n],
.toolbar-left > .tb-target-wrap > .btn > span[data-i18n] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 保存状态绝对定位到右侧，不参与居中布局 */
.toolbar-right { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); margin-left: 0; white-space: nowrap; }

/* ===== Target Word Count Popover ===== */
.tb-target-wrap { position: relative; display: inline-flex; }
.btn-icon { padding: 6px 8px; position: relative; }
.btn-icon svg { flex-shrink: 0; }
.tb-target-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--card-bg);
}
.tb-target-popover {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 220px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(10,37,64,0.22);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}
.tb-target-pop-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-right: 26px;
}

/* 弹窗右上角 X 关闭按钮 */
.tb-pop-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.tb-pop-close:hover { background: var(--bg-tertiary); color: var(--text); }
.tb-target-pop-row {
  display: flex;
  gap: 6px;
}
.tb-target-pop-input {
  flex: 1;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
  min-width: 0;
}
.tb-target-pop-input:focus { border-color: var(--primary); }
.btn-pop-btn { padding: 6px 12px; white-space: nowrap; }
.btn-pop-close {
  align-self: flex-end;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
}
.btn-pop-close:hover { color: var(--primary); }
.tb-target-popover .tb-target-info { font-size: 12px; padding: 8px; background: var(--bg-tertiary); border-radius: 6px; }
.toolbar-sep {
  display: inline-block;
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}
.toolbar-break {
  flex-basis: 100%;
  height: 0;
}
/* ===== Case popover ===== */
.tb-case-popover { min-width: 200px; }
.tb-case-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.tb-case-grid .btn-case-btn { white-space: nowrap; }
.btn-case-btn { padding: 6px 10px; font-size: 12px; justify-content: center; white-space: nowrap; }

/* ===== Dup popover ===== */
.tb-dup-disclaimer {
  font-size: 11px;
  color: var(--warning, #e37400);
  line-height: 1.5;
  margin: 6px 0 8px;
  padding: 6px 8px;
  background: var(--warning-light, rgba(227,116,0,0.08));
  border-radius: 5px;
  border-left: 3px solid var(--warning, #e37400);
}
.tb-dup-disclaimer strong { color: var(--warning, #e37400); font-weight: 700; }
.tb-dup-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: #e37400;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--card-bg);
}
.tb-platform-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  color: var(--text, #0a2540);
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
}
.tb-dup-popover { width: 320px; max-width: calc(100vw - 32px); max-height: 420px; overflow-y: auto; }
.tb-dup-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 8px;
  line-height: 1.5;
}
.btn-dup-run { width: 100%; justify-content: center; }
.tb-dup-popover .dup-result { margin-top: 10px; }
.tb-dup-popover .dup-summary,
.tb-dup-popover .dup-note { font-size: 12px; margin: 4px 0; }
.tb-dup-popover .dup-list { padding-left: 16px; margin: 4px 0; }
.tb-dup-popover .dup-list li { font-size: 11px; padding: 2px 0; line-height: 1.4; }
.tb-dup-popover .dup-sample { display: inline; }
.tb-dup-popover .dup-count { color: var(--danger); font-weight: 600; margin-left: 4px; white-space: nowrap; }
/* ===== 中文语句质检 popover ===== */
.tb-quality-popover { width: 320px; }
.quality-sec { font-size: 12px; font-weight: 600; color: var(--text); margin: 10px 0 2px; }
.quality-fix { color: var(--success); font-size: 11px; margin-left: 6px; flex-shrink: 0; }
.quality-issue-label { flex-shrink: 0; color: var(--text-secondary); white-space: nowrap; }
.dup-summary .warn { color: var(--warning); font-weight: 600; }
.dup-summary .bad { color: var(--danger); font-weight: 600; }
/* 弹窗内问题句子：单行不换行、横向滚动显示全 */
.tb-dup-popover .dup-list li { display: flex; align-items: center; gap: 6px; }
.tb-dup-popover .dup-sample {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
  word-break: normal;
}
/* 句子超宽时：外层固定裁剪，内层单方向无缝循环滚动（首尾相接） */
.tb-dup-popover .dup-sample.scrolling { overflow: hidden; }
.tb-dup-popover .dup-sample .marquee-inner {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
}
.tb-dup-popover .dup-sample.scrolling .marquee-inner {
  animation: marqueeLoop var(--marquee-dur, 12s) linear infinite;
}
.tb-dup-popover .dup-sample.scrolling:hover .marquee-inner { animation-play-state: paused; }
@keyframes marqueeLoop {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.tb-find-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: #0081a7;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--card-bg);
}
.tb-find-popover { min-width: 240px; }
.tb-find-popover .tb-target-pop-input { margin-bottom: 8px; }
.tb-find-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.btn-icon-sm { padding: 5px 10px; font-size: 12px; white-space: nowrap; }
.btn-icon-sm.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-icon-sm.btn-primary:hover { background: #7c6fff; border-color: #7c6fff; color: #fff; }

/* Info row in popovers */
.tb-target-info {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.tb-target-info strong { color: var(--text); font-weight: 600; }
.tb-target-popover .btn,
.tb-dup-popover .btn { white-space: nowrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover { background: var(--bg); color: var(--text); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover { background: #7c6fff; border-color: #7c6fff; }

.btn-danger:hover { background: #fce8e6; color: var(--danger); border-color: var(--danger); }

/* Platform load-more button — 仅移动端，扁平轻量化 */
.platform-load-more { display: none !important; }
@media (max-width: 640px) {
  .platform-load-more:not(.hidden) {
    display: flex !important;
    justify-content: center;
    align-items: center;
    margin: 16px auto 0;
    width: auto;
    padding: 0;
    font-size: 0;
    font-weight: 400;
    border-radius: 0;
    color: transparent;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: opacity 0.15s;
    letter-spacing: 0;
  }
  .platform-load-more:not(.hidden):hover { opacity: 0.6; }
  .platform-load-more:not(.hidden)::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-secondary);
    transition: transform 0.2s, border-top-color 0.15s;
  }
  .platform-load-more.expanded::after {
    transform: rotate(180deg);
    border-top-color: var(--primary);
  }
  .platform-load-more.hidden { display: none !important; }
}
/* PC 端确保所有平台可见（清除移动端遗留的 inline style） */
@media (min-width: 641px) {
  .platform-item { display: block !important; }
}

/* SEO mobile load-more button — 仅移动端 */
.home-seo-load-more { display: none !important; }
@media (max-width: 640px) {
  .home-seo-load-more:not(.hidden) {
    display: flex !important;
    margin: 12px auto 0;
    padding: 8px 20px;
    font-size: 13px;
  }
  .home-seo-load-more.hidden { display: none !important; }
}
/* PC 端确保 SEO 卡片全部可见 */
@media (min-width: 641px) {
  .home-seo-card { display: block !important; }
}

.text-area {
  width: 100%;
  min-height: var(--list-max);
  padding: 20px 24px;
  border: none;
  font-size: 15px;
  line-height: 1.8;
  resize: vertical;
  font-family: inherit;
  color: var(--text);
  background: transparent;
}

.text-area:focus { outline: none; }

.text-area::placeholder { color: var(--placeholder); }

/* ===== Keywords Sidebar ===== */
.keywords-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
  box-shadow: var(--shadow);
  position: sticky;
  top: 70px;
}

.keywords-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.keywords-tabs {
  display: flex;
  gap: 4px;
}

.keyword-tab {
  flex: 1;
  padding: 6px 0;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.keyword-tab:hover { background: var(--primary-light); color: var(--primary-ink); }

.keyword-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.keywords-body {
  max-height: var(--list-max);
  overflow-y: auto;
}

.keyword-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.keyword-item:last-child { border-bottom: none; }
.keyword-item:hover { background: var(--primary-light); }

.keyword-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.keyword-word {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.keyword-meta {
  font-size: 11px;
  color: var(--text-secondary);
}

.keyword-bar {
  width: 80px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 12px;
}

.keyword-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s;
}

.keyword-count-badge {
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ===== Platform Limits ===== */
.platform-section {
  margin-top: 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.platform-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1px;
  background: var(--border);
}

.platform-item {
  background: var(--card-bg);
  padding: 14px 16px;
}

.platform-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.platform-name {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.platform-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.platform-logo {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-block;
}

.platform-limit-text {
  font-size: 11px;
  color: var(--text-secondary);
}

.platform-progress {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.platform-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s, background 0.3s;
}

.platform-progress-fill.safe { background: var(--success); }
.platform-progress-fill.warn { background: var(--warning); }
.platform-progress-fill.over { background: var(--danger); }

.platform-chars {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===== Mode Toggle & History ===== */
.mode-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, border-color 0.15s;
}
.mode-toggle:hover { background: var(--bg-tertiary); border-color: var(--primary); }

.btn-history {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn-history:hover { background: var(--bg-tertiary); border-color: var(--primary); }
.btn-history.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* History Panel */
.history-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, 90vw);
  max-height: 420px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  z-index: 200;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.history-panel.open { display: flex; }
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}
.history-clear-all {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}
.history-clear-all:hover { background: var(--danger); color: #fff; }
.history-list {
  overflow-y: auto;
  flex: 1;
}
.history-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: var(--bg-tertiary); }
.history-item-text {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.history-item-meta {
  font-size: 11px;
  color: var(--text-secondary);
}
.history-item { position: relative; }
.history-item-del {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 2px 5px;
  border-radius: 3px;
  line-height: 1;
  opacity: 1;
  transition: background 0.15s, color 0.15s;
}
.history-item-del:hover { background: var(--danger); color: #fff; }
.history-empty {
  padding: 24px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Export Panel */
.btn-export-format {
  flex: 1;
  min-width: 80px;
  padding: 8px 16px;
}
.export-format-group {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
#exportStatus {
  white-space: nowrap;
}

/* ===== Dark / Eye-care Mode ===== */
[data-mode="dark"] {
  --bg: #0f0f1a;
  --primary-ink: #e2e8f0;
  --primary-light: #1e1e3f;
  --surface: #1a1a2e;
  --bg-tertiary: #252547;
  --card-bg: #1a1a2e;
  --border: #2e2e52;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --placeholder: #475569;
}
[data-mode="eye"] {
  --bg: #f5f7e8;
  --primary-ink: #1a2e0a;
  --primary-light: #f1f5e8;
  --surface: #f5f7e8;
  --bg-tertiary: #eef1dc;
  --card-bg: #f5f7e8;
  --border: #c8d4a8;
  --text: #2c3e1e;
  --text-secondary: #5a6b4a;
  --placeholder: #8a9a78;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
  background: linear-gradient(180deg, rgba(99,91,255,0.03) 0%, transparent 100%);
}

/* ===== Home SEO Content ===== */
.home-seo {
  margin: 0 0 24px;
}
.home-seo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.home-seo-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.home-seo-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 8px;
  line-height: 1.4;
}
.home-seo-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
}
.home-seo-faq {
  margin-top: 28px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.home-seo-faq-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 16px;
  line-height: 1.4;
}
.home-seo-faq-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.home-seo-faq-item {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.home-seo-faq-item:last-child {
  border-bottom: none;
}
.home-seo-faq-item summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  padding: 6px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s;
}
.home-seo-faq-item summary::-webkit-details-marker { display: none; }
.home-seo-faq-item summary::before {
  content: '+';
  font-size: 18px;
  line-height: 1;
  color: var(--primary);
  transition: transform 0.15s;
  display: inline-block;
  width: 14px;
}
.home-seo-faq-item[open] summary::before {
  content: '−';
}
.home-seo-faq-item summary:hover {
  color: var(--primary);
}
.home-seo-faq-item p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin: 8px 0 2px;
  padding-left: 22px;
}
.footer a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.footer a:hover {
  color: var(--text-primary);
}
.footer .footer-rules-link {
  margin-right: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
}
.footer .footer-rules-link:hover {
  color: var(--primary);
  text-decoration: underline;
}
.sitemap-status {
  display: inline;
  white-space: nowrap;
}

/* ===== Highlight ===== */
mark {
  background: var(--primary-light);
  border-radius: 2px;
  padding: 0 2px;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(5, 1fr); }
  .editor-layout { grid-template-columns: 1fr; }
  .keywords-panel { position: static; max-height: 320px; overflow-y: auto; }
}

@media (max-width: 640px) {
  /* Header — 保留上边距，避免贴顶；移动端渐变更明显 */
  .header { padding: 14px 16px; }
  .header::before {
    background: linear-gradient(180deg, rgba(99,91,255,0.30) 0%, rgba(99,91,255,0.12) 50%, transparent 100%);
  }
  .logo { font-size: 19px; gap: 8px; }
  .logo-img { width: 28px; height: 28px; }
  .header-actions { gap: 8px; }
  .toggle-group { font-size: 12px; }
  .toggle-track { width: 30px; height: 17px; }
  #jiebaStatus { display: none; }
  .toggle-track::after { width: 13px; height: 13px; }
  .lang-switcher { display: none !important; }

  /* Main — 上下各留 16px，左右 12px 安全区 */
  .main { padding: 16px 12px 24px; }

  /* ===== 移动端统计卡片：立体感 + 间距 ===== */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 16px;
  }
  .stat-card {
    padding: 12px 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    /* 极浅的立体感：微阴影 + 边框渐变 */
    box-shadow: 0 1px 3px rgba(10, 37, 64, 0.06),
                0 1px 2px rgba(10, 37, 64, 0.04);
    transition: box-shadow 0.15s, transform 0.15s;
  }
  .stat-card:active {
    box-shadow: 0 2px 6px rgba(99, 91, 255, 0.15),
                0 1px 3px rgba(99, 91, 255, 0.1);
    transform: translateY(-1px);
  }
  .stat-number {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
    letter-spacing: -0.3px;
  }
  .stat-number > span:first-child { display: none; }
  .stat-number-short { display: inline; }
  .stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: none;
    letter-spacing: 0;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Editor toolbar */
  .editor-toolbar { flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
  .editor-toolbar .btn { padding: 6px 12px; font-size: 12px; }
  .editor-toolbar .btn svg { width: 13px; height: 13px; }
  #jiebaStatus, #saveStatus { font-size: 11px; }
  #saveStatus { display: none; }

  /* Textarea */
  .text-area { min-height: 130px; font-size: 14px; padding: 14px 16px; line-height: 1.6; }

  /* Keywords panel — 立体感 */
  .keywords-panel {
    max-height: 260px;
    box-shadow: 0 1px 3px rgba(10, 37, 64, 0.06),
                0 1px 2px rgba(10, 37, 64, 0.04);
  }
  .keyword-tab { font-size: 12px; padding: 5px 0; }
  .keyword-item { padding: 8px 10px; }
  .keyword-word { font-size: 13px; }
  .keyword-meta { font-size: 10px; }
  .keyword-bar { width: 60px; margin: 0 8px; }

  /* Platform grid */
  .platform-grid { grid-template-columns: 1fr; gap: 1px; }
  .platform-item { padding: 12px 14px; }
  .platform-name { font-size: 12px; gap: 5px; }
  .platform-dot { width: 7px; height: 7px; }
  .platform-logo { width: 14px; height: 14px; }
  .platform-limit-text { font-size: 10px; }
  .platform-chars { font-size: 10px; }
  .platform-progress { height: 5px; }
  .platform-chars-text { font-size: 10px; }

  /* SEO block — 立体感 */
  .seo-content {
    margin: 0 0 16px;
    padding: 16px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(10, 37, 64, 0.06),
                0 1px 2px rgba(10, 37, 64, 0.04);
  }
  .seo-h1 { font-size: 17px; }
  .seo-desc { font-size: 13px; }
  .seo-intro { padding: 12px 14px; border-radius: 8px; }
  .seo-more summary { font-size: 12px; }
  .dup-desc { font-size: 12px; }
  .dup-summary { font-size: 13px; }
  .dup-summary b { font-size: 14px; }
  .dup-list li { padding: 6px 8px; font-size: 12px; gap: 8px; }
  .dup-count { font-size: 11px; }
  .dup-note { font-size: 12px; }
  .dup-result { padding: 0 12px 12px; }
  .seo-kw-tag { font-size: 11px; padding: 3px 8px; }

  /* Footer — 底部留白 */
  .footer { font-size: 11px; padding: 16px 16px 20px; margin-top: 20px; word-break: break-word; white-space: normal; }
  .home-seo-grid { grid-template-columns: 1fr; gap: 12px; }
  .home-seo-card { padding: 16px 18px; }
  .home-seo-title { font-size: 14px; }
  .home-seo-body { font-size: 12px; }
  .footer a { font-size: 11px; }
  /* Toolbar 移动端：单行紧凑，按钮只显图标，不撑宽页面 */
  .editor-toolbar { flex-wrap: nowrap; gap: 4px; padding: 8px 10px; overflow-x: auto; scrollbar-width: none; max-width: 100%; justify-content: center; }
  .editor-toolbar::-webkit-scrollbar { display: none; }
  .toolbar-left { gap: 3px; flex: 0 0 auto; flex-wrap: nowrap; border-top: none; padding-top: 0; min-width: 0; justify-content: center; }
  .toolbar-left .btn { padding: 5px 7px; font-size: 0; white-space: nowrap; min-width: 0; box-sizing: border-box; }
  .toolbar-left .btn svg { width: 13px; height: 13px; flex-shrink: 0; }
  .toolbar-left .btn span { display: none !important; }
  /* 弹窗虽挂在 toolbar-left DOM 下，但内容须正常显示：恢复字号与按钮文字 */
  .toolbar-left .tb-target-popover .btn { font-size: 13px; padding: 6px 14px; }
  .toolbar-left .tb-target-popover .btn span { display: inline !important; }
  .toolbar-left .tb-target-popover .btn svg { width: 14px; height: 14px; }
  .toolbar-break { display: none; }
  .toolbar-sep { display: none; }
  .tb-target-info { font-size: 10px; }
  .toolbar-right { display: none; }
}

/* ===== SEO Content Block ===== */
.seo-content {
  margin: 0 0 24px;
  padding: 24px 28px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.seo-h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text);
  line-height: 1.3;
}
.seo-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 14px;
  line-height: 1.5;
}
.seo-intro {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.seo-intro p {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.65;
}
.seo-intro p:last-child { margin-bottom: 0; }
.seo-more {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.seo-more summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--primary-ink);
  list-style: none;
  user-select: none;
}
.seo-more summary::-webkit-details-marker { display: none; }
.seo-more summary::before { content: attr(data-more) " ▾"; }
.seo-more[open] summary::before { content: attr(data-less) " ▴"; }
.seo-more-body { margin-top: 10px; }
.dup-result:empty { display: none; }
.dup-summary {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text);
}
.dup-summary b { color: var(--accent); font-size: 16px; }
.dup-disclaimer { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 4px; line-height: 1.5; }
.dup-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dup-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
}
.dup-sample { flex: 1; color: var(--text); word-break: break-word; }
.dup-count {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}
.dup-note { margin: 0; font-size: 13px; color: var(--text-secondary); }
.dup-ok { color: var(--success); }

/* ===== Home SEO (section removed — tools now inline in toolbar) ===== */
.home-seo {
  margin: 0 0 24px;
}
.seo-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.seo-kw-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--primary-light);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--primary-ink);
}
.seo-kw-tag small {
  font-size: 11px;
  opacity: .7;
}

/* ===== Platform Mode Popover ===== */
.tb-platform-popover {
  min-width: 260px;
  max-width: 340px;
}
.tb-platform-modes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 0;
}
.tb-platform-mode-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: all 0.15s;
  text-align: left;
  width: 100%;
}
.tb-platform-mode-btn:hover {
  border-color: var(--pc, var(--primary));
  background: color-mix(in srgb, var(--pc, var(--primary)) 8%, var(--card-bg));
}
.tb-platform-mode-btn.active {
  border-color: var(--pc, var(--primary));
  background: color-mix(in srgb, var(--pc, var(--primary)) 12%, var(--card-bg));
  box-shadow: 0 0 0 1px var(--pc, var(--primary));
}
.tb-platform-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tb-platform-result {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  flex-wrap: wrap;
}
.tb-platform-status {
  font-weight: 700;
  font-size: 13px;
}
.tb-platform-hint {
  color: var(--text-secondary);
  font-size: 12px;
  flex: 1;
  min-width: 0;
}
/* 平台网格高亮 */
.platform-item.platform-highlight {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  border-radius: 4px;
  background: var(--primary-light);
}
