/* batch5-booksdark (b5dark-20261022) — the Books section follows the site theme, like the app's Books V2.
   Tokens are the app's own (lib/books-v2/theme/tokens.ts; dark battle values from components/books-v2/battle/
   BvbTheme.ts). Light is the default; body:not(.light) is the site's dark theme. Books CSS files read these
   tokens instead of hard-coded light colours. Always-dark surfaces (heroes, cover scrims, badges) keep their
   literal colours in both themes, as the app's "one mode per container" rule says. */
body {
  --bk-app:#F6F4F9; --bk-card:#FFFFFF; --bk-soft:#FBF8FE; --bk-mute:#F1EEF6; --bk-tint:#EDE6FD; --bk-tint2:#DCCFF8;
  --bk-line:#E9E3F2; --bk-line2:#CFC6E4;
  --bk-ink:#1B1725; --bk-ink2:#2C2439; --bk-ink3:#3E374F; --bk-ink4:#5B5468; --bk-ink5:#6E6880; --bk-ink6:#8C86A0; --bk-ink7:#A29CB4;
  --bk-brandtext:#5527C4;
  --bk-okbg:#DFF5E7; --bk-okfg:#1E7A46; --bk-warnbg:#FCE9D8; --bk-warnfg:#8A5A0B;
  --bk-pinkbg:#FDEFF3; --bk-pinkfg:#C2185B; --bk-bluebg:#E7F3FE; --bk-bluefg:#1D5FD0;
  --bk-nav:rgba(255,255,255,.72); --bk-navline:rgba(237,232,245,.8);
  --bk-accent-ink:var(--accent-strong); --bk-accent-soft:var(--accent-soft); --bk-accent-fill:var(--accent-strong);
  --bk-shadow:rgba(43,28,72,.08);
}
body:not(.light) {
  --bk-app:#131020; --bk-card:#1D1930; --bk-soft:#231D38; --bk-mute:#282237; --bk-tint:#2E2551; --bk-tint2:#3E3270;
  --bk-line:#312A47; --bk-line2:#463C63;
  --bk-ink:#F2EEFA; --bk-ink2:#DFD8EE; --bk-ink3:#CBC3DE; --bk-ink4:#A9A1BE; --bk-ink5:#9D95B1; --bk-ink6:#8C85A0; --bk-ink7:#7C7591;
  --bk-brandtext:#C3ABFF;
  --bk-okbg:#15321F; --bk-okfg:#6BD79A; --bk-warnbg:#3A2711; --bk-warnfg:#EDA95A;
  --bk-pinkbg:#3A1428; --bk-pinkfg:#FF8AA3; --bk-bluebg:#14233F; --bk-bluefg:#8EC5FF;
  --bk-nav:rgba(22,18,36,.82); --bk-navline:rgba(60,52,86,.7);
  --bk-accent-ink:var(--accent-light); --bk-accent-soft:rgba(var(--accent-rgb),.22); --bk-accent-fill:var(--accent-strong);
  --bk-shadow:rgba(0,0,0,.35);
}

