/* 灵猫写作助手 — 新中式宣纸主题 v3
   设计语言：宣纸底 / 浓墨字 / 印章红 / 古铜铁青为辅
   触发：可通过给 <html> 添加 .theme-dark 切回深色（保留旧 token 备用） */

:root {
  color-scheme: light;

  /* 基础宣纸阶（暖灰，从米白到浅麻） */
  --bg: #efeae0;
  --bg-elev: #f5f1e8;
  --bg-card: #fbf8f1;
  --bg-card-hover: #f3eee2;
  --bg-input: #f8f4eb;

  /* 边框（淡墨，比卡片深一档） */
  --border: #d9d1bf;
  --border-soft: #e4ddcd;
  --border-strong: #b9b0a0;

  /* 文字（浓墨 → 淡墨 → 灰墨 → 远墨） */
  --text: #2b2620;
  --text-dim: #5a5247;
  --text-muted: #8b8273;
  --text-subtle: #b3aa97;

  /* 主色系：印章红（朱砂），辅古铜 */
  --accent: #c0392b;
  --accent-hover: #a02b1f;
  --accent-soft: rgba(192, 57, 43, 0.10);
  --accent-glow: rgba(192, 57, 43, 0.20);
  --accent-2: #b08442;

  /* 状态色（调和到温润色温） */
  --green: #5b8c5a;
  --green-soft: rgba(91, 140, 90, 0.12);
  --yellow: #c08a30;
  --yellow-soft: rgba(192, 138, 48, 0.12);
  --red: #c0392b;
  --red-soft: rgba(192, 57, 43, 0.10);
  --blue: #4a6e87;
  --blue-soft: rgba(74, 110, 135, 0.10);
  --purple: #8b6b94;
  --purple-soft: rgba(139, 107, 148, 0.10);

  /* 几何（圆角更小，传统器物感） */
  --radius-sm: 3px;
  --radius: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;

  /* 阴影（暖纸感，柔且短） */
  --shadow-sm: 0 1px 2px rgba(60, 50, 35, 0.06);
  --shadow: 0 4px 14px rgba(60, 50, 35, 0.10);
  --shadow-lg: 0 14px 40px rgba(60, 50, 35, 0.14);
  --shadow-glow: 0 0 0 3px var(--accent-soft);

  /* 字体（中文标题用宋体，正文沿用现代无衬线） */
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --font-serif: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC", "Source Han Serif", "PingFang SC", Georgia, serif;
  --font-mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --font-num: "Inter", -apple-system, sans-serif;

  /* 动效 */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 0.15s;
  --t-normal: 0.22s;
  --t-slow: 0.4s;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

a { color: var(--accent); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }

button { font-family: inherit; font-size: inherit; cursor: pointer; }

input, textarea, select { font-family: inherit; font-size: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ────── 顶栏 ────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(245, 241, 232, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}

.brand .logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}
.brand .title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.brand .subtitle {
  color: var(--text-muted);
  font-size: 11px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  letter-spacing: 0.05em;
}

.topnav {
  display: flex;
  gap: 2px;
}

.topnav a {
  position: relative;
  color: var(--text-dim);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: color var(--t-fast), background var(--t-fast);
}

.topnav a:hover {
  background: var(--bg-card);
  color: var(--text);
  text-decoration: none;
}

.topnav a.active {
  color: var(--text);
  background: var(--bg-card);
}
.topnav a.active::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px 1px 0 0;
}

/* ────── 主内容 ────── */
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 28px 80px;
  animation: fadeIn 0.3s var(--ease);
}

.page-title {
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.page-sub {
  color: var(--text-dim);
  margin-bottom: 28px;
  font-size: 14px;
}

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

/* ────── 卡片 ────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  transition: border-color var(--t-fast);
}

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

.card h3 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.row > * { flex-shrink: 0; }
.row .grow { flex-grow: 1; flex-shrink: 1; min-width: 0; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  main { padding: 20px 16px 60px; }
  .topbar { padding: 12px 16px; }
  .brand .subtitle { display: none; }
  .topnav { gap: 0; }
  .topnav a { padding: 6px 10px; font-size: 12px; }
}

/* ────── 表单 ────── */
label.field {
  display: block;
  margin-bottom: 14px;
}

label.field > .label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="email"],
textarea,
select {
  width: 100%;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  font-size: 13px;
}

input::placeholder, textarea::placeholder {
  color: var(--text-subtle);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  resize: vertical;
  min-height: 100px;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.65;
}

textarea.large { min-height: 320px; }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239da3b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* ────── 按钮 ────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 4px 12px var(--accent-glow);
}

.btn.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 6px 18px var(--accent-glow);
}

.btn.danger {
  border-color: rgba(192, 57, 43, 0.4);
  color: var(--red);
}

.btn.danger:hover:not(:disabled) {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}

.btn.ghost:hover:not(:disabled) {
  background: var(--bg-card);
  color: var(--text);
}

.btn.small {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 5px;
}

.btn.tiny {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 4px;
}

.btn .spinner {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ────── 列表 ────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: all var(--t-normal) var(--ease);
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, var(--accent-soft) 100%);
  opacity: 0;
  transition: opacity var(--t-normal);
  pointer-events: none;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.project-card:hover::before { opacity: 0.5; }

