/* Author bookshelf, from the 2026-09 build. Hand-written CSS on design tokens; no build step.
   Light theme: bright and photo-led, each book in its own colours. Dark theme: premium editorial navy and gold.
   Theme follows the device, with a manual override (html[data-scheme]). Mobile first. */

/* ================================================================== tokens */
:root {
  --paper-l: #f6f7f9;   --paper-d: #0b1020;
  --surface-l: #ffffff; --surface-d: #121a2b;
  --raised-l: #ffffff;  --raised-d: #182238;
  --sunken-l: #eef0f3;  --sunken-d: #0e1526;
  --ink-l: #151a26;     --ink-d: #f3eee4;
  --ink2-l: #3a4150;    --ink2-d: #d2cabb;
  --muted-l: #5d6472;   --muted-d: #a8a293;
  --line-l: #e2e6eb;    --line-d: #253049;
  --line2-l: #d2d7de;   --line2-d: #34405c;
  --control-l: #858c97; --control-d: #6b7899;
  --brand-l: #1b3334;   --brand-d: #e3b866;
  --on-brand-l: #ffffff; --on-brand-d: #1a1407;
  --gold-l: #8a5f17;    --gold-d: #e8c47f;
  --gold-deco-l: #c9a227; --gold-deco-d: #c9a227;
  --wash-l: #eef1f5;    --wash-d: #1c2640;
  --ok-l: #1d6b43;      --ok-d: #7fd3a1;
  --ok-bg-l: #e4f3ea;   --ok-bg-d: #12281e;
  --warn-l: #8a5a0a;    --warn-d: #f0c56e;
  --warn-bg-l: #fcf1d8; --warn-bg-d: #2b2312;
  --bad-l: #a8321f;     --bad-d: #f4a08c;
  --bad-bg-l: #fbe7e2;  --bad-bg-d: #2f1916;
  --info-l: #1d5591;    --info-d: #9cc8f0;
  --info-bg-l: #e5eef8; --info-bg-d: #132236;
  --star-l: #d89b16;    --star-d: #f2c14e;
  --shadow-sm-l: 0 1px 2px rgba(21, 26, 38, .06), 0 2px 6px rgba(21, 26, 38, .05);
  --shadow-l: 0 1px 2px rgba(21, 26, 38, .05), 0 10px 30px rgba(21, 26, 38, .09);
  --shadow-lg-l: 0 2px 6px rgba(21, 26, 38, .06), 0 24px 60px rgba(21, 26, 38, .16);
  --shadow-sm-d: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-d: 0 1px 2px rgba(0, 0, 0, .45), 0 12px 32px rgba(0, 0, 0, .4);
  --shadow-lg-d: 0 2px 6px rgba(0, 0, 0, .5), 0 28px 70px rgba(0, 0, 0, .55);

  --paper: var(--paper-l); --surface: var(--surface-l); --raised: var(--raised-l); --sunken: var(--sunken-l);
  --ink: var(--ink-l); --ink2: var(--ink2-l); --muted: var(--muted-l);
  --line: var(--line-l); --line2: var(--line2-l); --control: var(--control-l);
  --brand: var(--brand-l); --on-brand: var(--on-brand-l); --gold: var(--gold-l); --gold-deco: var(--gold-deco-l); --wash: var(--wash-l);
  --ok: var(--ok-l); --ok-bg: var(--ok-bg-l); --warn: var(--warn-l); --warn-bg: var(--warn-bg-l);
  --bad: var(--bad-l); --bad-bg: var(--bad-bg-l); --info: var(--info-l); --info-bg: var(--info-bg-l);
  --star: var(--star-l);
  --shadow-sm: var(--shadow-sm-l); --shadow: var(--shadow-l); --shadow-lg: var(--shadow-lg-l);
  /* Per-book colour world (set inline on .book-world); falls back to the site brand. */
  --book: var(--book-l, var(--brand)); --book2: var(--book2-l, var(--gold)); --on-book: var(--on-book-l, var(--on-brand));
  --book-tint: var(--book-tint-l, var(--wash));

  --display: "Sorts Mill Goudy", "Iowan Old Style", Georgia, serif; /* a classic book face; change with the brand */
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 32px);
  --appbar-h: 60px;
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);

  color-scheme: light dark;
  accent-color: var(--brand);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-scheme="light"]) {
    --paper: var(--paper-d); --surface: var(--surface-d); --raised: var(--raised-d); --sunken: var(--sunken-d);
    --ink: var(--ink-d); --ink2: var(--ink2-d); --muted: var(--muted-d);
    --line: var(--line-d); --line2: var(--line2-d); --control: var(--control-d);
    --brand: var(--brand-d); --on-brand: var(--on-brand-d); --gold: var(--gold-d); --gold-deco: var(--gold-deco-d); --wash: var(--wash-d);
    --ok: var(--ok-d); --ok-bg: var(--ok-bg-d); --warn: var(--warn-d); --warn-bg: var(--warn-bg-d);
    --bad: var(--bad-d); --bad-bg: var(--bad-bg-d); --info: var(--info-d); --info-bg: var(--info-bg-d);
    --star: var(--star-d);
    --shadow-sm: var(--shadow-sm-d); --shadow: var(--shadow-d); --shadow-lg: var(--shadow-lg-d);
    --book: var(--book-d, var(--brand)); --book2: var(--book2-d, var(--gold)); --on-book: var(--on-book-d, var(--on-brand));
    --book-tint: var(--book-tint-d, var(--wash));
  }
}
:root[data-scheme="dark"] {
  color-scheme: dark;
  --paper: var(--paper-d); --surface: var(--surface-d); --raised: var(--raised-d); --sunken: var(--sunken-d);
  --ink: var(--ink-d); --ink2: var(--ink2-d); --muted: var(--muted-d);
  --line: var(--line-d); --line2: var(--line2-d); --control: var(--control-d);
  --brand: var(--brand-d); --on-brand: var(--on-brand-d); --gold: var(--gold-d); --gold-deco: var(--gold-deco-d); --wash: var(--wash-d);
  --ok: var(--ok-d); --ok-bg: var(--ok-bg-d); --warn: var(--warn-d); --warn-bg: var(--warn-bg-d);
  --bad: var(--bad-d); --bad-bg: var(--bad-bg-d); --info: var(--info-d); --info-bg: var(--info-bg-d);
  --star: var(--star-d);
  --shadow-sm: var(--shadow-sm-d); --shadow: var(--shadow-d); --shadow-lg: var(--shadow-lg-d);
  --book: var(--book-d, var(--brand)); --book2: var(--book2-d, var(--gold)); --on-book: var(--on-book-d, var(--on-brand));
  --book-tint: var(--book-tint-d, var(--wash));
}
:root[data-scheme="light"] { color-scheme: light; }
/* The book-world variables are declared on the element, so re-resolve them there. */
.book-world { --book: var(--book-l); --book2: var(--book2-l); --on-book: var(--on-book-l); --book-tint: var(--book-tint-l); }
:root[data-scheme="dark"] .book-world { --book: var(--book-d); --book2: var(--book2-d); --on-book: var(--on-book-d); --book-tint: var(--book-tint-d); }
@media (prefers-color-scheme: dark) {
  :root:not([data-scheme="light"]) .book-world { --book: var(--book-d); --book2: var(--book2-d); --on-book: var(--on-book-d); --book-tint: var(--book-tint-d); }
}

/* ================================================================== base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--appbar-h) + var(--safe-top) + 64px); -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: clip;
}
img, picture, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 400; font-synthesis: none; line-height: 1.1; color: var(--ink); margin: 0 0 .5em; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.35rem + 2.8vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.2rem); }
h3 { font-size: 1.18rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 1em; text-wrap: pretty; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--gold-deco); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--gold-deco) 35%, transparent); }
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
small, .small { font-size: .875rem; }
.muted { color: var(--muted); }
.display { font-family: var(--display); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.icon { display: inline-block; vertical-align: -.2em; width: 1.15em; height: 1.15em; flex: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -80px; z-index: 300; background: var(--brand); color: var(--on-brand); padding: 10px 14px; border-radius: var(--radius-sm); }
.skip:focus { top: calc(10px + var(--safe-top)); }
.env-banner { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid currentColor; padding: .45rem 16px; font-size: .84rem; font-weight: 600; text-align: center; text-wrap: balance; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-narrow { max-width: 780px; }
.wrap-mid { max-width: 980px; }
.eyebrow { display: inline-block; font-family: var(--sans); font-size: .88rem; font-weight: 700; color: var(--gold); margin-bottom: 8px; }
.book-world .eyebrow { color: var(--book); }
.lede { font-size: clamp(1.05rem, 1rem + .35vw, 1.22rem); color: var(--ink2); max-width: 62ch; }
.page { flex: 1 0 auto; }
.stack { min-width: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: .16s var(--ease) both vt-out; }
  ::view-transition-new(root) { animation: .22s var(--ease) both vt-in; }
  ::view-transition-group(*) { animation-duration: .32s; animation-timing-function: var(--ease); }
  @keyframes vt-out { to { opacity: 0; } }
  @keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }
}

/* ================================================================== app bar (top) */
.appbar {
  position: sticky; top: 0; z-index: 60; padding-top: var(--safe-top);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  view-transition-name: appbar;
}
.appbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: var(--safe-top); background: #0e1628; }
.appbar-inner { max-width: var(--wrap); margin-inline: auto; height: var(--appbar-h); padding-inline: var(--gutter); display: flex; align-items: center; gap: 14px; }
.brandmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brandmark-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; flex: none; }
.brandmark-icon svg { width: 20px; height: 20px; }
.brandmark-text { display: grid; line-height: 1.05; min-width: 0; }
.brandmark-name { font-family: var(--display); font-weight: 400; font-size: 1.22rem; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brandmark-tag { font-size: .74rem; font-weight: 700; color: var(--gold); }
.appbar .appbar-back { display: none; }
.appbar-title { display: none; font-weight: 700; font-size: 1.02rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { display: flex; gap: 2px; margin-left: auto; }
.topnav a { color: var(--ink2); text-decoration: none; padding: 8px 14px; border-radius: 999px; font-size: .94rem; font-weight: 600; }
.topnav a:hover { background: var(--wash); color: var(--ink); }
.topnav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.appbar-tools { display: flex; align-items: center; gap: 4px; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--wash); }
.icon-btn .icon { width: 21px; height: 21px; }
.icon-btn .dot-count { position: absolute; top: 3px; right: 1px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--brand); color: var(--on-brand); font-size: .7rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--paper); }
.when-dark { display: none; }
:root[data-scheme="dark"] .when-dark { display: block; }
:root[data-scheme="dark"] .when-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-scheme="light"]) .when-dark { display: block; }
  :root:not([data-scheme="light"]) .when-light { display: none; }
}
.avatar-btn { width: 36px; height: 36px; border-radius: 999px; background: var(--book-tint); color: var(--ink); display: grid; place-items: center; font-weight: 700; font-size: .9rem; }

