/*
  Book Library app styles. Tokens come from projects/book-library/DESIGN.md.

  SHARED CLASSES (for screens; add only screen-specific CSS in your own module)
  Layout
    .screen            a screen root: flex column, fills the view. Put .hdr then .panel inside.
    .hdr               flat blush header (padding 24/20/26, gap 16). .hdr-row = flex row, space-between, centred.
    .panel             white sheet, 28px top radius, pulled up 14px over the header, bottom padding clears the nav. Add .panel-tight for no nav (sheets/sub-pages).
    .hscroll           horizontal scroll row, hidden scrollbar (chips, recently added).
  Type
    .h                 Crimson Pro. .page-title = 36/700 display; .sec-title = 23/700 section heading; .t = 19/600 row title.
    .meta              14px muted (#5B6670); .hdr .meta is #4A5B66. .num = tabular figures. .sub = 14px header secondary text.
  Controls
    .btn-primary       Antwarp Blue pill, 54px, white 19px/700. One per screen. [disabled] and .is-busy dim it.
    .btn-icon          40px accent circle with a white 18px icon.
    .btn-text          bold slate text button, 44px hit area.
    .chip (+ .on)      pill, white; .on = slate with white text. .chips = row of chips (use with .hscroll).
    .seg               segmented control: white pill, children buttons; .on = slate selected.
    .search            52px white pill with icon + input (see library.js for markup).
    .field / .input    labelled form field; .input = white pill-ish input 48px; .field label = 12/700 muted.
  Lists
    .row               list row: flex, 14px gap, 12px padding, hairline between siblings. Children: .t (title), .m (meta), .chev (chevron svg), .grow (flex 1 column).
    .st                status pill (+ .st-to-read .st-reading .st-read .st-abandoned); build with statusPill().
  Covers
    .tile              halo tile (18px radius, 12px padding); .tile-lg 104x152 cover, .tile-md 84x124 cover.
    .cov               cover (10px, cover shadow); .cov-row = 40x58 / 6px; .cov-ph = placeholder with title initial. Build with coverTile().
  Feedback
    .verdict           18px banner, Crimson 24/700: .verdict-owned (#C5DD99), .verdict-possibly (#E2EECC), .verdict-not (#F2F0F0).
    .sheet / .sheet-scrim   bottom sheet (white, 28px top radius) over scrim; use openSheet(el). Router "sheet" views use .sheet on their el.
    .toast             use toast(msg, kind).
    .empty             centred empty state: one line (.meta) + a .btn-primary.
  Motion
    .rise              fade and rise 10px, 500 ms; set style="animation-delay:Nms" (40 ms stagger). Off under reduced motion.
  Tokens: --antwarp-blue --slate --taupe --blush --oil-green --oil-green-light --accent-tint --neutral --muted --white
          --header-text --hairline --viewfinder --halo-grey, radii --r-cover --r-cover-sm --r-tile --r-sheet, shadows --sh-*.
*/

:root {
  --antwarp-blue: #008AA1;
  --slate: #1B3644;
  --taupe: #6B2E63;
  --blush: #FCDBDA;
  --oil-green: #C5DD99;
  --oil-green-light: #E2EECC;
  --accent-tint: #D9EEF1;
  --neutral: #F2F0F0;
  --muted: #5B6670;
  --white: #FFFFFF;
  --header-text: #4A5B66;
  --hairline: #ECE9E9;
  --viewfinder: #12252F;
  --halo-grey: #E8EEF1;

  --r-cover: 3px; --r-cover-sm: 2px; --r-tile: 18px; --r-sheet: 28px;
  --sh-cover: 0 1px 2px rgba(0,0,0,.10), 0 6px 14px -4px rgba(0,0,0,.16), 0 22px 40px -14px rgba(0,0,0,.28);
  --sh-cover-row: 0 1px 2px rgba(0,0,0,.10), 0 4px 10px -3px rgba(0,0,0,.14);
  --sh-search: 0 6px 16px -8px rgba(0,0,0,.25);
  --sh-primary: 0 10px 20px -10px rgba(0,0,0,.2);
  --sh-nav: 0 12px 28px -10px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.08);
  --sh-scan: 0 8px 16px -6px rgba(0,0,0,.3);
  --sh-sheet: 0 -12px 32px -12px rgba(0,0,0,.35);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --serif: "Crimson Pro", Georgia, serif;
  --sans: Manrope, system-ui, sans-serif;
}

