/* Audiobooks — dark, mobile-first UI */

:root {
  --bg: #0b0d12;
  --bg-2: #0f1218;
  --surface: #141821;
  --surface-2: #1b2030;
  --surface-3: #242a3c;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .13);
  --text: #eceef5;
  --text-2: #a7aec1;
  --text-3: #6f778c;
  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --accent-soft: rgba(139, 92, 246, .16);
  --grad: linear-gradient(135deg, #8b5cf6 0%, #6366f1 45%, #22d3ee 100%);
  --danger: #f43f5e;
  --ok: #34d399;
  --warn: #fbbf24;
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
  --topbar-h: 60px;
  --tabbar-h: 0px;
  --mini-h: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.5 var(--font);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(900px 500px at 0% -10%, rgba(139, 92, 246, .10), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(34, 211, 238, .06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(139, 92, 246, .45); }

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.marquee { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.marquee.is-scrolling { text-overflow: clip; }
.marquee.is-scrolling > span { display: inline-block; will-change: transform; }

/* ---------- Layout ---------- */

.app { min-height: 100dvh; }
.app.has-tabbar { --tabbar-h: calc(62px + var(--safe-b)); }
.app.has-mini { --mini-h: 68px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: calc(var(--topbar-h) + var(--safe-t));
  padding: var(--safe-t) 16px 0;
  background: rgba(11, 13, 18, .78);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; flex: 0 1 auto; min-width: 0; }
.brand-mark {
  flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(139, 92, 246, .35);
}
.brand-mark .ic { width: 18px; height: 18px; }
.brand-mark.has-img { background: none; box-shadow: none; border-radius: 0; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-name { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-short, .topbar .search-toggle, .topbar .search-close { display: none; }

.search {
  flex: 1; max-width: 520px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text-3); transition: border-color .15s, background .15s;
}
.search:focus-within { border-color: rgba(139, 92, 246, .6); background: var(--surface-2); color: var(--text-2); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font-size: 15px; }
.search input::-webkit-search-cancel-button { filter: invert(.6); }
.search kbd { font: 12px var(--font); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 6px; color: var(--text-3); }

.topnav { display: flex; align-items: center; gap: 4px; flex: none; }
.navlink { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; font-size: 14px; }
.navlink:hover { background: var(--surface); color: var(--text); }
.navlink.is-active { color: var(--text); background: var(--surface-2); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; margin-left: 6px;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff;
  background: var(--grad); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--line-2);
}

.view {
  max-width: 1280px; margin: 0 auto;
  padding: 20px 16px calc(32px + var(--mini-h) + var(--tabbar-h));
  outline: none;
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
  display: flex; justify-content: space-around;
  height: var(--tabbar-h); padding-bottom: var(--safe-b);
  background: rgba(15, 18, 24, .92);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 500; color: var(--text-3); }
.tabbar a .ic { width: 22px; height: 22px; }
.tabbar a.is-active { color: var(--text); }
.tabbar a.is-active .ic { color: var(--accent-2); }

@media (min-width: 761px) {
  .tabbar { display: none !important; }
  .app.has-tabbar { --tabbar-h: 0px; }
  .app.has-mini { --mini-h: 96px; }
}
@media (max-width: 760px) {
  .hide-mobile { display: none !important; }
  .brand-name { display: none; }
  .brand-short { display: inline; font-size: 17px; white-space: nowrap; }
  /* Drop everything a little so the browser's address bar doesn't cover the top row. */
  :root { --safe-t: calc(env(safe-area-inset-top, 0px) + 14px); }
  .topbar { gap: 10px; padding-left: 12px; padding-right: 12px; }
  /* Search hides behind the magnifier; opening it takes over the whole bar. */
  .topnav { margin-left: auto; gap: 2px; }
  .topbar .search-toggle { display: inline-grid; }
  .topbar:not(.search-open) .search { display: none; }
  .topbar.search-open .brand,
  .topbar.search-open .topnav { display: none; }
  .topbar.search-open .search { max-width: none; margin: 0; }
  .topbar.search-open .search-close { display: inline-grid; margin-right: -6px; }
  .view { padding-left: 14px; padding-right: 14px; padding-top: 16px; }
}
@media (max-width: 380px) { .hide-xs { display: none !important; } }
@media (hover: none) { .hide-touch { display: none !important; } }

/* ---------- Buttons & form controls ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 12px;
  font-weight: 600; font-size: 14px; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text);
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 22px rgba(99, 102, 241, .3); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: rgba(244, 63, 94, .12); border-color: rgba(244, 63, 94, .3); color: #fda4af; }
.btn-danger:hover { background: rgba(244, 63, 94, .22); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn .ic { width: 18px; height: 18px; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: inline-grid; place-items: center; color: var(--text-2);
  transition: background .15s, color .15s, transform .1s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; }
.icon-btn.sm .ic { width: 18px; height: 18px; }
.icon-btn.danger:hover { color: var(--danger); background: rgba(244, 63, 94, .1); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field small { color: var(--text-3); font-size: 12px; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 12px;
  color: var(--text); outline: none; font-size: 16px; /* 16px stops iOS zoom */
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, .2); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
@media (max-width: 520px) { .row.stack-mobile { flex-direction: column; gap: 0; } }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
/* Section headings in Profile & settings. */
.set-head { margin: 26px 0 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-2); }
.switch-text { display: grid; gap: 2px; }
.switch-text b { font-weight: 600; font-size: 14px; }
.switch-text small { color: var(--text-3); font-size: 12.5px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .knob { width: 44px; height: 26px; border-radius: 99px; background: var(--surface-3); position: relative; flex: none; transition: background .2s; }
.switch .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.switch input:checked + .knob { background: var(--accent); }
.switch input:checked + .knob::after { transform: translateX(18px); }
.switch input:focus-visible + .knob { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.check { display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 36px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }

.segmented { display: inline-flex; padding: 3px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; gap: 2px; flex-wrap: wrap; }
.segmented button { padding: 7px 12px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text-2); min-width: 44px; }
.segmented button.is-active { background: var(--surface-3); color: var(--text); }

/* ---------- Cards, covers, typography ---------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 6px 0 18px; flex-wrap: wrap; }
.page-title { font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.page-sub { margin: 4px 0 0; color: var(--text-2); }
.section { margin: 30px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title { font-size: 19px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.section-link { color: var(--text-3); font-size: 13px; font-weight: 600; }
.section-head:has(.shelf-nav) { align-items: center; }
.shelf-nav { display: flex; gap: 4px; margin: -6px 0; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
@media (max-width: 760px) { .page-title { font-size: 24px; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card-pad { padding: 20px; }
@media (max-width: 520px) { .card-pad { padding: 16px; } }

.cover {
  --h: 260;
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 1; border-radius: var(--r);
  background: linear-gradient(145deg, hsl(var(--h) 55% 32%), hsl(calc(var(--h) + 40) 60% 16%));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.cover::before {
  content: attr(data-initials); position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 800; font-size: 2.2em; letter-spacing: -.03em; color: rgba(255,255,255,.85);
  text-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.cover img.is-loaded { opacity: 1; }
/* Hairline edge drawn over the art (the inset shadow above sits under the img), so dark covers
   don't melt into the page. Covers already inside a card or bar get their edge from that frame. */
.cover::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255,255,255,.24); pointer-events: none; }
.card .cover::after, .resume .cover::after, .mini .cover::after { content: none; }
.cover-sm { width: 46px; height: 46px; border-radius: 10px; font-size: 8px; flex: none; }
.cover-xl { width: 100%; font-size: 26px; border-radius: 22px; box-shadow: 0 30px 60px rgba(0,0,0,.5), inset 0 0 0 1px rgba(255,255,255,.08); }

.progress { height: 4px; border-radius: 99px; background: rgba(255,255,255,.1); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--grad); border-radius: inherit; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.badge.ok { color: var(--ok); background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .25); }
.badge.accent { color: #c4b5fd; background: var(--accent-soft); border-color: rgba(139, 92, 246, .3); }
.badge.danger { color: #fda4af; background: rgba(244, 63, 94, .1); border-color: rgba(244, 63, 94, .25); }
.badge .ic { width: 13px; height: 13px; }

/* Collection grid */
.grid { display: grid; gap: 22px 18px; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; } }
/* minmax(0, 1fr): a long nowrap line (tile-meta) must not widen the column and blow up the cover. */
.tile { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; align-content: start; }
.tile .cover { transition: transform .2s, box-shadow .2s; }
.tile:hover .cover { transform: translateY(-3px); box-shadow: var(--shadow); }
.tile-name { font-weight: 650; font-size: 14.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-meta { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.tile .progress { margin-top: 6px; }
.stack { position: relative; }
.stack::after { content: ""; position: absolute; left: 8%; right: 8%; top: -6px; height: 12px; border-radius: 12px 12px 0 0; background: rgba(255,255,255,.06); z-index: -1; }

/* Continue listening shelf */
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(290px, 360px); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.shelf::-webkit-scrollbar { display: none; }
@media (max-width: 760px) { .shelf { grid-auto-columns: 84%; margin: 0 -14px; padding-left: 14px; padding-right: 14px; } }
.resume {
  scroll-snap-align: start; display: flex; gap: 14px; align-items: center;
  padding: 12px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line);
  text-align: left; transition: background .15s, border-color .15s; min-width: 0;
}
.resume:hover { background: var(--surface-2); border-color: var(--line-2); }
.resume .cover { width: 84px; height: 84px; flex: none; font-size: 12px; }
.resume-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.resume-title { font-weight: 650; }
.resume-sub { color: var(--text-3); font-size: 12.5px; }
.resume-play { width: 42px; height: 42px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; flex: none; }
.resume-play .ic { width: 18px; height: 18px; margin-left: 2px; }

/* Collection header */
.hero { display: flex; gap: 28px; align-items: flex-end; margin: 8px 0 28px; }
.hero .cover { width: 220px; flex: none; font-size: 22px; box-shadow: var(--shadow); }
.hero-body { min-width: 0; display: grid; gap: 10px; }
.hero-title { font-size: 38px; line-height: 1.08; font-weight: 800; letter-spacing: -.025em; margin: 0; }
.hero-desc { color: var(--text-2); margin: 0; max-width: 70ch; white-space: pre-line; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--text-3); font-size: 13.5px; }
.hero-stats span { display: inline-flex; align-items: center; gap: 6px; }
.hero-stats .ic { width: 16px; height: 16px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.hero .progress { max-width: 360px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-weight: 600; font-size: 13.5px; margin-bottom: 8px; padding: 6px 8px 6px 2px; }
.back-link:hover { color: var(--text); }
@media (max-width: 760px) {
  .hero { flex-direction: column; align-items: center; text-align: center; gap: 18px; }
  .hero .cover { width: min(62vw, 240px); }
  .hero-title { font-size: 26px; }
  .hero-stats, .hero-actions { justify-content: center; }
  .hero .progress { margin: 0 auto; width: 100%; }
}

/* Book list */
.booklist { display: grid; gap: 4px; }
.book {
  display: grid; grid-template-columns: 30px 46px 1fr auto; gap: 14px; align-items: center;
  padding: 10px 10px; border-radius: var(--r); cursor: pointer; transition: background .15s;
}
/* Chapter / part rows have no cover thumbnail. */
.booklist.no-covers .book { grid-template-columns: 30px minmax(0, 1fr) auto; }
.book:hover { background: var(--surface); }
.book.is-current { background: var(--accent-soft); }
.book-num { text-align: center; color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; }
.book.is-current .book-num { color: var(--accent-2); }
.book-body { min-width: 0; display: grid; gap: 3px; }
.book-title { font-weight: 600; }
.book-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--text-3); font-size: 12.5px; }
.book-meta .progress { width: 80px; }
.book-actions { display: flex; align-items: center; gap: 2px; }
.book.is-finished .book-title { color: var(--text-2); }
@media (max-width: 520px) {
  .book { grid-template-columns: 46px 1fr auto; gap: 12px; padding: 10px 6px; }
  .book-num { display: none; }
  .booklist.no-covers .book-num { display: block; }
}

