/* ===== 睡前故事听书网页样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #FFF7E6;
  --card: #FFFFFF;
  --primary: #FF9A76;
  --primary-dark: #E8734F;
  --text: #4A3B32;
  --sub: #9A8574;
  --accent: #6BB5A5;
  --playing: #FFF0DE;
  --border: #F0E0CC;
  --shadow: 0 4px 16px rgba(180, 130, 80, 0.15);
}
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  line-height: 1.75;
  font-size: 17px;
  padding-bottom: 84px;
  overflow-x: hidden;
}
#app { max-width: 720px; margin: 0 auto; }

/* 顶部栏 */
#topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255, 247, 230, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.top-title { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  border: none; background: none; font-size: 22px;
  width: 40px; height: 40px; border-radius: 50%;
  cursor: pointer; color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:active { background: rgba(0,0,0,0.06); }
#backBtn { font-size: 30px; line-height: 1; }

.view { padding: 14px; }
.hidden { display: none !important; }

/* 首页 */
.hero { text-align: center; padding: 26px 10px 18px; }
.hero h1 { font-size: 26px; margin-bottom: 8px; }
.hero p { color: var(--sub); font-size: 15px; }
.resume-bar { margin-top: 16px; }
.resume-btn {
  width: 100%; padding: 14px; font-size: 16px; font-weight: 600;
  background: linear-gradient(135deg, #FFB98A, #FF9A76);
  color: #fff; border: none; border-radius: 16px;
  box-shadow: var(--shadow); cursor: pointer;
}
.resume-btn:active { transform: scale(0.98); }

.book-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 6px 0 20px; }
.book-card {
  background: var(--card); border-radius: 18px; padding: 16px 14px;
  box-shadow: var(--shadow); cursor: pointer; border: 1px solid var(--border);
  transition: transform 0.12s;
}
.book-card:active { transform: scale(0.97); }
.book-emoji { font-size: 40px; line-height: 1.3; display: block; margin-bottom: 6px; }
.book-name { font-weight: 700; font-size: 17px; line-height: 1.35; margin-bottom: 4px; }
.book-author { color: var(--sub); font-size: 13px; margin-bottom: 8px; }
.book-progress {
  font-size: 12px; color: var(--primary-dark); background: var(--playing);
  border-radius: 20px; padding: 3px 8px; display: inline-block;
}

/* 书籍页 */
#bookHeader { text-align: center; padding: 10px 6px 14px; }
#bookHeader .b-emoji { font-size: 46px; display: block; margin-bottom: 4px; }
#bookHeader h2 { font-size: 23px; margin-bottom: 4px; }
#bookHeader .b-author { color: var(--sub); font-size: 14px; }

.chapter-nav {
  display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px 14px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.chapter-nav::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 20px;
  background: var(--card); border: 1px solid var(--border);
  font-size: 14px; cursor: pointer; color: var(--text); white-space: nowrap;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 段落 */
.para-list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 10px; }
.para {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px 16px;
  font-size: 17px; line-height: 1.85; cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.para:active { background: var(--playing); }
.para.playing {
  background: var(--playing);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(255, 154, 118, 0.35);
}
.para .para-index {
  display: inline-block; font-size: 12px; color: var(--sub);
  margin-bottom: 4px; letter-spacing: 0.5px;
}
.para .para-index::after { content: " · 点击播放"; }

/* 底部播放条 */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(180, 130, 80, 0.12);
}
.p-btn {
  border: none; background: var(--playing); border-radius: 50%;
  width: 42px; height: 42px; font-size: 18px; cursor: pointer; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; color: var(--text);
}
.p-btn.main { background: var(--primary); color: #fff; width: 50px; height: 50px; font-size: 20px; }
.p-btn:active { transform: scale(0.94); }
.p-btn.active { background: var(--accent); color: #fff; }
.p-info { flex: 1; min-width: 0; }
.p-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-text {
  font-size: 12px; color: var(--sub); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; margin-top: 2px;
}

/* 弹窗提示 */
#toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%);
  background: rgba(60, 45, 35, 0.92); color: #fff;
  padding: 10px 18px; border-radius: 24px; font-size: 14px;
  z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.3s;
  max-width: 85%; text-align: center; white-space: nowrap;
}
#toast.show { opacity: 1; }

.footer { text-align: center; color: var(--sub); font-size: 12px; padding: 18px 10px 30px; line-height: 1.8; }

/* 大屏适配 */
@media (min-width: 720px) {
  .book-list { grid-template-columns: repeat(4, 1fr); }
}