.project-card .name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  position: relative;
  letter-spacing: -0.01em;
}

.project-card .meta {
  font-size: 12px;
  color: var(--text-dim);
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.empty {
  padding: 64px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty .ico {
  font-size: 36px;
  display: block;
  margin-bottom: 12px;
  opacity: 0.5;
  filter: grayscale(0.4);
}

.empty .title {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
  font-weight: 500;
}

/* ────── 阶段流水线 ────── */
.stage-pipeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.stage-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--t-fast), background var(--t-fast);
}

.stage-row:hover { background: var(--bg-card-hover); }

.stage-row .num {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-num);
  flex-shrink: 0;
}

.stage-row .name {
  font-weight: 500;
  font-size: 13px;
}

.stage-row .desc {
  color: var(--text-dim);
  font-size: 12px;
  margin-left: 4px;
  flex-grow: 1;
}

.stage-row .status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-dim);
}

.stage-row.done .num {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.stage-row.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.stage-row.active .num {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  animation: pulse 2s var(--ease) infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

/* ────── Agent 卡片 ────── */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: all var(--t-fast);
}

.agent-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.agent-card .name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.agent-card .desc {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ────── Provider 卡片 ────── */
.provider-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.provider-card .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.provider-card .name {
  font-weight: 600;
  font-size: 14px;
}

/* ────── 模态框 ────── */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(43, 38, 32, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeBg 0.18s var(--ease);
  padding: 20px;
}

@keyframes fadeBg {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.22s var(--ease);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal .head {
  flex-shrink: 0;  /* 在小屏 / 长内容时不被挤压 */
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal .head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex-grow: 1;
  min-width: 0;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.modal .body {
  padding: 20px;
  overflow-y: auto;
  flex-grow: 1;
}

.modal .foot {
  flex-shrink: 0;
  padding: 14px 20px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: rgba(60, 50, 35, 0.06);
}

/* ────── 流式输出 ────── */
.stream-output {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 60vh;
  overflow-y: auto;
  color: var(--text);
}

/* ────── 成本看板 ────── */
.usage-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding: 16px 0 0;
}

.usage-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 16px;
}

.usage-bar .bar {
  width: 70%;
  background: linear-gradient(to top, var(--accent), rgba(192, 57, 43, 0.4));
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: opacity var(--t-fast);
}

.usage-bar:hover .bar { opacity: 0.75; }

.usage-bar .day {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
  font-family: var(--font-num);
}

.usage-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}

.usage-table th, .usage-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
}

.usage-table th {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.usage-table td.r, .usage-table th.r { text-align: right; font-family: var(--font-num); }

/* ────── 阅读模式 ────── */
.reader-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  height: calc(100vh - 110px);
}

.reader-side {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-y: auto;
}

.reader-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.reader-chapters {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.reader-chapter {
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 5px;
  font-size: 13px;
  color: var(--text-dim);
  transition: all var(--t-fast);
}

.reader-chapter:hover {
  background: var(--bg-elev);
  color: var(--text);
}

.reader-chapter.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.reader-main {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.reader-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-elev);
}

.reader-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 40px 60px 80px;
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 2.0;
  color: var(--text);
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

.reader-content p {
  margin: 0 0 1.2em;
  text-indent: 2em;
  letter-spacing: 0.02em;
}

@media (max-width: 720px) {
  .reader-layout { grid-template-columns: 1fr; height: auto; }
  .reader-content { padding: 24px; font-size: 16px; }
}

.history-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
}

/* ────── 焦点 Hero 卡片（项目页「下一步」） ────── */
.hero-card {
  background:
    linear-gradient(135deg, rgba(192, 57, 43, 0.04) 0%, rgba(176, 132, 66, 0.03) 100%),
    var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: -60%;
  right: -30%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 50%);
  pointer-events: none;
  opacity: 0.7;
}

.hero-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent), transparent) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.4;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero-step {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hero-step::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: pulse 2s infinite;
}

.hero-title {
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.hero-desc {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 22px;
  line-height: 1.7;
  max-width: 580px;
}

.hero-btn {
  font-size: 14px !important;
  padding: 11px 22px !important;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.hero-btn-auto {
  font-size: 13px !important;
  padding: 11px 18px !important;
  background: transparent !important;
  border: 1px dashed var(--accent) !important;
  color: var(--accent) !important;
}

.hero-btn-auto:hover:not(:disabled) {
  background: var(--accent-soft) !important;
  border-style: solid !important;
}

/* 全自动进度阶梯 */
.auto-progress {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}

.auto-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  transition: all var(--t-normal) var(--ease);
}

.auto-step-icon {
  font-size: 22px;
  filter: grayscale(0.7);
  opacity: 0.5;
  transition: all var(--t-normal);
}

.auto-step-name {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
  font-weight: 500;
}

.auto-step-status {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: var(--font-num);
}

.auto-step.running {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-soft), 0 4px 12px var(--accent-glow);
}
.auto-step.running .auto-step-icon {
  filter: none;
  opacity: 1;
  animation: pulseIcon 1.6s ease-in-out infinite;
}
.auto-step.running .auto-step-name { color: var(--text); }
.auto-step.running .auto-step-status { color: var(--accent); font-weight: 600; }