.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.eq i { width: 3px; height: 14px; background: var(--accent-2); border-radius: 2px; transform-origin: bottom; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; }
.eq.paused i { animation-play-state: paused; }
@keyframes eq { 0%, 100% { transform: scaleY(.29); } 50% { transform: scaleY(1); } }

.empty { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty .ic { width: 44px; height: 44px; color: var(--text-3); margin-bottom: 12px; }
.empty h2 { margin: 0 0 6px; color: var(--text); font-size: 20px; }
.empty p { margin: 0 auto; max-width: 44ch; }
.empty-logo { display: block; width: min(240px, 70%); height: auto; margin: 0 auto 18px; }

.about { text-align: center; }
.about-logo { display: block; width: min(260px, 80%); height: auto; margin: 0 auto 16px; }
.about p { margin: 4px 0; }
.about-stats { font-weight: 600; color: var(--text); }
.about-ver { margin-top: 12px !important; font-size: 12px; font-variant-numeric: tabular-nums; }

.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Auth ---------- */

.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; padding: 32px 28px; }
.auth-card .brand { justify-content: center; margin-bottom: 20px; }
.auth-card .brand-mark { width: 52px; height: 52px; border-radius: 16px; }
.auth-card .brand-mark .ic { width: 26px; height: 26px; }
.auth-logo { display: block; width: min(220px, 70%); height: auto; margin: -8px auto 14px; }
.auth-card h1 { text-align: center; font-size: 24px; margin: 0 0 4px; letter-spacing: -.02em; }
.auth-card p.lead { text-align: center; color: var(--text-2); margin: 0 0 24px; }
.form-error { color: #fda4af; background: rgba(244, 63, 94, .1); border: 1px solid rgba(244, 63, 94, .25); padding: 10px 12px; border-radius: 10px; font-size: 13.5px; margin-bottom: 14px; }

/* ---------- Mini player ---------- */

.mini {
  position: fixed; z-index: 34;
  left: 8px; right: 8px; bottom: calc(var(--tabbar-h) + 8px);
  height: 60px; display: flex; align-items: center; gap: 4px; padding: 0 6px 0 8px;
  background: rgba(30, 35, 50, .92); border: 1px solid var(--line-2); border-radius: 16px;
  backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: var(--shadow); overflow: hidden;
  animation: rise .3s ease-out;
}
@keyframes rise { from { transform: translateY(20px); opacity: 0; } }
.mini-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255,255,255,.08); }
.mini-progress span { display: block; height: 100%; width: 0; background: var(--grad); }
.mini-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; height: 100%; }
.mini .cover-sm { width: 44px; height: 44px; }
.mini-text { display: grid; min-width: 0; }
.mini-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-sub { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-sm { color: var(--text); }
.play-sm .ic { width: 24px; height: 24px; }
@media (min-width: 761px) {
  .mini { left: 50%; right: auto; width: min(760px, calc(100% - 32px)); transform: translateX(-50%); bottom: 16px; height: 72px; padding: 0 12px; animation: none; }
  .mini .cover-sm { width: 52px; height: 52px; }
}

/* ---------- Full player ---------- */

.player {
  position: fixed; inset: 0; z-index: 60;
  background: var(--bg);
  /* Light-to-dark wash in the cover's colours (--tone-a/-b, set by paintCoverTones). Static, so it costs nothing to draw. */
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--tone-a, var(--bg)) 55%, var(--bg)) 0%,
    color-mix(in srgb, var(--tone-b, var(--bg)) 25%, var(--bg)) 55%,
    var(--bg) 100%);
  transform: translateY(100%); visibility: hidden;
  transition: transform .38s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .38s;
  overflow: hidden; overflow: clip;
}
.player.is-open { transform: none; visibility: visible; transition: transform .38s cubic-bezier(.2, .8, .2, 1); }
.player-inner { position: relative; height: 100%; display: flex; flex-direction: column; padding-top: var(--safe-t); overflow: hidden; overflow: clip; }
/* Phones: lift the whole player 20px (eats into the extra top spacing; height grows to keep the bottom in place). */
@media (max-width: 760px) { .player-inner { margin-top: -20px; height: calc(100% + 20px); } }
.player-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; flex: none; }
.player-head .ic { width: 24px; height: 24px; }
.player-head-title { text-align: center; min-width: 0; display: grid; }
.player-head .eyebrow { color: var(--text-2); } /* brighter than usual: it sits on the cover-tinted gradient */
/* Shown beside "Now playing" while the screen wake lock is held. */
.awake-tag {
  display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; padding: 1px 7px 1px 6px; border-radius: 99px;
  font-size: 9.5px; letter-spacing: .1em; color: var(--accent-2); background: rgba(34, 211, 238, .12); vertical-align: 1px;
}
.awake-tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; animation: awake-pulse 2.4s ease-in-out infinite; }
@keyframes awake-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .awake-tag::before { animation: none; } }
.player-collection { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-collection:hover { text-decoration: underline; }

.player-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 20px calc(24px + var(--safe-b)); }
.player-main { max-width: 480px; margin: 0 auto; display: grid; gap: 18px; }
.player-art { padding: 8px 12px 0; }
.player-art .cover-xl { max-width: 380px; margin: 0 auto; }
@media (max-height: 700px) and (max-width: 760px) { .player-art .cover-xl { max-width: 240px; } }
.player-meta { text-align: center; display: grid; gap: 4px; justify-items: center; min-width: 0; }
.player-title { font-size: 22px; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; margin: 0; max-width: 100%; }
.player-author { color: var(--text-2); margin: 0; font-size: 14.5px; }
.chapter-pill {
  /* Fixed width so the pill doesn't jump around as chapter names change length. */
  position: relative; overflow: hidden;
  margin-top: 8px; display: inline-flex; align-items: center; gap: 8px;
  width: 280px; max-width: 100%;
  padding: 7px 14px; border-radius: 99px; background: rgba(255,255,255,.07); border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 600; color: var(--text);
}
.chapter-pill span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-pill .ic { width: 16px; height: 16px; color: var(--accent-2); }

