/* ============================================================
   Tủ sách Quyền lực — sach.1987.win
   Giấy / Ngà / Đêm themes · mobile-first · paper & ink
   ============================================================ */

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

:root {
  /* — theme: Giấy (default) — */
  --paper: #f6f2ea;
  --card: #fdfbf6;
  --ink: #211d17;
  --ink-soft: #5d564a;
  --ink-mute: #8b8375;
  --line: #ddd4c2;
  --line-soft: #e8e1d2;
  --accent: #8a3b2e;
  --accent-soft: rgba(138, 59, 46, 0.12);
  --shadow: 0 1px 2px rgba(33, 29, 23, 0.06), 0 6px 20px rgba(33, 29, 23, 0.07);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --read-font: "Noto Serif", Georgia, "Times New Roman", "Noto Serif CJK SC", "Songti SC", "SimSun", serif;
  --tap: 44px;
  --rd-fs: 18px;
  --rd-lh: 1.75;
}

html[data-theme="nga"] {
  --paper: #f0e7d2;
  --card: #f7f0e0;
  --ink: #38301f;
  --ink-soft: #675c44;
  --ink-mute: #948a6e;
  --line: #d8c9a6;
  --line-soft: #e2d7ba;
  --accent: #7a4a21;
  --accent-soft: rgba(122, 74, 33, 0.12);
}

html[data-theme="dem"] {
  --paper: #161412;
  --card: #1e1b18;
  --ink: #d9d2c4;
  --ink-soft: #a89f8e;
  --ink-mute: #776f63;
  --line: #37332c;
  --line-soft: #2a2722;
  --accent: #cf9a5e;
  --accent-soft: rgba(207, 154, 94, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui-font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
button { font-family: inherit; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 640px; margin: 0 auto; padding: 0 20px; }

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

/* ————— Brand ————— */

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(18px + var(--safe-t)) 20px 14px;
  max-width: 980px;
  margin: 0 auto;
}

.brand-mark {
  width: 46px; height: 46px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
}

.brand-mark svg { width: 26px; height: 26px; }

.brand-name {
  margin: 0;
  font-family: var(--read-font);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  margin-top: 1px;
}

/* ————— Buttons ————— */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

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

.btn svg { width: 18px; height: 18px; }

.btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fdf9f2;
}

.btn.small { min-height: 38px; padding: 0 14px; font-size: 13px; border-radius: 8px; }
.btn.big { font-size: 16px; min-height: 52px; padding: 0 26px; }
.btn.big svg { width: 20px; height: 20px; }

/* ————— Search box ————— */

.search {
  display: flex;
  gap: 8px;
  margin: 6px 0 4px;
}

.search input {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 10px;
  padding: 0 16px;
  font-size: 15px;
  font-family: var(--ui-font);
}