@keyframes pulseIcon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.auto-step.done {
  border-color: rgba(91, 140, 90, 0.3);
  background: var(--green-soft);
}
.auto-step.done .auto-step-icon { filter: none; opacity: 1; }
.auto-step.done .auto-step-name { color: var(--text); }
.auto-step.done .auto-step-status { color: var(--green); font-weight: 600; }

.auto-step.skipped {
  border-color: var(--border);
  opacity: 0.55;
}

.auto-step.error {
  border-color: var(--red);
  background: var(--red-soft);
}
.auto-step.error .auto-step-status { color: var(--red); font-weight: 600; }

/* 状态卡片 */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: all var(--t-fast);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.stat-card .num {
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  font-family: var(--font-num);
  letter-spacing: -0.02em;
}

.stat-card .label {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 6px;
  font-weight: 500;
}

.stat-card .sub {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 3px;
}

/* ────── 首次启动向导卡片 ────── */
.onb-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--t-fast);
}

.onb-card:hover {
  border-color: var(--accent);
}

.onb-card input {
  margin: 0;
  accent-color: var(--accent);
}

.onb-card span {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.onb-card span small {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 2px;
}

.onb-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ────── 后台任务面板（隐藏中的 modal） ────── */
#task-dock {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  flex-direction: column-reverse;     /* 新任务出现在底部，旧任务向上堆 */
  gap: 8px;
  z-index: 80;
  max-width: 320px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 4px;
  scrollbar-width: thin;
}
#task-dock::-webkit-scrollbar { width: 4px; }
#task-dock::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.dock-task {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  box-shadow: 0 8px 24px var(--accent-glow), 0 1px 2px rgba(60, 50, 35, 0.10);
  animation: slideIn 0.25s var(--ease);
  min-width: 260px;
  transition: all var(--t-fast);
}

.dock-task:hover {
  background: var(--bg-card-hover);
  transform: translateX(2px);
}

.dock-task .spin {
  font-size: 16px;
  animation: pulseTask 1.4s ease-in-out infinite;
  flex-shrink: 0;
}

.dock-task.done .spin,
.dock-task.error .spin { animation: none; }

.dock-task.done {
  border-color: var(--green);
  box-shadow: 0 8px 24px var(--green-soft), 0 1px 2px rgba(60, 50, 35, 0.10);
}

.dock-task.error {
  border-color: var(--red);
  opacity: 0.85;
}

.dock-task .t-wrap {
  flex-grow: 1;
  min-width: 0;
}

.dock-task .t {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.dock-task .t-sub {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock-task.error .t-sub { color: var(--red); }
.dock-task.done .t-sub { color: var(--green); }

@keyframes pulseTask {
  0%, 100% { opacity: 1; transform: rotate(0deg); }
  50% { opacity: 0.55; transform: rotate(8deg); }
}

/* ────── Toast ────── */
#toast-host {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
  max-width: calc(100vw - 48px);
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 13px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s var(--ease);
  pointer-events: auto;
  line-height: 1.5;
}

.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--yellow); }
.toast.info { border-left-color: var(--blue); }

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ────── 文件树 ────── */
.tree {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.85;
}

.tree-node {
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 4px;
  transition: background var(--t-fast);
}

.tree-node:hover {
  background: var(--bg-elev);
}

.tree-node.dir { color: var(--accent-2); font-weight: 500; }
.tree-node.file { color: var(--text-dim); }
.tree-node.active { background: var(--bg-elev); color: var(--text); }

/* ────── 杂项 ────── */
.kbd {
  display: inline-block;
  padding: 1px 7px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: 100px;
  font-size: 11px;
  color: var(--text-dim);
  margin-right: 4px;
  letter-spacing: 0.01em;
}

.tag.green { color: var(--green); border-color: rgba(91, 140, 90, 0.3); background: var(--green-soft); }
.tag.red { color: var(--red); border-color: rgba(192, 57, 43, 0.3); background: var(--red-soft); }
.tag.yellow { color: var(--yellow); border-color: rgba(176, 132, 66, 0.3); background: var(--yellow-soft); }
.tag.blue { color: var(--blue); border-color: rgba(59, 130, 246, 0.3); background: var(--blue-soft); }

.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-yellow { color: var(--yellow); }
.text-blue { color: var(--blue); }

hr {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 16px 0;
}

pre {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 12px;
  font-family: var(--font-mono);
  line-height: 1.6;
  color: var(--text);
}

code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border-soft);
  color: var(--text);
}

details > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

details > summary::before {
  content: '▸';
  font-size: 10px;
  transition: transform var(--t-fast);
  color: var(--text-dim);
}

details[open] > summary::before {
  transform: rotate(90deg);
}

details > summary::-webkit-details-marker { display: none; }

details > *:not(summary) {
  margin-top: 12px;
  padding-left: 14px;
}

/* ────── Skeleton 加载占位 ────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elev) 0%, var(--bg-card) 50%, var(--bg-elev) 100%);
  background-size: 200% 100%;
  animation: skeletonShine 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonShine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  height: 96px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.skeleton-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
  animation: skeletonShine 1.4s ease-in-out infinite;
}

/* ────── 全局加载条 ────── */
#nprogress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  z-index: 1000;
  box-shadow: 0 0 8px var(--accent);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.3s var(--ease), opacity 0.2s;
  pointer-events: none;
}

