/* ================================================================
   BOOK PLAYER v3 — Immersive Dark Player
   Inspired by: Apple Music, Spotify, Tidal
   Language: Full-bleed blurred artwork backdrop +
             large artwork + minimal controls
   ================================================================ */

/* ── Page shell ── */
.bookscreen-page {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #0a0a14;
  padding: 0;
}

/* ── Full-bleed backdrop ── */
.bookscreen-backdrop {
  position: absolute;
  inset: -40px;
  background-image: var(--bookscreen-cover, none);
  background-position: center top;
  background-size: cover;
  background-repeat: no-repeat;
  filter: blur(70px) saturate(1.8) brightness(.45);
  transform: scale(1.25);
  opacity: 1;
  pointer-events: none;
  will-change: opacity;
  transition: opacity 1s ease;
  z-index: 0;
}
.bookscreen-page:not([style*="--bookscreen-cover"]) .bookscreen-backdrop {
  background: radial-gradient(ellipse 120% 80% at 50% -10%, #1e5c3a, #0f3322 45%, transparent 80%);
  filter: none;
  opacity: 1;
}
body[data-theme="light"] .bookscreen-backdrop {
  filter: blur(70px) saturate(1.4) brightness(.72);
  opacity: .7;
}

/* Dark gradient overlays to maintain readability */
.bookscreen-backdrop-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* Strong bottom fade so controls are always readable */
  background:
    linear-gradient(180deg,
      rgba(0,0,0,.28) 0%,
      transparent 22%,
      transparent 46%,
      rgba(0,0,0,.48) 68%,
      rgba(0,0,0,.78) 85%,
      rgba(0,0,0,.90) 100%
    );
}
body[data-theme="light"] .bookscreen-backdrop-overlay {
  background:
    linear-gradient(180deg,
      rgba(255,255,255,.22) 0%,
      transparent 22%,
      transparent 42%,
      rgba(255,255,255,.38) 62%,
      rgba(255,255,255,.72) 82%,
      rgba(255,255,255,.90) 100%
    );
}

/* ── Top bar ── */
.bookscreen-topbar {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 10px;
  padding: calc(16px + env(safe-area-inset-top)) 20px 0;
}

.bookscreen-topbar-title {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: rgba(255,255,255,.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity .28s ease;
}
.bookscreen-topbar-title.is-visible { opacity: 1; }
body[data-theme="light"] .bookscreen-topbar-title { color: rgba(10,10,20,.65); }

.bookscreen-topbtn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: rgba(255,255,255,.85);
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform .18s var(--ease-spring, cubic-bezier(.34,1.56,.64,1)),
              background .15s ease;
}
.bookscreen-topbtn:active {
  transform: scale(.9);
  background: rgba(255,255,255,.18);
}
.bookscreen-topbtn[hidden] { display: none !important; }


/* ── Stage: holds the panel at the bottom ── */
.bookscreen-stage {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* ── Main panel ── */
.bookscreen-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0 24px calc(28px + env(safe-area-inset-bottom));
  gap: 0;
}

/* ── Artwork ── */
.bookscreen-artwork {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Sits in the upper area of the screen */
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  padding-top: calc(72px + env(safe-area-inset-top));
  margin-top: 5rem;
}

/* absolute artwork: glow behind cover */
.bookscreen-artwork__glow {
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(34, 197, 94, .22);
  filter: blur(60px);
  top: calc(72px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
  transition: opacity .6s ease;
  will-change: opacity;
}

.bookscreen-coverFrame {
  width: min(58vw, 218px);
  aspect-ratio: 0.72;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  box-shadow:
    0 36px 80px rgba(0,0,0,.60),
    0 10px 26px rgba(0,0,0,.38),
    0 0 0 1px rgba(255,255,255,.06),
    inset 0 1px 0 rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  transform: scale(1);
  transition:
    transform .5s cubic-bezier(.34,1.56,.64,1),
    box-shadow .4s ease;
  will-change: transform;
  z-index: 1;
}
.bookscreen-coverFrame.is-playing {
  transform: scale(1.06);
  box-shadow:
    0 44px 96px rgba(0,0,0,.70),
    0 14px 36px rgba(0,0,0,.44),
    0 0 0 1px rgba(255,255,255,.08),
    inset 0 1px 0 rgba(255,255,255,.12);
}

.bookscreen-coverImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Reflection */
.bookscreen-artwork__reflection {
  width: min(58vw, 218px);
  height: 50px;
  overflow: hidden;
  transform: scaleY(-1);
  opacity: .22;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.6), transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.6), transparent 100%);
  margin-top: -1px;
  border-radius: 0 0 10px 10px;
  pointer-events: none;
  z-index: 1;
  position: relative;
}
.bookscreen-artwork__reflection img {
  width: 100%;
  height: 200%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transform: scaleY(-1) translateY(-50%);
}