* { box-sizing: border-box; }
/* The page itself never scrolls or bounces; only .screen-wrap scrolls, so the floating nav stays put (iOS rubber-band included). */
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
/* Blush page ground: iOS 26 colours the status bar from the html/body background (theme-color is ignored). */
html, body { background: var(--blush); }
/* No double-tap zoom (native feel); panning still works. Pinch is blocked in main.js. */
html { touch-action: manipulation; }
body { color: var(--slate); font: 400 15px/1.45 var(--sans); -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
::selection { background: var(--accent-tint); color: var(--slate); }
a { color: var(--slate); }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
a:active, button:active { transform: scale(.97); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--antwarp-blue); outline-offset: 2px; border-radius: inherit;
}
/* Sheets take programmatic focus on open; the ring belongs on their controls, not the sheet edge. */
.sheet:focus-visible { outline: none; }

/* ---------- frame ---------- */
#app { position: fixed; inset: 0; max-width: 430px; margin: 0 auto; background: var(--blush); overflow: hidden; }
#view { position: absolute; inset: 0; }
.screen-wrap { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; background: var(--white); outline: none; }
.screen-wrap.under { visibility: hidden; }
.screen-wrap.wrap-sheet { background: rgba(0,0,0,.4); display: flex; flex-direction: column; justify-content: flex-end; }
.screen { min-height: 100%; display: flex; flex-direction: column; }