#nprogress.loading { animation: progressLoading 1.4s ease-in-out infinite; }

@keyframes progressLoading {
  0% { transform: scaleX(0); transform-origin: left; }
  50% { transform: scaleX(0.7); transform-origin: left; }
  51% { transform: scaleX(0.7); transform-origin: right; }
  100% { transform: scaleX(0); transform-origin: right; }
}

/* ────── 状态点（小圆点） ────── */
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-right: 6px;
  vertical-align: middle;
}
.dot.green { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.dot.red { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.dot.yellow { background: var(--yellow); box-shadow: 0 0 0 3px var(--yellow-soft); }

/* ────── 顶栏用户菜单 ────── */
.topnav-user { display: inline-flex; align-items: center; margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--border-soft); }
.topnav-user a { color: var(--text-dim); padding: 6px 10px; border-radius: 6px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.topnav-user a:hover { background: var(--bg-card); color: var(--text); text-decoration: none; }
.topnav-avatar {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white; font-weight: 600; font-size: 11px;
}
.topnav-username { font-weight: 500; }

/* ────── 登录 / 注册 页面 ────── */
.auth-wrap {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  text-align: center;
  margin-bottom: 14px;
}
.auth-logo svg,
.auth-logo img {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  display: inline-block;
  object-fit: contain;
}
.auth-title {
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.auth-sub {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 22px;
}
.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-btn { width: 100%; padding: 11px !important; margin-top: 6px; font-size: 14px; }
.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 14px;
}
.auth-tip {
  text-align: center;
  font-size: 11px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

/* ────── 可访问性：尊重系统降低动画偏好 ────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  #nprogress.loading { animation: none !important; }
}

/* ────── 文本溢出策略：长 CJK 串可换行 ────── */
.reader-content,
.modal .body,
.hero-desc,
.page-title,
.toast,
.dock-task .t,
.dock-task .t-sub {
  overflow-wrap: break-word;
  word-break: break-word;
}
.reader-content {
  /* CJK 段落：保留单字符不切断更典雅 */
  word-break: keep-all;
}

/* ────── 480px 小屏 ────── */
@media (max-width: 480px) {
  /* 触控目标 ≥ 44px */
  .btn.small, .btn.tiny, .dock-task [data-act="x"] {
    min-height: 36px;
    padding-top: 6px;
    padding-bottom: 6px;
  }
  /* hero 卡片紧凑 */
  .hero-card { padding: 20px 16px; }
  .hero-title { font-size: 20px; }
  .hero-desc { font-size: 13px; }
  /* 5 阶段进度条挤不下 → 改为可水平滚动 */
  .auto-progress {
    grid-template-columns: repeat(5, minmax(72px, 1fr));
    overflow-x: auto;
  }
  .auto-step { padding: 8px 4px; }
  .auto-step-name { font-size: 11px; }
  /* dock 与 toast 让出空间避免重叠 */
  #task-dock { left: 12px; bottom: 12px; max-width: calc(100vw - 24px); }
  #toast-host { right: 12px; bottom: 80px; }
  /* 顶栏紧凑 */
  .topbar { padding: 10px 12px; }
  .brand .title { font-size: 14px; }
  /* main 内边距 */
  main { padding: 16px 12px 60px; }
  /* modal padding */
  .modal .body { padding: 14px 16px; }
  .modal .head { padding: 12px 14px; }
  .modal .foot { padding: 10px 14px; }
}

/* 横屏短窗口（手机横屏）：modal 可用更高比例 */
@media (orientation: landscape) and (max-height: 500px) {
  .modal { max-height: 96vh; }
}

/* ────── 计费 / 套餐 / 顶栏字数 ────── */

/* 顶栏剩余字数指示器 */
.topnav-quota {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
  margin-right: 8px;
}
.topnav-quota:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}
.topnav-quota.warn {
  border-color: rgba(176, 132, 66, 0.5);
  background: rgba(176, 132, 66, 0.06);
}
.topnav-quota.warn .quota-num { color: var(--yellow); }
.topnav-quota.critical {
  border-color: var(--accent);
  background: var(--accent-soft);
  animation: quota-pulse 2s ease-in-out infinite;
}
.topnav-quota.critical .quota-num { color: var(--accent); }
@keyframes quota-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); }
  50% { box-shadow: 0 0 0 4px transparent; }
}
.topnav-quota .quota-num {
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.topnav-quota .quota-label {
  font-size: 11px;
  color: var(--text-muted);
  padding-left: 6px;
  border-left: 1px solid var(--border);
}

/* 顶栏管理员入口 */
.topnav-admin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  margin-right: 8px;
  transition: all 0.15s;
}
.topnav-admin:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-card-hover);
}

/* 套餐网格 */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.plan-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 20px 20px;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.plan-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.plan-card.plan-recommended {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 24px rgba(192, 57, 43, 0.15);
}
.plan-card.plan-current {
  border-color: var(--accent-2);
  background: linear-gradient(180deg, rgba(176, 132, 66, 0.06), var(--bg-card));
}
.plan-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.plan-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.plan-price {
  font-family: var(--font-num);
  margin-bottom: 4px;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.plan-price .price-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.plan-price .price-unit {
  font-size: 12px;
  color: var(--text-muted);
}
.plan-quota {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-num);
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border-soft);
  margin-bottom: 14px;
}
.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  flex-grow: 1;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-dim);
}
.plan-features li {
  padding: 2px 0;
}
.plan-card .btn {
  width: 100%;
}

