/* ============================================================
   WordCount.top - 全站样式
   主题：暖纸底色 + 墨绿点缀（写作工具质感）
   ============================================================ */

:root {
  --paper: #faf8f4;          /* 页面底色：暖纸 */
  --card: #ffffff;           /* 卡片底 */
  --ink: #1f2937;            /* 主文字 */
  --ink-soft: #4b5563;       /* 次文字 */
  --ink-faint: #9ca3af;      /* 弱提示 */
  --accent: #0d9488;         /* 墨绿主色 */
  --accent-dark: #0f766e;    /* 墨绿深色（hover） */
  --accent-soft: #ccfbf1;    /* 墨绿浅底 */
  --danger: #dc2626;         /* 清空按钮 */
  --line: #e7e2d9;           /* 分隔线（暖灰） */
  --radius: 12px;
  --shadow: 0 1px 3px rgba(31, 41, 55, .08), 0 4px 14px rgba(31, 41, 55, .05);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.25; }

/* ---------------- 页头 ---------------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 58px;
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.brand-icon { display: block; }
.brand-name { font-family: Georgia, serif; font-size: 20px; font-weight: 700; letter-spacing: .2px; }
.brand-name em { font-style: normal; color: var(--accent); }
.site-nav { display: flex; gap: 22px; align-items: center; }
.site-nav a {
  color: var(--ink-soft); text-decoration: none; font-size: 14.5px; font-weight: 500;
}
.site-nav a:hover { color: var(--accent); }

/* 语言切换器 */
.lang-select {
  font: inherit; font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--line); border-radius: 7px;
  background: #fbfaf7; color: var(--ink-soft);
  cursor: pointer;
  max-width: 130px;
}
.lang-select:hover { border-color: var(--accent); color: var(--accent-dark); }
.lang-select:focus { outline: none; border-color: var(--accent); }

/* ---------------- 首屏标题 ---------------- */
.hero { text-align: center; padding: 40px 0 26px; }
.hero h1 { font-size: 34px; margin-bottom: 10px; }
.hero-sub {
  max-width: 720px; margin: 0 auto;
  color: var(--ink-soft); font-size: 16px;
}

/* ---------------- 计数器布局 ---------------- */
.counter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
  margin-bottom: 44px;
}

/* 编辑器卡片 */
.editor-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* 统计条 */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fdfcf9 0%, #faf7f1 100%);
}
.stat {
  padding: 14px 8px 12px;
  text-align: center;
  border-left: 1px solid var(--line);
}
.stat:first-child { border-left: none; }
.stat-num {
  display: block;
  font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.stat-primary .stat-num { color: var(--accent); font-size: 30px; }
.stat-label {
  display: block;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--ink-faint); margin-top: 2px;
}