.search input::placeholder { color: var(--ink-mute); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

.search button {
  flex: 0 0 auto;
  width: var(--tap); height: var(--tap);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.search button svg { width: 20px; height: 20px; }

/* ————— Install hint ————— */

.hint {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 12px 8px 12px 14px;
  margin: 8px 0 14px;
  font-size: 13.5px;
  color: var(--ink-soft);
  box-shadow: var(--shadow);
}

.hint b { color: var(--ink); font-weight: 600; }
.hint-txt { flex: 1; min-width: 0; }
.hint-act { display: flex; align-items: center; gap: 6px; }

.hint-x {
  flex: 0 0 auto;
  width: var(--tap); height: var(--tap);
  border: none; background: none;
  color: var(--ink-mute);
  display: grid; place-items: center;
  cursor: pointer;
}

.hint-x svg { width: 18px; height: 18px; }

/* ————— Continue listening card ————— */

.cont {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin: 8px 0 14px;
  box-shadow: var(--shadow);
}

.cont-cover {
  width: 54px; height: 54px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--line-soft);
}

.cont-body { flex: 1; min-width: 0; }

.cont-kick {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.cont-title {
  font-family: var(--read-font);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 2px;
}

.cont-sub { font-size: 12.5px; color: var(--ink-mute); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ————— Filter chips ————— */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 6px;
}

.chip {
  min-height: var(--tap);
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.chip svg { width: 16px; height: 16px; }

.chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* ————— Book tiles ————— */

.books {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 12px 0 24px;
}

@media (min-width: 640px) { .books { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .books { grid-template-columns: 1fr 1fr 1fr; } }

.book-tile {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  max-width: 100%;
}

.book-tile:active { transform: translateY(1px); }

.tile-cover {
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  background: color-mix(in srgb, var(--tile-ink, #8a3b2e) 9%, var(--card));
  min-height: 128px;
  display: flex;
  flex-direction: column;
}

.tc-kick {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 700;
}

.tc-title {
  font-family: var(--read-font);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.22;
  margin-top: 8px;
  color: var(--ink);
}

.tc-orig {
  font-size: 13px;
  font-style: italic;
  color: var(--ink-mute);
  margin-top: 3px;
}

.tc-author {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.tile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  background: transparent;
}

.badge svg { width: 13px; height: 13px; }

.badge.aud {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--accent-soft);
}

.badge.cat { color: var(--ink-mute); border-style: dashed; }

/* ————— Page head (book / search) ————— */

.page-head { padding-top: calc(10px + var(--safe-t)); }

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--ink-soft);
  text-decoration: none;
  margin-bottom: 10px;
}

.crumb svg { width: 16px; height: 16px; }

.page-head h1 {
  font-family: var(--read-font);
  font-size: 30px;
  line-height: 1.2;
  margin: 6px 0 4px;
}

.sub-title {
  font-family: var(--read-font);
  font-style: italic;
  font-size: 17px;
  color: var(--ink-mute);
  margin-bottom: 4px;
}

.byline { font-size: 14px; color: var(--ink-soft); }

.lede { font-size: 15.5px; line-height: 1.65; color: var(--ink-soft); max-width: 640px; }

.bk-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }

.bk-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 18px;
  margin: 0 0 18px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.bk-meta dt { color: var(--ink-mute); font-weight: 600; }
.bk-meta dd { margin: 0; }

.bk-lang { margin: 0 0 20px; }

.bk-lang h2 {
  font-family: var(--read-font);
  font-size: 18px;
  margin: 0 0 4px;
}

.bk-src { font-size: 13px; color: var(--ink-mute); margin: 0 0 8px; }

.bk-chapters {
  margin: 0;
  padding-left: 22px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink-soft);
  max-height: 300px;
  overflow: hidden;
  position: relative;
  border-radius: 8px;
}

.bk-chapters li { transition: color .15s; }
.bk-chapters li:hover { color: var(--ink); }

.note { font-size: 13.5px; color: var(--ink-mute); font-style: italic; }

/* ————— Footer ————— */

.foot {
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-mute);
  padding: 18px 20px calc(24px + var(--safe-b));
  letter-spacing: 0.03em;
}

/* ————— Toast ————— */

#toast {
  position: fixed;
  top: calc(10px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%) translateY(-160%);
  z-index: 200;
  background: #211d17;
  color: #f3ede1;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  font-size: 14px;
  max-width: min(92vw, 420px);
  transition: transform 0.25s ease;
}

#toast.show { transform: translateX(-50%) translateY(0); }

#toast button {
  border: none;
  background: #cf9a5e;
  color: #211d17;
  font-weight: 700;
  font-size: 13px;
  border-radius: 8px;
  padding: 8px 14px;
  min-height: 36px;
  cursor: pointer;
}

/* ————— Search results ————— */

.srch-status { font-size: 13.5px; color: var(--ink-mute); margin: 12px 0; }

.srch-count { font-size: 13px; color: var(--ink-mute); margin: 14px 0 4px; letter-spacing: 0.02em; }

.sr-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
  max-width: 640px;
}

.sr-kick {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  margin-bottom: 4px;
}

.sr-book { font-weight: 700; font-size: 14.5px; text-decoration: none; }
.sr-book:hover { color: var(--accent); }

.sr-meta { font-size: 12px; color: var(--ink-mute); }

.sr-snip { font-size: 14px; line-height: 1.7; color: var(--ink-soft); font-family: var(--read-font); }

.sr-snip mark {
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 600;
}

.sr-cat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
  color: inherit;
  max-width: 640px;
}

.sr-cat-cover { width: 44px; height: 58px; border-radius: 6px; object-fit: cover; flex: 0 0 auto; }
.sr-cat-title { font-weight: 700; font-size: 15px; font-family: var(--read-font); }
.sr-cat-sub { font-size: 12.5px; color: var(--ink-mute); }

/* ————— 404 ————— */

.err {
  text-align: center;
  padding: 60px 20px;
  max-width: 480px;
  margin: 0 auto;
}

.err h1 { font-family: var(--read-font); font-size: 26px; margin: 0 0 8px; }
.err p { color: var(--ink-soft); font-size: 15px; }

/* ============================================================
   READER
   ============================================================ */

body.reader-page { background: var(--paper); }