/* ────── 开关 (Switch) ────── */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  transition: 0.2s;
  border-radius: 24px;
}
.switch .slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-dim);
  transition: 0.2s;
  border-radius: 50%;
}
.switch input:checked + .slider {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.switch input:checked + .slider::before {
  transform: translate(20px, -50%);
  background: var(--accent);
}
.switch input:focus-visible + .slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.switch input:disabled + .slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ────── 配额耗尽 modal（升级强引导） ────── */
.quota-cta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.quota-cta {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 14px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  font-family: inherit;
  color: var(--text);
}
.quota-cta:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}
.quota-cta.primary-cta {
  background: linear-gradient(160deg, rgba(192, 57, 43, 0.06), var(--bg-elev));
  border-color: var(--accent);
}
.quota-cta .cta-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.quota-cta .cta-price {
  font-family: var(--font-num);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.quota-cta .cta-price span {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}
.quota-cta .cta-detail {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ────── 付款引导 modal ────── */
.payment-modal-mask .pay-summary {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.pay-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  flex-wrap: wrap;
}
.pay-row > span:first-child {
  color: var(--text-muted);
  min-width: 70px;
}
.pay-row code.pay-ref {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 4px;
  font-family: var(--font-num);
  font-size: 12px;
  color: var(--accent-2);
  flex-grow: 1;
}
.pay-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.pay-tab {
  flex: 1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.pay-tab.active {
  background: var(--bg-card);
  border-color: var(--accent);
  color: var(--text);
}
.pay-qr-wrap {
  display: flex;
  justify-content: center;
  background: white;
  padding: 14px;
  border-radius: 8px;
  min-height: 240px;
  align-items: center;
}
.pay-qr {
  max-width: 260px;
  max-height: 260px;
  display: block;
}
.pay-qr.hidden { display: none; }

/* ────── 连贯性引擎实时追踪面板（项目页） ────── */
.continuity-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
  position: relative;
}
.continuity-head {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}
.continuity-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
  flex-grow: 1;
}
.continuity-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: cont-pulse 1.6s ease-in-out infinite;
}
@keyframes cont-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(91, 140, 90, 0.5); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

.continuity-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 12px;
}
.cont-card {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
}
.cont-main {
  background: linear-gradient(140deg, rgba(192, 57, 43, 0.06), var(--bg-elev));
  border-color: rgba(192, 57, 43, 0.25);
}
.cont-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.cont-tag {
  font-size: 10px;
  background: var(--accent);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.cont-tag-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 4px;
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 12px;
}
.cont-name {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}
.cont-stat-label {
  color: var(--text-muted);
  font-size: 11px;
  margin-right: 6px;
}
.cont-power-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-soft);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.cont-power-num {
  font-family: var(--font-num);
  color: var(--accent-2);
  font-size: 14px;
  font-weight: 700;
}
.cont-line {
  padding: 4px 0;
  color: var(--text-dim);
  line-height: 1.5;
}
.cont-goal {
  font-style: italic;
}
.cont-card-foot {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-soft);
  color: var(--text-muted);
  font-size: 11px;
}

.cont-fore {
  padding: 5px 0;
  border-bottom: 1px dashed var(--border-soft);
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-size: 11px;
  flex-wrap: wrap;
}
.cont-fore:last-child { border-bottom: none; }
.cont-fore-ch {
  font-family: var(--font-num);
  color: var(--accent-2);
  font-weight: 600;
  flex-shrink: 0;
}
.cont-fore-desc {
  color: var(--text-dim);
  flex-grow: 1;
  min-width: 0;
}
.cont-fore-resolve {
  font-family: var(--font-num);
  color: var(--text-muted);
  font-size: 10px;
}

.cont-char {
  padding: 5px 0;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  border-bottom: 1px dashed var(--border-soft);
}
.cont-char:last-of-type { border-bottom: none; }
.cont-char b { color: var(--text); }

.cont-event-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 8px 0;
}
.cont-event {
  padding: 3px 0;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.5;
}

.continuity-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-soft);
  font-size: 11px;
  color: var(--text-dim);
}
.continuity-foot b {
  color: var(--text);
  font-family: var(--font-num);
}

@media (max-width: 720px) {
  .continuity-grid { grid-template-columns: 1fr; }
}

/* ────── 章节分享 modal（Canvas 预览） ────── */
.share-modal-bg .share-preview-wrap {
  background: var(--bg-elev);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  max-height: 380px;
  overflow: hidden;
}
.share-modal-bg #share-canvas {
  max-width: 100%;
  max-height: 350px;
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 4px 18px rgba(60, 50, 35, 0.12);
}