/* ── Meta ── */
.bookscreen-meta {
  margin-bottom: 22px;
}

.bookscreen-title {
  margin: 0 0 5px;
  font-size: 23px;
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: -.035em;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
body[data-theme="light"] .bookscreen-title { color: rgba(10,10,20,.92); }

.bookscreen-summary {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
  color: rgba(255,255,255,.5);
  text-align: center;
}
body[data-theme="light"] .bookscreen-summary { color: rgba(10,10,20,.45); }

/* ── Progress ── */
.bookscreen-progress {
  margin-bottom: 26px;
  display: grid;
  gap: 9px;
}

.bookscreen-progress input[type="range"] {
  width: 100%;
  appearance: none;
  direction: ltr;
  -webkit-appearance: none;
  height: 3px;
  border-radius: 99px;
  outline: none;
  cursor: pointer;
  background:
    linear-gradient(90deg,
      var(--emerald) var(--seek-fill, 0%),
      rgba(255,255,255,.16) var(--seek-fill, 0%)
    );
  transition: height .18s ease;
}
.bookscreen-progress input[type="range"]:active { height: 5px; }
body[data-theme="light"] .bookscreen-progress input[type="range"] {
  background:
    linear-gradient(90deg,
      rgba(10,10,20,.80) var(--seek-fill, 0%),
      rgba(10,10,20,.14) var(--seek-fill, 0%)
    );
}

.bookscreen-progress input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.40);
  transition: transform .15s ease;
}
.bookscreen-progress input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.3);
}
.bookscreen-progress input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.40);
}
body[data-theme="light"] .bookscreen-progress input[type="range"]::-webkit-slider-thumb {
  background: rgba(10,10,20,.85);
}
body[data-theme="light"] .bookscreen-progress input[type="range"]::-moz-range-thumb {
  background: rgba(10,10,20,.85);
}

.bookscreen-progressRow {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
  color: rgba(255,255,255,.42);
}
body[data-theme="light"] .bookscreen-progressRow { color: rgba(10,10,20,.40); }

/* ── Controls ── */
.bookscreen-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 30px;
}

/* Skip buttons */
.bookscreen-control {
  width: 64px;
  height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(255,255,255,.72);
  background: none;
  border: none;
  transition: transform .15s var(--ease-spring, cubic-bezier(.34,1.56,.64,1)),
              color .15s ease;
}
.bookscreen-control:active {
  transform: scale(.88);
  color: rgba(255,255,255,.95);
}
body[data-theme="light"] .bookscreen-control {
  color: rgba(10,10,20,.58);
}
body[data-theme="light"] .bookscreen-control:active {
  color: rgba(10,10,20,.92);
}

.bookscreen-control i {
  font-size: 28px;
}
.bookscreen-control span {
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}
/* The play/pause button — the hero element */
.bookscreen-play {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  color: #fff;
  margin: 0 20px;

  /* Premium Apple-style green */
  background: linear-gradient(145deg, #22c55e 0%, #34d399 35%, #3cb78f 70%, #3bb17b 100%);

  border: none;

  box-shadow:
    0 14px 40px rgba(34,197,94,.45),
    0 4px 12px rgba(34,197,94,.30),
    inset 0 1px 0 rgba(255,255,255,.22);

  transition:
    transform .2s cubic-bezier(.34,1.56,.64,1),
    box-shadow .2s ease;

  overflow: visible;
}

/* Glow halo */
.bookscreen-play::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;

  background: radial-gradient(
    circle,
    rgba(34,197,94,.28) 0%,
    rgba(52,211,153,.18) 50%,
    transparent 75%
  );

  filter: blur(8px);
  z-index: -1;
  transition: opacity .3s ease;
}

