/* 设计令牌见 ../DESIGN.md（墨块工具方向，2026-08-26 定稿），与之保持一致 */
:root {
  --bg: #F1F0EC;
  --card: #FFFFFF;
  --fg: #141414;
  --fg2: #5C5C5C;
  --ph: #8A8A8A;
  --ink: #141414;
  --on-ink: #FFFFFF;
  --shadow-ink: #141414;
  --divider: #EDEBE4;
  --chip-line: #C9C6BC;
  --accent: #1D4ED8;
  --accent-fill: #1D4ED8;
  --danger: #C7000B;
  --danger-soft: rgba(255, 59, 48, 0.13);
  --ok: #1D7A34;
  --ok-soft: #DCEFDD;
  --warn: #8F4600;
  --warn-soft: #FFE1B3;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
button, input, textarea { -webkit-tap-highlight-color: transparent; }

/* 键盘焦点态：立即出现，不做过渡 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.btn-primary:focus-visible, .btn-line:focus-visible, .seg-btn:focus-visible, .badge-wrap:focus-visible { border-radius: 8px; }

@media (prefers-reduced-motion: reduce) {
  .rise, .mask, .sheet, .modal { animation-duration: 0.01ms !important; }
  .btn-primary { transition: none; }
}

.hidden { display: none !important; }

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

/* 通用按钮 */
.btn-primary {
  display: block;
  width: 100%;
  height: 50px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--accent-fill);
  box-shadow: 4px 4px 0 var(--shadow-ink);
  color: #FFFFFF;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.2px;
  text-align: center;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn-primary:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow-ink);
}
.btn-primary:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-text {
  display: inline-block;
  height: 44px;
  line-height: 44px;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  text-align: left;
}
.card {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--shadow-ink);
}

/* 顶部状态行 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 0;
}
.brand { font-size: 17px; font-weight: 800; }
.badge-wrap { padding: 8px 0; border: 0; background: none; }
.badge { border-radius: 8px; }
.badge-free {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg);
  background: var(--card);
  border: 1.5px solid var(--ink);
  padding: 4px 9px;
}

/* 主标题：左对齐大黑标题 */
.hero { padding: 28px 22px 24px; text-align: left; }
.hero-title {
  margin: 0;
  font-size: 34px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.hero-sub { margin: 12px 0 0; font-size: 15px; line-height: 1.55; color: var(--fg2); }

/* 分段切换器 */
.seg { position: relative; display: flex; background: var(--card); border: 2px solid var(--ink); border-radius: 8px; }
.seg-main-wrap { padding: 0 20px; }
.seg-main { height: 46px; padding: 3px; }
.seg-main .seg-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: 36px;
  border-radius: 5px;
  background: var(--ink);
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}
.seg-btn {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  padding: 0;
}
.seg-txt { font-size: 14px; font-weight: 600; color: var(--fg2); }
.seg-txt.on { color: var(--on-ink); font-weight: 700; }
.seg-style { height: 34px; padding: 2px; border-width: 1.5px; }
.seg-style .seg-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(50% - 2px);
  height: 27px;
  border-radius: 5px;
  background: var(--bg);
  border: 1.5px solid var(--ink);
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}
.seg-style .seg-btn { padding: 0 12px; }
.seg-txt-sm { font-size: 12.5px; font-weight: 600; color: var(--fg2); position: relative; z-index: 1; }