/* ────── 新手 3 步欢迎 wizard ────── */
.welcome-wizard .welcome-modal {
  max-width: 480px;
  padding: 0;
  overflow: hidden;
}
.welcome-progress {
  display: flex;
  gap: 8px;
  padding: 16px 24px 0;
  justify-content: center;
}
.welcome-step-dot {
  width: 30px;
  height: 4px;
  background: var(--bg-elev);
  border-radius: 2px;
  transition: background 0.2s;
}
.welcome-step-dot.active {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.welcome-body {
  padding: 24px 28px 20px;
}
.welcome-hero {
  text-align: center;
  margin-bottom: 24px;
}
.welcome-emoji {
  font-size: 44px;
  margin-bottom: 14px;
}
.welcome-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.welcome-brand {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 28px;
}
.welcome-sub {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.7;
  margin: 0 0 18px;
}
.welcome-features {
  text-align: left;
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  background: var(--bg-elev);
  border-radius: 8px;
  padding: 14px 16px;
}
.welcome-features li {
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-dim);
}
.welcome-input {
  width: 100%;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  margin-bottom: 14px;
  text-align: center;
  font-weight: 500;
  transition: border-color 0.15s;
}
.welcome-input:focus {
  outline: none;
  border-color: var(--accent);
}
.welcome-suggestions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}
.welcome-chip {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.welcome-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text);
  border-color: var(--accent);
}
.welcome-tips {
  text-align: left;
  background: var(--bg-elev);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 16px;
}
.welcome-tip {
  padding: 5px 0;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
}
.welcome-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 16px 24px;
  border-top: 1px solid var(--border-soft);
  background: rgba(60, 50, 35, 0.06);
}

/* ────── 邀请奖励卡片（账号页） ────── */
.invite-card {
  background: linear-gradient(135deg, rgba(176, 132, 66, 0.08), rgba(192, 57, 43, 0.04)) !important;
  border-color: rgba(176, 132, 66, 0.3) !important;
}
.invite-card h3 {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}
.invite-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-soft);
}
.invite-stat {
  background: var(--bg-elev);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.invite-stat-num {
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.invite-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ────── 章节生成完成后的"下一步"面板（强引导） ────── */
.next-actions {
  margin-top: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(192, 57, 43, 0.08), rgba(176, 132, 66, 0.04));
  border: 1px solid rgba(192, 57, 43, 0.25);
  border-radius: 10px;
  animation: nextActionsIn 0.4s var(--ease) both;
}
@keyframes nextActionsIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.next-actions-title {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 10px;
  text-align: center;
}
.next-actions-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.next-actions-row .btn {
  min-width: 120px;
}

/* ────── 管理后台：经营看板 ────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  transition: border-color 0.15s;
}
.kpi-card:hover { border-color: var(--border-strong); }
.kpi-card.highlight {
  background: linear-gradient(160deg, rgba(192, 57, 43, 0.08), var(--bg-card));
  border-color: rgba(192, 57, 43, 0.3);
}
.kpi-card.urgent {
  background: linear-gradient(160deg, rgba(176, 132, 66, 0.08), var(--bg-card));
  border-color: rgba(176, 132, 66, 0.4);
}
.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.kpi-num {
  font-family: var(--font-num);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.kpi-sub {
  font-size: 11px;
  color: var(--text-dim);
}
.kpi-sub .pos { color: var(--green); font-weight: 600; }

/* 套餐分布 */
.plan-dist { display: flex; flex-direction: column; gap: 6px; }
.dist-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.dist-label { width: 56px; color: var(--text-dim); flex-shrink: 0; }
.dist-bar {
  flex-grow: 1;
  height: 8px;
  background: var(--bg-elev);
  border-radius: 4px;
  overflow: hidden;
}
.dist-bar > span {
  display: block;
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s var(--ease);
}
.dist-val {
  font-family: var(--font-num);
  width: 36px;
  text-align: right;
  color: var(--text);
  font-weight: 600;
  flex-shrink: 0;
}

/* 7 日营收柱状图 */
.revenue-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 110px;
  padding: 0 4px;
}
.rev-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  cursor: default;
  height: 100%;
  position: relative;
}
.rev-bar {
  width: 100%;
  min-height: 2px;
  background: var(--accent-2);
  border-radius: 3px 3px 0 0;
  transition: height 0.4s var(--ease);
}
.rev-day {
  font-family: var(--font-num);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}
.rev-val {
  font-family: var(--font-num);
  font-size: 10px;
  color: var(--text-dim);
}

/* 14 日注册曲线（堆叠柱：邀请 + 直接）*/
.signup-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  padding: 0 4px;
}
.signup-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  cursor: default;
  min-width: 0;
}
.signup-bar-stack {
  display: flex;
  flex-direction: column-reverse;
  min-height: 1px;
  border-radius: 3px 3px 0 0;
  overflow: hidden;
  transition: height 0.4s var(--ease);
}
.signup-bar-direct {
  background: var(--blue);
  flex-shrink: 0;
}
.signup-bar-ref {
  background: var(--accent-2);
  flex-shrink: 0;
}
.signup-day {
  font-family: var(--font-num);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: center;
}

@media (max-width: 720px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr !important; }
  .signup-bars { height: 80px; }
}