/* ================================================================== tab bar (bottom, phones) */
.tabbar { display: none; }
@media (max-width: 899px) {
  :root { --appbar-h: 56px; }
  body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom)); }
  .topnav, .appbar .hide-phone { display: none; }
  .appbar-tools { margin-left: auto; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; z-index: 70; left: 0; right: 0; bottom: 0;
    height: calc(var(--tabbar-h) + var(--safe-bottom)); padding: 6px 6px calc(6px + var(--safe-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(16px); backdrop-filter: saturate(1.4) blur(16px);
    border-top: 1px solid var(--line); view-transition-name: tabbar;
  }
  .tabbar a { position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .01em; border-radius: 14px; }
  .tabbar a .icon { width: 23px; height: 23px; }
  .tabbar a[aria-current="page"] { color: var(--ink); }
  .tabbar a[aria-current="page"] .tab-ico { background: var(--book-tint); }
  .tab-ico { display: grid; place-items: center; width: 52px; height: 30px; border-radius: 999px; transition: background .2s; }
  .tabbar .dot-count { position: absolute; top: 0; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--brand); color: var(--on-brand); font-size: .66rem; display: grid; place-items: center; border: 2px solid var(--surface); }
  /* Inner pages: back arrow and title like a native app bar. */
  .has-back .appbar-back { display: inline-grid; margin-left: -10px; }
  .has-back .brandmark { display: none; }
  .has-back .appbar-title { display: block; flex: 1; }
  .toasts { bottom: calc(var(--tabbar-h) + 14px + var(--safe-bottom)) !important; }
  .pwa-update { bottom: calc(var(--tabbar-h) + 12px + var(--safe-bottom)) !important; }
}
@media (max-width: 380px) { .brandmark-tag { display: none; } .brandmark-name { font-size: 1.02rem; } .icon-btn { width: 40px; } }