.bookscreen-play:active {
  transform: scale(.92);

  box-shadow:
    0 6px 20px rgba(34,197,94,.35),
    inset 0 1px 0 rgba(255,255,255,.18);
}
.bookscreen-play.is-playing::before {
  animation: play-glow 2.4s ease infinite;
}
@keyframes play-glow {
  0%, 100% { opacity: .7; transform: scale(1); }
  50%       { opacity: .4; transform: scale(1.12); }
}

/* Pulse ring — visible only when playing */
.bookscreen-play__ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1.5px solid rgba(34,197,94,.35);
  opacity: 0;
  transform: scale(.88);
  transition: opacity .35s ease, transform .35s ease;
  pointer-events: none;
}
.bookscreen-play.is-playing .bookscreen-play__ring {
  opacity: 1;
  transform: scale(1);
  animation: ring-expand 2.4s ease infinite;
}
@keyframes ring-expand {
  0%   { transform: scale(1);    opacity: .35; }
  60%  { transform: scale(1.12); opacity: .10; }
  100% { transform: scale(1);    opacity: .35; }
}

.bookscreen-play i {
  font-size: 28px;
  position: relative;
  z-index: 1;
  margin-inline-start: 2px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.20));
}
/* Pause icon: no indent needed */
.bookscreen-play i.fa-pause { margin-inline-start: 0; }

/* ── Action pills (speed + download) ── */
.bookscreen-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.bookscreen-action {
  height: 54px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: rgba(255,255,255,.82);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.09);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition:
    transform .16s cubic-bezier(.34,1.56,.64,1),
    background .14s ease;
}
.bookscreen-action:active {
  transform: scale(.95);
  background: rgba(255,255,255,.14);
}
body[data-theme="light"] .bookscreen-action {
  color: rgba(10,10,20,.72);
  background: rgba(255,255,255,.68);
  border-color: rgba(10,10,20,.08);
}
.bookscreen-action i {
  font-size: 17px;
  color: var(--emerald);
}
.bookscreen-action span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  color: rgba(255,255,255,.46);
}
body[data-theme="light"] .bookscreen-action span { color: rgba(10,10,20,.46); }

.bookscreen-action:disabled,
.bookscreen-action[disabled] { opacity: .42; pointer-events: none; }

