/* AI互动小说 H5 · 全局样式（移动端优先，无构建依赖） */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f5f6f8;
  color: #1f2329;
  font-size: 15px;
}
button { font-family: inherit; border: none; background: none; cursor: pointer; }
input, textarea { font-family: inherit; font-size: 15px; outline: none; border: 1px solid #e2e5ea; border-radius: 10px; padding: 10px 12px; width: 100%; background: #fff; }
textarea { min-height: 160px; resize: vertical; line-height: 1.6; }

/* 布局 */
.page { padding: 16px 16px 76px; max-width: 560px; margin: 0 auto; }
.page.nofull { padding-bottom: 16px; }
.section-title { font-size: 16px; font-weight: 700; margin: 18px 2px 10px; display: flex; justify-content: space-between; align-items: center; }
.section-title .fold { color: #8a919c; font-size: 13px; cursor: pointer; }

.card { background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.card-title { font-weight: 700; margin-bottom: 4px; }
.card-sub { color: #8a919c; font-size: 13px; line-height: 1.5; }

.btn { display: block; width: 100%; padding: 13px; border-radius: 12px; font-size: 16px; font-weight: 600; text-align: center; transition: opacity .15s; }
.btn:active { opacity: .75; }
.btn-primary { background: #2b2f36; color: #fff; }
.btn-ghost { background: transparent; color: #2b2f36; border: 1px solid #d8dce2; margin-top: 10px; }
.btn-danger { color: #d33; border-color: #eccaca; }
.btn:disabled { opacity: .45; }

.tip { color: #8a919c; font-size: 12px; text-align: center; margin-top: 12px; line-height: 1.6; }

/* 底部导航 */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 60px;
  background: #fff; border-top: 1px solid #eceef1;
  display: flex; max-width: 560px; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #8a919c; font-size: 11px; text-decoration: none; }
.tabbar a.on { color: #2b2f36; font-weight: 600; }
.tabbar .ico { font-size: 20px; line-height: 1; }

/* 积分卡 */
.points-card { display: flex; align-items: center; justify-content: space-between; }
.points-num { font-size: 34px; font-weight: 800; }
.points-label { color: #8a919c; font-size: 12px; }
.points-card .btn { width: auto; padding: 9px 20px; font-size: 14px; }

/* 书城 */
.book-card { display: flex; gap: 12px; }
.book-tag { display: inline-block; background: #eef1f5; color: #5b6470; border-radius: 6px; padding: 2px 8px; font-size: 11px; margin-right: 6px; }
.book-summary { color: #8a919c; font-size: 13px; margin-top: 6px; line-height: 1.6; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* 创作表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: #5b6470; margin-bottom: 6px; }
.chips { display: flex; gap: 10px; }
.chip { padding: 8px 22px; border-radius: 999px; background: #eef1f5; color: #5b6470; font-size: 14px; }
.chip.on { background: #2b2f36; color: #fff; font-weight: 600; }
.word-count { text-align: right; color: #8a919c; font-size: 12px; margin-top: 4px; }

/* 进度流水线 */
.steps { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.step { display: flex; align-items: center; gap: 10px; color: #b6bdc7; font-size: 14px; transition: color .3s; }
.step.on { color: #2b2f36; font-weight: 600; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* 结果预览 */
.stats { display: flex; text-align: center; }
.stat { flex: 1; }
.stat-num { font-size: 22px; font-weight: 800; }
.stat-label { color: #8a919c; font-size: 12px; margin-top: 2px; }

/* 我的作品列表 */
.work { display: flex; align-items: center; gap: 10px; }
.work-main { flex: 1; min-width: 0; }
.work-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-sub { color: #8a919c; font-size: 12px; margin-top: 4px; }
.work-btn { padding: 7px 16px; border-radius: 999px; font-size: 13px; background: #eef1f5; color: #2b2f36; white-space: nowrap; }
.work-btn.primary { background: #2b2f36; color: #fff; }
.work-btn.pub { background: transparent; border: 1px solid #2b2f36; }
.pub-tag { font-size: 11px; color: #8a919c; background: #eef1f5; border-radius: 999px; padding: 5px 10px; white-space: nowrap; }
.work-del { color: #b6bdc7; font-size: 20px; padding: 0 4px; }

/* ---- 阅读器（全屏沉浸） ---- */
.reader {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column;
  color: #e8e5df; padding: max(20px, env(safe-area-inset-top)) 22px calc(20px + env(safe-area-inset-bottom));
  transition: background .5s;
  overflow-y: auto;
}
.reader.bg-dusk { background: linear-gradient(160deg, #1b1c28, #2a2536); }
.reader.bg-battle { background: linear-gradient(160deg, #2b1512, #3c1e14); }
.reader.bg-dark { background: linear-gradient(160deg, #10141a, #1a222c); }
.reader.bg-triumph { background: linear-gradient(160deg, #232c1a, #1c3324); }
.reader-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.reader-back { color: #e8e5df; font-size: 22px; padding: 4px 8px; }
.reader-title { font-size: 13px; opacity: .7; }
.reader-node-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; letter-spacing: 1px; }
.reader-text { font-size: 16px; line-height: 2; white-space: pre-wrap; flex: 1; text-shadow: 0 1px 2px rgba(0,0,0,.4); animation: fadein .6s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.reader-choices { margin-top: 26px; display: flex; flex-direction: column; gap: 12px; }
.choice {
  text-align: left; width: 100%; padding: 14px 16px; border-radius: 12px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
  color: #e8e5df; font-size: 15px; transition: background .15s;
}
.choice:active { background: rgba(255,255,255,.2); }
.choice .key { opacity: .55; margin-right: 10px; font-weight: 700; }
.reader-progress { height: 3px; background: rgba(255,255,255,.15); border-radius: 2px; margin-top: 20px; overflow: hidden; }
.reader-progress i { display: block; height: 100%; background: rgba(255,255,255,.5); transition: width .3s; }
.ending-actions { margin-top: 30px; display: flex; flex-direction: column; gap: 10px; }
.ending-actions .btn { background: rgba(255,255,255,.1); color: #e8e5df; border: 1px solid rgba(255,255,255,.2); }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  background: rgba(20,22,26,.92); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; z-index: 99; display: none; max-width: 80vw; text-align: center;
}