/* 工具条 */
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.tool-btn {
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 6px 13px;
  border: 1px solid var(--line); border-radius: 7px;
  background: #fbfaf7; color: var(--ink-soft);
  cursor: pointer;
  transition: all .15s ease;
}
.tool-btn:hover { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-soft); }
.tool-btn:active { transform: translateY(1px); }
.tool-btn-danger:hover { border-color: var(--danger); color: var(--danger); background: #fef2f2; }
.autosave { margin-left: auto; font-size: 12px; color: var(--ink-faint); }

/* 文本区 */
.editor {
  display: block; width: 100%; min-height: 340px;
  padding: 18px;
  border: none; outline: none; resize: vertical;
  font: 16px/1.75 Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: var(--card);
}
.editor::placeholder { color: var(--ink-faint); }

/* 字数目标 */
.goal-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fdfcf9;
  font-size: 13px; color: var(--ink-soft);
}
.goal-row input {
  width: 90px; font: inherit; font-size: 13px;
  padding: 5px 9px;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--card); color: var(--ink);
}
.goal-row input:focus { outline: none; border-color: var(--accent); }
.goal-track {
  flex: 1; height: 8px;
  background: #efeae0; border-radius: 99px; overflow: hidden;
}
.goal-fill {
  height: 100%; width: 0;
  background: var(--accent);
  border-radius: 99px;
  transition: width .3s ease, background .3s ease;
}
.goal-fill.done { background: #16a34a; }
.goal-pct { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- 侧栏面板 ---------------- */
.side-panel { display: flex; flex-direction: column; gap: 18px; }
.panel-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.panel-title {
  font-size: 17px; margin-bottom: 12px;
  display: flex; align-items: baseline; gap: 8px;
}
.panel-sub { font-family: inherit; font-size: 12px; font-weight: 400; color: var(--ink-faint); }

.detail-list { display: flex; flex-direction: column; }
.detail-item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.detail-item:last-child { border-bottom: none; padding-bottom: 0; }
.detail-item dt { color: var(--ink-soft); }
.detail-item dd { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; word-break: break-word; }

/* 可读性 */
.readability-score { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.score-num {
  font-size: 38px; font-weight: 700; line-height: 1;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.score-label { font-size: 13px; color: var(--ink-soft); }
.score-track {
  height: 8px; background: #efeae0; border-radius: 99px; overflow: hidden; margin-bottom: 10px;
}
.score-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s ease, background .3s ease; }
.score-desc { font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; }

/* 关键词 */
.kw-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.kw-tab {
  flex: 1; font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 6px 0;
  border: 1px solid var(--line); border-radius: 7px;
  background: #fbfaf7; color: var(--ink-soft); cursor: pointer;
  transition: all .15s ease;
}
.kw-tab:hover { border-color: var(--accent); color: var(--accent-dark); }
.kw-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.kw-list { list-style: none; }
.kw-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px; align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}
.kw-item:last-child { border-bottom: none; }
.kw-word {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  position: relative; padding-left: 2px;
}
.kw-bar {
  position: absolute; left: 0; bottom: 1px; height: 4px;
  background: var(--accent-soft); border-radius: 2px;
  width: 100%; z-index: 0;
}
.kw-bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.kw-text { position: relative; z-index: 1; }
.kw-count { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.kw-pct { font-weight: 600; color: var(--accent-dark); min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.kw-empty { color: var(--ink-faint); font-size: 13px; padding: 6px 0; }

/* ---------------- 内容区 ---------------- */
.content-section { margin-bottom: 38px; }
.content-section h2 { font-size: 24px; margin-bottom: 12px; }
.content-section p { color: var(--ink-soft); margin-bottom: 12px; max-width: 860px; }
.howto-list { padding-left: 22px; color: var(--ink-soft); max-width: 860px; }
.howto-list li { margin-bottom: 8px; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}
.feature-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.feature-item h3 { font-size: 16.5px; margin-bottom: 6px; color: var(--accent-dark); }
.feature-item p { font-size: 14px; margin-bottom: 0; }

/* FAQ */
.faq-list { max-width: 860px; }
.faq-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-item summary {
  cursor: pointer;
  padding: 13px 18px;
  font-weight: 600; font-size: 15px;
  list-style: none;
  position: relative;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  color: var(--accent); font-size: 18px; font-weight: 700;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item p { padding: 0 18px 14px; color: var(--ink-soft); font-size: 14.5px; margin-bottom: 0; }

/* ---------------- 页脚 ---------------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--card);
  margin-top: 20px;
}
.footer-inner { padding: 26px 20px 30px; text-align: center; }
.footer-inner p { color: var(--ink-soft); font-size: 14px; margin-bottom: 8px; }
.footer-nav { display: flex; justify-content: center; gap: 20px; margin-bottom: 10px; }
.footer-nav a { color: var(--accent-dark); text-decoration: none; font-size: 14px; }
.footer-nav a:hover { text-decoration: underline; }
.disclaimer { font-size: 12.5px !important; color: var(--ink-faint) !important; }

/* ---------------- 隐私政策页 ---------------- */
.legal { max-width: 820px; margin: 0 auto; padding: 36px 0 48px; }
.legal h1 { font-size: 30px; margin-bottom: 6px; }
.legal .updated { color: var(--ink-faint); font-size: 13px; margin-bottom: 22px; }
.legal h2 { font-size: 20px; margin: 26px 0 8px; }
.legal p, .legal li { color: var(--ink-soft); font-size: 15px; }
.legal p { margin-bottom: 10px; }
.legal ul { padding-left: 22px; margin-bottom: 10px; }
.legal li { margin-bottom: 6px; }
.legal a { color: var(--accent-dark); }

/* ---------------- 响应式：平板 ---------------- */
@media (max-width: 960px) {
  .counter-grid { grid-template-columns: 1fr; }
  .side-panel { flex-direction: row; flex-wrap: wrap; }
  .panel-card { flex: 1 1 280px; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 28px; }
}

/* ---------------- 响应式：手机 ---------------- */
@media (max-width: 620px) {
  .hero { padding: 28px 0 20px; }
  .hero h1 { font-size: 24px; }
  .hero-sub { font-size: 14px; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: none; }
  .stat { border-top: 1px solid var(--line); }
  .stat:nth-child(-n+2) { border-top: none; }
  .stat-num { font-size: 22px; }
  .stat-primary .stat-num { font-size: 24px; }
  .editor { min-height: 260px; font-size: 15px; }
  .side-panel { flex-direction: column; }
  .feature-grid { grid-template-columns: 1fr; }
  .toolbar { gap: 6px; }
  .tool-btn { padding: 5px 10px; font-size: 12.5px; }
  .autosave { width: 100%; margin-left: 0; text-align: right; }
  .content-section h2 { font-size: 20px; }
}