/* ================================================================== buttons, chips, controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 11px 22px;
  border-radius: 999px; border: 1px solid transparent; font: inherit; font-weight: 700; font-size: .96rem; line-height: 1.2; letter-spacing: .005em;
  text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .08s, box-shadow .15s; max-width: 100%; text-align: center; text-wrap: balance;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 86%, var(--ink)); }
.btn-book { background: var(--book); color: var(--on-book); box-shadow: 0 6px 18px color-mix(in srgb, var(--book) 30%, transparent); }
.btn-book:hover { background: color-mix(in srgb, var(--book) 88%, #000); }
.btn-accent { background: var(--gold-deco); color: #1a1305; }
.btn-accent:hover { background: color-mix(in srgb, var(--gold-deco) 88%, #000); }
.btn-quiet { background: var(--surface); border-color: var(--control); color: var(--ink); }
.btn-quiet:hover { border-color: var(--ink2); }
.btn-soft { background: var(--book-tint); color: var(--ink); }
.btn-soft:hover { background: color-mix(in srgb, var(--book-tint) 80%, var(--ink) 6%); }
.btn-ghost { background: transparent; color: var(--brand); padding-inline: 12px; }
.btn-ghost:hover { background: var(--wash); }
.btn-danger { background: transparent; border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-danger-solid { background: var(--bad); color: #fff; }
.btn-sm { min-height: 38px; padding: 7px 15px; font-size: .86rem; }
.btn-lg { min-height: 56px; padding: 15px 30px; font-size: 1.04rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid currentColor; border-color: var(--on-brand) transparent var(--on-brand) transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-book.is-loading::after { border-color: var(--on-book) transparent var(--on-book) transparent; }
.btn-quiet.is-loading::after, .btn-ghost.is-loading::after, .btn-soft.is-loading::after { border-color: var(--ink) transparent var(--ink) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.link-more { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; text-decoration: none; color: var(--brand); }
.link-more:hover { text-decoration: underline; }
.book-world .link-more { color: var(--book); }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: 0 calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--control); background: var(--surface); color: var(--ink2); font-weight: 600; font-size: .88rem; text-decoration: none; white-space: nowrap; cursor: pointer; font-family: inherit; }
.chip:hover { border-color: var(--ink2); color: var(--ink); }
.chip[aria-current="page"], .chip[aria-pressed="true"], .chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip .swatch { width: 10px; height: 10px; border-radius: 50%; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; padding: 5px; border-radius: 16px; background: var(--sunken); }
.segmented label { position: relative; display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; cursor: pointer; text-align: left; min-width: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented .seg-name { font-weight: 700; font-size: .92rem; }
.segmented .seg-sub { font-size: .8rem; color: var(--muted); }
.segmented label:has(input:checked) { background: var(--surface); box-shadow: var(--shadow-sm); outline: 2px solid var(--book); outline-offset: -2px; }
.segmented label:has(input:focus-visible) { outline: 3px solid var(--gold-deco); }
.segmented label.is-soon { cursor: default; }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--control); border-radius: 999px; background: var(--raised); height: 48px; }
.qty button { width: 44px; height: 46px; border: 0; background: none; color: var(--ink); cursor: pointer; display: grid; place-items: center; border-radius: 999px; }
.qty button:hover { background: var(--wash); }
.qty input { width: 42px; border: 0; background: none; text-align: center; font: inherit; font-weight: 700; color: var(--ink); -moz-appearance: textfield; appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-sm { height: 40px; } .qty-sm button { width: 38px; height: 38px; } .qty-sm input { width: 34px; }

.stars { display: inline-flex; gap: 2px; vertical-align: -2px; }
.star { width: 15px; height: 15px; background: linear-gradient(90deg, var(--star) var(--fill), color-mix(in srgb, var(--muted) 35%, transparent) var(--fill));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6.2 6.8.8-5 4.7 1.3 6.7L12 17.6l-6 3.3 1.3-6.7-5-4.7 6.8-.8z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6.2 6.8.8-5 4.7 1.3 6.7L12 17.6l-6 3.3 1.3-6.7-5-4.7 6.8-.8z'/%3E%3C/svg%3E") center/contain no-repeat; }
.stars-lg .star { width: 22px; height: 22px; }
.rating-line { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); text-decoration: none; }
.rating-line strong { color: var(--ink); }
.star-input { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.star-input input { position: absolute; opacity: 0; }
.star-input label { width: 38px; height: 38px; cursor: pointer; background: color-mix(in srgb, var(--muted) 35%, transparent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6.2 6.8.8-5 4.7 1.3 6.7L12 17.6l-6 3.3 1.3-6.7-5-4.7 6.8-.8z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6.2 6.8.8-5 4.7 1.3 6.7L12 17.6l-6 3.3 1.3-6.7-5-4.7 6.8-.8z'/%3E%3C/svg%3E") center/contain no-repeat; }
.star-input label:hover, .star-input label:hover ~ label, .star-input input:checked ~ label { background: var(--star); }
.star-input input:focus-visible + label { outline: 3px solid var(--gold-deco); outline-offset: 2px; }

/* ================================================================== badges, notes, toasts */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; line-height: 1.5; white-space: nowrap; background: var(--wash); color: var(--ink2); letter-spacing: .01em; }
.badge-success { background: var(--ok-bg); color: var(--ok); }
.badge-warning { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-book { background: var(--book); color: var(--on-book); }
.badge-gold { background: color-mix(in srgb, var(--gold-deco) 22%, transparent); color: var(--gold); }
.note { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--info-bg); color: var(--ink); border: 1px solid color-mix(in srgb, var(--info) 22%, transparent); }
.note .icon { color: var(--info); margin-top: 3px; }
.note p:last-child { margin: 0; }
.note-ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 25%, transparent); } .note-ok .icon { color: var(--ok); }
.note-warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 25%, transparent); } .note-warn .icon { color: var(--warn); }
.note-bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 25%, transparent); } .note-bad .icon { color: var(--bad); }
.toasts { position: fixed; z-index: 400; left: 50%; transform: translateX(-50%); bottom: calc(18px + var(--safe-bottom)); display: grid; gap: 8px; width: min(460px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow-lg); font-size: .94rem; animation: toast-in .24s var(--ease); }
.toast a { color: inherit; }
.toast .icon { margin-top: 2px; }
.toast-error { background: var(--bad); color: #fff; }
.toast-success .icon { color: var(--ok-d); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ================================================================== sections */
.section { padding: clamp(40px, 7vw, 88px) 0; }
.section-tight { padding: clamp(26px, 5vw, 48px) 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: clamp(20px, 3.5vw, 32px); }
.section-head h2 { margin: 0; }
.section-head p { margin: 6px 0 0; color: var(--muted); max-width: 62ch; }
.alt { background: var(--surface); }
.tinted { background: var(--book-tint); }
.page-head { padding: clamp(22px, 5vw, 44px) 0 18px; }
.page-head h1 { font-size: clamp(1.8rem, 1.4rem + 1.8vw, 2.7rem); margin-bottom: 6px; }
.page-head p { color: var(--muted); margin: 0; }
.crumbs { font-size: .86rem; color: var(--muted); margin: 18px 0 0; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }

/* ================================================================== covers */
.cover { display: block; position: relative; }
.cover img { width: 100%; border-radius: 3px 6px 6px 3px; box-shadow: 0 2px 4px rgba(0, 0, 0, .14), 0 16px 34px rgba(20, 20, 30, .24); }
.cover::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 6%; border-radius: 3px 0 0 3px; pointer-events: none; background: linear-gradient(90deg, rgba(0, 0, 0, .18), rgba(255, 255, 255, .12) 45%, transparent); }
.cover-typeset {
  aspect-ratio: 2 / 3; width: 100%; border-radius: 3px 6px 6px 3px; padding: 12% 11%; display: flex; flex-direction: column; justify-content: flex-start; gap: 10px;
  background: linear-gradient(160deg, #1d3350, #0f1b2c 70%); color: #f3ead7; box-shadow: 0 2px 4px rgba(0, 0, 0, .15), 0 14px 30px rgba(10, 16, 28, .3); overflow: hidden; container-type: inline-size;
}
.ct-author { font-family: var(--sans); font-size: max(9px, 6.4cqi); letter-spacing: .22em; text-transform: uppercase; color: #d8ab5b; font-weight: 700; }
.ct-title { font-family: var(--display); font-size: max(15px, 11.5cqi); line-height: 1.08; font-weight: 400; font-synthesis: none; margin-top: auto; text-wrap: balance; }
.ct-sub { font-family: var(--display); font-style: italic; font-size: max(10px, 6cqi); color: #d9cdb4; line-height: 1.3; }
.ct-rule { display: block; height: 2px; width: 34%; background: #d8ab5b; margin-top: 6px; }
@container (max-width: 120px) { .ct-author, .ct-sub { display: none; } .ct-title { font-size: 15cqi; } }
:root[data-scheme="dark"] .cover img { outline: 1px solid rgba(255, 255, 255, .1); outline-offset: -1px; }
@media (prefers-color-scheme: dark) { :root:not([data-scheme="light"]) .cover img { outline: 1px solid rgba(255, 255, 255, .1); outline-offset: -1px; } }

/* ================================================================== home: hero stage */
.stage { position: relative; overflow: hidden; background: var(--book-tint); border-bottom: 1px solid var(--line); }
.stage-slides { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.stage-slides::-webkit-scrollbar { display: none; }
.slide { scroll-snap-align: start; position: relative; min-width: 0; background: var(--book-tint); }
.slide::before { content: ""; position: absolute; inset: 0; background:
  radial-gradient(900px 500px at 85% 20%, color-mix(in srgb, var(--book) 22%, transparent), transparent 65%),
  radial-gradient(600px 400px at 0% 100%, color-mix(in srgb, var(--book2) 18%, transparent), transparent 70%); pointer-events: none; }
.slide-inner { position: relative; max-width: var(--wrap); margin-inline: auto; padding: clamp(28px, 6vw, 72px) var(--gutter) clamp(56px, 7vw, 84px); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(24px, 5vw, 64px); align-items: center; }
.slide h2 { font-size: clamp(2.1rem, 1.3rem + 3.4vw, 3.9rem); margin-bottom: 14px; line-height: 1.02; }
.slide .tagline { font-family: var(--display); font-style: italic; font-size: clamp(1.02rem, .95rem + .4vw, 1.25rem); color: var(--book); margin-bottom: 12px; }
.slide .lede { margin-bottom: 22px; }
.slide-buy { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.slide-price { display: grid; line-height: 1.15; margin-right: 6px; }
.slide-price .price { font-size: 1.7rem; }
.slide-art { position: relative; display: grid; place-items: center; min-height: 300px; }
.slide-art .cover { width: min(64%, 300px); transform: rotate(-2deg); z-index: 2; }
.slide-photo { position: absolute; right: -4%; bottom: -8%; width: 62%; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-lg); transform: rotate(4deg); z-index: 1; border: 6px solid var(--surface); }
.slide-photo img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.slide-photo + .cover { transform: translate(-18%, -4%) rotate(-3deg); }
.stage-dots { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 8px; z-index: 5; }
/* Each dot is a full 24px tap target; the visible dot is drawn inside it. */
.stage-dots { gap: 2px; }
.stage-dots button { width: 24px; height: 24px; padding: 0; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; border-radius: 999px; transition: width .25s var(--ease); }
.stage-dots button::after { content: ""; width: 10px; height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 25%, transparent); transition: width .25s var(--ease), background .25s; }
.stage-dots button[aria-current="true"] { width: 36px; }
.stage-dots button[aria-current="true"]::after { width: 28px; background: var(--ink); }
.stage-arrows { position: absolute; right: max(var(--gutter), calc((100vw - var(--wrap)) / 2 + var(--gutter))); bottom: 14px; display: flex; gap: 8px; z-index: 5; }
.stage-arrows .icon-btn { background: var(--surface); box-shadow: var(--shadow-sm); }
@media (max-width: 760px) {
  .slide-inner { grid-template-columns: minmax(0, 1fr); gap: 14px; padding-top: 18px; padding-bottom: 58px; }
  .slide-art { order: -1; min-height: 0; padding: 4px 0 0; height: 210px; }
  .slide-art .cover { width: auto; height: 200px; }
  .slide-art .cover img { width: auto; height: 200px; }
  .slide-photo { width: 46%; right: 2%; bottom: 0; border-width: 4px; }
  .slide-photo + .cover { transform: translate(-22%, 0) rotate(-3deg); }
  .slide h2 { font-size: clamp(1.8rem, 1.2rem + 3vw, 2.3rem); margin-bottom: 10px; }
  .slide .lede { font-size: 1rem; margin-bottom: 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .stage-arrows { display: none; }
}

/* ================================================================== trust strip */
.trust { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 24px; padding: 6px 0 4px; border-bottom: 1px solid var(--line); padding-bottom: 22px; }
.trust > div { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: center; min-width: 0; }
.trust .icon { width: 22px; height: 22px; color: var(--gold); }
.trust .ti { width: 40px; height: 40px; border-radius: 12px; background: var(--wash); display: grid; place-items: center; }
.trust strong { display: block; font-size: .92rem; line-height: 1.25; }
.trust span { font-size: .8rem; color: var(--muted); line-height: 1.3; display: block; }
@media (max-width: 900px) { .trust { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .trust > div { grid-template-columns: 1fr; gap: 8px; } }

/* ================================================================== product cards and rails */
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 4px var(--gutter) 18px; margin: 0 calc(-1 * var(--gutter)); scroll-padding-inline: var(--gutter); }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }
.rail-nav { display: flex; gap: 6px; }
.rail-nav .icon-btn { border: 1px solid var(--line2); background: var(--surface); }
@media (max-width: 899px) { .rail-nav { display: none; } }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: clamp(16px, 2.5vw, 26px); }
.pcard { position: relative; display: grid; grid-template-rows: auto 1fr; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); overflow: hidden; min-width: 0; transition: border-color .15s; }
.pcard:hover { border-color: var(--line2); }
.pcard-art { position: relative; display: grid; place-items: end center; height: 290px; padding: 26px 26px 0; background: var(--book-tint); text-decoration: none; overflow: hidden; }
.pcard-art::before { content: ""; position: absolute; inset: 0; background: radial-gradient(420px 260px at 50% 110%, color-mix(in srgb, var(--book) 26%, transparent), transparent 70%); }
.pcard-art .cover { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.pcard-art .cover img { width: auto; max-height: 100%; max-width: 100%; }
.pcard-art .cover-typeset { width: auto; height: 100%; }
.pcard .badge { position: absolute; top: 14px; left: 14px; z-index: 2; }
.pcard-fav { position: absolute; top: 10px; right: 10px; z-index: 3; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); }
.pcard-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pcard-body h3 { font-size: 1.35rem; margin: 0; }
.pcard-body h3 a { color: inherit; text-decoration: none; }
.pcard-body h3 a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.pcard-sub { color: var(--muted); font-size: .88rem; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-buy { margin-top: auto; padding-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pcard-buy form, .pcard-buy .btn { position: relative; z-index: 2; }
.price { font-family: var(--sans); font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: lining-nums tabular-nums; }
.price-was { font-size: .86rem; color: var(--muted); text-decoration: line-through; margin-left: 6px; }
.price-pending { font-family: var(--sans); font-size: .9rem; font-weight: 600; color: var(--muted); }
.stock-tag { font-size: .8rem; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.stock-in { color: var(--ok); } .stock-low { color: var(--warn); } .stock-out { color: var(--bad); }

/* frequently bought together */
.fbt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: clamp(16px, 3vw, 28px); align-items: center; padding: clamp(18px, 3vw, 26px); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.fbt-covers { display: flex; align-items: center; gap: 10px; }
.fbt-covers .cover { width: 84px; }
.fbt-plus { width: 30px; height: 30px; border-radius: 999px; background: var(--wash); display: grid; place-items: center; color: var(--muted); }
.fbt h3 { margin: 0 0 4px; }
.fbt p { margin: 0; color: var(--muted); font-size: .92rem; }
.fbt-buy { display: grid; justify-items: end; gap: 8px; }
.save-tag { font-size: .82rem; font-weight: 700; color: var(--ok); }
/* The set card lays itself out by its own width (it sits in a half-width column on desktop). */
.fbt-wrap { container-type: inline-size; }
@container (max-width: 760px) {
  .fbt { grid-template-columns: auto minmax(0, 1fr); }
  .fbt-buy { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding-top: 14px; border-top: 1px solid var(--line); }
  .fbt-buy form { margin-left: auto; }
}
@container (max-width: 470px) {
  .fbt { grid-template-columns: minmax(0, 1fr); }
  .fbt-buy form { margin-left: 0; }
}

/* ================================================================== promise, tools, outline */
.promise { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 22px; }
.promise li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; align-items: start; color: var(--ink2); }
.promise li::before { content: ""; width: 24px; height: 24px; border-radius: 8px; background: var(--book-tint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/14px no-repeat; margin-top: 1px; }
:root[data-scheme="dark"] .promise li::before { filter: invert(1); background-color: color-mix(in srgb, var(--book-tint) 60%, #fff); }
@media (prefers-color-scheme: dark) { :root:not([data-scheme="light"]) .promise li::before { filter: invert(1); background-color: color-mix(in srgb, var(--book-tint) 60%, #fff); } }
@media (max-width: 720px) { .promise { grid-template-columns: minmax(0, 1fr); } }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.tool { padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--book2); min-width: 0; }
.tool strong { display: block; font-size: .98rem; margin-bottom: 4px; }
.tool span { font-size: .88rem; color: var(--muted); }
.outline { display: grid; gap: 10px; }
.outline details { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.outline summary { list-style: none; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 18px; cursor: pointer; }
.outline summary::-webkit-details-marker { display: none; }
.outline summary:hover { background: var(--wash); }
.part-no { width: 52px; height: 52px; border-radius: 14px; background: var(--book-tint); color: var(--book); display: grid; place-items: center; font-family: var(--display); font-weight: 400; font-size: 1.5rem; line-height: 1; text-align: center; }
.part-no small { display: block; font-family: var(--sans); font-size: .66rem; font-weight: 700; }
.outline summary h3 { margin: 0 0 2px; font-size: 1.08rem; }
.outline summary p { margin: 0; font-size: .88rem; color: var(--muted); }
.outline .chev { transition: transform .2s var(--ease); color: var(--muted); }
.outline details[open] .chev { transform: rotate(180deg); }
.chapters { list-style: none; margin: 0; padding: 0 18px 12px 84px; }
.chapters li { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.chapters .ch-no { font-weight: 700; color: var(--book); font-variant-numeric: tabular-nums; font-size: .9rem; }
.chapters strong { display: block; font-size: .96rem; }
.chapters span { font-size: .87rem; color: var(--muted); }
.chapters .ch-page { font-size: .78rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 600px) { .chapters { padding-left: 18px; } .outline summary { grid-template-columns: 44px minmax(0, 1fr) auto; } .part-no { width: 44px; height: 44px; } }

/* ================================================================== book page */
.book-top { padding: 14px 0 clamp(30px, 5vw, 56px); background: linear-gradient(var(--book-tint), var(--paper) 88%); }
.book-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(22px, 5vw, 64px); align-items: start; }
.gallery { position: sticky; top: calc(var(--appbar-h) + var(--safe-top) + 16px); display: grid; gap: 12px; min-width: 0; }
.gallery-main { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.gallery-main::-webkit-scrollbar { display: none; }
.gallery-main > * { scroll-snap-align: center; display: grid; place-items: center; height: min(560px, 44vw); padding: clamp(16px, 3vw, 34px); min-width: 0; min-height: 0; overflow: hidden; position: relative; }
.gallery-main .cover { height: 100%; display: flex; align-items: center; justify-content: center; min-height: 0; }
.gallery-main .cover img { height: 100%; max-height: 100%; width: auto; max-width: 100%; object-fit: contain; }
.gallery-main .cover-typeset { height: 100%; width: auto; }
.gallery-main .g-photo { padding: 0; overflow: hidden; }
.gallery-main .g-photo img { width: 100%; height: 100%; object-fit: cover; }
.gallery-main .g-page img { height: 100%; width: auto; max-width: 100%; object-fit: contain; background: #fff; border-radius: 4px; box-shadow: var(--shadow); }
.gallery-main .g-cap { position: absolute; left: 12px; bottom: 12px; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 75%, transparent); color: var(--paper); font-size: .76rem; font-weight: 600; }
.gallery-thumbs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.gallery-thumbs button { flex: none; width: 64px; height: 64px; padding: 4px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; overflow: hidden; }
.gallery-thumbs button[aria-current="true"] { border-color: var(--book); }
.gallery-thumbs img { max-height: 100%; width: auto; border-radius: 4px; }
.gallery-thumbs .t-photo img { width: 100%; height: 100%; object-fit: cover; }
.book-info h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3rem); margin-bottom: 8px; }
.book-tagline { font-family: var(--display); font-style: italic; color: var(--book); font-size: 1.08rem; margin: 0 0 6px; }
.book-sub { font-size: 1.04rem; color: var(--ink2); margin: 0 0 10px; }
.byline { color: var(--muted); margin: 0 0 12px; font-size: .95rem; }
.byline a { color: var(--ink); font-weight: 700; }
.book-meta-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 18px; font-size: .88rem; color: var(--muted); }
.buybox { display: grid; gap: 16px; padding: clamp(16px, 3vw, 22px); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.buybox-price { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.buybox-price .price { font-size: 2rem; }
.tier-note { display: flex; gap: 8px; align-items: center; font-size: .86rem; color: var(--ok); font-weight: 600; margin: 2px 0 0; }
.buy-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.buy-row .btn { flex: 1 1 150px; white-space: nowrap; }
/* With the quantity stepper, "Buy now" takes its own row so no label ever wraps. */
.buy-row:has(.qty) .btn[name="buy"] { flex-basis: 100%; }
.buy-note { font-size: .86rem; color: var(--muted); display: flex; gap: 10px; align-items: flex-start; margin: 0; }
.buy-note .icon { margin-top: 3px; color: var(--book); }
.buy-note strong { color: var(--ink); }
.promise-box { display: grid; gap: 10px; padding-top: 14px; border-top: 1px dashed var(--line2); }
.soon-box { display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: var(--book-tint); }
.soon-box form { display: flex; gap: 8px; flex-wrap: wrap; }
.soon-box .input { flex: 1 1 200px; min-height: 44px; }
.fav-btn[aria-pressed="true"] .icon { fill: var(--bad); color: var(--bad); }
.book-tabs { position: sticky; top: calc(var(--appbar-h) + var(--safe-top)); z-index: 40; background: color-mix(in srgb, var(--paper) 92%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.book-tabs nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.book-tabs nav::-webkit-scrollbar { display: none; }
.book-tabs a { flex: none; padding: 14px 14px 12px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: .9rem; border-bottom: 3px solid transparent; }
.book-tabs a:hover { color: var(--ink); }
.book-tabs a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--book); }
.overview { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 60px); }
.prose { max-width: 70ch; }
.prose p { color: var(--ink2); }
.pullquote { margin: 0; padding: 22px 24px; border-radius: var(--radius); background: var(--book-tint); font-family: var(--display); font-size: 1.14rem; line-height: 1.5; font-style: italic; }
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ticks li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; color: var(--ink2); }
.ticks li::before { content: ""; width: 8px; height: 8px; margin: 9px 0 0 6px; border-radius: 50%; background: var(--book2); }
.meta-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 24px; margin: 0; font-size: .95rem; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; font-weight: 600; }
.sticky-buy { position: fixed; z-index: 65; left: 0; right: 0; bottom: 0; padding: 10px var(--gutter) calc(10px + var(--safe-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; transform: translateY(110%); transition: transform .25s var(--ease); }
.sticky-buy.show { transform: none; }
.sticky-buy .cover { width: 34px; flex: none; }
.sticky-buy .sb-info { flex: 1; min-width: 0; line-height: 1.2; }
.sticky-buy .sb-info strong { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sticky-buy .price { font-size: 1.05rem; }
.sticky-buy form { flex: none; }
@media (max-width: 899px) { .sticky-buy { bottom: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: 10px; } }
@media (min-width: 900px) { .sticky-buy { left: auto; right: 24px; bottom: 24px; width: 440px; border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); } }
@media (max-width: 860px) {
  .book-hero { grid-template-columns: minmax(0, 1fr); }
  .gallery { position: static; }
  .gallery-main > * { height: min(74vw, 420px); }
  .overview { grid-template-columns: minmax(0, 1fr); }
}

/* samples and endorsements */
.samples { display: grid; grid-auto-flow: column; grid-auto-columns: 160px; gap: 14px; overflow-x: auto; padding: 4px var(--gutter) 16px; margin: 0 calc(-1 * var(--gutter)); scroll-snap-type: x mandatory; scrollbar-width: none; }
.samples::-webkit-scrollbar { display: none; }
.sample-thumb { scroll-snap-align: start; cursor: zoom-in; text-decoration: none; color: inherit; }
.sample-thumb img { border-radius: 6px; border: 1px solid var(--line); box-shadow: var(--shadow); background: #fff; transition: transform .2s var(--ease); }
.sample-thumb:hover img { outline: 2px solid var(--book); outline-offset: 2px; }
.sample-thumb span { display: block; font-size: .8rem; color: var(--muted); margin-top: 8px; font-weight: 600; }
.quotes { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(300px, 400px); gap: 16px; overflow-x: auto; padding: 4px var(--gutter) 18px; margin: 0 calc(-1 * var(--gutter)); scroll-snap-type: x mandatory; scrollbar-width: none; }
.quotes::-webkit-scrollbar { display: none; }
.quote { scroll-snap-align: start; margin: 0; padding: 22px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.quote blockquote { margin: 0; font-family: var(--display); font-size: 1.02rem; line-height: 1.55; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical; overflow: hidden; }
.quote blockquote::before { content: "\201C"; display: block; font-size: 2.6rem; line-height: .5; color: var(--book2); margin: 10px 0 6px; }
.quote figcaption { margin-top: auto; font-size: .84rem; color: var(--muted); display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; align-items: center; }
.quote figcaption strong { display: block; color: var(--ink); font-size: .92rem; }
.initials { width: 40px; height: 40px; border-radius: 999px; background: var(--book-tint); color: var(--book); display: grid; place-items: center; font-weight: 800; font-size: .86rem; }
@media (max-width: 520px) { .quotes { grid-auto-columns: 86%; } }

/* ================================================================== reviews */
.review-summary { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: clamp(20px, 4vw, 44px); align-items: start; }
.rs-score { display: grid; gap: 6px; }
.rs-score .big { font-family: var(--sans); font-size: 3rem; font-weight: 800; line-height: 1; }
.histo { display: grid; gap: 6px; }
.histo div { display: grid; grid-template-columns: 52px minmax(0, 1fr) 36px; gap: 10px; align-items: center; font-size: .84rem; color: var(--muted); }
.histo .bar { height: 9px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.histo .bar span { display: block; height: 100%; border-radius: inherit; background: var(--star); }
.reviews { display: grid; gap: 14px; margin-top: 24px; }
.review { padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.review-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 6px; }
.review h4 { margin: 0 0 6px; font-family: var(--sans); font-size: 1rem; font-weight: 700; }
.review p { color: var(--ink2); margin: 0 0 8px; }
.verified { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; color: var(--ok); }
.author-reply { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--book-tint); font-size: .92rem; }
.post-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.post-actions .btn { min-height: 34px; padding: 5px 12px; font-size: .82rem; }
.helpful[aria-pressed="true"] { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
@media (max-width: 700px) { .review-summary { grid-template-columns: minmax(0, 1fr); } }

/* ================================================================== community */
.forum-head { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 22px 0 14px; }
.forum-head .cover { width: 72px; }
.forum-head h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.2rem); margin: 0 0 4px; }
.forum-head p { margin: 0; color: var(--muted); font-size: .92rem; }
@media (max-width: 640px) { .forum-head { grid-template-columns: 56px minmax(0, 1fr); } .forum-head .cover { width: 56px; } .forum-head .fh-cta { grid-column: 1 / -1; } }
.forum-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.forum-tools .search { flex: 1 1 220px; position: relative; }
.forum-tools .search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.forum-tools .search .input { padding-left: 42px; min-height: 44px; border-radius: 999px; }
.forum-tools .forum-chapter { flex: 0 1 260px; min-width: 0; max-width: 100%; min-height: 44px; border-radius: 999px; }
@media (max-width: 520px) { .forum-tools .forum-chapter { flex-basis: 100%; } }
.threads { display: grid; gap: 10px; }
.thread-card { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s; }
.thread-card:hover { border-color: var(--line2); box-shadow: var(--shadow-sm); }
.thread-card h3 { font-family: var(--sans); font-size: 1rem; font-weight: 700; margin: 0 0 4px; line-height: 1.35; }
.thread-card h3 a { color: inherit; text-decoration: none; }
.thread-card h3 a::after { content: ""; position: absolute; inset: 0; }
.thread-card p { margin: 0; font-size: .88rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thread-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 8px; font-size: .78rem; color: var(--muted); }
.thread-stats { display: grid; justify-items: center; gap: 2px; min-width: 50px; font-size: .74rem; color: var(--muted); }
.thread-stats strong { font-size: 1.1rem; color: var(--ink); }
.avatar { width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center; font-weight: 800; font-size: .95rem; background: var(--wash); color: var(--ink2); flex: none; }
.avatar-anon { background: repeating-linear-gradient(45deg, var(--wash), var(--wash) 5px, var(--sunken) 5px, var(--sunken) 10px); }
.avatar-author { background: var(--brand); color: var(--on-brand); }
.avatar-sm { width: 34px; height: 34px; font-size: .78rem; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; background: var(--book-tint); color: var(--ink2); font-size: .74rem; font-weight: 700; }
.tag-author { background: var(--brand); color: var(--on-brand); }
.tag-pin { background: var(--warn-bg); color: var(--warn); }
.thread-view { display: grid; gap: 14px; }
.post { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.post-first { border-color: color-mix(in srgb, var(--book) 40%, var(--line)); }
.post-by-author { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); background: color-mix(in srgb, var(--brand) 5%, var(--surface)); }
.post-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 6px; font-size: .84rem; color: var(--muted); }
.post-head strong { color: var(--ink); font-size: .94rem; }
.post-body p { margin: 0 0 .8em; color: var(--ink2); overflow-wrap: anywhere; }
.post-body p:last-child { margin: 0; }
.post-pending { opacity: .75; border-style: dashed; }
.composer { display: grid; gap: 12px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line2); }
.composer .textarea { min-height: 120px; }
.anon-toggle { display: flex; gap: 10px; align-items: center; font-size: .9rem; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 210px; padding: 6px; border-radius: 14px; background: var(--raised); border: 1px solid var(--line); box-shadow: var(--shadow-lg); display: grid; }
.menu-list button, .menu-list a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; border: 0; background: none; color: var(--ink); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; text-decoration: none; }
.menu-list button:hover, .menu-list a:hover { background: var(--wash); }
.fab { position: fixed; z-index: 64; right: 18px; bottom: calc(var(--tabbar-h) + 16px + var(--safe-bottom)); box-shadow: var(--shadow-lg); }
@media (min-width: 900px) { .fab { display: none; } }

/* ================================================================== account */
.acct-hero { display: flex; gap: 16px; align-items: center; padding: 24px 0 18px; }
.acct-hero .avatar { width: 60px; height: 60px; font-size: 1.3rem; background: var(--brand); color: var(--on-brand); }
.acct-hero h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.2rem); margin: 0; }
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px; margin-bottom: 26px; }
.acct-card { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; }
.acct-card:hover { border-color: var(--line2); box-shadow: var(--shadow-sm); }
.acct-card .ai { width: 44px; height: 44px; border-radius: 14px; background: var(--wash); display: grid; place-items: center; }
.acct-card .ai .icon { width: 22px; height: 22px; color: var(--gold); }
.acct-card strong { display: block; }
.acct-card span { font-size: .84rem; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.list > li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .cover { width: 46px; }
.list strong { display: block; }
.list .sub { font-size: .84rem; color: var(--muted); }
.otp { display: flex; gap: 8px; }
.otp-input { letter-spacing: .5em; font-size: 1.5rem !important; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.auth-panel { width: min(440px, 100%); margin: clamp(24px, 6vw, 60px) auto; padding: clamp(22px, 5vw, 34px); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.auth-panel h1 { font-size: 1.7rem; }
.danger-zone { border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--line)); border-radius: var(--radius); padding: 18px; }

/* ================================================================== dialogs, sheets, viewer */
dialog { border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); max-width: min(560px, calc(100vw - 24px)); width: 100%; }
dialog::backdrop { background: rgba(8, 11, 20, .6); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dlg-body { padding: 24px; }
.dlg-body h2 { font-size: 1.35rem; margin-bottom: 8px; }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 0 24px 22px; }
@media (max-width: 640px) {
  dialog.sheet { margin: auto 0 0; max-width: 100vw; border-radius: 24px 24px 0 0; padding-bottom: var(--safe-bottom); animation: sheet-in .28s var(--ease); }
  dialog.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line2); margin: 10px auto 0; }
}
@keyframes sheet-in { from { transform: translateY(100%); } }
.viewer { max-width: min(900px, calc(100vw - 16px)); background: #111; color: #eee; }
.viewer-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.viewer-bar .grow { flex: 1; font-size: .9rem; }
.viewer-bar .icon-btn { color: #eee; }
.viewer-bar .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.viewer-page { display: grid; place-items: center; padding: 0 12px 14px; }
.viewer-page img { max-height: calc(100dvh - 120px); width: auto; background: #fff; border-radius: 3px; }

/* ================================================================== forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field label, .label { font-weight: 600; font-size: .93rem; color: var(--ink); }
.field .opt { font-weight: 400; color: var(--muted); font-size: .85rem; }
.input, .select, .textarea {
  width: 100%; min-height: 50px; padding: 12px 15px; border-radius: 12px; border: 1px solid var(--control);
  background: var(--raised); color: var(--ink); font: inherit; font-size: 16px; transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
.select { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 22px, calc(100% - 15px) 22px; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--book); box-shadow: 0 0 0 3px color-mix(in srgb, var(--book) 22%, transparent); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--bad); }
.hint { font-size: .84rem; color: var(--muted); margin: 0; }
.err { font-size: .86rem; color: var(--bad); margin: 0; font-weight: 600; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-family: var(--display); font-weight: 400; font-size: 1.4rem; padding: 0; margin-bottom: 12px; }
.choices { display: grid; gap: 10px; }
.choice { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 16px; border: 1px solid var(--control); border-radius: var(--radius); background: var(--raised); cursor: pointer; }
.choice:hover { border-color: var(--ink2); }
.choice input { width: 20px; height: 20px; margin: 2px 0 0; }
.choice strong { display: block; font-weight: 700; }
.choice span { color: var(--muted); font-size: .88rem; }
.choice .choice-price { font-weight: 700; color: var(--ink); white-space: nowrap; }
.choice:has(input:checked) { border-color: var(--book); box-shadow: 0 0 0 1px var(--book); }
.choice:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.switch { display: flex; gap: 12px; align-items: center; justify-content: space-between; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 48px; height: 28px; border-radius: 999px; background: var(--line2); position: relative; cursor: pointer; flex: none; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease); }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(20px); }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.form-section { padding: 22px 0; border-top: 1px solid var(--line); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.promo-form { display: flex; gap: 8px; }
.promo-form .input { min-height: 44px; text-transform: uppercase; }

/* ================================================================== basket, checkout, order */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 390px); gap: clamp(22px, 4vw, 44px); align-items: start; padding-bottom: 60px; }
@media (max-width: 900px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.line { display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; gap: 16px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); align-items: start; }
.line .cover { width: 78px; }
.line h3 { font-size: 1.04rem; margin: 0 0 4px; font-family: var(--sans); font-weight: 700; }
.line h3 a { color: inherit; text-decoration: none; }
.line-sub { font-size: .86rem; color: var(--muted); margin: 0 0 10px; }
.line-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.line-total { font-weight: 800; text-align: right; white-space: nowrap; }
@media (max-width: 520px) { .line { grid-template-columns: 62px minmax(0, 1fr); } .line .cover { width: 62px; } .line-total { grid-column: 2; text-align: left; } }
.summary { position: sticky; top: calc(var(--appbar-h) + var(--safe-top) + 16px); border-radius: var(--radius-lg); padding: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.summary h2 { font-size: 1.3rem; margin-bottom: 14px; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; }
.sum-row span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.sum-save span:last-child { color: var(--ok); font-weight: 700; }
.sum-total { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 12px; font-weight: 800; font-size: 1.16rem; }
.sum-items { list-style: none; margin: 0 0 12px; padding: 0 0 12px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; font-size: .9rem; }
.sum-items li { display: flex; justify-content: space-between; gap: 12px; }
/* Payment picker on the order page: native radios, so it works without script and with a keyboard. */
.paypick { border: 0; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; min-width: 0; }
.paypick legend, .legend-sm { font-family: var(--sans); font-weight: 700; font-size: 1rem; margin-bottom: 8px; padding: 0; }
.pp-opt { border: 1px solid var(--line); border-radius: var(--radius); background: var(--raised); overflow: hidden; }
.pp-opt:has(.pp-radio:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.pp-radio { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pp-tile { display: flex; align-items: center; gap: 12px; padding: 13px 14px; cursor: pointer; min-height: 56px; }
.pp-radio:focus-visible + .pp-tile { outline: 3px solid var(--gold-deco); outline-offset: -3px; border-radius: var(--radius); }
.pp-dot { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--control); display: grid; place-items: center; }
.pp-radio:checked + .pp-tile .pp-dot { border-color: var(--brand); }
.pp-radio:checked + .pp-tile .pp-dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.pp-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.pp-text strong { font-size: .98rem; }
.pp-text span { font-size: .82rem; color: var(--muted); }
.pp-marks { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: 45%; }
.pp-marks span { padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line); font-size: .68rem; font-weight: 800; color: var(--ink2); background: var(--surface); white-space: nowrap; }
.pp-panel { display: none; padding: 0 14px 14px; }
.pp-radio:checked ~ .pp-panel { display: grid; gap: 10px; }
.pp-how { margin: 0; font-size: .88rem; color: var(--ink2); }
.pp-panel .till-details summary { justify-self: start; }
.pay-methods { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .84rem; margin-top: 14px; }
.pay-logos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pay-logos span { padding: 4px 9px; border-radius: 8px; border: 1px solid var(--line); font-size: .74rem; font-weight: 800; color: var(--ink2); background: var(--raised); letter-spacing: .02em; }
@media (max-width: 900px) { .summary { position: static; } }
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 10px; flex-wrap: wrap; font-size: .84rem; }
.steps li { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; }
.steps li + li::before { content: ""; width: 18px; height: 1px; background: var(--line2); }
.steps li[aria-current="step"] { color: var(--ink); }
.steps li.done { color: var(--ok); }
.order-card { border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); padding: clamp(18px, 4vw, 28px); }
.order-no { font-family: var(--sans); font-weight: 700; font-size: 1.02rem; }
.progress { list-style: none; padding: 0; margin: 20px 0 6px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.progress li { position: relative; padding-top: 16px; font-size: .82rem; color: var(--muted); font-weight: 600; }
.progress li::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px; border-radius: 3px; background: var(--line); }
.progress li.done { color: var(--ink); } .progress li.done::before { background: var(--ok); }
.progress li.current { color: var(--ink); } .progress li.current::before { background: var(--gold-deco); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.timeline li { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 12px; font-size: .92rem; }
.timeline li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; background: var(--gold-deco); }
.timeline time { display: block; color: var(--muted); font-size: .8rem; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 18px; }
.kv h3 { font-family: var(--sans); font-size: .86rem; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.kv p { margin: 0; }
.pay-choice { display: grid; gap: 10px; margin-top: 16px; }
.till-box { display: grid; gap: 12px; padding: 16px; border-radius: var(--radius); background: var(--ok-bg); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); }
.till-box ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: .92rem; }
.till-number { font-family: var(--sans); font-size: 1.5rem; font-weight: 800; letter-spacing: .06em; }

/* ================================================================== generic content blocks */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.card { padding: 22px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.card h3 { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; }
.card h3 .icon { color: var(--gold); width: 22px; height: 22px; }
.card p { color: var(--ink2); margin: 0; font-size: .95rem; }
.band { position: relative; overflow: hidden; background: var(--brand); color: var(--on-brand); border-radius: var(--radius-lg); padding: clamp(26px, 5vw, 48px); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.band::after { content: ""; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%; border: 36px solid color-mix(in srgb, var(--gold-deco) 30%, transparent); pointer-events: none; }
.band h2 { color: inherit; margin-bottom: 8px; }
.band p { margin: 0; opacity: .9; max-width: 58ch; }
.band .btn { position: relative; z-index: 1; background: var(--on-brand); color: var(--brand); border-color: transparent; }
.band .btn:hover { background: color-mix(in srgb, var(--on-brand) 88%, var(--brand)); }
@media (max-width: 700px) { .band { grid-template-columns: minmax(0, 1fr); } }
.author-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(18px, 4vw, 40px); align-items: center; padding: clamp(20px, 4vw, 36px); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.portrait { width: clamp(120px, 18vw, 180px); aspect-ratio: 265 / 340; border-radius: 22px; object-fit: cover; border: 4px solid var(--surface); box-shadow: 0 0 0 2px var(--gold-deco), var(--shadow); }
.monogram { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: var(--on-brand); font-family: var(--display); font-size: 2.4rem; font-weight: 400; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
:has(> .facts) { container-type: inline-size; }
@container (min-width: 680px) { .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.facts > div { padding: 12px 14px; border-radius: 14px; background: var(--wash); min-width: 0; }
.facts strong { display: block; font-family: var(--sans); font-size: 1.12rem; font-weight: 800; line-height: 1.25; }
.facts span { color: var(--muted); font-size: .82rem; line-height: 1.35; display: block; }
@media (max-width: 760px) { .author-card { grid-template-columns: minmax(0, 1fr); text-align: left; } }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-icon { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--gold-deco); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.skeleton { background: linear-gradient(90deg, var(--sunken), var(--wash), var(--sunken)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ================================================================== footer */
.colophon { margin-top: auto; background: #0e1628; color: #ddd4c2; }
:root[data-scheme="dark"] .colophon { background: #070b16; }
@media (prefers-color-scheme: dark) { :root:not([data-scheme="light"]) .colophon { background: #070b16; } }
.colophon a { color: #f3ead7; }
.colophon-inner { max-width: var(--wrap); margin-inline: auto; padding: 44px var(--gutter) 26px; display: grid; grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 1fr)); gap: 28px; }
.colophon .brandmark { color: #f3ead7; }
.colophon .brandmark-icon { background: #e3b866; color: #1a1407; }
.colophon .brandmark-tag { color: #e3b866; }
.colophon p { color: #bdb4a1; font-size: .9rem; }
.colophon h2 { font-family: var(--sans); font-size: .92rem; font-weight: 700; color: #e3b866; margin: 4px 0 12px; }
.colophon-links { display: grid; gap: 9px; align-content: start; }
.colophon-links a { text-decoration: none; font-size: .92rem; }
.colophon-links a:hover { text-decoration: underline; }
.colophon-contact { display: grid; gap: 8px; }
.colophon-contact a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.install-slot { border: 1px solid rgba(255, 255, 255, .16); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; justify-items: start; margin-top: 14px; }
.install-slot p { margin: 0; }
.colophon .btn-quiet { background: transparent; color: #f3ead7; border-color: rgba(255, 255, 255, .28); }
.colophon .btn-quiet:hover { background: rgba(255, 255, 255, .08); }
.colophon-base { max-width: var(--wrap); margin-inline: auto; padding: 16px var(--gutter) 22px; border-top: 1px solid rgba(255, 255, 255, .12); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: .82rem; color: #a99f8c; }
@media (max-width: 900px) { .colophon-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .colophon-brand { grid-column: 1 / -1; } }
@media (max-width: 460px) { .colophon-inner { grid-template-columns: minmax(0, 1fr); } }

/* ================================================================== PWA prompts */
.pwa-update { position: fixed; z-index: 380; left: 50%; transform: translateX(-50%); bottom: calc(16px + var(--safe-bottom)); width: min(540px, calc(100vw - 24px)); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line2); box-shadow: var(--shadow-lg); }
.pwa-update strong { display: block; }
.pwa-update span { font-size: .88rem; color: var(--muted); }
.pwa-update-actions { display: flex; gap: 6px; margin-left: auto; }
.pwa-install { flex-wrap: nowrap; align-items: flex-start; }
.pwa-install img { flex: none; border-radius: 12px; }
.pwa-install > div:nth-child(2) { flex: 1 1 auto; min-width: 0; }
@media (max-width: 560px) { .pwa-install { flex-wrap: wrap; } .pwa-install .pwa-update-actions { width: 100%; justify-content: flex-end; } }
@media (min-width: 1024px) { .pwa-install { left: auto; right: 24px; transform: none; width: 400px; flex-wrap: wrap; } .pwa-install .pwa-update-actions { width: 100%; justify-content: flex-end; } }
@media (prefers-reduced-motion: no-preference) { .pwa-install { animation: pwa-rise .25s ease-out; } @keyframes pwa-rise { from { opacity: 0; translate: 0 12px; } } }
.ios-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.ios-steps li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; }
.ios-steps p { margin: 2px 0 0; font-size: .9rem; color: var(--muted); }
.ios-step-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--wash); color: var(--brand); }
.ios-step-icon img { width: 44px; height: 44px; border-radius: 10px; }
.is-standalone .colophon-base span:last-child { display: none; }

/* ================================================================== admin */
.portal-admin { background: var(--paper); }
.admin-frame { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.admin-side { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); padding: calc(18px + var(--safe-top)) 12px 18px; display: flex; flex-direction: column; gap: 16px; }
.admin-mark { padding: 4px 10px 8px; }
.admin-side nav { display: grid; gap: 1px; }
.admin-side .nav-group { font-size: .8rem; font-weight: 700; color: var(--muted); padding: 14px 12px 6px; }
.admin-side nav a, .admin-side-foot a, .admin-side-foot .linkish { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--ink2); text-decoration: none; font-size: .92rem; font-weight: 600; }
.admin-side nav a:hover, .admin-side-foot a:hover, .admin-side-foot .linkish:hover { background: var(--wash); color: var(--ink); }
.admin-side nav a[aria-current="page"] { background: var(--brand); color: var(--on-brand); }
.nav-badge { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--gold-deco); color: #1a1305; font-size: .72rem; font-weight: 800; text-align: center; line-height: 22px; }
.admin-side-foot { margin-top: auto; display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 12px; }
.admin-side-foot .linkish { width: 100%; }
.admin-who { padding: 8px 12px; font-weight: 700; font-size: .9rem; display: grid; }
.admin-who small { color: var(--muted); font-weight: 500; }
.admin-main { min-width: 0; }
.admin-topbar { display: none; }
.admin-content { max-width: 1240px; padding: 26px clamp(16px, 3vw, 36px) 60px; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.admin-head h1 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem); margin: 0; }
.admin-head p { margin: 6px 0 0; }
.admin-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 960px) {
  .admin-frame { grid-template-columns: minmax(0, 1fr); }
  .admin-side { position: fixed; z-index: 90; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); transform: translateX(-102%); transition: transform .22s var(--ease); box-shadow: var(--shadow-lg); }
  .admin-side.open { transform: none; }
  .admin-topbar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 60; background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding: calc(6px + var(--safe-top)) 10px 6px; }
  .admin-topbar .nav-toggle { display: inline-grid; }
  .admin-topbar-title { font-family: var(--display); font-weight: 400; flex: 1; }
  .admin-content { padding-top: 20px; }
}
.nav-toggle { display: none; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 20px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 1.12rem; margin: 0; }
.panel-body { padding: 18px; }
.panel .table-wrap { border: 0; border-radius: 0 0 var(--radius) var(--radius); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px 18px; text-decoration: none; color: inherit; display: block; min-width: 0; }
a.stat:hover { border-color: var(--line2); box-shadow: var(--shadow-sm); }
.stat-value { font-family: var(--sans); font-size: 1.55rem; font-weight: 800; line-height: 1.15; font-variant-numeric: lining-nums tabular-nums; }
.stat-label { color: var(--muted); font-size: .86rem; }
.stat-trend { font-size: .8rem; font-weight: 700; }
.stat-trend.up { color: var(--ok); } .stat-trend.down { color: var(--bad); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 960px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist .ok { color: var(--ok); } .checklist .no { color: var(--warn); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.filters .field { min-width: 160px; }
.filters .grow { flex: 1 1 220px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--gold-deco); }
.tabs .count { margin-left: 6px; font-size: .8rem; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; font-size: .9rem; }
.pager a { display: inline-flex; align-items: center; gap: 6px; }
.actions-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs { display: flex; gap: 12px; flex-wrap: wrap; }
.thumbs figure { margin: 0; width: 120px; display: grid; gap: 6px; font-size: .82rem; }
.thumbs img { border-radius: 6px; border: 1px solid var(--line); }
.repeat-row { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--raised); margin-bottom: 10px; }
.cover-cell { width: 46px; }
.cover-cell .cover { width: 46px; }
.cover-cell .ct-author, .cover-cell .ct-sub { display: none; }
.cover-cell .ct-title { font-size: 7px; }
.qr-box { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; }
.qr-box img, .qr-box svg { width: 220px; height: 220px; background: #fff; padding: 10px; border-radius: 8px; border: 1px solid var(--line); }
@media (max-width: 640px) { .qr-box { grid-template-columns: minmax(0, 1fr); } }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .82rem; color: var(--muted); font-weight: 700; background: var(--sunken); }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; }
.table a.row-link { color: var(--ink); font-weight: 700; }
.cell-sub { display: block; font-size: .83rem; color: var(--muted); }
@media (max-width: 720px) {
  .table.stack thead { display: none; }
  .table.stack tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table.stack td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .table.stack td::before { content: attr(data-label); color: var(--muted); font-size: .84rem; text-align: left; }
  .table.stack td.primary { display: block; text-align: left; padding-bottom: 8px; }
  .table.stack td.primary::before { content: none; }
}
.bars { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding: 8px 0 0; }
.bars span { flex: 1; min-width: 3px; border-radius: 4px 4px 0 0; background: var(--gold-deco); position: relative; }
.bars span:hover { background: var(--brand); }
.bar-axis { display: flex; justify-content: space-between; font-size: .74rem; color: var(--muted); margin-top: 6px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; margin-bottom: 10px; font-size: .9rem; }
.hbar .track { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.hbar .track span { display: block; height: 100%; border-radius: inherit; background: var(--gold-deco); }

/* ================================================================== auth (dashboard sign-in) */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(900px 400px at 50% -10%, color-mix(in srgb, var(--gold-deco) 18%, transparent), transparent 70%), var(--paper); }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(22px, 5vw, 34px); box-shadow: var(--shadow); }
.auth-card .brandmark { margin-bottom: 18px; }
.auth-card h1 { font-size: 1.6rem; }

/* ================================================================== motion and print */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .appbar, .tabbar, .colophon, .admin-side, .admin-topbar, .no-print, .toasts, .pwa-update, .sticky-buy, .fab { display: none !important; }
  body { background: #fff; color: #000; padding: 0 !important; }
  .admin-frame { display: block; }
  .admin-content { padding: 0; max-width: none; }
  .panel { border-color: #999; break-inside: avoid; }
}

/* ================================================================== small shared helpers */
details > summary.btn { list-style: none; }
details > summary.btn::-webkit-details-marker { display: none; }
.fav-form { display: inline-flex; margin: 0; }
.steps a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.check.span-2 { grid-column: 1 / -1; }
@media (max-width: 899px) { .hide-phone { display: none !important; } }
@media (min-width: 900px) { .hide-desk { display: none !important; } }

/* ================================================================== page hero (about, institutions) */
.hero { position: relative; overflow: hidden; background: var(--book-tint); border-bottom: 1px solid var(--line); }
.hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(900px 420px at 90% 10%, color-mix(in srgb, var(--gold-deco) 20%, transparent), transparent 65%); }
.hero-inner { position: relative; max-width: var(--wrap); margin-inline: auto; padding: clamp(28px, 6vw, 72px) var(--gutter); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: clamp(22px, 5vw, 60px); align-items: center; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hero-stage { display: flex; align-items: flex-end; justify-content: center; gap: 18px; }
.hero-stage .cover { width: clamp(120px, 18vw, 200px); }
@media (max-width: 760px) { .hero-inner { grid-template-columns: minmax(0, 1fr); } .hero-stage { justify-content: flex-start; } }
.ways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ways > div { padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.ways h3 { display: flex; align-items: center; gap: 10px; font-size: 1.08rem; }
.ways h3 .icon { color: var(--gold); width: 22px; height: 22px; }
.ways p { color: var(--ink2); margin: 0; font-size: .94rem; }
@media (max-width: 820px) { .ways { grid-template-columns: minmax(0, 1fr); } }
.book-sections { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 60px); }
@media (max-width: 860px) { .book-sections { grid-template-columns: minmax(0, 1fr); } }
.parts { list-style: none; padding: 0; margin: 0; counter-reset: part; }
.parts li { counter-increment: part; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.parts li::before { content: counter(part); width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--wash); color: var(--gold); font-weight: 800; font-size: .9rem; }
.gallery-thumbs .cover { height: 100%; display: flex; justify-content: center; }
.gallery-thumbs .cover img { height: 100%; width: auto; box-shadow: none; }
.gallery-thumbs .cover::after { display: none; }

/* Consent boxes on forms (never pre-ticked) */
.check.consent { align-items: flex-start; font-size: .88rem; line-height: 1.45; color: var(--ink2); }
.check.consent input { margin-top: 3px; }
.check.consent a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
[data-waitlist-form] .wl-consent { flex-basis: 100%; }

/* Cookie notice: small, bottom of the screen, above the app tab bar on phones */
.cookie-notice { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-bottom, 0px)); z-index: 60; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--raised); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.cookie-notice p { margin: 0; display: flex; gap: 8px; align-items: flex-start; font-size: .85rem; line-height: 1.45; color: var(--ink2); }
.cookie-notice p .icon { flex: none; margin-top: 2px; }
.cookie-notice a { color: inherit; text-decoration: underline; }
@media (max-width: 899px) { .cookie-notice { bottom: calc(var(--tabbar-h, 64px) + 10px + var(--safe-bottom, 0px)); } }
/* The update prompt matters more; the notice comes back on the next page. */
body:has(.pwa-update) .cookie-notice { display: none; }
@media print { .cookie-notice { display: none; } }

/* ------------------------------------------------------------ blog */
.blog-head { display: grid; gap: 10px; }
.blog-search { position: relative; max-width: 420px; margin-top: 6px; }
.blog-search .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.blog-search .input { padding-left: 40px; }
.blog-topics { margin-top: 14px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 8px; font-size: .82rem; color: var(--muted); }
.post-meta a { color: var(--brand); font-weight: 700; text-decoration: none; }
.post-meta a:hover { text-decoration: underline; }
.lead-post { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px; align-items: center; margin: 26px 0 10px; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.lead-post.no-cover { grid-template-columns: 1fr; }
.lead-cover img { width: 100%; height: auto; border-radius: var(--radius-lg); display: block; aspect-ratio: 3 / 2; object-fit: cover; }
.lead-text h2 { font-family: var(--display); font-weight: 400; font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1.12; margin: 0 0 12px; }
.lead-text h2 a, .post-row h3 a { color: var(--ink); text-decoration: none; }
.lead-text h2 a:hover, .post-row h3 a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.lead-dek { font-size: 1.08rem; color: var(--ink2); margin: 0 0 12px; }
.post-book { display: flex; gap: 8px; align-items: center; font-size: .9rem; color: var(--muted); margin: 0; }
.blog-more { font-size: 1.15rem; margin: 30px 0 4px; font-family: var(--sans); font-weight: 700; }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-row { display: flex; gap: 22px; align-items: flex-start; padding: 22px 0; border-bottom: 1px solid var(--line); }
.post-row-text { flex: 1; min-width: 0; }
.post-row h3 { font-family: var(--display); font-weight: 400; font-size: 1.45rem; line-height: 1.2; margin: 0 0 6px; }
.post-row p { margin: 0; color: var(--ink2); }
.post-row-cover { flex: none; width: 200px; }
.post-row-cover img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); display: block; }
.post-list.compact .post-row h3 { font-size: 1.2rem; }
.post-list.compact .post-row-cover { width: 140px; }
.blog-follow { display: grid; grid-template-columns: 1fr auto; gap: 14px 30px; align-items: center; margin: 40px 0 70px; padding: 24px; border-radius: var(--radius-lg); background: var(--wash); }
.blog-follow h2 { font-size: 1.3rem; margin: 0 0 4px; }
.blog-follow p { margin: 0; }
.blog-follow > p:last-child { grid-column: 1 / -1; }
@media (max-width: 760px) {
  .lead-post { grid-template-columns: 1fr; gap: 16px; }
  .post-row { gap: 14px; }
  .post-row-cover, .post-list.compact .post-row-cover { width: 104px; }
  .post-row h3 { font-size: 1.2rem; }
  .post-row p:not(.post-meta) { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .blog-follow { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ article */
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 90; pointer-events: none; }
.read-progress span { display: block; height: 100%; background: var(--brand); transform: scaleX(0); transform-origin: left; }
.article { max-width: 1040px; padding-bottom: 70px; }
.article-head { max-width: 760px; margin: 28px auto 22px; }
.article-head h1 { font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.08; margin: 6px 0 14px; }
.article-dek { font-size: 1.2rem; line-height: 1.5; color: var(--ink2); margin: 0 0 18px; }
.article-byline { display: flex; gap: 12px; align-items: center; margin: 0; }
.article-cover { margin: 0 0 30px; }
.article-cover img { width: 100%; height: auto; display: block; border-radius: var(--radius-lg); }
.article-layout { max-width: 760px; margin: 0 auto; }
.article-layout.has-toc { max-width: none; display: grid; grid-template-columns: 220px minmax(0, 700px); gap: 44px; justify-content: center; }
.article-toc { position: sticky; top: calc(var(--appbar-h, 64px) + 20px); align-self: start; font-size: .88rem; }
.article-toc summary { font-weight: 700; cursor: pointer; margin-bottom: 8px; list-style: none; }
.article-toc ol { list-style: none; margin: 0; padding: 0 0 0 12px; border-left: 2px solid var(--line); display: grid; gap: 7px; }
.article-toc .toc-l3 { padding-left: 12px; }
.article-toc a { color: var(--muted); text-decoration: none; display: block; line-height: 1.35; }
.article-toc a:hover, .article-toc a[aria-current] { color: var(--ink); }
.article-toc a[aria-current] { font-weight: 700; }
.article-body { max-width: none; font-size: 1.1rem; line-height: 1.75; }
.article-body h2 { font-size: 1.7rem; margin: 2em 0 .5em; scroll-margin-top: calc(var(--appbar-h, 64px) + 16px); }
.article-body h3 { font-size: 1.3rem; margin: 1.6em 0 .4em; scroll-margin-top: calc(var(--appbar-h, 64px) + 16px); font-family: var(--sans); font-weight: 700; }
.article-body a { color: var(--brand); text-underline-offset: 3px; }
.article-body blockquote { margin: 1.6em 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--gold-deco); font-family: var(--display); font-size: 1.35rem; line-height: 1.45; color: var(--ink); }
.article-body aside.callout { margin: 1.6em 0; padding: 16px 20px; border-radius: var(--radius); background: var(--wash); }
.article-body aside.callout p { margin: 0; }
.article-body figure { margin: 1.8em 0; }
.article-body figure img { width: 100%; height: auto; border-radius: var(--radius); display: block; }
.article-body figcaption { font-size: .88rem; color: var(--muted); margin-top: 8px; }
.article-body hr { border: 0; border-top: 1px solid var(--line2); margin: 2.2em auto; width: 40%; }
.article-body table { width: 100%; border-collapse: collapse; font-size: .95rem; margin: 1.4em 0; display: block; overflow-x: auto; }
.article-body th, .article-body td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.article-actions { max-width: 760px; margin: 34px auto 0; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 22px; border-top: 1px solid var(--line); }
.article-actions [aria-pressed="true"] { border-color: var(--brand); color: var(--brand); }
.article-book { max-width: 760px; margin: 30px auto 0; display: flex; gap: 20px; align-items: center; padding: 20px; border-radius: var(--radius-lg); background: var(--book-tint); }
.article-book img { width: 100px; height: auto; display: block; border-radius: 4px; box-shadow: var(--shadow); }
.article-book h2 { font-size: 1.35rem; margin: 2px 0 6px; }
.article-book h2 a { color: var(--ink); text-decoration: none; }
.article-book p { margin: 0; color: var(--ink2); }
.article-discuss, .article-related { max-width: 760px; margin: 40px auto 0; }
.article-discuss h2, .article-related h2 { font-size: 1.4rem; margin: 0 0 12px; }
.discuss-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 14px; }
.discuss-list li { display: flex; gap: 12px; }
.discuss-list .avatar { width: 36px; height: 36px; font-size: .8rem; }
.discuss-list .avatar.is-anon { background: var(--sunken); }
@media (max-width: 899px) {
  .article-layout.has-toc { display: block; }
  .article-toc { position: static; margin: 0 0 24px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); }
  .article-toc summary { margin: 0; }
  .article-toc details[open] summary { margin-bottom: 10px; }
  .article-body { font-size: 1.05rem; }
  .article-book { align-items: flex-start; }
  .article-book img { width: 76px; }
}
@media print { .read-progress, .article-actions, .article-discuss, .article-related, .article-toc { display: none; } }

/* ------------------------------------------------------------ article editor (dashboard) */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.editor-main { display: grid; gap: 16px; min-width: 0; }
.editor-side { display: grid; gap: 16px; position: sticky; top: 16px; }
.input-lg { font-size: 1.3rem; font-family: var(--display); min-height: 54px; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix span { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--control); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--sunken); color: var(--muted); font-size: .88rem; }
.input-prefix .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; min-width: 0; }
.editor { border: 1px solid var(--control); border-radius: var(--radius); background: var(--surface); overflow: hidden; margin-top: 6px; }
.editor .note { margin: 10px; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); background: var(--sunken); position: sticky; top: 0; z-index: 2; }
.editor-toolbar button { min-height: 34px; min-width: 34px; padding: 4px 9px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--ink); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; }
.editor-toolbar button:hover { background: var(--surface); border-color: var(--line); }
.editor-toolbar button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.editor-toolbar .sep { width: 1px; background: var(--line2); margin: 4px 3px; }
.editor-area { min-height: 420px; max-width: none; padding: 18px 22px; outline: none; font-size: 1.05rem; line-height: 1.7; }
.editor-area:focus-visible { box-shadow: inset 0 0 0 2px var(--gold-deco); }
.editor-area h2 { font-size: 1.5rem; }
.editor-area h3 { font-size: 1.2rem; font-family: var(--sans); font-weight: 700; }
.editor-area blockquote { border-left: 3px solid var(--gold-deco); padding-left: 16px; margin-left: 0; font-family: var(--display); font-size: 1.2rem; }
.editor-area aside.callout { padding: 12px 16px; border-radius: var(--radius); background: var(--wash); }
.editor-area img { max-width: 100%; height: auto; border-radius: 8px; }
.editor-area figcaption { font-size: .88rem; color: var(--muted); }
.editor-source { border: 0; border-radius: 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88rem; min-height: 420px; }
.editor-status { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0; padding: 8px 12px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.editor-cover img { width: 100%; height: auto; border-radius: 8px; display: block; }
@media (max-width: 1100px) { .editor-grid { grid-template-columns: 1fr; } .editor-side { position: static; } }

/* Sign in with Google */
.gsi-slot { min-height: 44px; display: grid; justify-items: center; }
.gsi-button { width: 100%; max-width: 400px; display: flex; justify-content: center; }
.or-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin: 16px 0; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.gsi-sheet .gsi-form { display: grid; gap: 14px; }
.gsi-sheet h2 { margin: 0; font-size: 1.4rem; }

/* Inline tools for the author and staff on public pages */
.mod-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; padding: 8px 10px; border: 1px dashed var(--line2); border-radius: var(--radius); }
.mod-label { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; color: var(--muted); margin-right: 4px; }
.mod-form { display: inline; margin: 0; }
.composer-author { border-color: var(--book); }