.rd-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 60;
  background: transparent;
  pointer-events: none;
}

.rd-progress i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.15s linear;
}

.rd-top, .rd-bottom {
  position: fixed;
  left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 2px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.25s ease;
}

.rd-top {
  top: 0;
  padding: var(--safe-t) 8px 6px;
  border-bottom: 1px solid var(--line);
}

.rd-bottom {
  bottom: 0;
  padding: 6px 8px calc(6px + var(--safe-b));
  border-top: 1px solid var(--line);
}

html.rd-ui-off .rd-top { transform: translateY(-110%); }
html.rd-ui-off .rd-bottom { transform: translateY(110%); }

.rd-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
}

.rd-btn {
  flex: 0 0 auto;
  width: var(--tap);
  height: var(--tap);
  border: none;
  background: none;
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 8px;
}

.rd-btn:active { background: var(--accent-soft); }
.rd-btn svg { width: 22px; height: 22px; }
.rd-btn.txt { font-size: 16px; font-weight: 700; font-family: var(--read-font); }
.rd-btn.on { color: var(--accent); }
.rd-btn:disabled { opacity: 0.35; cursor: default; }

.rd-count {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--ink-mute);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rd-body {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(64px + var(--safe-t)) 20px calc(72px + var(--safe-b));
  font-family: var(--read-font);
  font-size: var(--rd-fs);
  line-height: var(--rd-lh);
  color: var(--ink);
}

.rd-body article { min-height: 60vh; }

.rd-ch-kick {
  font-family: var(--ui-font);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 6px;
}

.rd-ch-title {
  font-size: 1.42em;
  line-height: 1.3;
  font-weight: 700;
  margin: 0 0 0.6em;
}

.rd-body p { margin: 0 0 1em; text-align: justify; }

.rd-src {
  font-family: var(--ui-font);
  font-size: 11.5px;
  color: var(--ink-mute);
  font-style: italic;
  margin-bottom: 1.4em;
  text-align: left;
}

.rd-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 1.8em 0 1.2em;
  font-family: var(--ui-font);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 700;
}

.rd-divider::before, .rd-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.rd-alt { color: var(--ink-mute); }

.rd-alt .rd-alt-label {
  font-family: var(--ui-font);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 4px;
  color: var(--ink-soft);
}

.rd-alt-title {
  font-size: 1.1em;
  font-weight: 700;
  margin: 0 0 0.7em;
  line-height: 1.35;
}

.rd-alt p { margin-bottom: 0.9em; }
.rd-alt p:first-of-type { text-align: left; }

#rdbody p.flash {
  background: var(--accent-soft);
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* — reader TOC drawer — */

.rd-toc {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(18, 15, 11, 0.45);
}

.rd-toc-panel {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: min(340px, 88vw);
  background: var(--card);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(14px + var(--safe-t)) 10px calc(16px + var(--safe-b));
}

.rd-toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.rd-toc-head h2 { font-family: var(--read-font); font-size: 17px; margin: 0; }

.rd-toc-langs { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px 8px; }

.rd-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}

.rd-toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
.rd-toggle.off { opacity: 0.5; }

.rd-toc ol { list-style: none; margin: 8px 0 0; padding: 0 2px; }

.rd-toc ol button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.45;
  padding: 10px 10px;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--ui-font);
}

.rd-toc ol button:active { background: var(--accent-soft); }

.rd-toc ol button.cur { color: var(--accent); font-weight: 700; }

.rd-toc ol button .n { color: var(--ink-mute); font-size: 12px; margin-right: 8px; }

/* ============================================================
   PLAYER
   ============================================================ */

body.player-page {
  background: #12100e;
  color: #ece6da;
}

body.player-page .pp-wrap {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(10px + var(--safe-t)) 20px calc(18px + var(--safe-b));
  display: flex;
  flex-direction: column;
}

.pp-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pp-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  color: #a89f92;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.pp-back svg { width: 20px; height: 20px; }

.pp-brand {
  font-family: var(--read-font);
  font-size: 13px;
  color: #6f6a5f;
  letter-spacing: 0.06em;
}

.pp-cover {
  width: min(58vw, 280px);
  aspect-ratio: 1;
  margin: 26px auto 22px;
  border-radius: 12px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55);
  object-fit: cover;
  align-self: center;
}

.pp-title {
  font-family: var(--read-font);
  font-size: 28px;
  line-height: 1.22;
  text-align: center;
  margin: 0;
  font-weight: 700;
}