/* ────── 管理后台：QR 配置 ────── */
.qr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.qr-slot {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 12px;
}
.qr-slot-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
}
.qr-preview {
  background: white;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 10px;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-preview img {
  max-width: 100%;
  max-height: 200px;
  display: block;
}
.qr-preview .qr-empty {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 20px;
  background: transparent;
}

/* ────── 管理后台：待审批行 ────── */
.pending-row {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  align-items: flex-start;
  border-radius: 6px;
  transition: background 0.15s;
}
.pending-row:hover { background: var(--bg-elev); }
.pending-row.is-paid {
  background: linear-gradient(90deg, rgba(91, 140, 90, 0.06), transparent);
  border-left: 3px solid var(--green);
  padding-left: 9px;
}
.pending-info { flex-grow: 1; min-width: 0; }
.pending-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ────── 挑开篇方案卡片（项目页"下一步"特殊态） ────── */
.opening-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.opening-choice-card {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
  transition: border-color 0.15s, transform 0.15s;
}
.opening-choice-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.opening-choice-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.opening-choice-preview {
  font-size: 12px;
  line-height: 1.7;
  flex-grow: 1;
  max-height: 120px;
  overflow: hidden;
  position: relative;
}
.opening-choice-preview::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 24px;
  background: linear-gradient(180deg, transparent, var(--bg-elev));
  pointer-events: none;
}
.opening-choice-meta {
  font-size: 11px;
}
@media (max-width: 480px) {
  .opening-choice-grid { grid-template-columns: 1fr; }
}