/* The sidebar keeps the site theme on Books (it was forced to dark ink on the Books canvas). */
@media (min-width:769px) {
  body:not(.light).on-books:has(#bookPage.books-mobile-v2) #appSidebar { --rail-ink:var(--text); }
}

/* ── For You ─────────────────────────────────────────────────────────────────────────────────────────────── */
/* Section ribbons: the app's dark palette per heading (ForYouDecoratedHeading.tsx), set inline beside the light one. */
body:not(.light) .bfy .bfy-heading { --ribbon-a:var(--ribbon-a-dark) !important; --ribbon-b:var(--ribbon-b-dark) !important; --heading-ink:var(--heading-ink-dark) !important; }
/* batch4-integration.css darkened these greys for the (then always light) Books canvas; in dark they follow the tokens. */
body:not(.light) .bfy { --bfy-muted:var(--bk-ink5); }
body:not(.light) .bfy .bfy-continue-info p, body:not(.light) .bfy .bfy-progress span, body:not(.light) .bfy .bfy-empty p, body:not(.light) .bfy .bfy-menu { color:var(--bk-ink5); }
body:not(.light) .bfy .bfy-continue-go, body:not(.light) .bfy .bfy-feed-actions button { color:var(--bk-accent-ink); }
body:not(.light) #booksMobileV2 .bmv2-tabs button:not(.active) { color:var(--bk-ink4); }
/* Mood pills and eyebrows draw in the mood's own colour; lift it on the dark card and deepen it on white (2.0–4.3:1). */
body:not(.light) .bfy .bfy-mood-tabs button:not([aria-pressed=true]), body:not(.light) .bfy .bfy-eyebrow, body:not(.light) .bfy .bfy-mood-intro > .bfy-icon { color:color-mix(in srgb,var(--mood) 45%,#fff); }
body.light .bfy .bfy-mood-tabs button:not([aria-pressed=true]), body.light .bfy .bfy-eyebrow { color:color-mix(in srgb,var(--mood) 78%,#000); }
.bfy .bfy-mood-tabs [aria-pressed=true] { background:color-mix(in srgb,var(--mood) 82%,#000); border-color:color-mix(in srgb,var(--mood) 82%,#000); }
/* "Best of This Week" medal numbers: white on gold/silver/lilac measured 2.1–2.3:1 and on bronze 4.0:1 — dark ink on
   the light medals, a deeper bronze under the white. */
.bfy .bfy-rank--best { color:#1B1725; }
.bfy .bfy-rank--best[style*="#B56A3F"] { --rank:#9A5530 !important; color:#fff; }

/* ── Discover ────────────────────────────────────────────────────────────────────────────────────────────── */
/* "Made for You Today": the app's dark card per tone, its label lifted on dark and deepened on light (4.1–4.4:1). */
body:not(.light) .bdv .bdv-recommendation { background:var(--bdv-tone-dark); }
body:not(.light) .bdv .bdv-recommendation-label { color:color-mix(in srgb,var(--bdv-accent) 50%,#fff); }
body.light .bdv .bdv-recommendation-label { color:color-mix(in srgb,var(--bdv-accent) 76%,#000); }
body:not(.light) .bdv .bdv-recommendation-author, body:not(.light) .bdv .bdv-recommendation-description { color:var(--bk-ink3); }
body:not(.light) .bdv .bdv-recommendation-tags > span { background:var(--bk-card); border-color:var(--bk-line); color:var(--bk-ink3); }
body.light .bdv .bdv-recommendation-author { color:var(--bk-ink4); }
/* The "See more" category card: white on the 10 % accent wash was 1.2:1 — the app's solid #2E2551 card. */
.bdv .bdv-category-more { background:#2E2551; }
.bdv .bdv-category-more > .bdv-icon { background:rgba(255,255,255,.14); }
.blv-stat-icon.is-orange { color:var(--bk-warnfg); }

/* ── Books vs Books (Discover card + Battle Detail): the app's dark BvB palette (BvbTheme.ts BVB_PALETTE.dark) ── */
.bdb .bdb-art-dark { display:none; }
body:not(.light) .bdb .bdb-art-light { display:none; }
body:not(.light) .bdb .bdb-art-dark { display:block; }
body:not(.light) .bdp[data-page=battle] { background:#150e26; }
body:not(.light) .bdb { border-color:rgba(168,120,255,.5); background:#150d28 url('/img/books-v2/battle/bg-dark.webp') center/100% 100% no-repeat; color:#fff; box-shadow:0 0 34px rgba(124,58,237,.25); }
body:not(.light) .bdb button:focus-visible { outline-color:#c4a6ff; }
body:not(.light) .bdb-header p, body:not(.light) .bdb-voting p, body:not(.light) .bdb-reasons p { color:#c4b5fd; }
body:not(.light) .bdb-book { border-color:rgba(244,114,182,.65); background:linear-gradient(140deg,rgba(236,72,153,.22),rgba(76,29,149,.35)); box-shadow:0 10px 28px rgba(0,0,0,.35),0 0 22px rgba(236,72,153,.2); }
body:not(.light) .bdb-right { border-color:rgba(96,165,250,.6); background:linear-gradient(140deg,rgba(59,130,246,.22),rgba(49,46,129,.4)); box-shadow:0 10px 28px rgba(0,0,0,.35),0 0 22px rgba(59,130,246,.2); }
body:not(.light) .bdb-cover { background:#241443; box-shadow:0 8px 20px rgba(0,0,0,.45); }
body:not(.light) .bdb-book > p, body:not(.light) .bdb-book h3 { color:#e3d5ff; }
body:not(.light) .bdb-book h3 { color:#fff; }
body:not(.light) .bdb-book > small, body:not(.light) .bdb-streak small, body:not(.light) .bdb-streak-stats span, body:not(.light) .bdb-schedule, body:not(.light) .bdb-footnote { color:#cbbcf0; }
body:not(.light) .bdb-progress > span { background:rgba(255,255,255,.16); }
body:not(.light) .bdb-progress b { background:rgba(30,15,58,.85); color:#e3d5ff; }
body:not(.light) .bdb-vs { color:#fff; background:radial-gradient(circle,rgba(60,32,110,.92) 45%,rgba(124,58,237,.35) 65%,transparent 75%); text-shadow:none; }
body:not(.light) .bdb-stats, body:not(.light) .bdb-voting, body:not(.light) .bdb-streak-stats { background:rgba(46,26,84,.55); border-color:rgba(168,120,255,.35); }
body:not(.light) .bdb-stats > span { color:#c084fc; }
body:not(.light) .bdb-stats > span + span, body:not(.light) .bdb-streak-stats span + span { border-color:rgba(196,181,253,.3); }
body:not(.light) .bdb-stats strong, body:not(.light) .bdb-streak-stats strong, body:not(.light) .bdb-voting h3, body:not(.light) .bdb-reasons h3, body:not(.light) .bdb-detail-header h2 { color:#fff; }
body:not(.light) .bdb-stats small { color:#c4b5fd; }
body:not(.light) .bdb-detail-header > span { color:#c084fc; }
body:not(.light) .bdb-detail-header button { color:#d8c5ff; }
body:not(.light) .bdb-detail-header .bdb-share { background:rgba(46,26,84,.6); border-color:rgba(168,120,255,.4); color:#d8c5ff; }
body:not(.light) :is(.bdb-book-actions button,.bdb-notice button,.bdb-reasons button,.bdb-refresh):not(.bdb-vote-left):not(.bdb-vote-right),
body:not(.light) .bdb-book-actions [data-battle-action="sample"] { background:rgba(30,15,58,.55); border-color:rgba(168,120,255,.4); color:#d8c5ff; }
body:not(.light) .bdb-reasons button[aria-pressed="true"] { background:rgba(124,58,237,.45); border-color:#c4a6ff; color:#fff; box-shadow:inset 0 0 0 1px #c4a6ff; }
body:not(.light) .bdb-detail-link { background:rgba(46,26,84,.7); border-color:rgba(168,120,255,.45); color:#d8c5ff; }
body:not(.light) .bdb-notice { background:rgba(120,53,15,.4); border-color:rgba(251,146,60,.45); color:#fed7aa; }
body:not(.light) .bdb-reasons { background:rgba(30,15,58,.6); border-color:rgba(168,120,255,.35); }
body:not(.light) .bdb-reasons [role="alert"] { color:#ff8a80; }
body:not(.light) .bdb-streak { background:rgba(30,15,58,.6); border-color:rgba(168,120,255,.45); color:#fff; }
body:not(.light) .bdb-week i { background:rgba(196,181,253,.22); }
body:not(.light) .bdb-week i.today { background:rgba(216,197,255,.5); }
body:not(.light) .bdb-week i.filled { background:#c026d3; }
body:not(.light) .bdb-footnote { border-color:rgba(196,181,253,.3); }
body:not(.light) .bdv-battle:empty { background:linear-gradient(135deg,#150d28,#1c1033); }

/* ── Book page (css/bookpage.css, batch 4): the review composer card and the gift picker were fixed pastels, so
      they stayed light on the dark page. Dark: the same hues as deep tints, light ink. ──────────────────────── */
body:not(.light) .bp-compose-card { background:linear-gradient(135deg,#2E1F3D,#2A2147); color:#F2EEFA; }
body:not(.light) .bp-compose-card h3 { color:#F2EEFA; }
body:not(.light) .bp-compose-card p { color:#CBC3DE; }
body:not(.light) .bp-trust span { color:#D8C5FF; }
body:not(.light) .bp-trust span:last-child { color:#FF9DB8; }
body:not(.light) .bp-gifts { background:linear-gradient(135deg,#231D38,#2A1E33,#29231A); border-color:var(--bk-line); color:var(--bk-ink2); }
body:not(.light) .bp-gifts h3 { color:#C3ABFF; }
body:not(.light) .bp-gift-group { background:#2E2551; border-color:#463C63; }
body:not(.light) .bp-gift-group.is-pink { background:#3A1428; border-color:#5A2440; }
body:not(.light) .bp-gift-group.is-gold { background:#3A2711; border-color:#5A4020; }
body:not(.light) .bp-gift-group strong { color:#C3ABFF; }
body:not(.light) .bp-gift-group.is-pink strong { color:#FF8AA3; }
body:not(.light) .bp-gift-group.is-gold strong { color:#EDA95A; }
body:not(.light) .bp-gift-group small, body:not(.light) .bp-gifts > p { color:var(--bk-ink4); }
body:not(.light) .bp-gift em { color:var(--bk-ink2); }

/* ── Both themes: white text on light art (measured 2.6–4.5:1) ───────────────────────────────────────────────── */
/* Category card counts were 88 % white over the card colour (4.0:1). */
.bdv .bdv-category small, .bdp-card small { color:#fff; }
/* Vote buttons: white on the light end of the pink/blue gradients (2.6–4.5:1) — the same hues, one step deeper. */
.bdb-vote-buttons button { background:linear-gradient(120deg,#c0257f,#8b3fd9); }
.bdb-vote-buttons .bdb-vote-right { background:linear-gradient(120deg,#1d6fc0,#5b4fd6); }
.bdb-book-actions .bdb-vote-left { background:linear-gradient(120deg,#b8288c,#8a3cc9); }
.bdb-book-actions .bdb-vote-right { background:linear-gradient(120deg,#1f6aa8,#6a48bd); }
/* The gold "See the championship bracket" banner keeps its own dark ink in both themes (white in dark was 1.2:1;
   the faded caption lines were 3.3–3.5:1 in light). */
.bdb-bracket-link, .bdp .bdb-bracket-link { color:#2b1d00; }
.bdb-bracket-copy small, .bdb-bracket-copy span { opacity:1; }

/* ── Header icons stay plain on Books (owner, 22 Oct): style.css paints a 42 % white bubble behind every
      .topbar-icon-btn with !important, which beat books-shell.css's `background:none`. ─────────────────────── */
body.on-books:has(#bookPage.books-mobile-v2) .topbar .topbar-icon-btn,
body.on-books:has(#bookPage.books-mobile-v2) .topbar .topbar-icon-btn:hover { background:none !important; box-shadow:none !important; }
/* Rating stars on the light canvas: #F5B93B was 1.6:1 — the app detail palette's darker star on light. */
body.light .bfy .bfy-metrics i { color:#B7791F; }
