/* ============================================================
   故事熔炉 - 番茄小说风 v15
   橙红主色 + 米黄阅读区 + 卡片化
   ============================================================ */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  /* 护眼米黄（默认主题）— 番茄阅读区 */
  --bg: #FAF6F0;
  --bg-elevated: #FFFFFF;
  --bg-secondary: #F0E8DA;
  --bg-tertiary: #E5DCC8;
  --separator: rgba(196, 158, 106, 0.18);
  --separator-opaque: #DCC9A8;
  --border: rgba(196, 158, 106, 0.25);

  --text: #2A1F14;
  --text-secondary: rgba(42, 31, 20, 0.65);
  --text-tertiary: rgba(42, 31, 20, 0.4);
  --text-faint: rgba(42, 31, 20, 0.3);

  --accent: #FF6B35;                  /* 番茄橙红 */
  --accent-dim: #FF8A5C;
  --accent-soft: #FFE4D6;             /* 番茄浅色背景 */
  --success: #4CAF50;
  --warning: #FF9F0A;
  --danger: #E84A3D;
  --pink: #FF375F;

  --reader-font-size: 18px;

  /* 字体 */
  --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-serif: "New York", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", Georgia, serif;
  --font-mono: "SF Mono", Menlo, Consolas, "Courier New", monospace;

  /* 圆角 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* 动效 */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 0.15s;
  --t-norm: 0.25s;

  /* 阴影（番茄卡片） */
  --shadow-sm: 0 1px 3px rgba(196, 158, 106, 0.12);
  --shadow-md: 0 4px 12px rgba(196, 158, 106, 0.16);
}

/* 夜间模式（深色 + 暖橙） */
body[data-theme="dark"] {
  --bg: #1F1814;
  --bg-elevated: #2A2018;
  --bg-secondary: #382C20;
  --bg-tertiary: #4A3A2A;
  --separator: rgba(255, 138, 92, 0.18);
  --separator-opaque: #4A3A2A;
  --border: rgba(255, 138, 92, 0.22);

  --text: #F5E6D3;
  --text-secondary: rgba(245, 230, 211, 0.65);
  --text-tertiary: rgba(245, 230, 211, 0.4);
  --text-faint: rgba(245, 230, 211, 0.3);

  --accent: #FF8A5C;
  --accent-dim: #FFA078;
  --accent-soft: #3A2618;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* 纯亮色模式（白底） */
body[data-theme="light"] {
  --bg: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --bg-secondary: #F5F0E6;
  --bg-tertiary: #E5DCC8;
  --separator: rgba(60, 40, 20, 0.1);
  --separator-opaque: #E5DCC8;
  --border: rgba(60, 40, 20, 0.12);

  --text: #1A1208;
  --text-secondary: rgba(26, 18, 8, 0.65);
  --text-tertiary: rgba(26, 18, 8, 0.4);
  --text-faint: rgba(26, 18, 8, 0.3);

  --accent: #FF6B35;
  --accent-dim: #FF8A5C;
  --accent-soft: #FFE4D6;
}

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-system);
  font-size: 17px;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: contain;
  /* iOS 11+ 不允许长按选中时高亮 */
  -webkit-touch-callout: none;
}
body { padding-bottom: env(safe-area-inset-bottom); }

* { -webkit-user-select: none; user-select: none; }
input, textarea, .selectable { -webkit-user-select: text; user-select: text; }

#app { min-height: 100vh; min-height: 100dvh; }

/* === 启动屏 === */
.splash {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100vh; gap: 16px; color: var(--text-secondary);
  font-size: 17px;
}
.splash-icon { font-size: 64px; }

/* === Toast（底部提示，0.25s 滑入） === */
#toast {
  position: fixed; bottom: calc(40px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(28, 28, 30, 0.92); backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff; padding: 12px 20px; border-radius: 999px;
  font-size: 15px; font-weight: 500;
  z-index: 9999; pointer-events: none; opacity: 0; transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  max-width: 80%; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
body[data-theme="light"] #toast { background: rgba(28, 28, 30, 0.85); }

/* === 通用布局 === */
.view { padding: 0; padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
.hidden { display: none !important; }

/* 顶部导航栏 - iOS Large Title 风格 */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(28, 28, 30, 0.72); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--separator);
  min-height: 44px;
}
body[data-theme="light"] .topbar { background: rgba(248, 248, 248, 0.92); }
.topbar .back {
  background: none; border: none; color: var(--accent); font-size: 17px;
  padding: 4px 12px 4px 4px; cursor: pointer; font-weight: 400;
  margin-left: -4px; min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
}
.topbar .title { flex: 1; font-size: 17px; font-weight: 600; text-align: center; letter-spacing: -0.01em; }
.topbar .title.large { text-align: left; font-size: 34px; font-weight: 700; padding: 8px 20px; letter-spacing: -0.02em; }
.topbar .action { background: none; border: none; color: var(--accent); font-size: 17px; padding: 4px 8px; cursor: pointer; min-width: 44px; min-height: 44px; }
.topbar .action:active { opacity: 0.4; }

/* === iOS 风格按钮 === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 20px; height: 44px; min-height: 44px;
  border: none; border-radius: 12px;
  background: var(--accent); color: #fff;
  font-size: 17px; font-weight: 600; font-family: var(--font-system);
  cursor: pointer; transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  -webkit-user-select: none; user-select: none;
}
.btn:active { opacity: 0.7; transform: scale(0.97); }
.btn:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-ghost { background: var(--bg-tertiary); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-block { display: flex; width: 100%; }
.btn-sm { height: 32px; min-height: 32px; padding: 0 14px; font-size: 15px; border-radius: 9px; }
.btn-icon { width: 44px; padding: 0; }

/* iOS 风格 toggle switch */
.ios-toggle {
  position: relative; width: 51px; height: 31px;
  background: var(--bg-tertiary); border-radius: 16px; cursor: pointer;
  transition: background var(--t-norm) var(--ease);
}
.ios-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; background: #fff; border-radius: 50%;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
  transition: transform var(--t-norm) var(--ease);
}
.ios-toggle.on { background: var(--success); }
.ios-toggle.on::after { transform: translateX(20px); }

/* iOS 风格输入框 */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; padding-left: 4px; font-weight: 400; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; min-height: 44px;
  background: var(--bg-secondary); color: var(--text);
  border: 1px solid transparent; border-radius: 10px;
  font-size: 17px; font-family: var(--font-system);
  transition: border-color var(--t-fast);
  -webkit-appearance: none; appearance: none;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea { min-height: 100px; resize: vertical; line-height: 1.4; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-tertiary); }

/* 创作面板：分组 + chip 选择器 */
.form-section { margin-bottom: 24px; padding: 0 4px; }
.form-section .section-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; font-weight: 600; letter-spacing: 0.02em; }
.form-section .section-hint { font-size: 12px; color: var(--text-tertiary); margin: -4px 0 8px 0; line-height: 1.5; }

/* 写小说向导 */
.wizard-progress {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 12px 12px; background: var(--bg-elevated);
  border-bottom: 1px solid var(--separator);
  position: sticky; top: 0; z-index: 10;
}