.seek { display: grid; gap: 8px; }
.seek-track { position: relative; height: 26px; cursor: pointer; touch-action: pan-y; }
.seek-track::before, .seek-buffer, .seek-fill { content: ""; position: absolute; left: 0; top: 11px; height: 4px; border-radius: 99px; transition: height .15s, top .15s; }
.seek-track::before { right: 0; background: rgba(255,255,255,.12); }
.seek-buffer { background: rgba(255,255,255,.32); width: 0; }
.seek-fill { background: var(--grad); width: 0; }
.seek-track:hover::before, .seek-track:hover .seek-buffer, .seek-track:hover .seek-fill, .seek-track.is-drag::before, .seek-track.is-drag .seek-buffer, .seek-track.is-drag .seek-fill { top: 10px; height: 6px; }
.seek-marks { position: absolute; left: 0; right: 0; top: 9px; height: 8px; pointer-events: none; }
.seek-marks i { position: absolute; top: 0; width: 2px; height: 8px; margin-left: -1px; background: rgba(11,13,18,.9); border-radius: 1px; }
.seek-thumb { position: absolute; top: 13px; left: 0; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4); transform: scale(.85); transition: transform .15s; }
.seek-track:hover .seek-thumb, .seek-track.is-drag .seek-thumb { transform: scale(1.1); }
/* Touch: only the thumb can be dragged, so make it read as the handle. */
@media (pointer: coarse) { .seek-thumb { transform: none; } .seek-track.is-drag .seek-thumb { transform: scale(1.35); } }
.seek-tip {
  position: absolute; bottom: 30px; left: 0; transform: translateX(-50%); pointer-events: none;
  padding: 6px 10px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line-2);
  font-size: 12px; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity .12s; box-shadow: var(--shadow);
}
.seek-tip b { font-variant-numeric: tabular-nums; margin-right: 6px; }
.seek-track:hover .seek-tip, .seek-track.is-drag .seek-tip { opacity: 1; }
.seek-times { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.t-mid { color: var(--text-3); font-size: 12px; padding: 4px 8px; border-radius: 8px; }
.t-mid:hover { background: rgba(255,255,255,.06); color: var(--text-2); }

.controls { display: flex; align-items: center; justify-content: space-between; max-width: 400px; width: 100%; margin: 0 auto; }
.ctl { width: 52px; height: 52px; color: var(--text); }
.ctl .ic { width: 26px; height: 26px; }
.skip { position: relative; }
.skip .ic { width: 32px; height: 32px; stroke-width: 1.6; }
.skip-n { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; padding-top: 2px; }
.play-btn {
  width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--bg); box-shadow: 0 12px 32px rgba(139, 92, 246, .35), 0 0 0 8px rgba(255,255,255,.04);
  transition: transform .12s;
}
.play-btn:active { transform: scale(.95); }
.play-btn .ic { width: 32px; height: 32px; }
.play-btn.is-play .ic { margin-left: 4px; }
/* Loading: an hourglass drains top to bottom, then flips over. Both bulbs are mirror images, so the loop is seamless. */
.play-btn .hg { display: none; stroke-width: 1.8; animation: hg-flip 2.4s ease-in-out infinite; }
.play-btn.is-loading .ic:not(.hg) { display: none; }
.play-btn.is-loading .hg { display: block; }
.hg-top, .hg-bot { fill: currentColor; stroke: none; transform-box: fill-box; transform-origin: 50% 100%; }
.hg-top { animation: hg-top 2.4s linear infinite; }
.hg-bot { animation: hg-bot 2.4s linear infinite; }
.hg-fall { stroke-width: 1; stroke-dasharray: 1 1; animation: hg-fall 2.4s linear infinite; }
@keyframes hg-flip { 0%, 75% { transform: rotate(0); } 100% { transform: rotate(180deg); } }
@keyframes hg-top { 0% { transform: scaleY(1); } 70%, 100% { transform: scaleY(0); } }
@keyframes hg-bot { 0% { transform: scaleY(0); } 70%, 100% { transform: scaleY(1); } }
@keyframes hg-fall { 0% { opacity: 1; stroke-dashoffset: 0; } 68% { opacity: 1; stroke-dashoffset: -12; } 69%, 100% { opacity: 0; stroke-dashoffset: -12; } }
@media (prefers-reduced-motion: reduce) { .play-btn .hg, .play-btn .hg * { animation: none !important; } .hg-bot, .hg-fall { opacity: 0; } }