/* Download with progress fill */
.bookscreen-action--download {
  position: relative;
  overflow: hidden;
  --download-progress: 0%;
}
.bookscreen-action--download::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    rgba(34,197,94,.88) 0 var(--download-progress),
    transparent var(--download-progress) 100%
  );
}
.bookscreen-action--download > * { position: relative; z-index: 1; }
.bookscreen-action--download.is-downloading {
  color: #fff;
  border-color: transparent;
}
.bookscreen-action--download.is-downloading i,
.bookscreen-action--download.is-downloading span { color: #fff; }
.bookscreen-action--download.is-downloaded {
  background: linear-gradient(135deg, #22c55e, #34d399);
  border-color: transparent;
}
.bookscreen-action--download.is-downloaded i,
.bookscreen-action--download.is-downloaded span { color: #fff; }

/* ── Speed menu ── */
.bookscreen-speedMenu {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 10px;
  border-radius: 20px;
  background: rgba(12,10,22,.96);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 28px 56px rgba(0,0,0,.50);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}
body[data-theme="light"] .bookscreen-speedMenu {
  background: rgba(255,255,255,.97);
  border-color: rgba(10,10,20,.08);
  box-shadow: 0 24px 48px rgba(0,0,0,.16);
}

.bookscreen-speedMenu button {
  min-height: 36px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  color: rgba(255,255,255,.60);
  background: rgba(255,255,255,.06);
  transition: transform .14s ease, background .14s ease, color .14s ease;
}
.bookscreen-speedMenu button:active { transform: scale(.94); }
body[data-theme="light"] .bookscreen-speedMenu button {
  color: rgba(10,10,20,.55);
  background: rgba(10,10,20,.05);
}
.bookscreen-speedMenu button.is-active {
    color: #fff;
    background: var(--emerald);
    box-shadow: 0 6px 16px rgba(34,197,94,.38);
}
.bookscreen-speedMenu.is-hidden { display: none !important; }

/* ── PDF Modal ── */
.bookscreen-pdfModal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: stretch;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.bookscreen-pdfModal.is-hidden,
.bookscreen-pdfModal[hidden] { display: none !important; }

.bookscreen-pdfSheet {
  width: 100%;
  height: 100%;
  border-radius: 0;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  background: rgba(12,10,22,.98);
  border: 0;
}
body[data-theme="light"] .bookscreen-pdfSheet {
  background: rgba(253,252,255,.99);
}

.bookscreen-pdfHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #fff;
}
body[data-theme="light"] .bookscreen-pdfHead { color: var(--text, #111); }
.bookscreen-pdfHead strong { font-size: 17px; font-weight: 900; }

.bookscreen-kicker {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #34d399;
  margin-bottom: 2px;
}

.bookscreen-pdfTabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bookscreen-pdfTab {
  min-height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: rgba(255,255,255,.62);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.10);
  transition: background .14s ease, color .14s ease;
}
body[data-theme="light"] .bookscreen-pdfTab {
  color: var(--text, #111);
  background: rgba(10,10,20,.06);
  border-color: rgba(10,10,20,.10);
}
.bookscreen-pdfTab.is-active {
  color: #fff;
  background: linear-gradient(135deg, #22c55e, #34d399);
  border-color: transparent;
}

.bookscreen-pdfFrameWrap {
  min-height: 0;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.08);
}
body[data-theme="light"] .bookscreen-pdfFrameWrap { border-color: rgba(10,10,20,.08); }
.bookscreen-pdfFrameWrap iframe {
  width: 100%; height: 100%;
  border: 0;
  background: #fff;
}

/* ── Image shell (shimmer) ── */
.image-shell {
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,.05);
}
.image-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.14) 45%, transparent 90%);
  transform: translateX(-100%);
  opacity: 0;
  animation: none;
  pointer-events: none;
  z-index: 2;
}
.image-shell.is-loading::before {
  opacity: 1;
  animation: shimmer 1.4s infinite;
}
.image-shell.is-loading img { opacity: 0; }
.image-shell img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  opacity: 1;
  transition: opacity .28s ease;
}
.image-shell.is-loaded::before { opacity: 0; animation: none; }
.image-shell.is-loaded img,
.image-shell:not(.is-loading) img { opacity: 1; }
.image-shell.is-empty::before { opacity: 0; animation: none; }

.bookscreen-coverFrame.image-shell { position: relative; }
.bookscreen-coverFrame.image-shell img { position: relative; z-index: 1; }
.bookscreen-coverFrame.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.14) 45%, transparent 90%);
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
  z-index: 2;
}
.bookscreen-coverFrame.is-loading img { opacity: 0; }
.bookscreen-coverFrame.is-loaded::after { opacity: 0; animation: none; }

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* ── Layout: artwork sits absolutely in upper screen ── */
/* The stage has position:relative, artwork is absolute inside it */
.bookscreen-stage {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* Artwork: absolute, centered in screen upper portion */
.bookscreen-artwork {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 16px;
  pointer-events: none;
}
.bookscreen-artwork__glow {
  position: absolute;
  width: 70%;
  aspect-ratio: 1;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(34,197,94,.25);
  filter: blur(72px);
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}
.bookscreen-coverFrame { pointer-events: auto; z-index: 1; position: relative; }
.bookscreen-artwork__reflection { pointer-events: none; z-index: 1; position: relative; }

/* Panel: sits at the bottom, with enough top padding to not overlap cover */
.bookscreen-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding-left: 24px;
  padding-right: 24px;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
  /* Push below artwork */
  padding-top: calc(min(58vw, 218px) * 1.39 + 16px + 40px + 10px + env(safe-area-inset-top) + 70px);
}