/* 写小说轻量提示窗 (modal) */
.qb-modal-bg {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: qb-fade 0.2s;
}
@keyframes qb-fade { from { opacity: 0; } to { opacity: 1; } }
.qb-modal {
  background: var(--bg-elevated);
  border-radius: 20px;
  padding: 28px 24px 20px;
  width: 100%; max-width: 420px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  position: relative;
  animation: qb-pop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes qb-pop { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.qb-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-secondary); color: var(--text-secondary);
  border: none; font-size: 22px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.qb-close:hover { background: var(--bg-tertiary); }
.qb-progress {
  display: flex; align-items: center; justify-content: center;
  gap: 0; margin-bottom: 20px;
}
.qb-dot {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg-tertiary); color: var(--text-tertiary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  transition: all 0.25s;
}
.qb-dot.active { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(255, 107, 53, 0.35); }
.qb-dot.done { background: var(--accent-soft); color: var(--accent); }
.qb-dot.done::before { content: "✓"; }
.qb-dot.done { font-size: 0; }
.qb-dot.done::before { font-size: 14px; }
.qb-line { height: 2px; width: 24px; background: var(--bg-tertiary); margin: 0 4px; }
.qb-pane { animation: qb-fade 0.2s; }
.qb-hint {
  font-size: 14px; color: var(--text-secondary);
  margin-bottom: 12px; text-align: center;
}
.qb-modal input[type="text"] {
  width: 100%; padding: 14px 16px; font-size: 16px;
  background: var(--bg-secondary); color: var(--text);
  border: 2px solid transparent; border-radius: 12px;
  outline: none; transition: border-color 0.2s;
}
.qb-modal input[type="text"]:focus { border-color: var(--accent); background: var(--bg-elevated); }
.qb-vis, .qb-chips {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; justify-content: center;
}
.qb-chip {
  padding: 8px 14px; font-size: 14px;
  background: var(--bg-secondary); color: var(--text);
  border: 1.5px solid transparent; border-radius: 18px;
  cursor: pointer; transition: all 0.15s;
}
.qb-chip:hover { background: var(--bg-tertiary); }
.qb-chip.selected {
  background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent); font-weight: 600;
}
.qb-nav {
  display: flex; gap: 10px; margin-top: 20px;
}
.qb-prev, .qb-next, .qb-create {
  flex: 1; padding: 12px;
  border-radius: 10px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  border: none;
}
.qb-prev {
  background: var(--bg-secondary); color: var(--text-secondary);
}
.qb-prev:disabled { opacity: 0.4; cursor: not-allowed; }
.qb-next, .qb-create {
  background: var(--accent); color: #fff; flex: 2;
}
.qb-next:hover, .qb-create:hover { filter: brightness(1.05); }
.qb-next:disabled { opacity: 0.5; cursor: not-allowed; }
.qb-advanced {
  text-align: center; margin-top: 14px;
  padding-top: 14px; border-top: 1px dashed var(--separator);
}
.qb-advanced button {
  background: none; border: none; color: var(--text-tertiary);
  font-size: 13px; cursor: pointer; padding: 4px 8px;
}
.qb-advanced button:hover { color: var(--accent); }
.qb-cover-preview {
  display: flex; justify-content: center; margin-bottom: 8px;
}
.qb-mini-btn {
  flex: 1; padding: 8px 4px;
  background: var(--bg-secondary); color: var(--text);
  border: 1px solid var(--separator);
  border-radius: 8px; font-size: 12px; cursor: pointer;
  transition: all 0.15s;
}
.qb-mini-btn:hover { background: var(--bg-tertiary); }
.qb-mini-btn:disabled { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 480px) {
  .qb-modal-bg { padding: 0; }
  .qb-modal { max-width: 100%; min-height: 100vh; border-radius: 0; padding-top: 40px; }
}

/* 听书模式 v1 底部控制条 */
.tts-bar {
  position: fixed; left: 12px; right: 12px;
  bottom: 80px; z-index: 9000;
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  animation: tts-slide 0.25s ease-out;
}
@keyframes tts-slide { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.tts-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-secondary); color: var(--text);
  border: none; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.tts-btn:active { transform: scale(0.95); }
.tts-play {
  width: 48px; height: 48px;
  background: var(--accent); color: #fff;
  font-size: 18px;
}
.tts-close { background: transparent; color: var(--text-tertiary); width: 32px; height: 32px; font-size: 22px; }
.tts-info {
  flex: 1; display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px;
}
.tts-progress {
  font-size: 12px; color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}
.tts-rate {
  background: var(--bg-secondary); color: var(--text);
  border: 1px solid var(--separator);
  border-radius: 8px; padding: 4px 8px; font-size: 12px;
  cursor: pointer;
}

/* 离线缓存标识 */
.cached-badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 2px;
}