/* ---------- type ---------- */
.h { font-family: var(--serif); }
.page-title { font: 700 36px/1.05 var(--serif); }
.sec-title { font: 700 23px/1.2 var(--serif); }
.t { font: 600 19px/1.2 var(--serif); }
.meta { font-size: 14px; color: var(--muted); }
.hdr .meta, .sub { font-size: 14px; color: var(--header-text); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- header and panel ---------- */
/* Bottom padding 40 = 26 visible + 14 extra, because .panel now overlaps by the full corner radius (28px). */
.hdr { background: var(--blush); padding: calc(24px + env(safe-area-inset-top)) 20px 40px; display: flex; flex-direction: column; gap: 16px; }
.hdr-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel { flex: 1; background: var(--white); border-radius: var(--r-sheet) var(--r-sheet) 0 0; margin-top: calc(-1 * var(--r-sheet)); /* overlap = radius, so the corners sit on the header colour, not the page */ padding: 20px 20px calc(120px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; position: relative; }
.panel-tight { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.hscroll { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.hscroll::-webkit-scrollbar { display: none; }

/* ---------- buttons ---------- */
.btn-primary { height: 54px; width: 100%; border: 0; border-radius: 999px; background: var(--antwarp-blue); color: var(--white); font: 700 19px var(--sans); box-shadow: var(--sh-primary); display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; cursor: pointer; transition: transform .12s, opacity .15s; }
.btn-primary[disabled], .btn-primary.is-busy { opacity: .6; pointer-events: none; }
.btn-icon { width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; background: var(--antwarp-blue); color: var(--white); display: flex; align-items: center; justify-content: center; box-shadow: var(--sh-scan); text-decoration: none; cursor: pointer; }
.btn-text { min-height: 44px; padding: 0 4px; border: 0; background: none; font: 700 15px var(--sans); color: var(--slate); display: inline-flex; align-items: center; gap: 4px; text-decoration: none; cursor: pointer; }

/* ---------- chips, status, segmented ---------- */
.chips { display: flex; gap: 8px; }
.chip { flex: none; border: 0; border-radius: 999px; padding: 8px 14px; font: 600 14px var(--sans); white-space: nowrap; background: var(--white); color: var(--slate); cursor: pointer; }
.chip.on { background: var(--slate); color: var(--white); }
.st { flex: none; font: 700 12px var(--sans); border-radius: 999px; padding: 4px 10px; white-space: nowrap; background: var(--neutral); color: var(--slate); }
.st-to-read { background: var(--accent-tint); }
.st-reading { background: var(--slate); color: var(--white); }
.st-abandoned { color: var(--muted); }
.seg { display: flex; background: var(--white); border-radius: 999px; padding: 4px; box-shadow: var(--sh-search); }
.seg > * { flex: 1; border: 0; background: none; text-align: center; padding: 9px 8px; min-height: 40px; white-space: nowrap; font: 600 14px var(--sans); border-radius: 999px; color: var(--slate); cursor: pointer; transition: background .15s, color .15s; }
.seg > .on { background: var(--slate); color: var(--white); }

/* ---------- search, fields ---------- */
.search { display: flex; align-items: center; gap: 10px; height: 52px; background: var(--white); border-radius: 999px; padding: 0 6px 0 18px; box-shadow: var(--sh-search); }
/* Inputs stay at 16px: iOS Safari zooms the page when a focused field is smaller. */
.search input { border: 0; outline: 0; font: 500 16px var(--sans); color: var(--slate); flex: 1; min-width: 0; background: transparent; }
.search input::placeholder { color: var(--muted); }
.search:focus-within { outline: 2px solid var(--antwarp-blue); outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font: 700 12px var(--sans); color: var(--muted); }
.input { height: 48px; border: 0; border-radius: 999px; padding: 0 18px; background: var(--neutral); font: 500 16px var(--sans); color: var(--slate); width: 100%; }
input, textarea, select { font-size: max(16px, 1em); }
.input::placeholder { color: var(--muted); }

/* ---------- rows, covers ---------- */
.row { display: flex; align-items: center; gap: 14px; padding: 12px 0; min-height: 44px; color: inherit; text-decoration: none; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; }
.row + .row { border-top: 1px solid var(--hairline); }
.row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .m { font-size: 14px; color: var(--muted); }
.row .chev { flex: none; color: var(--muted); }
/* Covers float on the page: no tile behind them, a large soft shadow (Libby-like). Placeholders paint their own colour inline. */
.cov { border-radius: var(--r-cover); box-shadow: var(--sh-cover); overflow: hidden; flex: none; }
.cov-lg { width: 104px; height: 152px; }
.cov-md { width: 84px; height: 124px; }
.cov-row { width: 40px; height: 58px; border-radius: var(--r-cover-sm); box-shadow: var(--sh-cover-row); }
.cov img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cov-ph { display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.9); font: 700 34px/1 var(--serif); }
.cov-row.cov-ph { font-size: 20px; }
.cov-md.cov-ph { font-size: 40px; }
.cov-xl { width: 200px; height: 296px; margin: 8px 0 14px; }
.cov-xl.cov-ph { font-size: 76px; }
.cov-grid { width: 100%; aspect-ratio: 2 / 3; }
.cov-feat { width: 104px; height: 152px; align-self: flex-start; margin: 12px 0 4px; }
.cov-feat.cov-ph { font-size: 34px; }
.lib-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 14px; }
.lib-grid a { display: flex; flex-direction: column; gap: 8px; color: inherit; text-decoration: none; min-width: 0; }
.lib-grid .t { font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sec-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.sec-row .sec-title { margin-top: 0; }

/* ---------- verdict, sheet, toast, empty ---------- */
.verdict { border-radius: var(--r-tile); padding: 16px 18px; font: 700 24px/1.15 var(--serif); color: var(--slate); background: var(--neutral); }
.verdict-owned { background: var(--oil-green); }
.verdict-possibly { background: var(--oil-green-light); }
.verdict-not { background: var(--neutral); }
.verdict-wish { background: var(--accent-tint); } /* wishlist: accent tint, never green (ownership rule) */
#sheet-layer { position: absolute; inset: 0; pointer-events: none; z-index: 30; }
.sheet-scrim { pointer-events: auto; position: absolute; inset: 0; background: rgba(0,0,0,.4); display: flex; flex-direction: column; justify-content: flex-end; z-index: 30; animation: fade-in .2s both; }
.sheet { background: var(--white); border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: var(--sh-sheet); padding-top: 12px; max-height: 92%; overflow-y: auto; outline: none; animation: sheet-up .32s var(--ease) both; }
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--hairline); margin: 0 auto 8px; }
.wrap-sheet > .sheet { max-height: 92%; }
.sheet-scrim.out { animation: fade-out .22s both; }
.sheet-scrim.out .sheet { animation: sheet-down .22s ease-in both; }
#toasts { position: absolute; left: 20px; right: 20px; bottom: calc(82px + max(22px, calc(env(safe-area-inset-bottom) - 6px))); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 50; }
.toast { background: var(--slate); color: var(--white); border-radius: 999px; padding: 10px 18px; font: 600 14px var(--sans); box-shadow: var(--sh-nav); animation: rise .25s var(--ease) both; max-width: 100%; }
.toast.out { opacity: 0; transition: opacity .25s; }
.toast-error { background: #7A2B2B; }
.empty { flex: 1; display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 16px; text-align: center; padding: 24px 0; }
.empty .meta { font-size: 15px; }

/* ---------- floating nav ---------- */
/* On phones with a home indicator the pill may sit inside the safe area, just above the indicator (34px inset -> 28px). */
#nav { position: absolute; left: 20px; right: 20px; bottom: max(22px, calc(env(safe-area-inset-bottom) - 6px)); height: 64px; z-index: 20; background: var(--white); border-radius: 999px; box-shadow: var(--sh-nav); display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.nav-tab { width: 48px; height: 48px; border-radius: 999px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--slate); text-decoration: none; font: 700 14px var(--sans); flex: none; }
.nav-tab .lbl { display: none; }
.nav-tab { position: relative; z-index: 1; transition: color .2s; }
.nav-tab[aria-current="page"] { width: auto; padding: 0 16px; color: var(--white); }
.nav-pill { position: absolute; left: 0; top: 8px; height: 48px; width: 0; border-radius: 999px; background: var(--slate); opacity: 0; pointer-events: none; transition: opacity .2s; }
.nav-tab[aria-current="page"] .lbl { display: inline; }
.nav-scan { width: 56px; height: 56px; margin-top: -20px; flex: none; border-radius: 50%; background: var(--antwarp-blue); display: flex; align-items: center; justify-content: center; color: var(--white); box-shadow: var(--sh-scan); }
.nav-scan[aria-current="page"] { box-shadow: var(--sh-scan), 0 0 0 4px var(--accent-tint); }

/* ---------- motion ---------- */
.rise { animation: rise .5s var(--ease) both; }
.anim-fade { animation: fade-in .15s ease-out both; }
.anim-slide { animation: slide-in .28s var(--ease) both; box-shadow: -12px 0 32px -12px rgba(0,0,0,.25); }
.anim-slide-out { animation: slide-out .22s ease-in both; }
.anim-sheet > .sheet { animation: sheet-up .32s var(--ease) both; }
.anim-sheet { animation: fade-in .2s both; }
.anim-sheet-out { animation: fade-out .22s both; }
.anim-sheet-out > .sheet { animation: sheet-down .22s ease-in both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes slide-out { to { transform: translateX(100%); } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  a:active, button:active { transform: none; }
}

/* ---------- library and detail ---------- */
/* overflow-x makes overflow-y clip too: padding gives the cover shadows room, negative margin keeps the layout */
.lib-recent { display: flex; gap: 12px; margin: -8px -20px -24px -20px; padding: 8px 20px 32px; }
.lib-card { width: 128px; flex: none; display: flex; flex-direction: column; gap: 8px; color: inherit; text-decoration: none; }
.lib-card .t { font-size: 16px; }
.sync { min-height: 20px; }
.hdr-detail { padding-top: calc(20px + env(safe-area-inset-top)); align-items: center; gap: 8px; }
.hdr-detail .hdr-row { align-self: stretch; }
.hdr-detail h1 { font: 600 26px/1.15 var(--serif); text-align: center; }
.detail-id { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.detail-id .by { font-size: 15px; font-weight: 600; }
.hdr-detail .seg { align-self: stretch; margin-top: 6px; }
.back { display: flex; align-items: center; gap: 4px; font: 700 15px var(--sans); border: 0; background: none; padding: 8px 0; min-height: 44px; cursor: pointer; }
.about { position: relative; }
.about p { font-size: 15px; line-height: 1.45; }
.about p.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.about .btn-text { min-height: 32px; font-size: 14px; }
.info .lbl { font-size: 16px; font-weight: 700; }

/* == phase 5: stats == */
.st-langs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.st-lrow { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.st-lname { font: 600 15px var(--sans); color: var(--slate); }
.st-lnum { font: 500 14px var(--sans); color: var(--muted); }
.st-track { height: 10px; border-radius: 999px; background: var(--neutral); overflow: hidden; }
.st-fill { display: block; height: 100%; border-radius: 999px; background: var(--antwarp-blue); min-width: 0; }
.st-head { font: 500 15px var(--sans); color: var(--muted); }
.st-head b { font: 700 22px var(--serif); color: var(--slate); }
.st-chart { display: flex; flex-direction: column; gap: 6px; padding-top: 22px; }
.st-plot { position: relative; height: 140px; display: flex; align-items: flex-end; gap: 8px; border-bottom: 1px solid var(--hairline); }
.st-col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; min-width: 0; }
.st-bar { position: relative; width: 100%; max-width: 32px; min-height: 2px; border-radius: 6px 6px 0 0; background: color-mix(in srgb, var(--slate) 28%, var(--white)); }
.st-bar.cur { background: var(--antwarp-blue); }
.st-val { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding-bottom: 3px; font: 600 12px var(--sans); color: var(--muted); }
.st-bar.cur .st-val { color: var(--slate); font-weight: 700; }
.st-goal { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--taupe); pointer-events: none; z-index: 1; }
.st-goal span { position: absolute; left: 0; bottom: 2px; padding: 0 4px 0 0; background: var(--white); font: 700 11px var(--sans); color: var(--taupe); }
.st-years { display: flex; gap: 8px; }
.st-years span { flex: 1; text-align: center; font: 500 11px var(--sans); color: var(--muted); min-width: 0; }
.st-years .cur { color: var(--slate); font-weight: 700; }
.st-goalform { display: flex; flex-direction: column; gap: 16px; padding: 12px 20px calc(24px + env(safe-area-inset-bottom)); }
.st-err { min-height: 18px; font: 600 13px var(--sans); color: #7A2B2B; }
.st-goalform .input[aria-invalid="true"] { outline: 2px solid #7A2B2B; }
/* == end phase 5 == */

/* == phase 4a: book/page transitions == */
/* Cover clone that flies between a tile and the book page's hero cover (router.js bookOpen/bookClose). Transform/opacity only. */
.bk-fx { position: absolute; inset: 0; z-index: 60; overflow: hidden; pointer-events: none; }
.bk-fx, .bk-fx * { animation: none !important; } /* the cloned hero may carry .rise */
/* == end phase 4a == */

/* == phase 4b: book page == */
/* Paper tokens. Light values live on :root so chips and sheets used outside the book page keep them; the dark paper is scoped to .book-page. */
:root {
  --book: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; /* system font on iOS/macOS (Apple Books) */
  --paper: #FAF7F1; --paper-edge: #EDE5D4;
  --bk-line: #D6CAB0; --bk-surface: #FFFFFF; --bk-on: #FFFFFF;
  --bk-star: #B5720F; --bk-danger: #9B2C2C;
}
.book-page {
  color: var(--slate);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse 100% 50% at 100% 100%, rgba(150,112,54,.06), transparent 65%),
    repeating-linear-gradient(0deg, rgba(120,100,60,.035) 0 1px, transparent 1px 4px);
}
.book-page .hdr { background: transparent; }
.book-page .panel { background: transparent; margin-top: 0; border-radius: 0; }
.book-page .btn-icon { width: 44px; height: 44px; }
.bk-tools { display: flex; gap: 8px; }
.book-page .hdr-detail h1 { font: 700 30px/1.15 var(--book); letter-spacing: normal; }
.book-page .sec-title { font: 600 24px/1.2 var(--book); }
.book-page .detail-id .by { font: italic 400 18px/1.3 var(--book); }
.book-page .detail-id .sub, .book-page .hdr-detail > .sub { font-family: var(--book); font-style: italic; }
.book-page .about p { font: 400 17px/1.55 var(--book); letter-spacing: normal; }
.book-page .info .lbl { font: 600 18px var(--book); }
.book-page .info .m { font: italic 400 15px/1.35 var(--book); }
.book-page .row + .row { border-top-color: var(--bk-line); }
.book-page .seg { background: var(--bk-surface); }
.book-page .seg > .on { color: var(--bk-on); }
.book-page .st-reading { color: var(--bk-on); }
.book-page .meta { font: italic 400 15px/1.4 var(--book); }
.book-page .btn-text { min-height: 44px; }
.bk-orn { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.bk-orn::before, .bk-orn::after { content: ""; flex: 1; height: 1px; background: linear-gradient(to right, transparent, var(--bk-line)); }
.bk-orn::after { background: linear-gradient(to left, transparent, var(--bk-line)); }
.bk-orn i { width: 7px; height: 7px; border: 1px solid var(--bk-line); background: var(--paper); transform: rotate(45deg); flex: none; }
.bk-chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.bk-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--bk-line); background: var(--bk-surface); color: var(--slate); font: 600 14px var(--sans); text-decoration: none; cursor: pointer; }
.bk-chip.on, .bk-chip[aria-pressed="true"] { background: var(--slate); border-color: var(--slate); color: var(--bk-on); }
.bk-chip:disabled { opacity: .4; cursor: default; }
.bk-rating { display: flex; flex-direction: column; gap: 2px; padding: 8px 0 4px; }
.bk-rating .lbl { font: 600 18px var(--book); }
.bk-rate { display: flex; align-items: center; gap: 12px; }
.bk-stars { position: relative; width: 200px; height: 44px; flex: none; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; border-radius: 8px; }
.bk-stars-bg, .bk-stars-fg { position: absolute; left: 0; top: 0; height: 100%; display: flex; align-items: center; }
.bk-stars-fg { overflow: hidden; width: 0; }
.bk-stars-fg > div, .bk-stars-bg { display: flex; align-items: center; width: 200px; }
.bk-stars svg { flex: none; stroke-width: 1.4; }
.bk-stars-bg svg { fill: none; stroke: var(--muted); }
.bk-stars-fg svg { fill: var(--bk-star); stroke: var(--bk-star); }
.bk-rate-val { font: 600 14px var(--sans); color: var(--muted); }
.bk-sheet { padding: 8px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; color: var(--slate); }
.bk-sheet .sec-title { font: 600 24px/1.2 var(--book); }
.bk-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bk-dates .input { padding: 0 14px; }
.bk-some { align-self: flex-start; }
.bk-confirm { font: 400 19px/1.35 var(--book); }
.bk-actions { display: flex; gap: 12px; }
.bk-col { flex-direction: column; }
.bk-btn { flex: 1; min-height: 52px; border: 0; border-radius: 999px; background: var(--neutral); color: var(--slate); font: 700 16px var(--sans); cursor: pointer; }
.bk-danger { background: var(--bk-danger); color: #fff; }
.bk-danger-text { background: none; color: var(--bk-danger); justify-content: flex-start; text-align: left; padding: 0 4px; }
.bk-btn:disabled, .bk-btn.is-busy { opacity: .6; pointer-events: none; }
/* Library: select mode, tag filter */
.bk-select { min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--white); color: var(--slate); font: 700 14px var(--sans); box-shadow: var(--sh-search); cursor: pointer; flex: none; }
.bk-select.on { background: var(--slate); color: var(--white); }
.bk-filter-row { display: flex; }
.bk-filter { background: var(--slate); }
.bk-check { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 2px solid var(--muted); display: grid; place-items: center; color: transparent; }
.row[aria-pressed="true"] .bk-check { background: var(--antwarp-blue); border-color: var(--antwarp-blue); color: #fff; }
/* Solid backing (no see-through list behind the button), full panel width, soft top edge. */
.bk-bar { position: sticky; bottom: 0; z-index: 5; margin: 0 -20px calc(-120px - env(safe-area-inset-bottom)); padding: 14px 20px calc(104px + env(safe-area-inset-bottom)); background: var(--white); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 24px -14px rgba(0,0,0,.22); }
/* No dark-mode paper: the book page is always off-white with stripes (user, 2026-11-27). */
.sheet { overscroll-behavior: contain; }
/* == end phase 4b == */

/* == phase 5b: globe == */
.globe-wrap { position: relative; height: 360px; margin: 0 0 16px; border-radius: var(--r-tile); background: radial-gradient(ellipse at 50% 45%, #0E2036 0%, #070F1C 70%); overflow: hidden; }
.globe-wrap[hidden] { display: none; }
.globe-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.globe-canvas:active { cursor: grabbing; }
.globe-label { position: absolute; left: 50%; bottom: 14px; transform: translate(-50%, 6px); padding: 6px 14px; border-radius: 999px; background: rgba(7,15,28,.82); color: #FFE2B0; font: 700 14px var(--sans); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .16s var(--ease), transform .16s var(--ease); }
.globe-label.on { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .globe-label { transition: none; } }
/* == end phase 5b == */

/* == themes == */
/* router.js applyTheme sets html[data-theme] = paper | night from view.theme. iOS colours the status bar from the html/body background,
   so the ground follows the theme; the floating nav follows too. No quoted attribute selectors needed here. */
html[data-theme=paper], html[data-theme=paper] body, html[data-theme=paper] #app { background: var(--paper); }
html[data-theme=night], html[data-theme=night] body, html[data-theme=night] #app { background: #070F1C; }
/* Status-bar strip: iOS 26 ignores theme-color and samples the fixed element at the top edge (reports, 2026). */
#status-tint { position: fixed; top: 0; left: 0; right: 0; height: max(12px, env(safe-area-inset-top)); z-index: 40; pointer-events: none; background: var(--blush); transition: background-color .2s; }
html[data-theme=paper] #status-tint { background: #FAF7F1; }
html[data-theme=night] #status-tint { background: #070F1C; }
#nav, .nav-pill { transition: background-color .24s, opacity .2s, box-shadow .24s; }
html[data-theme=paper] #nav { background: rgba(250,247,241,.86); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 12px 28px -10px rgba(60,40,10,.3), inset 0 0 0 1px rgba(60,40,10,.08); }
html[data-theme=paper] .nav-tab { color: var(--slate); }
html[data-theme=paper] .nav-pill { background: var(--slate); }
html[data-theme=paper] #nav .nav-tab[aria-current=page] { color: #fff; }
html[data-theme=night] #nav { background: rgba(13,26,44,.82); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 12px 28px -10px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,255,255,.08); }
html[data-theme=night] .nav-tab { color: #C9D6E3; }
html[data-theme=night] #nav .nav-tab[aria-current=page] { color: #1A1206; }
html[data-theme=night] .nav-pill { background: #FFC46B; }
/* == end themes == */