/* Slim dashboard strip on public pages, for the author and staff only */
.admin-bar { display: flex; align-items: center; gap: 12px; padding: 6px var(--gutter); padding-top: calc(6px + var(--safe-top)); background: var(--ink); color: var(--paper); font-size: .82rem; overflow-x: auto; scrollbar-width: none; }
.admin-bar::-webkit-scrollbar { display: none; }
.admin-bar-who { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; opacity: .85; }
.admin-bar nav { display: flex; gap: 4px; margin-left: auto; }
.admin-bar a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; min-height: 32px; border-radius: 999px; color: inherit; text-decoration: none; white-space: nowrap; }
.admin-bar a:hover, .admin-bar a:focus-visible { background: color-mix(in srgb, var(--paper) 16%, transparent); }
.admin-bar a.is-key { background: var(--brand); color: var(--on-brand); }
.admin-bar .icon { width: 16px; height: 16px; }
.admin-bar + .appbar { padding-top: 0; }
.on-site-editor { padding-bottom: 60px; }
.on-site-editor .admin-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-end; }
@media (max-width: 700px) { .editor-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; } .editor-toolbar button { flex: none; } }

/* Notifications: bell, panel and toasts */
.notify-bell { position: relative; }
.notify-bell .dot-count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff; font-size: .68rem; font-weight: 800; line-height: 18px; text-align: center; }
.admin-bar-bell { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 999px; background: transparent; color: inherit; cursor: pointer; }
.admin-bar-bell .icon { width: 18px; height: 18px; }
.admin-bar-bell .dot-count { top: -2px; right: -4px; }
.admin-mark-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.admin-mark-row .brandmark { gap: 8px; }
.admin-mark-row .brandmark-name { font-size: 1.04rem; }
.admin-mark-row .icon-btn { flex: none; width: 36px; height: 36px; }
.notify-panel { position: absolute; z-index: 400; width: min(380px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 100px)); overflow: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.np-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 8px; position: sticky; top: 0; background: var(--surface); }
.np-head h2 { margin: 0; font-size: 1.1rem; font-family: var(--sans); font-weight: 800; }
.np-list { list-style: none; margin: 0; padding: 0 6px; }
.np-item a { display: grid; gap: 2px; padding: 10px 10px 10px 18px; border-radius: 12px; text-decoration: none; color: inherit; position: relative; }
.np-item a:hover, .np-item a:focus-visible { background: var(--wash); }
.np-item.unread a::before { content: ""; position: absolute; left: 6px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.np-item strong { font-size: .92rem; }
.np-item span { font-size: .85rem; color: var(--ink2); }
.np-item small { font-size: .76rem; color: var(--muted); }
.np-empty { padding: 18px 16px; color: var(--muted); font-size: .9rem; }
.np-device { display: grid; gap: 8px; margin: 8px 12px; padding: 12px; border-radius: 12px; background: var(--wash); font-size: .86rem; }
.np-device p { margin: 0; }
.np-device .btn { justify-self: start; }
.np-sound { font-size: .86rem; }
.np-all { display: block; padding: 12px 16px 14px; font-size: .88rem; }
@media (max-width: 640px) {
  .notify-panel { position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(var(--tabbar-h, 64px) + 12px + var(--safe-bottom, 0px)); width: auto; max-height: 70vh; }
}
.notify-toast { display: flex; gap: 10px; align-items: flex-start; text-decoration: none; cursor: pointer; max-width: min(420px, calc(100vw - 32px)); }
.notify-toast strong { display: block; }
.notify-toast span span { display: block; font-size: .85rem; opacity: .85; }
.notify-toast .nt-icon { flex: none; width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; background: var(--brand); color: var(--on-brand); }
.notify-toast .nt-icon .icon { width: 16px; height: 16px; }
.notify-toast.out { opacity: 0; transform: translateY(-6px); transition: opacity .3s, transform .3s; }
.notify-page { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.notify-side { display: grid; gap: 18px; }
.np-page { padding: 6px; }
@media (max-width: 900px) { .notify-page { grid-template-columns: 1fr; } }
