/* ============================================================
 * 声声 — 有声图书馆
 * ============================================================ */
:root {
  --bg: #0a0a0f;
  --bg2: #12121a;
  --bg3: #1a1a25;
  --card: #1e1e2a;
  --text: #e8e8f0;
  --text2: #a0a0b0;
  --muted: #707080;
  --accent: #6c5ce7;
  --accent2: #a29bfe;
  --border: #2a2a35;
  --success: #00b894;
  --header-h: 110px;
  --player-h: 68px;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Serif SC', serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  min-height: 100dvh;
}

.app { display: flex; flex-direction: column; min-height: 100dvh; }

/* ── Header ── */
.header {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  padding: 12px 16px 0;
}

.header-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}

.logo { font-size: 20px; font-weight: 600; letter-spacing: 2px; }

.btn-tab {
  background: none; border: none; color: var(--text);
  font-size: 22px; cursor: pointer; padding: 4px;
}

.header-tabs { display: flex; gap: 6px; padding-bottom: 8px; }

.tab {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); padding: 5px 18px; border-radius: 20px;
  font-size: 13px; cursor: pointer; transition: .2s; font-family: inherit;
}
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.search {
  display: block; width: 100%; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 14px; color: var(--text); font-size: 14px;
  outline: none; font-family: inherit;
  margin-bottom: 10px;
}
.search::placeholder { color: var(--muted); }

/* ── Main Content ── */
.content {
  flex: 1;
  padding: 0 16px 20px;
  overflow-y: auto;
  padding-bottom: calc(var(--player-h) + 200px);
}

.hidden { display: none !important; }

/* ── Book List (Grid) ── */
.book-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding-top: 6px;
}

@media (min-width: 600px) { .book-grid { grid-template-columns: repeat(3, 1fr); } }

.book-card {
  background: var(--card); border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  border: 1px solid var(--border); transition: transform .2s, box-shadow .2s;
}
.book-card:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(0,0,0,.4); }

.card-cover {
  height: 100px; display: flex; align-items: center;
  justify-content: center; font-size: 38px;
}

.card-body { padding: 8px 10px 10px; }
.card-title { font-size: 13px; font-weight: 500; line-height: 1.3; margin-bottom: 3px; }
.card-author { font-size: 11px; color: var(--muted); margin-bottom: 4px; }

.card-meta { display: flex; justify-content: space-between; align-items: center; }
.card-rating { color: var(--accent2); font-size: 11px; }
.card-ch { font-size: 11px; color: var(--text2); }

.card-progress {
  margin-top: 6px; height: 3px; background: var(--bg);
  border-radius: 2px; overflow: hidden;
}
.card-progress-fill { height: 100%; background: var(--success); border-radius: 2px; }

/* ── Empty ── */
.empty { text-align: center; padding: 70px 16px; color: var(--muted); }
.empty-title { font-size: 18px; color: var(--text2); margin-bottom: 6px; }

/* ── Book Detail ── */
.detail { padding-top: 8px; }

.btn-back {
  background: none; border: 1px solid var(--border); color: var(--text);
  padding: 6px 16px; border-radius: 20px; font-size: 13px;
  cursor: pointer; font-family: inherit; margin-bottom: 16px;
}
.btn-back:hover { background: var(--border); }

.detail-head {
  display: flex; gap: 16px; margin-bottom: 20px;
  flex-wrap: wrap;
}

.detail-cover {
  width: 120px; height: 160px; border-radius: var(--radius);
  border: 1px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 50px;
}

.detail-info { flex: 1; min-width: 0; }
.detail-genre { color: var(--accent2); font-size: 12px; margin-bottom: 4px; }
.detail-title { font-size: 20px; font-weight: 600; line-height: 1.2; margin-bottom: 6px; }
.detail-author { font-size: 14px; color: var(--text2); margin-bottom: 4px; }
.detail-narrator { font-size: 11px; color: var(--muted); margin-bottom: 12px; }
.detail-desc {
  font-size: 13px; line-height: 1.6; color: var(--text2);
  margin-bottom: 12px; display: -webkit-box;
  -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}

.detail-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.badge {
  background: var(--bg3); padding: 3px 10px; border-radius: 12px;
  font-size: 11px; color: var(--text2);
}

.detail-prog { margin-bottom: 14px; }
.prog-info { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; color: var(--muted); }
.prog-bar { height: 5px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.prog-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--success)); border-radius: 3px; }

.detail-btns { display: flex; gap: 10px; }
.btn-play {
  background: var(--accent); color: #fff; border: none;
  padding: 10px 24px; border-radius: 25px; font-size: 14px;
  cursor: pointer; font-family: inherit; transition: .2s;
}
.btn-play:hover { background: #5a4bd1; }

.btn-fav {
  background: none; border: 1px solid var(--border); color: var(--text);
  padding: 10px 18px; border-radius: 25px; font-size: 14px;
  cursor: pointer; font-family: inherit; transition: .2s;
}
.btn-fav.faved { border-color: #FFE082; background: #FFF3CD; color: #856404; }

/* ── Chapters ── */
.ch-title {
  font-size: 15px; font-weight: 500; padding-bottom: 8px;
  border-bottom: 1px solid var(--border); margin-bottom: 10px;
}
.ch-list { display: flex; flex-direction: column; gap: 6px; }
.ch {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg3); padding: 10px 12px;
  border-radius: 8px; cursor: pointer; transition: .2s;
  border: 1px solid transparent;
}
.ch:hover { background: var(--card); }
.ch.playing { background: var(--accent); color: #fff; }
.ch.active { border-color: var(--accent2); }
.ch-num { color: var(--accent2); font-size: 12px; min-width: 28px; }
.ch-name { flex: 1; font-size: 14px; }
.ch.playing .ch-num { color: #ddd; }

/* ── Player Bar ── */
.player-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--player-h); background: var(--bg2);
  border-top: 1px solid var(--border); z-index: 20;
  display: flex; align-items: center; padding: 0 14px; gap: 14px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.player-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.player-cover { width: 44px; height: 44px; border-radius: 8px; flex-shrink: 0; border: 1px solid var(--border); }
.player-info { min-width: 0; }
.player-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-subtitle { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.player-controls { display: flex; gap: 14px; align-items: center; }
.ctl { background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; padding: 0 6px; }
.btn-main { background: var(--accent); width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

.player-right { flex-shrink: 0; }
.ctl-sm { background: var(--bg3); border: 1px solid var(--border); color: var(--accent2); padding: 3px 10px; border-radius: 14px; font-size: 12px; cursor: pointer; font-family: inherit; }

.progress-track {
  position: absolute; top: -3px; left: 0; right: 0; height: 6px; cursor: pointer;
}
.progress-bar { height: 100%; background: var(--accent); border-radius: 3px; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: var(--player-h); left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--card); padding: 9px 20px; border-radius: 10px;
  box-shadow: 0 4px 16px var(--shadow); z-index: 30;
  font-size: 13px; opacity:0; pointer-events: none; transition: .3s;
}
.toast.show { opacity:1; transform: translateX(-50%) translateY(0); }