.pp-author { text-align: center; color: #a89f92; font-size: 14.5px; margin-top: 4px; }

.pp-part {
  text-align: center;
  color: #cf9a5e;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-top: 8px;
  min-height: 18px;
}

.pp-scrub { margin: 26px 0 2px; width: 100%; }

input[type="range"].pp-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  background: transparent;
  cursor: pointer;
  margin: 0;
  display: block;
}

input[type="range"].pp-range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #ece6da var(--pp, 0%), #37332c var(--pp, 0%));
}

input[type="range"].pp-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #ece6da;
  border: none;
  margin-top: -8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

input[type="range"].pp-range::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: #37332c;
}

input[type="range"].pp-range::-moz-range-progress {
  height: 8px;
  border-radius: 4px;
  background: #ece6da;
}

input[type="range"].pp-range::-moz-range-thumb {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #ece6da;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.pp-times {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #a89f92;
  font-variant-numeric: tabular-nums;
}

.pp-ctrl {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin: 14px 0 6px;
}

.pp-btn {
  width: 88px; height: 88px;
  border-radius: 50%;
  border: 1px solid #37332c;
  background: #1c1915;
  color: #ece6da;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.pp-btn svg { width: 34px; height: 34px; }
.pp-btn:active { transform: scale(0.96); background: #26221c; }

.pp-btn.main {
  width: 116px; height: 116px;
  background: #ece6da;
  border-color: #ece6da;
  color: #12100e;
  flex-direction: column;
}

.pp-btn.main svg { width: 46px; height: 46px; }

.pp-btn.main .pp-play-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}

.pp-opts {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.pp-speed {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pp-speed button {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid #37332c;
  background: #1c1915;
  color: #ece6da;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.pp-speed button svg { width: 20px; height: 20px; }

.pp-speed-val {
  width: 62px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #d8d2c6;
  font-variant-numeric: tabular-nums;
}

.pp-sleepbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid #37332c;
  background: #1c1915;
  color: #d8d2c6;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.pp-sleepbtn svg { width: 18px; height: 18px; }
.pp-sleepbtn.on { border-color: #cf9a5e; color: #cf9a5e; }

.pp-sleep {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.pp-sleep::-webkit-scrollbar { display: none; }

.pp-sleep button {
  flex: 0 0 auto;
  min-height: var(--tap);
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid #37332c;
  background: #1c1915;
  color: #d8d2c6;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.pp-sleep button.on { background: #ece6da; color: #12100e; border-color: #ece6da; }

.pp-parts {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 16px 0 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.pp-parts::-webkit-scrollbar { display: none; }

.pp-parts button {
  flex: 0 0 auto;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid #37332c;
  background: #1c1915;
  color: #d8d2c6;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pp-parts button .d { color: #8a8378; font-size: 12px; font-variant-numeric: tabular-nums; }
.pp-parts button.cur { background: #ece6da; color: #12100e; border-color: #ece6da; }
.pp-parts button.cur .d { color: #5d564a; }

.pp-note {
  text-align: center;
  color: #8a8378;
  font-size: 13px;
  margin-top: auto;
  padding-top: 18px;
}

/* ============================================================
   MINI PLAYER BAR
   ============================================================ */

#mp {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 90;
  background: #141210;
  color: #ece6da;
  border-top: 1px solid #2c2822;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.35);
  padding: 8px 10px calc(8px + var(--safe-b));
  transform: translateY(110%);
  transition: transform 0.22s ease;
  max-width: 100%;
}

#mp.show { transform: translateY(0); }

/* The fixed mini bar must not cover the reader's fixed bottom bar */
body.mp-open { --mp-h: calc(63px + var(--safe-b)); padding-bottom: var(--mp-h); }
body.mp-open .rd-bottom { bottom: var(--mp-h); }

.mp-in {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.mp-cover {
  width: 46px; height: 46px;
  border-radius: 7px;
  object-fit: cover;
  flex: 0 0 auto;
  background: #26221c;
}

.mp-go {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  color: inherit;
  text-align: left;
  padding: 6px 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 44px;
  justify-content: center;
}

.mp-title {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--read-font);
}

.mp-sub {
  font-size: 12px;
  color: #8a8378;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}

.mp-sub svg { width: 13px; height: 13px; flex: 0 0 auto; }

.mp-btn {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: none;
  background: #26221c;
  color: #ece6da;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.mp-btn:active { background: #332e26; }
.mp-btn svg { width: 22px; height: 22px; }

.mp-close { background: none; color: #8a8378; }

/* ————— static prerendered icon wrapper ————— */

.svg-ic { display: inline-flex; }

/* ————— a11y / misc ————— */

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

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