/* 我的预约列表 */
.rsv-list { display: flex; flex-direction: column; gap: 8px; }
.rsv-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; background: var(--bg-secondary);
  border-radius: 10px; cursor: pointer;
}
.rsv-item:active { background: var(--bg-tertiary); }
.rsv-cover { width: 40px; height: 56px; border-radius: 6px; background: var(--bg-tertiary); display: flex; align-items: center; justify-content: center; overflow: hidden; flex: 0 0 auto; }
.rsv-cover img { width: 100%; height: 100%; object-fit: cover; }
.rsv-info { flex: 1; min-width: 0; }
.rsv-title { font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rsv-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.rsv-del { background: none; border: none; color: var(--text-tertiary); font-size: 20px; padding: 0 8px; cursor: pointer; }
.rsv-del:hover { color: var(--danger); }

/* AI 抽取道具结果 */
.extracted-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; margin-bottom: 12px;
}
.extracted-card {
  background: var(--bg-secondary); border-radius: 12px;
  padding: 10px; text-align: center;
  border: 2px solid transparent;
  position: relative;
}
.extracted-card.rarity-common { border-color: #B0B0B0; }
.extracted-card.rarity-rare { border-color: #4A90E2; box-shadow: 0 0 12px rgba(74,144,226,0.3); }
.extracted-card.rarity-epic { border-color: #A855F7; box-shadow: 0 0 12px rgba(168,85,247,0.4); }
.extracted-card.rarity-legendary {
  border-color: #F59E0B;
  box-shadow: 0 0 20px rgba(245,158,11,0.6);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(245,158,11,0.1) 100%);
}
.extracted-card img {
  width: 96px; height: 96px; object-fit: contain;
  image-rendering: pixelated;
  display: block; margin: 0 auto 8px;
}
.extracted-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.extracted-rarity { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.extracted-rarity.rarity-common { color: #B0B0B0; }
.extracted-rarity.rarity-rare { color: #4A90E2; }
.extracted-rarity.rarity-epic { color: #A855F7; }
.extracted-rarity.rarity-legendary { color: #F59E0B; font-weight: 700; }
.extracted-desc { font-size: 11px; color: var(--text-tertiary); line-height: 1.4; }
.failed-tip {
  font-size: 12px; color: var(--warning);
  padding: 8px; background: rgba(255,159,10,0.1);
  border-radius: 6px; margin-top: 8px;
}

/* 桌面端布局（≥ 768px）— tabbar 改成左侧 sidebar */
@media (min-width: 768px) {
  .tabbar {
    position: fixed;
    left: 0; top: 0; bottom: 0; right: auto;
    width: 220px;
    flex-direction: column;
    align-items: stretch;
    padding: 20px 12px;
    border-top: none;
    border-right: 0.5px solid var(--separator);
  }
  .tabbar-spacer { display: none; }
  .tab {
    flex-direction: row;
    justify-content: flex-start;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 4px;
    font-size: 15px;
  }
  .tab-ico { font-size: 20px; margin-right: 10px; }
  .tab.active { background: var(--accent-soft); color: var(--accent); }
  /* 顶部 logo 区域 */
  .tabbar::before {
    content: "📖 故事熔炉";
    display: block;
    font-size: 18px; font-weight: 700;
    color: var(--accent);
    padding: 8px 16px 16px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--separator);
    text-align: left;
  }
  /* 主内容区加左边距 */
  #app > .view {
    margin-left: 220px;
    min-height: 100vh;
    max-width: 960px;
    padding: 0 32px;
  }
  /* 阅读器居中 + 合适宽度 */
  .reader {
    margin-left: 220px;
    max-width: 720px;
    padding: 0 32px;
  }
  .reader-header { padding: 16px 0; }
  .topbar { padding: 16px 0; }
  /* 创书 FAB 桌面端挪到 sidebar 右边，避免遮挡底部 tab */
  .fab {
    position: fixed;
    left: 244px; bottom: 24px;
    width: 56px; height: 56px;
  }
  /* 书架网格在桌面端更密 */
  .book-shelf {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
    gap: 18px !important;
  }
  /* modal 在桌面端居中且限宽 */
  .qb-modal { max-width: 480px; }
}
.wizard-step { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; flex: 0 0 auto; min-width: 56px; }
.wizard-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-tertiary); color: var(--text-tertiary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  transition: all 0.25s;
}
.wizard-label { font-size: 11px; color: var(--text-tertiary); transition: color 0.25s; white-space: nowrap; }
.wizard-step.active .wizard-dot { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(255,107,53,0.35); }
.wizard-step.active .wizard-label { color: var(--accent); font-weight: 600; }
.wizard-step.done .wizard-dot { background: var(--accent-soft); color: var(--accent); }
.wizard-step.done .wizard-dot::before { content: "✓"; }
.wizard-step.done .wizard-dot { font-size: 0; }
.wizard-step.done .wizard-dot::before { font-size: 14px; }
.wizard-step.done .wizard-label { color: var(--text-secondary); }
.wizard-line { flex: 1 1 auto; height: 2px; background: var(--bg-tertiary); margin: 0 4px; margin-bottom: 18px; min-width: 12px; }
.wizard-pane { animation: wizard-fade 0.25s ease-out; }
@keyframes wizard-fade { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: translateX(0); } }
.wizard-step-hint { font-size: 13px; color: var(--text-secondary); padding: 12px 4px 16px; line-height: 1.5; border-bottom: 1px dashed var(--separator); margin-bottom: 16px; }
.wizard-nav {
  display: flex; gap: 10px; padding: 16px 4px;
  position: sticky; bottom: 0; background: var(--bg-elevated);
  border-top: 1px solid var(--separator);
  margin: 0 -4px;
}
.wizard-nav button:disabled { opacity: 0.4; cursor: not-allowed; }
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; padding: 8px 14px;
  background: var(--bg-secondary); color: var(--text);
  border: 1px solid transparent; border-radius: 18px;
  font-size: 14px; cursor: pointer; min-height: 34px;
  transition: all var(--t-fast) var(--ease);
  -webkit-user-select: none; user-select: none;
  white-space: nowrap;
}
.chip:active { transform: scale(0.95); }
.chip.selected { background: var(--accent); color: #fff; font-weight: 600; }
.char-row { display: flex; gap: 8px; margin-bottom: 8px; }
.char-row input { flex: 1; }
.char-row input.char-name { flex: 0 0 30%; }
.char-row .char-del { background: var(--bg-secondary); border: none; color: var(--danger); font-size: 18px; padding: 0 12px; border-radius: 10px; cursor: pointer; min-height: 44px; }
.btn-add { width: 100%; padding: 10px; background: var(--bg-secondary); color: var(--accent); border: 1px dashed var(--border); border-radius: 10px; font-size: 14px; cursor: pointer; min-height: 40px; margin-top: 4px; }
.struct-meta { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.meta-row { display: flex; align-items: baseline; gap: 12px; padding: 4px 0; font-size: 14px; }
.meta-row .meta-label { color: var(--text-tertiary); min-width: 44px; font-size: 13px; }
.meta-row .meta-value { color: var(--text); flex: 1; }
.meta-row .meta-value.empty { color: var(--text-faint); font-style: italic; }

/* === iOS 风格卡片 === */
.card {
  background: var(--bg-elevated);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid transparent;
  transition: background var(--t-fast) var(--ease);
}
.card-row { display: flex; align-items: center; gap: 12px; }
.card-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.card-meta { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* === 登录页 === */
.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 32px 24px;
}
.login-wrap h1 {
  font-size: 34px; font-weight: 700; letter-spacing: -0.02em;
  text-align: center; margin: 0 0 8px;
}
.login-wrap .sub {
  text-align: center; color: var(--text-secondary);
  font-size: 15px; margin-bottom: 36px;
}
.login-tabs { display: flex; margin-bottom: 24px; background: var(--bg-tertiary); border-radius: 10px; padding: 3px; }
.login-tabs button {
  flex: 1; padding: 8px; background: none; border: none; color: var(--text-secondary);
  font-size: 15px; font-weight: 500; cursor: pointer; border-radius: 8px;
  transition: all var(--t-fast) var(--ease);
}
.login-tabs button.active { background: var(--bg-secondary); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* === 书架 === */
.large-title {
  font-size: 34px; font-weight: 700; letter-spacing: -0.02em;
  padding: 16px 20px 8px;
}
.section-title {
  font-size: 22px; font-weight: 700; letter-spacing: -0.01em;
  padding: 24px 20px 12px;
  color: var(--text);
}
.book-shelf {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 18px 14px;
  padding: 4px 20px 20px;
}
.book-card {
  background: transparent; border-radius: var(--r-lg);
  padding: 0; cursor: pointer;
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
  -webkit-user-select: none;
}
.book-card:active { transform: scale(0.96); opacity: 0.85; }
.book-cover {
  aspect-ratio: 3/4; border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-elevated));
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; margin-bottom: 8px; overflow: hidden;
  box-shadow: var(--shadow-md);
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-title-sm { font-size: 14px; font-weight: 600; line-height: 1.3; margin-bottom: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  padding: 0 2px; }
.book-meta { font-size: 11px; color: var(--text-secondary); padding: 0 2px; }

/* === FAB（浮动添加按钮） === */
.fab {
  position: fixed; right: 20px; bottom: calc(80px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  font-size: 32px; font-weight: 300; line-height: 0;
  box-shadow: 0 4px 16px rgba(255, 107, 53, 0.4);
  cursor: pointer; z-index: 100; transition: transform var(--t-fast) var(--ease);
}
.fab:active { transform: scale(0.9); }

/* === iOS 风格 List 列表 === */
.list {
  background: var(--bg-elevated);
  border-radius: var(--r-lg);
  margin: 0 16px 16px;
  overflow: hidden;
}
.list-row {
  display: flex; align-items: center; padding: 14px 16px;
  min-height: 48px; cursor: pointer; position: relative;
  border-bottom: 0.5px solid var(--separator);
  transition: background var(--t-fast) var(--ease);
}
.list-row:last-child { border-bottom: none; }
.list-row:active { background: var(--bg-tertiary); }
.list-row .lr-content { flex: 1; min-width: 0; }
.list-row .lr-title { font-size: 17px; font-weight: 500; }
.list-row .lr-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.list-row .lr-chevron { color: var(--text-tertiary); font-size: 18px; margin-left: 8px; }
.list-row .lr-trailing { color: var(--text-secondary); font-size: 15px; margin-left: 8px; }
.list-row .lr-icon {
  width: 32px; height: 32px; border-radius: 7px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; margin-right: 12px; flex-shrink: 0;
}
.list-row .lr-icon.green { background: var(--success); }
.list-row .lr-icon.orange { background: var(--warning); }
.list-row .lr-icon.pink { background: var(--pink); }

/* === 章节目录 === */
.chapter-list { padding: 0 16px; }
.chapter-item {
  display: flex; align-items: center; padding: 14px 12px;
  background: var(--bg-elevated); border-radius: var(--r-md);
  margin-bottom: 8px; cursor: pointer; min-height: 60px;
  border-left: 3px solid transparent;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.chapter-item:active { background: var(--bg-tertiary); }
.chapter-item.is-read { opacity: 0.6; }
.chapter-item.is-read .chapter-num { color: var(--success); font-weight: 600; }
.chapter-item.in-progress { border-left-color: var(--accent); }
.chapter-num { color: var(--text-secondary); font-size: 14px; min-width: 56px; font-variant-numeric: tabular-nums; }
.chapter-info { flex: 1; min-width: 0; }
.chapter-info .ch-title { font-size: 16px; font-weight: 500; }
.chapter-info .ch-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.badge-mini {
  font-size: 11px; padding: 2px 8px; background: var(--accent);
  color: #fff; border-radius: 6px; margin-left: 8px; font-weight: 500;
}

/* === 书详情 === */
.book-meta-card { padding: 16px; }
.meta-row {
  display: flex; gap: 12px; align-items: flex-start;
  font-size: 15px; line-height: 1.5;
  padding: 10px 0; border-bottom: 0.5px solid var(--separator);
}
.meta-row:last-of-type { border-bottom: none; padding-bottom: 0; }
.meta-label {
  flex-shrink: 0; color: var(--text-secondary);
  font-size: 13px; min-width: 40px; padding-top: 2px;
}
.meta-body { flex: 1; color: var(--text); white-space: pre-wrap; }
.meta-stats {
  display: flex; gap: 16px; font-size: 13px; color: var(--text-secondary);
  margin-top: 12px; flex-wrap: wrap;
}
.meta-stats span { display: inline-flex; align-items: center; gap: 4px; }

.chars-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px; margin-top: 4px;
}
.char-chip {
  background: var(--bg-secondary); border-radius: 10px; padding: 10px 12px;
  border: 0.5px solid var(--separator);
}
.char-name { font-size: 15px; font-weight: 600; }
.char-trait { font-size: 12px; color: var(--text-secondary); margin-top: 2px; line-height: 1.4; }

/* === 阅读器 === */
.reader { padding: 0; padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
.reader-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(28, 28, 30, 0.72); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 4px;
  border-bottom: 0.5px solid var(--separator);
  min-height: 44px;
}
body[data-theme="light"] .reader-header { background: rgba(248, 248, 248, 0.92); }
.reader-header .ch-info { flex: 1; min-width: 0; padding: 0 8px; }
.reader-header .ch-title { font-size: 15px; font-weight: 600; }
.reader-header .ch-meta { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }
.reader-header .back {
  background: none; border: none; color: var(--accent); font-size: 28px; line-height: 1;
  padding: 0 12px; cursor: pointer; font-weight: 300;
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
}
.reader-header .insp-fab {
  background: var(--accent-soft) !important; color: var(--accent) !important;
  font-size: 14px !important; font-weight: 600;
  border-radius: 18px !important;
  padding: 6px 12px !important;
  min-height: 32px !important;
}
.insp-prompt {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 16px 22px 8px;
  padding: 14px 18px;
  background: var(--accent-soft);
  border-radius: var(--r-lg);
  color: var(--text);
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}
.insp-cta {
  background: var(--accent); color: #FFFFFF;
  border: none; border-radius: 18px;
  padding: 8px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; min-height: 32px;
  white-space: nowrap;
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
.insp-cta:active { transform: scale(0.95); opacity: 0.85; }
.cmt-suggest { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; font-size: 14px; color: var(--text-secondary); cursor: pointer; }
.cmt-suggest input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.cmt-list { max-height: 200px; overflow-y: auto; margin: 8px 0; padding: 8px 0; border-top: 1px solid var(--separator); border-bottom: 1px solid var(--separator); }
.cmt-item { padding: 8px 0; border-bottom: 1px solid var(--separator); }
.cmt-item:last-child { border-bottom: none; }
.cmt-quote { font-size: 12px; color: var(--text-tertiary); font-style: italic; margin-bottom: 4px; }
.cmt-content { font-size: 15px; line-height: 1.5; margin-bottom: 4px; }
.cmt-meta { font-size: 11px; color: var(--text-tertiary); display: flex; align-items: center; gap: 6px; }
.cmt-badge { display: inline-block; padding: 2px 6px; border-radius: 6px; font-size: 10px; font-weight: 600; }
.cmt-badge.ok { background: rgba(76, 175, 80, 0.18); color: #2E7D32; }
.cmt-badge.no { background: rgba(232, 74, 61, 0.18); color: var(--danger); }
.cmt-badge.wait { background: var(--accent-soft); color: var(--accent); }

/* === 底部 3 Tab 导航（番茄式） === */
.tabbar-spacer { height: 64px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: rgba(250, 246, 240, 0.95);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
  display: flex; padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
}
body[data-theme="dark"] .tabbar { background: rgba(31, 24, 20, 0.95); }
.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  color: var(--text-tertiary);
  text-decoration: none; cursor: pointer;
  font-size: 11px;
  padding: 6px 0;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--t-fast) var(--ease);
}
.tab .tab-ico { font-size: 22px; line-height: 1; }
.tab.active { color: var(--accent); font-weight: 600; }
.tab:active { opacity: 0.6; }

/* === 我的页 === */
.me-header {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 20px 16px;
  background: linear-gradient(135deg, var(--accent-soft), transparent);
}
.me-avatar-wrap { position: relative; width: 80px; height: 80px; flex-shrink: 0; }
.me-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; color: var(--text-tertiary);
  box-shadow: var(--shadow-md);
  border: 3px solid var(--bg-elevated);
}
.me-level-badge {
  position: absolute; bottom: -4px; right: -8px;
  font-size: 12px;
}
.lvl-badge {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 7px; border-radius: 10px;
  font-size: 11px; font-weight: 700;
  background: var(--bg-elevated);
  border: 1.5px solid;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  white-space: nowrap;
}
.lvl-1 { border-color: #4CAF50; color: #2E7D32; background: rgba(76,175,80,0.1); }
.lvl-2 { border-color: #2196F3; color: #1565C0; background: rgba(33,150,243,0.1); }
.lvl-3 { border-color: #9C27B0; color: #6A1B9A; background: rgba(156,39,176,0.1); }
.lvl-4 { border-color: #FF6B35; color: #E84A3D; background: rgba(255,107,53,0.1); }
.lvl-5 { border-color: #FFD700; color: #B8860B; background: rgba(255,215,0,0.18); box-shadow: 0 0 8px rgba(255,215,0,0.5); }
.me-name { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.me-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bg-elevated);
  margin: 0 16px 12px;
  border-radius: var(--r-lg);
  padding: 14px 0;
  box-shadow: var(--shadow-sm);
}
.me-stats { grid-template-columns: repeat(3, 1fr); }  /* 6 个统计时换 3 列 */
.stat { text-align: center; }
.stat-num { font-size: 20px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.me-level-info {
  margin: 0 16px 12px;
  background: var(--bg-elevated);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.level-progress-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.tiers { display: flex; flex-direction: column; gap: 4px; }
.tier { font-size: 12px; color: var(--text-tertiary); padding: 4px 8px; border-radius: 6px; }
.tier.reached { color: var(--accent); font-weight: 600; }
.tier.current { background: var(--accent-soft); }
.level-next { font-size: 11px; color: var(--text-tertiary); margin-top: 8px; text-align: right; }
.me-actions {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 16px;
}
.me-action {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 0;
  background: var(--bg-elevated);
  border: none; border-radius: var(--r-lg);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast) var(--ease);
}
.me-action:active { transform: scale(0.96); }
.me-action .ico { font-size: 28px; }

/* === 书架页：我的书 + 收藏（两 tab） === */
.shelf-tabs { display: flex; gap: 4px; padding: 0 20px 12px; }
.shelf-tab { flex: 1; padding: 10px; background: var(--bg-secondary); color: var(--text-secondary); border: none; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.shelf-tab.active { background: var(--accent); color: #fff; }

/* === 书详情：加入书架按钮 === */
.shelf-btn { padding: 10px 16px; border-radius: 18px; font-size: 14px; font-weight: 600; border: 1.5px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer; }
.shelf-btn.added { background: var(--accent); color: #fff; }
.follow-btn { padding: 8px 14px; border-radius: 18px; font-size: 13px; font-weight: 600; border: 1.5px solid var(--text-tertiary); background: transparent; color: var(--text-secondary); cursor: pointer; }
.follow-btn.following { background: var(--text-tertiary); color: var(--bg); border-color: var(--text-tertiary); }

/* === 通知铃铛 === */
.notif-dot { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; background: var(--danger); color: #fff; border-radius: 8px; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.notif-dot-mini { display: inline-block; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; }
.notif-item { display: flex; align-items: center; padding: 12px 0; border-bottom: 0.5px solid var(--separator); cursor: pointer; }
.notif-item.unread { background: var(--accent-soft); margin: 0 -16px; padding: 12px 16px; }
.notif-item:active { opacity: 0.6; }

/* === 管理员面板 / 管理读者 === */
.admin-user { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 0.5px solid var(--separator); }

/* === 浏览历史详情页 === */
.hist-group { margin-bottom: 16px; }
.hist-group-title { font-size: 13px; color: var(--text-tertiary); padding: 8px 16px 4px; font-weight: 600; }
.hist-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--bg-elevated); border-bottom: 0.5px solid var(--separator); cursor: pointer; }
.hist-item:active { opacity: 0.6; }
.hist-cover { width: 48px; height: 64px; border-radius: 6px; object-fit: cover; background: var(--bg-tertiary); flex-shrink: 0; }

/* === 评论嵌套 === */
.reply-link { background: none; border: none; color: var(--accent); font-size: 12px; cursor: pointer; padding: 4px 0; margin-top: 4px; }
.reply-quote { padding: 8px 12px; background: var(--bg-secondary); border-left: 3px solid var(--accent); border-radius: 6px; font-size: 13px; color: var(--text-secondary); margin: 8px 0; }

/* === 个人主页 === */
.up-banner {
  height: 140px;
  background-size: cover; background-position: center;
  position: relative;
}
.up-avatar {
  position: absolute; bottom: -40px; left: 20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; color: var(--text-tertiary);
  border: 4px solid var(--bg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.up-avatar img { width: 100%; height: 100%; object-fit: cover; }
.up-level-badge { position: absolute; bottom: -6px; right: -10px; }
.up-info { padding: 50px 20px 12px; }
.up-name { font-size: 22px; font-weight: 700; }
.up-bio { color: var(--text-secondary); font-size: 14px; margin-top: 6px; line-height: 1.5; }
.up-stats { display: grid; grid-template-columns: repeat(4, 1fr); padding: 14px 0; margin-top: 8px; }
.up-stat { text-align: center; }
.up-stat-num { font-size: 18px; font-weight: 700; color: var(--text); }
.up-stat-label { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.up-follow { width: 100%; padding: 10px 16px; border-radius: 18px; font-size: 14px; font-weight: 600; border: none; background: var(--accent); color: #fff; cursor: pointer; margin-top: 12px; }
.up-follow.following { background: var(--text-tertiary); color: var(--bg); }

.hdr-btn {
  background: none; border: none; color: var(--accent);
  font-size: 20px; padding: 8px; cursor: pointer; min-width: 40px; min-height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
}
.hdr-btn:active { background: var(--bg-tertiary); }

.reader-body { padding: 28px 24px 100px; font-size: var(--reader-font-size, 18px); line-height: 1.95; font-family: var(--font-serif); color: var(--text); }
.paragraph {
  margin-bottom: 1.5em; position: relative; -webkit-user-select: text; user-select: text;
  transition: background var(--t-fast) var(--ease);
  padding: 4px 0;
}
.paragraph.commented {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 4px 10px;
  margin-left: -10px; margin-right: -10px;
}
.paragraph.search-hit {
  background: rgba(255, 107, 53, 0.22);
  padding: 2px 4px; border-radius: 3px;
}
.com-dot { position: absolute; right: -4px; top: 4px; font-size: 11px; color: var(--accent); }
.search-count {
  position: sticky; top: 56px; z-index: 15;
  background: var(--bg-elevated); color: var(--text);
  text-align: center; font-size: 13px; padding: 8px;
  border-bottom: 0.5px solid var(--separator);
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.search-count button {
  background: var(--bg-tertiary); border: none; color: var(--text);
  padding: 4px 10px; border-radius: 6px; font-size: 13px;
}

/* === 章节底部导航 === */
.chapter-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: rgba(28, 28, 30, 0.92); backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid var(--separator);
  padding-bottom: env(safe-area-inset-bottom);
}
body[data-theme="light"] .chapter-nav { background: rgba(248, 248, 248, 0.92); }
.chapter-nav button {
  flex: 1; padding: 14px; background: none; border: none; color: var(--accent);
  font-size: 15px; font-weight: 500; cursor: pointer; min-height: 48px;
}
.chapter-nav button:disabled { color: var(--text-tertiary); }
.chapter-nav .nav-info {
  flex: 1.5; text-align: center; font-size: 13px; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums;
}

/* === iOS 风格 Sheet 弹窗（从下往上） === */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.25s var(--ease);
}
.sheet {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 201;
  background: var(--bg-elevated);
  border-radius: 14px 14px 0 0;
  padding: 12px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 85vh; max-height: 85dvh;
  animation: slideUp 0.3s var(--ease);
  display: flex; flex-direction: column;
}
.sheet-handle {
  width: 36px; height: 5px; background: var(--text-tertiary);
  border-radius: 3px; margin: 0 auto 12px;
  flex-shrink: 0;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet h3 {
  font-size: 17px; font-weight: 600; margin: 0 0 12px; text-align: center;
}
.sheet .ref { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; line-height: 1.5;
  background: var(--bg-secondary); padding: 10px 12px; border-radius: 10px; max-height: 80px; overflow-y: auto; }
.sheet textarea { width: 100%; min-height: 100px; padding: 12px;
  background: var(--bg-secondary); color: var(--text);
  border: none; border-radius: 10px; font-size: 17px;
  font-family: var(--font-system); resize: none;
}
.sheet textarea:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.sheet .actions { display: flex; gap: 8px; margin-top: 16px; }
.sheet .actions .btn { flex: 1; }

/* 评论列表 */
.comments-panel { margin-top: 12px; padding: 12px; background: var(--bg-elevated); border-radius: 10px; }
.comment-item { padding: 8px 0; border-bottom: 0.5px solid var(--separator); }
.comment-item:last-child { border-bottom: none; }
.comment-item .c-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }
.comment-item .c-content { font-size: 15px; line-height: 1.5; }

/* 重写确认 sheet */
.regen-comments { max-height: 35vh; overflow-y: auto; background: var(--bg-secondary); border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; }
.regen-cmt { padding: 6px 0; border-bottom: 0.5px solid var(--separator); font-size: 14px; line-height: 1.5; }
.regen-cmt:last-child { border-bottom: none; }
.regen-cmt-quote { color: var(--text-secondary); font-style: italic; font-size: 13px; margin-bottom: 2px; }

/* === 灵感便签 === */
.insp-card { margin-bottom: 8px; }
.insp-card .insp-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.insp-card .tag {
  font-size: 11px; padding: 3px 8px; background: var(--bg-tertiary);
  border-radius: 6px; color: var(--text-secondary);
}

/* === 设置页（iOS Settings.app 风格） === */
.settings-section {
  margin: 0 16px 24px;
  background: var(--bg-elevated);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.settings-section .ss-header {
  font-size: 13px; color: var(--text-secondary);
  padding: 8px 16px 4px; text-transform: uppercase; letter-spacing: 0.05em;
}
.settings-row {
  display: flex; align-items: center; padding: 12px 16px;
  min-height: 44px; border-bottom: 0.5px solid var(--separator);
}
.settings-row:last-child { border-bottom: none; }
.settings-row .sr-label { flex: 1; font-size: 17px; }
.settings-row .sr-value { color: var(--text-secondary); font-size: 15px; }

/* 主题选择（iOS segmented control） */
.segmented {
  display: flex; background: var(--bg-tertiary);
  border-radius: 9px; padding: 2px; gap: 0;
}
.segmented button {
  flex: 1; padding: 6px 12px; background: none; border: none;
  color: var(--text); font-size: 13px; font-weight: 500;
  border-radius: 7px; cursor: pointer; transition: all var(--t-fast) var(--ease);
  min-height: 32px;
}
.segmented button.active {
  background: var(--bg-secondary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  font-weight: 600;
}

/* 字体大小条 */
.slider-row {
  display: flex; align-items: center; padding: 12px 16px; gap: 12px;
}
.slider-row input[type="range"] {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 4px; background: var(--bg-tertiary); border-radius: 2px;
  outline: none;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; background: #fff; border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.slider-row .slider-value { font-size: 13px; color: var(--text-secondary); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

/* === 加载/空状态 === */
.empty { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.spinner {
  display: inline-block; width: 18px; height: 18px; border: 2px solid var(--bg-tertiary);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite;
  vertical-align: middle; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === 选区高亮（iOS 系统色）=== */
::selection { background: rgba(10, 132, 255, 0.3); }

/* === 工具类 === */
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.tac { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* === 道具系统样式（v1.1） === */
.loot-badge {
  display: inline-block; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; padding: 2px 7px;
  border-radius: 10px; margin-left: 6px; min-width: 18px; text-align: center;
  vertical-align: middle;
}
.loot-section-title {
  font-size: 13px; color: var(--text-secondary); font-weight: 600;
  margin-bottom: 10px;
}
.loot-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.loot-box {
  background: var(--bg-secondary); border-radius: 12px; padding: 12px;
  text-align: center; border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.loot-box-icon { font-size: 36px; }
.loot-box-source { font-size: 12px; color: var(--text-secondary); }
.loot-box-time { font-size: 11px; color: var(--text-tertiary); }
.loot-box .loot-open-btn { width: 100%; margin-top: 4px; }
.loot-history {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 160px; overflow-y: auto;
}
.loot-history-item {
  display: flex; justify-content: space-between;
  font-size: 12px; padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.open-result-sheet { max-width: 360px; }
.open-result-backdrop { background: rgba(0,0,0,0.55); }
.open-result-rarity { animation: rarityPulse 1.5s ease-in-out infinite; }
@keyframes rarityPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.04); }
}
.open-result-img-anchor { text-align: center; margin: 8px 0; }
.open-result-img-wrap { display: inline-block; }

.props-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px; padding-bottom: 40px;
}
.prop-cell {
  background: var(--bg-secondary); border-radius: 10px; padding: 10px;
  text-align: center; border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 12px;
}
.prop-cell.equipped {
  border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft);
}
.prop-cell-img-wrap { display: inline-block; }
.prop-cell-name { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 2px; }
.prop-cell-rarity { font-size: 11px; }
.prop-cell-count { font-size: 11px; color: var(--text-tertiary); }
.prop-cell .prop-equip-btn { font-size: 11px; padding: 4px 8px; margin-top: 4px; }

/* === 书架快捷按钮（书城书卡右下角） === */
.book-shelf-quick {
  position: absolute; right: 6px; bottom: 6px;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,0.95); color: var(--accent);
  border: none; font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  line-height: 1; padding: 0; transition: transform var(--t-fast);
}
.book-shelf-quick:active { transform: scale(0.9); }
.book-shelf-quick.added {
  background: var(--accent); color: #fff;
}

/* === 生成进度 sheet 动画 === */
.gen-progress { max-width: 360px; padding: 24px 20px 28px !important; }
.gen-progress h3 { color: var(--accent); }
.gen-stage { animation: stagePulse 1.6s ease-in-out infinite; }
@keyframes stagePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.96); }
}
.gen-orbit {
  width: 80px; height: 80px; border-radius: 50%;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  animation: genSpin 1.2s linear infinite;
  position: relative;
}
.gen-orbit-inner {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(255, 107, 53, 0.5);
  animation: genPulse 1.2s ease-in-out infinite;
}
@keyframes genSpin { to { transform: rotate(360deg); } }
@keyframes genPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.4); opacity: 0.6; }
}

/* === 埃斯坦小镇 === */
.aestan-view { padding-bottom: 80px; }
.aestan-filters {
  background: var(--bg-secondary);
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.aestan-filter-row {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
}
.aestan-filter-label {
  font-size: 11px; color: var(--text-tertiary); min-width: 32px; flex-shrink: 0;
}
.aestan-chip-row {
  display: flex; gap: 4px; overflow-x: auto; flex: 1;
  scrollbar-width: none;
}
.aestan-chip-row::-webkit-scrollbar { display: none; }
.aestan-chip {
  padding: 4px 10px; font-size: 12px;
  background: var(--bg-elevated); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 12px;
  white-space: nowrap; cursor: pointer; transition: all var(--t-fast);
}
.aestan-chip.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.aestan-group { padding: 12px 16px 4px; }
.aestan-group-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.aestan-group-cover {
  width: 40px; height: 54px; border-radius: 4px; object-fit: cover; flex-shrink: 0;
  background: var(--bg-tertiary);
}
.aestan-group-cover-empty {
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.aestan-group-info { flex: 1; min-width: 0; }
.aestan-group-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.aestan-group-meta { font-size: 11px; color: var(--text-tertiary); }
.aestan-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}
.aestan-card {
  background: var(--bg-secondary); border-radius: 10px; padding: 8px;
  text-align: center; cursor: pointer; transition: all var(--t-fast);
  border: 1.5px solid transparent;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.aestan-card.equipped { border-color: var(--accent); background: var(--accent-soft); }
.aestan-card:active { transform: scale(0.96); }
.aestan-card-img-wrap {
  width: 100%; aspect-ratio: 1/1; position: relative;
  background: #fff; border-radius: 6px; padding: 4px; overflow: hidden;
}
.aestan-card-img { width: 100%; height: 100%; object-fit: contain; }
.aestan-equipped-mark {
  position: absolute; top: 2px; left: 2px;
  background: var(--accent); color: #fff;
  font-size: 9px; padding: 1px 4px; border-radius: 4px; font-weight: 600;
}
.aestan-owned-mark {
  position: absolute; bottom: 2px; right: 2px;
  background: rgba(0,0,0,0.6); color: #fff;
  font-size: 10px; padding: 1px 5px; border-radius: 4px; font-weight: 600;
}
.aestan-card-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.aestan-card-meta { font-size: 10px; color: var(--text-tertiary); display: flex; gap: 2px; justify-content: center; }

/* 详情 sheet */
.aestan-detail-head { text-align: center; padding: 8px 0 4px; }
.aestan-detail-img-wrap {
  display: inline-block; background: #fff; padding: 10px; border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.aestan-detail-img { width: 128px; height: 128px; object-fit: contain; display: block; }
.aestan-detail-tags {
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; padding: 8px 0;
}
.aestan-tag {
  font-size: 11px; padding: 3px 9px; border-radius: 10px;
  background: var(--bg-secondary); color: var(--text-secondary);
}
.aestan-tag.era { background: rgba(255, 107, 53, 0.12); color: var(--accent); }
.aestan-tag.effect { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.aestan-tag.use { background: rgba(168, 85, 247, 0.12); color: #a855f7; }
.aestan-detail-stats {
  display: flex; justify-content: space-around; padding: 12px 0 4px;
  border-top: 1px dashed var(--border);
}
.aestan-detail-stats > div {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.aestan-detail-stats b { font-size: 20px; color: var(--accent); }
.aestan-detail-stats span { font-size: 11px; color: var(--text-tertiary); }
#a-like-btn.liked { background: var(--accent); color: #fff; border-color: var(--accent); }

/* === AI 伴随小人 === */
.npc-float {
  position: fixed; right: 14px; bottom: 80px;
  width: 56px; height: 64px;
  z-index: 60;
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.npc-float-img {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--bg-elevated);
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  object-fit: cover;
  border: 2px solid var(--accent);
  image-rendering: pixelated;  /* 像素图保留硬边 */
}
.npc-float.floating .npc-float-img {
  animation: npcFloat 3s ease-in-out infinite;
}
@keyframes npcFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.npc-float-bubble {
  position: absolute; bottom: 50px;
  background: rgba(0,0,0,0.78); color: #fff;
  font-size: 11px; padding: 2px 8px; border-radius: 8px;
  white-space: nowrap; opacity: 0; transition: opacity 0.2s;
  pointer-events: none;
}
.npc-float:hover .npc-float-bubble { opacity: 1; }
.npc-float-dot {
  position: absolute; top: 0; right: 0;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; line-height: 16px; text-align: center;
  border-radius: 8px; padding: 0 4px;
}

/* 弹幕 */
.npc-danmuku-layer {
  position: fixed; top: 0; right: 0; left: 0; bottom: 80px;
  pointer-events: none;
  z-index: 55;
  overflow: hidden;
}
.npc-danmuku {
  position: absolute;
  right: -100%;
  white-space: nowrap;
  font-size: 13px; font-weight: 500;
  padding: 4px 10px; border-radius: 12px;
  animation: danmakuFly 12s linear forwards;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
}
@keyframes danmakuFly {
  from { right: -100%; }
  to { right: 110%; }
}
.npc-danmuku.style-normal {
  background: rgba(255,255,255,0.88); color: #2A1F14;
}
.npc-danmuku.style-whisper {
  background: rgba(147, 197, 253, 0.78); color: #0A2D5C;
  font-size: 12px; font-style: italic;
}
.npc-danmuku.style-shout {
  background: rgba(255, 215, 0, 0.92); color: #6B3100;
  font-size: 16px; font-weight: 700;
}
.npc-danmuku.style-thought {
  background: rgba(192, 132, 252, 0.82); color: #fff;
  font-style: italic;
}

/* NPC 历史 sheet */
.npc-history-sheet { max-width: 480px; }
.npc-history-head {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 4px 12px;
}
.npc-history-avatar {
  width: 56px; height: 56px; border-radius: 50%; overflow: hidden;
  border: 2px solid var(--accent); flex-shrink: 0;
  background: var(--bg-secondary);
}
.npc-history-avatar img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.npc-history-meta {
  font-size: 12px; color: var(--text-tertiary); line-height: 1.5;
  padding: 4px 4px 12px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 8px;
}
#npc-history-list { max-height: 50vh; overflow-y: auto; }
.npc-history-item {
  padding: 10px 8px; margin-bottom: 6px;
  border-radius: 8px;
  background: var(--bg-secondary);
}
.npc-history-item.style-whisper { background: rgba(147, 197, 253, 0.12); }
.npc-history-item.style-shout { background: rgba(255, 215, 0, 0.15); }
.npc-history-item.style-thought { background: rgba(192, 132, 252, 0.12); }
.npc-history-text { font-size: 14px; line-height: 1.5; }
.npc-history-item .npc-history-meta { border: none; padding: 4px 0 0; margin: 0; }

/* === 开宝箱分阶段动画 === */
.open-result-sheet { max-width: 380px; padding: 18px 20px 24px !important; }
.open-stage-1 { text-align: center; padding: 12px 0 8px; }
.open-stage-2 { text-align: center; padding: 8px 0 4px; position: relative; }

/* 神秘盒 */
.open-mystery-box {
  width: 140px; height: 140px;
  margin: 24px auto 12px;
  position: relative;
  animation: mysteryShake 1.6s ease-in-out infinite;
}
@keyframes mysteryShake {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-3deg) scale(1.02); }
  40% { transform: rotate(3deg) scale(1.02); }
  60% { transform: rotate(-2deg) scale(1.01); }
  80% { transform: rotate(2deg) scale(1.01); }
}
.open-mystery-lid {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  width: 110px; height: 36px;
  background: linear-gradient(135deg, #8B4513, #5C2E0A);
  border: 3px solid #5C2E0A;
  border-radius: 8px 8px 4px 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  z-index: 2;
}
.open-mystery-lid::before {
  content: ""; position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  width: 24px; height: 16px; background: linear-gradient(135deg, #FFD700, #B8860B);
  border-radius: 4px 4px 0 0;
}
.open-mystery-body {
  position: absolute; left: 50%; top: 30px; transform: translateX(-50%);
  width: 130px; height: 100px;
  background: linear-gradient(135deg, #A0522D, #6B3410);
  border: 3px solid #5C2E0A;
  border-radius: 4px 4px 8px 8px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.open-mystery-glow {
  position: absolute; inset: 0;
  background: radial-gradient(circle, var(--glow), transparent 70%);
  animation: mysteryGlow 1.5s ease-in-out infinite;
}
@keyframes mysteryGlow {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 0.8; transform: scale(1.1); }
}
.open-mystery-icon {
  position: relative; z-index: 1;
  font-size: 56px; font-weight: 700; color: #fff;
  text-shadow: 0 0 16px var(--glow), 0 0 4px rgba(0,0,0,0.5);
  animation: mysteryQuestion 2s ease-in-out infinite;
}
@keyframes mysteryQuestion {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.open-rarity-pre { opacity: 0.7; }
.open-reveal-btn { animation: btnPulse 1.4s ease-in-out infinite; }
@keyframes btnPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 currentColor; }
  50% { transform: scale(1.03); box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
}

/* 阶段 2 揭示 */
.open-stage-2 .open-result-img-wrap { animation: imgReveal 0.7s ease-out; }
@keyframes imgReveal {
  0% { transform: scale(0.3) rotateY(180deg); opacity: 0; }
  60% { transform: scale(1.1) rotateY(0deg); opacity: 1; }
  100% { transform: scale(1) rotateY(0deg); opacity: 1; }
}
.open-stage-2 .open-result-img { animation: imgShine 1.2s ease-out 0.4s; }
@keyframes imgShine {
  0% { filter: brightness(0.5) saturate(0); }
  50% { filter: brightness(1.4) saturate(1.3); }
  100% { filter: brightness(1) saturate(1); }
}
.open-prop-name { animation: nameReveal 0.5s ease-out 0.5s backwards; }
@keyframes nameReveal {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.open-result-rarity { animation: rarityReveal 0.6s ease-out backwards; }
@keyframes rarityReveal {
  from { letter-spacing: 8px; opacity: 0; }
  to { letter-spacing: 2px; opacity: 1; }
}
.open-result-type, .open-result-desc { animation: fadeIn 0.5s ease-out 0.8s backwards; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.open-added-toast {
  background: var(--accent); color: #fff;
  text-align: center; font-size: 13px; font-weight: 600;
  padding: 8px 12px; border-radius: 8px;
  margin: 8px 0;
  opacity: 0; transform: translateY(-10px);
  transition: all 0.3s;
}
.open-added-toast.show { opacity: 1; transform: translateY(0); }

/* 闪光（全屏稀有/史诗/传说）*/
.open-flash {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,0.95), transparent 70%);
  opacity: 0; transition: opacity 0.2s;
  z-index: 9998;
}
.open-flash.fire {
  animation: flashFire 1s ease-out;
}
@keyframes flashFire {
  0% { opacity: 0; }
  10% { opacity: 1; }
  100% { opacity: 0; }
}

/* 传说级彩带粒子 */
.open-particles {
  position: fixed; inset: 0; pointer-events: none;
  overflow: hidden; z-index: 9997;
}
.open-particles::before, .open-particles::after {
  content: ""; position: absolute;
  width: 100%; height: 100%;
  background-image:
    linear-gradient(45deg, #FFD700 25%, transparent 25%),
    linear-gradient(-45deg, #FF6B35 25%, transparent 25%),
    linear-gradient(135deg, #A855F7 25%, transparent 25%),
    linear-gradient(-135deg, #3B82F6 25%, transparent 25%);
  background-size: 20px 20px;
  animation: confetti 3s linear infinite;
  opacity: 0.6;
}
.open-particles::after { animation-delay: -1.5s; }
@keyframes confetti {
  0% { transform: translateY(-100%) rotate(0deg); }
  100% { transform: translateY(100vh) rotate(720deg); }
}

/* 稀有度专属颜色高亮（背景光晕） */
.open-stage-2.rarity-rare::before,
.open-stage-2.rarity-epic::before,
.open-stage-2.rarity-legendary::before {
  content: ""; position: absolute; top: 30px; left: 50%; transform: translateX(-50%);
  width: 200px; height: 200px; border-radius: 50%;
  filter: blur(40px);
  z-index: -1;
  pointer-events: none;
}
.open-stage-2.rarity-rare::before { background: rgba(59, 130, 246, 0.25); }
.open-stage-2.rarity-epic::before { background: rgba(168, 85, 247, 0.35); }
.open-stage-2.rarity-legendary::before {
  background: linear-gradient(45deg, #FFD700, #FF6B35, #A855F7);
  animation: legendaryAura 2s ease-in-out infinite;
}
@keyframes legendaryAura {
  0%, 100% { opacity: 0.4; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.7; transform: translateX(-50%) scale(1.2); }
}

/* === 17.5 埃斯坦小镇 MVP === */
.reader-tools {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--card, #fff);
  border-top: 1px solid var(--border, #E8DDD0);
  /* 浮在 chapter-nav（fixed bottom:0）之上，避免被遮挡 */
  position: fixed;
  bottom: 60px;
  left: 0;
  right: 0;
  z-index: 39;
}
.reader-tool {
  flex: 1;
  padding: 12px 16px;
  background: #F3F4F6;
  color: #6B7280;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: not-allowed;
  transition: all 0.2s;
}
.reader-tool.enabled {
  background: var(--accent, #FF6B35);
  color: #fff;
  border-color: var(--accent, #FF6B35);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(255, 107, 53, 0.3);
}
.reader-tool.enabled:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(255, 107, 53, 0.4);
}
.reader-tool.muted {
  opacity: 0.6;
}

.world-view {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #FAF6F0;
  overflow: hidden;
}
.stall-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
}
.stall-btn:hover { background: rgba(255, 255, 255, 0.3); }

.pixel-world {
  flex: 1;
  position: relative;
  overflow: hidden;
  image-rendering: pixelated;
  background: #2A1F14;
  outline: none;
}
.pixel-world-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  pointer-events: none;
  user-select: none;
}
.pixel-world-npc {
  position: absolute;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -100%);
  cursor: pointer;
  z-index: 2;
}
.pixel-world-npc img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  transition: transform 0.15s;
}
.pixel-world-npc:hover img {
  transform: scale(1.1) translateY(-4px);
}
.pixel-world-npc:hover .npc-name-tag { opacity: 1; }
.npc-name-tag {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.pixel-world-user {
  position: absolute;
  width: 48px;
  height: 48px;
  transform: translate(-50%, -100%);
  z-index: 3;
  transition: left 0.15s ease, top 0.15s ease;
}
.pixel-world-user img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}
.pixel-world-tip {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 11px;
  pointer-events: none;
  z-index: 4;
}

.npc-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--border, #E8DDD0);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 160px;
  max-width: 240px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10;
  margin-bottom: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}
.npc-tooltip-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--accent, #FF6B35);
}
.npc-tooltip-desc {
  font-size: 12px;
  line-height: 1.4;
  color: #4B5563;
}
.npc-tooltip-close {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 18px;
  height: 18px;
  text-align: center;
  line-height: 18px;
  font-size: 14px;
  cursor: pointer;
  color: #9CA3AF;
  border-radius: 50%;
}
.npc-tooltip-close:hover { background: #F3F4F6; color: #1F2937; }

.stall-district {
  min-height: 100vh;
  background: #FAF6F0;
  display: flex;
  flex-direction: column;
}
.stall-scroll {
  display: flex;
  gap: 16px;
  padding: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}
.stall-card {
  flex: 0 0 280px;
  background: #fff;
  border: 2px solid var(--theme, #FF6B35);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.stall-card-img {
  width: 100%;
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F3F4F6;
  overflow: hidden;
}
.stall-card-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
.stall-card-img-empty {
  font-size: 64px;
  font-weight: 700;
  font-family: serif;
}
.stall-card-body {
  padding: 12px;
  flex: 1;
}
.stall-card-body h3 {
  font-size: 16px;
  margin-bottom: 4px;
  word-break: break-all;
}
.stall-card-body p {
  font-size: 12px;
  color: #4B5563;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.stall-card-meta {
  font-size: 11px;
  color: #9CA3AF;
}
.stall-card button {
  margin: 0 12px 12px;
}

/* === 17.6 大地图小镇 v2 === */
.big-map-viewport {
  position: relative;
  width: 100%;
  height: calc(100vh - 50px);
  overflow: hidden;
  background: #2A1F14;
  image-rendering: pixelated;
  touch-action: none;
  user-select: none;
}
.big-map {
  position: absolute;
  left: 0;
  top: 0;
  image-rendering: pixelated;
  transition: transform 0.15s ease-out;
  will-change: transform;
}
.big-map-tile,
.big-map-deco {
  position: absolute;
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  pointer-events: none;
}
.big-map-deco {
  pointer-events: auto;
  z-index: 2;
}
.big-map-npc {
  position: absolute;
  width: 32px;
  height: 32px;
  z-index: 5;
  cursor: pointer;
  transform: translate(-25%, -75%);
  image-rendering: pixelated;
}
.big-map-npc img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}
.npc-personality-badge {
  position: absolute;
  top: -14px;
  right: -4px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  z-index: 6;
}
.big-map-user {
  position: absolute;
  width: 32px;
  height: 32px;
  z-index: 10;
  transform: translate(-25%, -75%);
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5));
}
.big-map-user img {
  position: absolute;
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
}
.big-map-user .layer-base { z-index: 1; }
.big-map-user .layer-clothes { z-index: 2; }
.big-map-user .layer-hat { z-index: 3; }
.big-map-user .layer-hand { z-index: 4; }
.big-map-hud {
  position: fixed;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 6px 12px;
  font-size: 12px;
  z-index: 30;
  font-family: ui-monospace, monospace;
}
.npc-tooltip-meta {
  font-size: 11px;
  color: #8B5A2B;
  margin-bottom: 4px;
  font-weight: 500;
}