.controls-2 { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px;
  border-radius: 99px; background: rgba(255,255,255,.07); border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 600; color: var(--text); transition: background .15s;
}
.chip:hover { background: rgba(255,255,255,.12); }
.chip .ic { width: 17px; height: 17px; color: var(--text-2); }
.chip.is-on { background: var(--accent-soft); border-color: rgba(139, 92, 246, .4); }
.chip.is-on .ic { color: #c4b5fd; }
.volume { display: flex; align-items: center; gap: 2px; }
.volume input { width: 110px; }

input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; height: 28px; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: linear-gradient(90deg, var(--accent) var(--pct, 50%), rgba(255,255,255,.14) var(--pct, 50%)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 99px; background: rgba(255,255,255,.14); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; margin-top: -6px; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; }

.player-side { max-width: 480px; margin: 26px auto 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 8px; position: sticky; top: 0; z-index: 2; background: linear-gradient(var(--bg) 80%, transparent); }
.tab { padding: 12px 12px; font-weight: 600; font-size: 14px; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text-2); }
.tab.is-active { color: var(--text); border-color: var(--accent); }
.tab .count { color: var(--text-3); font-weight: 500; margin-left: 2px; }
@media (max-width: 999px) {
  /* Same rounded card as the desktop side panel; the sticky tab strip keeps the card's top corners. */
  .player-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0 12px 12px; }
  .tabs { background: var(--surface); margin: 0 -12px 8px; padding: 0 12px; border-radius: var(--r-lg) var(--r-lg) 0 0; }
}
.panel { display: none; }
.panel.is-active { display: block; }