/* ── Responsive ── */
@media (max-width: 390px) {
  .bookscreen-topbar { padding: calc(12px + env(safe-area-inset-top)) 16px 0; }
  .bookscreen-panel {
    padding-left: 18px;
    padding-right: 18px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    padding-top: calc(min(52vw, 190px) * 1.39 + 14px + 40px + 8px + env(safe-area-inset-top) + 60px);
  }
  .bookscreen-coverFrame { width: min(52vw, 190px); }
  .bookscreen-artwork__reflection { width: min(52vw, 190px); }
  .bookscreen-title { font-size: 20px; }
  .bookscreen-play { width: 70px; height: 70px; }
  .bookscreen-play i { font-size: 24px; }
}

@media (max-height: 700px) {
  .bookscreen-panel {
    padding-top: calc(min(46vw, 170px) * 1.39 + 12px + 38px + 6px + env(safe-area-inset-top) + 50px);
  }
  .bookscreen-coverFrame { width: min(46vw, 170px); }
  .bookscreen-artwork__reflection { width: min(46vw, 170px); height: 36px; }
  .bookscreen-meta { margin-bottom: 16px; }
  .bookscreen-progress { margin-bottom: 18px; }
  .bookscreen-controls { margin-bottom: 20px; }
  .bookscreen-title { font-size: 18px; }
  .bookscreen-action { height: 46px; }
}

/* ================================================================
   BOOK LIST — Unchanged from v2, kept intact
   ================================================================ */
.booklist-page { gap: 10px; overflow: hidden; }
.booklist-head-copy { min-width: 0; display: flex; align-items: center; gap: 10px; flex: 1; }
.booklist-head-copy .page-title { font-size: 16px; }
.booklist-head-copy .micro-label { margin: 0; }

.booklist-hero {
  padding: 12px 14px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background:
    radial-gradient(circle at top right, rgba(38,199,133,.10), transparent 20%),
    color-mix(in srgb, var(--surface-strong) 90%, transparent);
  border: 1px solid var(--line);
}
.booklist-hero strong { display: block; margin-top: 2px; font-size: 13px; font-weight: 900; }
.booklist-hero-badge {
  min-height: 30px; padding: 0 14px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 900;
  background: linear-gradient(135deg, var(--primary), #4dcf9a);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 22%, transparent);
}

.booklist-grid {
  flex: 1; min-height: 0;
  display: grid; gap: 8px;
  overflow: auto; padding-bottom: 2px;
  scrollbar-width: none;
  align-content: start;
}
.booklist-grid::-webkit-scrollbar { display: none; }

.booklist-item {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px; padding: 10px;
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface-strong) 94%, transparent);
  border: 1px solid var(--line);
  transition: transform .15s ease;
}
.booklist-item:active { transform: scale(.98); }
body[data-theme="dark"] .booklist-item {
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.06);
}
.booklist-item--downloaded { grid-template-columns: 62px minmax(0, 1fr) auto; }

.booklist-delete {
  width: 38px; height: 38px; border-radius: 14px;
  display: grid; place-items: center;
  color: var(--rose);
  background: color-mix(in srgb, var(--rose) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--rose) 14%, transparent);
}
.booklist-meta { display: flex; align-items: center; gap: 8px; font-size: 10px; color: var(--muted); }

.booklist-thumb {
  width: 62px; height: 88px; border-radius: 16px;
  overflow: hidden; position: relative;
  background-size: cover; background-position: center;
  box-shadow: 0 10px 22px rgba(16,57,39,.14);
}
.booklist-thumb::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 58%, rgba(0,0,0,.32) 100%);
}
.booklist-play {
  position: absolute; left: 7px; bottom: 7px;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-size: 11px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 16px color-mix(in srgb, var(--primary) 24%, transparent);
  z-index: 1;
}
.booklist-body { min-width: 0; display: grid; gap: 4px; }
.booklist-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.booklist-row strong {
  font-size: 12px; line-height: 1.35; font-weight: 900; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.booklist-body p {
  margin: 0; font-size: 10px; line-height: 1.65; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.booklist-pill {
  min-height: 24px; padding: 0 8px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 900; white-space: nowrap;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 12%, transparent);
}
.booklist-chevron {
  width: 28px; height: 28px; border-radius: 12px;
  display: grid; place-items: center; color: var(--muted);
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
  border: 1px solid var(--line);
}

.booklist-item--skeleton .booklist-thumb,
.booklist-item--skeleton .booklist-row strong,
.booklist-item--skeleton .booklist-body p,
.booklist-item--skeleton .booklist-pill,
.booklist-item--skeleton .booklist-chevron { min-height: 12px; }
.booklist-item--skeleton .booklist-row strong { width: 72%; }
.booklist-item--skeleton .booklist-body p { width: 92%; height: 10px; }
.booklist-item--skeleton .booklist-pill { width: 54px; }
.booklist-item--skeleton .booklist-chevron { width: 28px; height: 28px; }

.booklist-confirm {
  position: fixed; inset: 0; z-index: 35;
  display: grid; place-items: center; padding: 18px;
  background: rgba(0,0,0,.54);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(10px);
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}
.booklist-confirm.is-open {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0);
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear 0s;
}
.booklist-confirm.is-hidden, .booklist-confirm[hidden] { display: none !important; }