/* 输入卡片 */
.section { padding: 20px 20px 0; }
.input-card { padding: 18px 16px 16px; }
.input {
  display: block;
  width: 100%;
  min-height: 150px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--fg);
  font-size: 16px;
  line-height: 1.6;
  font-family: inherit;
}
.input::placeholder, .prompt::placeholder, .field-input::placeholder { color: var(--ph); }
.input-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  margin-top: 8px;
  border-top: 2px solid var(--divider);
  padding-top: 6px;
}
.input-toolbar.right-only { justify-content: flex-end; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.link-sm {
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  padding: 12px 4px;
}
.count { font-size: 12.5px; color: var(--fg2); font-variant-numeric: tabular-nums; }
.gen-btn { margin-top: 14px; }
.hint { margin: 12px 6px 0; font-size: 13px; line-height: 1.5; font-weight: 600; color: var(--danger); }

/* 加载 */
.loading { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 22px 0 4px; }
.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid var(--divider);
  border-top-color: var(--fg);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-txt { font-size: 13.5px; color: var(--fg2); }

/* 结果卡片 */
.rise { animation: riseIn 0.24s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.result-card { padding: 16px; }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.result-label { font-size: 12px; font-weight: 800; letter-spacing: 0.5px; color: var(--fg); padding-top: 4px; }
.tag { flex: none; max-width: 180px; font-size: 10.5px; line-height: 1.35; font-weight: 700; border: 1.5px solid var(--ink); border-radius: 8px; padding: 3px 8px; }
.tag-warn { color: var(--warn); background: var(--warn-soft); }
.tag-ok { color: var(--ok); background: var(--ok-soft); }
.result-body { margin: 13px 0 0; white-space: pre-wrap; font-size: 15.5px; line-height: 1.68; }
.result-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  border-top: 2px solid var(--divider);
}

/* 生成记录 */
.history { padding-top: 28px; }
.history-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.history-title { font-size: 13px; font-weight: 800; letter-spacing: 0.5px; color: var(--fg); }
.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-item { border-radius: 12px; box-shadow: 2px 2px 0 var(--shadow-ink); padding: 14px 14px 4px; }
.history-meta { display: block; font-size: 11.5px; letter-spacing: 0.2px; color: var(--fg2); }
.history-text {
  margin: 7px 0 0;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.history-actions { display: flex; align-items: center; gap: 14px; margin-top: 8px; border-top: 2px solid var(--divider); }
.btn-text.sm { font-size: 14px; }
.btn-text.dim { color: var(--fg2); margin-left: auto; }

/* 检测结果 */
.verdict { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 2px; }
.dot-bad { background: var(--danger); }
.dot-ok { background: var(--ok); }
.verdict-txt { font-size: 15px; font-weight: 800; }
.verdict-txt.bad { color: var(--danger); }
.verdict-txt.ok { color: var(--ok); }
.marked { margin: 12px 0 14px; white-space: pre-wrap; font-size: 15px; line-height: 1.72; }
.seg-mark {
  color: var(--danger);
  font-weight: 700;
  background: var(--danger-soft);
  border-radius: 4px;
  padding: 1px 2px;
}
.hit { display: flex; flex-direction: column; gap: 5px; padding: 12px 0; border-top: 2px solid var(--divider); }
.hit-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hit-word { font-size: 15px; font-weight: 800; color: var(--danger); }
.hit-cat { font-size: 11px; font-weight: 600; color: var(--fg2); background: var(--divider); border-radius: 8px; padding: 3px 8px; }
.hit-why { font-size: 13px; line-height: 1.55; color: var(--fg2); }
.good-note { margin: 9px 0 0; font-size: 13px; line-height: 1.55; color: var(--fg2); }

/* 页脚 */
.footnote { padding: 30px 30px 16px; text-align: center; cursor: pointer; user-select: none; }
.footnote-line { display: block; font-size: 11.5px; line-height: 1.65; color: var(--fg2); }

/* 弹层 */
.mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  animation: fadeIn 0.2s ease-out both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* 设置页 */
.settings { padding: 16px 20px calc(40px + env(safe-area-inset-bottom)); }
.set-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.set-title { font-size: 17px; font-weight: 800; }
.set-topbar-pad { width: 44px; }
.notice { padding: 14px 16px; margin-bottom: 20px; box-shadow: 2px 2px 0 var(--shadow-ink); }
.notice-title { display: block; font-size: 14px; font-weight: 700; }
.notice-body { display: block; margin-top: 6px; font-size: 12.5px; line-height: 1.6; color: var(--fg2); }
.group-title { font-size: 13px; font-weight: 800; letter-spacing: 0.5px; color: var(--fg); padding: 4px 4px 8px; }
.group-note { margin: 0; font-size: 12px; line-height: 1.6; color: var(--fg2); padding: 8px 4px 16px; }
.form-card { padding: 2px 16px; margin-bottom: 16px; box-shadow: 2px 2px 0 var(--shadow-ink); }
.field { display: flex; align-items: center; gap: 12px; min-height: 52px; border-bottom: 2px solid var(--divider); }
.field.no-line { border-bottom: none; }
.label { flex: none; width: 76px; font-size: 14px; font-weight: 600; }
.field-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--fg);
  font-size: 14px;
  font-family: inherit;
}
.prompt {
  display: block;
  width: 100%;
  min-height: 170px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--fg);
  padding: 14px 0;
  font-size: 13.5px;
  line-height: 1.7;
  font-family: inherit;
}
.slider-field { gap: 6px; }
.quota-slider { flex: 1; margin: 0 4px; accent-color: var(--accent-fill); }
.unit { flex: none; font-size: 13px; color: var(--fg2); font-variant-numeric: tabular-nums; }
.save-btn { margin-top: 8px; }
.btn-line {
  display: block;
  width: 100%;
  height: 46px;
  margin-top: 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 2px 2px 0 var(--shadow-ink);
  color: var(--fg);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}
.btn-line.danger { color: var(--danger); }
.btn-line:disabled { opacity: 0.55; cursor: default; }

/* 通用弹窗 */
.modal-mask { justify-content: center; padding: 0 32px; z-index: 80; }
.modal {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  padding: 22px 20px 12px;
  animation: riseIn 0.2s ease-out both;
}
.modal-title { display: block; font-size: 16px; font-weight: 800; text-align: center; }
.modal-body {
  margin: 10px 0 6px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--fg2);
  text-align: center;
  white-space: pre-wrap;
  max-height: 40vh;
  overflow-y: auto;
}
.modal-actions { display: flex; gap: 8px; margin-top: 8px; }
.modal-btn { flex: 1; height: 44px; border: 0; background: none; font-size: 15px; font-weight: 600; }
.modal-cancel { color: var(--fg2); }
.modal-confirm { color: var(--accent); font-weight: 800; }
.modal-confirm.danger { color: var(--danger); }