@media (min-width: 1000px) {
  .player-body { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(340px, 440px); gap: 48px; padding: 0 40px 32px; max-width: 1280px; margin: 0 auto; width: 100%; overflow: hidden; }
  .player-main { align-self: center; overflow-y: auto; max-height: 100%; padding-bottom: 8px; }
  .player-side { margin: 0; max-width: none; display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 6px 16px 16px; }
  .tabs { background: none; }
  .tab-panels { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -8px; padding: 0 8px; }
}

/* Chapter / bookmark lists */
.chap-list, .bm-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.chap {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  padding: 10px 8px; border-radius: 10px; text-align: left; width: 100%;
  font-size: 14px; color: var(--text-2); cursor: pointer;
}
/* Each row's ⋯ menu: resume, restart, mark played / unplayed. */
.chap-more { width: 30px; height: 30px; margin: -6px -4px -6px -4px; color: var(--text-3); }
.chap-more:hover, .chap-more[aria-expanded="true"] { color: var(--text); }
@media (hover: hover) { .chap:not(:hover):not(:focus-within) .chap-more { opacity: .55; } }
.chap:hover { background: rgba(255,255,255,.05); color: var(--text); }
.chap-n { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 12.5px; text-align: right; }
.chap-t { color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.chap.is-current { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.chap.is-current .chap-n { color: var(--accent-2); }
.chap.is-flash, .chapter-pill.is-flash { animation: chap-flash 1.4s ease-out; }
@keyframes chap-flash { 0%, 30% { box-shadow: inset 0 0 0 2px var(--accent-2); } 100% { box-shadow: inset 0 0 0 2px transparent; } }
.chap-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Thin progress line through the current chapter (now-playing pill and the chapter list). */
.chap { position: relative; overflow: hidden; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.chap-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255,255,255,.06); pointer-events: none; }
.chap-prog b { display: block; height: 100%; width: 0; background: var(--grad); transition: width .3s linear; }
.chap > .chap-prog { left: 8px; right: 8px; bottom: 3px; border-radius: 99px; }
.chap:not(.is-current):not(.has-prog) > .chap-prog { display: none; }
/* Other chapters show how far they were played, dimmer than the one playing. */
.chap.has-prog:not(.is-current) .chap-prog b { opacity: .45; transition: none; }
.chap.is-played:not(.is-current) { color: var(--text-3); }

.names-warn { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; font-size: 13px; color: var(--warn); overflow-wrap: anywhere; }
.names-warn .ic { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.names-warn b { font-weight: 600; }

.bm { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 8px; border-radius: 12px; }
.bm:hover { background: rgba(255,255,255,.04); }
.bm-time { font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 700; color: #c4b5fd; background: var(--accent-soft); padding: 4px 8px; border-radius: 8px; cursor: pointer; margin-top: 1px; }
.bm-time:hover { background: rgba(139, 92, 246, .3); }
.bm-body { min-width: 0; cursor: pointer; }
.bm-title { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.bm-note { color: var(--text-2); font-size: 13px; white-space: pre-line; margin-top: 2px; overflow-wrap: anywhere; }
.bm-date { color: var(--text-3); font-size: 11.5px; margin-top: 3px; }
.bm-actions { display: flex; }
.panel-actions { display: flex; gap: 8px; justify-content: space-between; align-items: center; padding: 6px 0 10px; }
.panel-empty { color: var(--text-3); text-align: center; padding: 30px 10px; font-size: 14px; }

.info-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; padding: 8px 4px; }
.info-grid dt { color: var(--text-3); }
.info-grid dd { margin: 0; overflow-wrap: anywhere; }
.info-desc { color: var(--text-2); font-size: 14px; white-space: pre-line; padding: 8px 4px; }
.info-desc.rich { white-space: normal; }
.info-desc.rich > :first-child { margin-top: 0; }
.info-desc.rich > :last-child { margin-bottom: 0; }
.info-desc.rich p { margin: 0 0 .75em; }
.info-desc.rich ul, .info-desc.rich ol { margin: 0 0 .75em; padding-left: 1.4em; }

/* ---------- Popovers, menus, modals, toasts ---------- */

.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.5); animation: fade .2s; }
.scrim.clear { background: transparent; }
@keyframes fade { from { opacity: 0; } }

.pop {
  position: fixed; z-index: 81; min-width: 220px; max-width: min(340px, calc(100vw - 24px));
  max-height: min(70vh, 520px); overflow-y: auto;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 16px; padding: 6px;
  box-shadow: 0 20px 50px rgba(0,0,0,.55); animation: pop .16s ease-out;
}
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
.pop-title { padding: 10px 12px 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.pop-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 10px; text-align: left; font-size: 14.5px; font-weight: 500; }
.pop-item:hover { background: rgba(255,255,255,.06); }
.pop-item .ic { width: 18px; height: 18px; color: var(--text-2); }
.pop-item.is-active { color: #c4b5fd; }
.pop-item.is-active .ic { color: #c4b5fd; }
.pop-item.danger { color: #fda4af; }
.pop-item.danger .ic { color: #fda4af; }
.pop-item .kbd { margin-left: auto; color: var(--text-3); font-size: 12px; }
.pop-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.pop-head { padding: 12px; display: grid; gap: 2px; }
.pop-head b { font-size: 15px; }
.pop-head small { color: var(--text-3); }
.pop-body { padding: 8px 10px 12px; }

@media (max-width: 640px) {
  .pop.sheetable {
    left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important;
    max-width: none; width: 100%; border-radius: 20px 20px 0 0; padding: 8px 8px calc(12px + var(--safe-b));
    animation: sheet .25s cubic-bezier(.2, .8, .2, 1); max-height: 80vh;
  }
  .pop.sheetable::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); margin: 2px auto 8px; }
  .pop.sheetable .pop-item { padding: 14px 12px; font-size: 15.5px; }
}
@keyframes sheet { from { transform: translateY(100%); } }

.speed-big { text-align: center; font-size: 34px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; padding: 4px 0; }
.speed-row { display: flex; align-items: center; gap: 10px; }
.speed-row input { flex: 1; }
.speed-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.speed-presets button { padding: 9px 0; border-radius: 10px; background: rgba(255,255,255,.05); font-weight: 600; font-size: 13.5px; }
.speed-presets button.is-active { background: var(--accent); color: #fff; }

.modal-wrap { position: fixed; inset: 0; z-index: 90; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px; background: rgba(0,0,0,.6); animation: fade .2s; overflow-y: auto; }
.modal { width: 100%; min-width: 0; max-width: 520px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: pop .2s ease-out; display: flex; flex-direction: column; max-height: calc(100dvh - 32px); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px 22px; border-bottom: 1px solid var(--line); flex: none; }
.modal-head h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }
@media (max-width: 640px) {
  .modal-wrap { place-items: end stretch; padding: 0; }
  .modal { max-width: none; border-radius: 22px 22px 0 0; max-height: 92dvh; animation: sheet .28s cubic-bezier(.2, .8, .2, 1); }
  .modal-body { padding: 16px; }
  .modal-head { padding: 14px 12px 10px 16px; }
  .modal-foot { padding: 12px 16px calc(12px + var(--safe-b)); }
  .modal-foot .btn { flex: 1; }
  .modal-foot .spacer { display: none; }
}

.toasts { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--mini-h) + 18px); transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 24px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 14px; font-weight: 500; animation: rise .25s ease-out; pointer-events: auto; cursor: pointer; touch-action: pan-y; user-select: none; transition: transform .2s, opacity .2s; }
.toast .ic { width: 18px; height: 18px; color: var(--ok); }
.toast.error .ic { color: var(--danger); }
.toast button { color: #c4b5fd; font-weight: 700; margin-left: 6px; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .2s; }

/* ---------- Admin & tables ---------- */

.subnav { display: flex; gap: 6px; margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.subnav a { padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--text-2); white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.subnav a .ic { width: 17px; height: 17px; }
.subnav a:hover { background: var(--surface); }
.subnav a.is-active { background: var(--surface-2); color: var(--text); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: rgba(255,255,255,.02); }
.user-cell { display: flex; align-items: center; gap: 12px; }
.user-cell .avatar { margin: 0; width: 36px; height: 36px; flex: none; }
@media (max-width: 760px) {
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table.responsive tr:last-child { border-bottom: 0; }
  .table.responsive td { border: 0; padding: 3px 0; }
  .table.responsive td[data-label]::before { content: attr(data-label) ": "; color: var(--text-3); font-size: 12.5px; }
  .table.responsive td.actions { padding-top: 8px; }
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.stat-label { font-size: 12.5px; color: var(--text-3); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat-label .ic { width: 15px; height: 15px; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .stats { grid-template-columns: 1fr 1fr; } .stat-value { font-size: 22px; } }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 10px; }
.bars div { flex: 1; min-width: 0; background: var(--accent); border-radius: 4px 4px 1px 1px; min-height: 3px; opacity: .85; position: relative; }
.bars div.zero { background: var(--surface-3); opacity: 1; }
.bars div.today { background: var(--accent-2); }
.bars div:hover { opacity: 1; filter: brightness(1.2); }
.bars-axis { display: flex; justify-content: space-between; color: var(--text-3); font-size: 11.5px; margin-top: 6px; }

.access-list { border: 1px solid var(--line); border-radius: 12px; max-height: 320px; overflow-y: auto; }
.access-col { border-bottom: 1px solid var(--line); }
.access-col:last-child { border-bottom: 0; }
.access-col-head { display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 12px; }
.access-col-head .check { flex: 1; min-width: 0; }
.access-col-head .check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.access-books { padding: 0 12px 8px 40px; display: grid; grid-template-columns: minmax(0, 1fr); }
.access-books .check { font-size: 13.5px; color: var(--text-2); min-height: 32px; min-width: 0; }
.access-list.is-disabled { opacity: .45; pointer-events: none; }
.caret { transition: transform .15s; }
.caret.is-open { transform: rotate(180deg); }

.col-admin { display: grid; grid-template-columns: 96px 1fr; gap: 18px; padding: 18px; }
.col-admin .cover { width: 96px; font-size: 12px; }
.col-admin + .col-admin { border-top: 1px solid var(--line); }
.col-admin .path { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
@media (max-width: 520px) { .col-admin { grid-template-columns: 1fr; } .col-admin .cover { width: 72px; } }

.kbd-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; align-items: center; }
.kbd-list kbd { font: 600 12px var(--font); padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); white-space: nowrap; justify-self: start; }

.search-group { margin-bottom: 26px; }
mark { background: rgba(34, 211, 238, .22); color: inherit; border-radius: 3px; padding: 0 1px; }

.sleep-badge { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* Bookmarks page, tile shelf, bookmark ticks on the seek bar */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .search { flex: 1; }
#bm-groups { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.bm-group { padding: 6px 6px 8px; min-width: 0; }
.bm-group-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 8px; }
.bm-group-head .cover { width: 44px; height: 44px; flex: none; }
.bm-group .bm-list { padding: 0 4px; }
.shelf.tiles { grid-auto-columns: 150px; }
@media (max-width: 760px) { .shelf.tiles { grid-auto-columns: 38%; } }
.shelf.tiles .tile { cursor: pointer; scroll-snap-align: start; }
/* Bookmarks: small red triangles above the bar pointing down at their spot, clear of the knob. */
.seek-marks b { position: absolute; top: -16px; width: 0; height: 0; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid var(--danger); filter: drop-shadow(0 1px 1px rgba(11,13,18,.8)); }
.book, .resume { cursor: pointer; }
.eyebrow a:hover { text-decoration: underline; }

/* Low-power playback (Profile & settings → This device; on by default). Endless animations and live
   blur keep the GPU redrawing every frame while the screen is on; this drops both. */
.low-power .eq i, .low-power .awake-tag::before { animation: none; }
.low-power .eq i:nth-child(1) { transform: scaleY(.55); }
.low-power .eq i:nth-child(3) { transform: scaleY(.75); }
.low-power .topbar, .low-power .tabbar, .low-power .mini, .low-power .player-side { backdrop-filter: none; -webkit-backdrop-filter: none; }
.low-power .topbar { background: rgb(11, 13, 18); }
.low-power .tabbar { background: rgb(15, 18, 24); }
.low-power .mini { background: rgb(30, 35, 50); }
.low-power .player-side { background: rgb(20, 24, 33); }