.booklist-confirm__sheet {
  width: min(100%, 360px); padding: 20px; border-radius: 28px;
  display: grid; justify-items: center; gap: 12px; text-align: center;
  background: color-mix(in srgb, var(--surface-strong) 96%, transparent);
  border: 1px solid var(--line);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
body[data-theme="dark"] .booklist-confirm__sheet {
  background: rgba(14,12,22,.96); border-color: rgba(255,255,255,.08);
}
.booklist-confirm__icon {
  width: 56px; height: 56px; border-radius: 20px;
  display: grid; place-items: center; font-size: 20px; color: #fff;
  background: linear-gradient(135deg, #ef5a73, #f38aa0);
  box-shadow: 0 14px 28px rgba(239,90,115,.22);
}
.booklist-confirm__title { font-size: 17px; font-weight: 900; }
.booklist-confirm__text { color: var(--muted); font-size: 12px; line-height: 1.8; }
.booklist-confirm__actions {
  width: 100%; display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.booklist-confirm__actions button { min-height: 48px; border-radius: 16px; font-weight: 900; }
.booklist-confirm__actions .ghost-btn {
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
}
.danger-btn {
  min-height: 50px; padding: 0 16px; border-radius: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900; color: #fff;
  background: linear-gradient(135deg, #ef5a73, #f38aa0);
  box-shadow: 0 14px 28px rgba(239,90,115,.18);
}

/* ── Tasks dark theme ── */
body[data-theme="dark"] .tasks-page {
  background:
    radial-gradient(circle at top left, rgba(38,199,133,.10), transparent 20%),
    radial-gradient(circle at top right, rgba(34,197,94,.10), transparent 18%),
    linear-gradient(180deg, #08110d 0%, #0c1612 48%, #0a120f 100%);
}
body[data-theme="dark"] .tasks-page .micro-label,
body[data-theme="dark"] .tasks-page .page-title,
body[data-theme="dark"] .tasks-page .task-overview-card span,
body[data-theme="dark"] .tasks-page .task-copy span,
body[data-theme="dark"] .tasks-page .tasks-empty span,
body[data-theme="dark"] .tasks-page .tasks-empty strong,
body[data-theme="dark"] .tasks-page .task-meta span,
body[data-theme="dark"] .tasks-page .modal-head .page-title { color: #eef7f2; }
body[data-theme="dark"] .tasks-page .task-overview-card,
body[data-theme="dark"] .tasks-page .task-item,
body[data-theme="dark"] .tasks-page .tasks-list,
body[data-theme="dark"] .tasks-page .modal-sheet,
body[data-theme="dark"] .tasks-page .input-box,
body[data-theme="dark"] .tasks-page .task-delete {
  background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.08);
}
body[data-theme="dark"] .tasks-page .task-overview-card { box-shadow: 0 16px 32px rgba(0,0,0,.22); }
body[data-theme="dark"] .tasks-page .task-check {
  background: rgba(255,255,255,.08); border-color: rgba(38,199,133,.18);
}
body[data-theme="dark"] .tasks-page .task-check.is-done {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 64%, #fff 36%));
}
body[data-theme="dark"] .tasks-page .task-meta span {
  color: #eff6f2; background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.08);
}
body[data-theme="dark"] .tasks-page .task-delete { color: #ff95a5; }
body[data-theme="dark"] .tasks-page .modal { background: rgba(1,3,7,.62); }