/* 轻提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(60px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 90;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 8px;
  padding: 10px 18px;
  animation: fadeIn 0.18s ease-out both;
}

/* ============ 多视图版新增（v1.1） ============ */

/* 底部导航 */
.with-tab { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
.shell.sub { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  z-index: 50;
  display: flex;
  background: var(--card);
  border-top: 2px solid var(--ink);
  padding: 8px 0 calc(10px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: 0;
  background: none;
  color: var(--fg2);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
}
.tab.on { color: var(--fg); font-weight: 800; }

/* 首页公告条 */
.newsbar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 40px);
  margin: 14px 20px 0;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  background: var(--card);
  color: var(--fg);
  padding: 9px 12px;
  font-family: inherit;
  text-align: left;
}
.newsbar-title { flex: 1; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.newsbar-link { flex: none; font-size: 12.5px; font-weight: 700; color: var(--accent); }

/* 页头 */
.ph-wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 16px 22px 6px;
}
.ph-title { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.ph-note { margin: 0; padding: 0 22px 16px; font-size: 12.5px; line-height: 1.5; color: var(--fg2); }

/* 子页返回头 */
.subhead { display: flex; align-items: center; gap: 6px; padding: 14px 14px 0; }
.subback {
  border: 0;
  background: none;
  color: var(--fg);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.subhead-title { font-size: 15px; font-weight: 700; }

/* 筛选芯片 */
.chips { display: flex; gap: 8px; padding: 0 20px 16px; }
.chip {
  position: relative;
  border: 1.5px solid var(--chip-line);
  border-radius: 8px;
  background: var(--card);
  color: var(--fg2);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  padding: 7px 14px;
}
/* 视觉不变，把点击热区扩到 44px 以上 */
.chip::after { content: ''; position: absolute; inset: -6px; }
.chip-on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
  font-weight: 700;
}

/* 记录页 */
.group-label { font-size: 12px; font-weight: 800; letter-spacing: 0.5px; color: var(--fg2); padding: 8px 22px 10px; }
#histGroups .history-item { margin: 0 20px 12px; }
.hist-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.status-tag { flex: none; font-size: 10.5px; font-weight: 700; border: 1.5px solid var(--ink); border-radius: 8px; padding: 2px 7px; }
.status-tag.ok { color: var(--ok); background: var(--ok-soft); }
.status-tag.bad { color: var(--danger); background: var(--danger-soft); }
.hist-empty { margin: 30px 22px 0; font-size: 13.5px; line-height: 1.6; color: var(--fg2); }

/* 我的 */
.section-flat { padding: 6px 20px 0; display: flex; flex-direction: column; gap: 16px; }
.user-card { padding: 16px; display: flex; align-items: center; gap: 14px; }
.avatar {
  flex: none;
  width: 52px;
  height: 52px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.me-info { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.me-name { font-size: 16px; font-weight: 800; }
.me-sub { font-size: 12px; color: var(--fg2); }
.list-card { box-shadow: 2px 2px 0 var(--shadow-ink); display: flex; flex-direction: column; overflow: hidden; }
.lrow {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  border: 0;
  border-bottom: 2px solid var(--divider);
  background: none;
  color: var(--fg);
  font-family: inherit;
  text-align: left;
  padding: 0 16px;
}
.lrow:last-child { border-bottom: none; }
.lrow-ico { flex: none; color: var(--fg); }
.lrow-label { flex: 1; font-size: 14.5px; font-weight: 700; }
.lrow-side { flex: none; font-size: 12px; color: var(--fg2); }
.lrow-chev { flex: none; color: var(--fg2); }
.dot-unread { flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--danger); }
.me-version { text-align: center; font-size: 11.5px; line-height: 1.65; color: var(--fg2); padding: 14px 0 4px; cursor: pointer; user-select: none; }


/* 公告 */
.news-card { box-shadow: 2px 2px 0 var(--shadow-ink); padding: 16px; }
.news-card.news-top { box-shadow: 4px 4px 0 var(--shadow-ink); }
.news-head { display: flex; align-items: center; gap: 8px; }
.news-pin {
  font-size: 10.5px;
  font-weight: 700;
  color: #FFFFFF;
  background: var(--danger);
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  padding: 2px 7px;
}
.news-date { font-size: 11.5px; color: var(--ph); }
.news-title { margin-top: 10px; font-size: 16px; font-weight: 800; }
.news-body { margin-top: 8px; font-size: 13.5px; line-height: 1.7; color: var(--fg2); }
.news-act {
  display: block;
  width: 100%;
  margin-top: 12px;
  border: 0;
  border-top: 2px solid var(--divider);
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
  text-align: left;
  padding: 10px 0 0;
}
.news-end { margin: 28px 0 0; text-align: center; font-size: 11.5px; color: var(--ph); }