/* ────── 段落选中浮 toolbar ────── */
.select-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 6px 20px rgba(60, 50, 35, 0.14);
  animation: selToolIn 0.16s var(--ease, ease-out);
}
@keyframes selToolIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ────── 段落重写 modal ────── */
.rewrite-segment-modal .rs-original {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-dim);
  max-height: 130px;
  overflow-y: auto;
  white-space: pre-wrap;
}
.rewrite-segment-modal .rs-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: -6px;
  margin-bottom: 14px;
}
.rs-chip {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.rs-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text);
  border-color: var(--accent);
}
.rs-diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.rs-diff-old, .rs-diff-new {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 12px;
  max-height: 280px;
  overflow-y: auto;
}
.rs-diff-old { border-left: 3px solid var(--text-muted); }
.rs-diff-new { border-left: 3px solid var(--accent); background: linear-gradient(180deg, rgba(239,68,68,0.04), var(--bg-elev)); }
.rs-diff-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.rs-diff-text {
  font-size: 13px;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
}
@media (max-width: 720px) {
  .rs-diff { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════
 * 响应式补丁（手机端全面审计）— 2026-05
 * 以下规则补足之前在中等屏 / 小屏 / 极小屏 下溢出 / 拥挤 / 触摸目标过小的问题
 * ════════════════════════════════════════════════════════════ */

/* ───── 720px 以下（平板 + 大手机横屏）────────────────────── */
@media (max-width: 720px) {
  /* hero 标题缩小 */
  .hero-title { font-size: 24px; }
  .page-title { font-size: 20px; }
  .page-sub { font-size: 13px; }
  /* hero-card 内边距收紧 */
  .hero-card { padding: 22px 18px; }
  .hero-card .hero-title { font-size: 22px; }

  /* 阅读模式：双栏改成单栏（侧栏置顶） */
  .reader-layout { grid-template-columns: 1fr !important; }
  .reader-side { max-height: 200px; overflow-y: auto; border-right: none !important; border-bottom: 1px solid var(--border-soft); }

  /* 阅读工具栏 — 多按钮横滚 */
  .reader-toolbar {
    overflow-x: auto;
    scrollbar-width: none;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
  }
  .reader-toolbar::-webkit-scrollbar { display: none; }
  .reader-toolbar .btn { flex-shrink: 0; }

  /* 章节生成完成的"下一步"面板 — 按钮纵向 */
  .next-actions-row { flex-direction: column; }
  .next-actions-row .btn { width: 100%; min-width: 0; }

  /* 项目页连贯性面板 — 改单列 */
  .continuity-grid { grid-template-columns: 1fr; }

  /* admin 看板 — KPI 4 → 2 列 */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-num { font-size: 22px; }

  /* admin 收款码 grid 2 → 1 列 */
  .qr-grid { grid-template-columns: 1fr; }

  /* admin 待审批行 — 按钮纵向 */
  .pending-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .pending-actions { justify-content: stretch; }
  .pending-actions .btn { flex: 1; }

  /* 套餐卡片 grid 4 → 2 → 1 */
  .plans { grid-template-columns: repeat(2, 1fr); }

  /* 表格通用：字号收紧 */
  .usage-table th, .usage-table td { padding: 8px 6px; font-size: 12px; }

  /* 8 阶段流程图 4 列 → 2 列 */
  .stages { grid-template-columns: repeat(2, 1fr) !important; }

  /* 邀请页统计 3 列 → 1 列保持紧凑 */
  /* (保留 3 列就好；只是字号缩紧) */
  .invite-stat-num { font-size: 17px; }
}

/* ───── 480px 以下（手机竖屏） ────────────────────────────── */
@media (max-width: 480px) {
  /* 套餐卡片单列 */
  .plan-grid { grid-template-columns: 1fr; }
  .plans { grid-template-columns: 1fr; }

  /* 顶栏字数胶囊紧凑 */
  .topnav-quota { padding: 5px 8px; }
  .topnav-quota .quota-label { display: none; }
  .topnav-username { display: none; }
  .topnav-admin { width: 28px; height: 28px; font-size: 13px; }

  /* 项目页头部 row — 高级 / 导出按钮 wrap */
  .row { flex-wrap: wrap; }

  /* hero 区进一步压缩 */
  .hero-title { font-size: 20px; }
  .hero-card { padding: 18px 14px; }
  section { padding: 36px 0; }
  section h2 { font-size: 20px; }

  /* 付款 modal — 收款码 + 备注更紧凑 */
  .pay-row { gap: 4px; }
  .pay-row > span:first-child { min-width: 52px; font-size: 11px; }
  .pay-row code.pay-ref { font-size: 11px; padding: 3px 6px; }
  .pay-qr-wrap { padding: 10px; min-height: 200px; }
  .pay-qr { max-width: 100%; max-height: 220px; }

  /* 分享 modal canvas 限制高度防溢出 */
  .share-modal-bg .share-preview-wrap { padding: 8px; max-height: 280px; }
  .share-modal-bg #share-canvas { max-height: 260px; }

  /* 配额耗尽 modal CTA 改单列 */
  .quota-cta-grid { grid-template-columns: 1fr; }
  .quota-cta { padding: 12px 14px; }

  /* 欢迎 wizard 紧凑 */
  .welcome-body { padding: 18px 20px 16px; }
  .welcome-title { font-size: 18px; }
  .welcome-brand { font-size: 22px; }
  .welcome-emoji { font-size: 36px; }
  .welcome-input { font-size: 15px; padding: 12px 14px; }
  .welcome-suggestions { gap: 4px; }
  .welcome-chip { font-size: 10px; padding: 3px 8px; }

  /* 邀请统计 3 → 1 列 */
  .invite-stats { grid-template-columns: 1fr; }

  /* admin KPI 卡 — 2 列保持，但字号再缩 */
  .kpi-num { font-size: 20px; }
  .kpi-label { font-size: 11px; }

  /* 注册 / 登录卡 padding 更紧 */
  .auth-card { padding: 24px 20px; }
  .auth-title { font-size: 19px; }

  /* 项目卡 padding 更紧 */
  .project-card { padding: 14px 16px; }

  /* 章节列表项 */
  .reader-chapters .ch-item { padding: 8px 10px; }

  /* 7 日营收柱状图占位太矮 */
  .revenue-bars, .signup-bars { height: 70px; }
  .rev-day, .signup-day, .rev-val { font-size: 9px; }

  /* 滚动锁定问题：项目页 textarea 在小屏自动放大字号导致 iOS 拉伸 */
  textarea, input[type="text"], input[type="password"], input[type="email"], input[type="number"] {
    font-size: 16px;  /* iOS 防止 zoom */
  }
}

/* ───── 360px 以下（小屏老 Android / iPhone SE 1st gen） ───── */
@media (max-width: 360px) {
  .topbar { padding: 8px 10px; gap: 8px; }
  .brand .logo { width: 24px; height: 24px; }
  .brand .title { font-size: 13px; }
  .topnav { gap: 0; }
  .topnav a { padding: 5px 8px; font-size: 11px; }
  /* 字数胶囊只显示数字 */
  .topnav-quota .quota-num { font-size: 11px; }
  .topnav-quota { padding: 4px 6px; margin-right: 4px; }
  .topnav-admin { margin-right: 4px; }

  /* main 几乎贴边 */
  main { padding: 14px 10px 60px; }

  /* hero 题字最小 */
  .hero-title { font-size: 18px; line-height: 1.25; }

  /* btn 最小尺寸保留触摸目标 */
  .btn.small, .btn.tiny { font-size: 11px; padding: 6px 10px; }
}

/* ───── 触摸目标全局保证 ──────────────────────────────────── */
/* 触摸设备（粗指针）— 所有可点击元素 ≥ 44×44（Apple HIG / Material 通用标准） */
@media (pointer: coarse) {
  button, a.btn, input[type="checkbox"], input[type="radio"], select, .switch {
    min-height: 44px;
  }
  /* button.small 通常用于 modal 内的次级按钮，触屏下也要满足 44px */
  .btn.small {
    min-height: 44px;
    padding: 8px 14px;
  }
  /* 链接 / tag 类小目标加大 hit-area */
  .topnav a, .topnav-admin, .pay-tab {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  /* 删除 / x / 关闭按钮单独加大 */
  [data-act="x"], [data-act="close"], .btn.ghost {
    min-width: 44px;
    min-height: 44px;
  }
  /* 表单元素更大触摸区 */
  input[type="text"], input[type="password"], input[type="email"],
  input[type="number"], textarea, select {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 16px;  /* iOS 防自动放大：input font-size < 16px 时 iOS Safari 会缩放页面 */
  }
  textarea { min-height: 88px; }
  /* 阅读页字号在小屏更大些（默认 1.85 行高在 iPhone SE 上太挤） */
  .reader-content {
    font-size: 17px;
    line-height: 1.9;
  }
  /* 阅读页段落间留更多空气 */
  .reader-content p {
    margin: 0 0 1.1em 0;
  }
  /* tag 等小元素加 padding（不强制 44px 否则布局炸） */
  .tag {
    padding: 4px 10px;
    line-height: 1.6;
  }
}

/* ───── 防止水平溢出（hard cap） ─────────────────────────── */
@media (max-width: 720px) {
  body, main, .modal { max-width: 100vw; overflow-x: hidden; }
  .modal { width: calc(100vw - 24px); margin: 0 12px; }
  pre, code, .stream-output {
    max-width: 100%;
    overflow-x: auto;
    word-break: break-all;
  }
}
