/* Passages. Crisp white or deep dark, one sage-green accent (the icon's), as little chrome
   as possible: the books and the page do the talking. */
@font-face { font-family: "Literata"; src: url("../fonts/literata-latin-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Literata"; src: url("../fonts/literata-latin-wght-italic.woff2") format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
/* Lithuanian and other Latin letters (ė, š, ž, ū…) */
@font-face { font-family: "Literata"; src: url("../fonts/literata-latin-ext-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Literata"; src: url("../fonts/literata-latin-ext-wght-italic.woff2") format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #ffffff;
  --surface: #f4f5f7;
  --surface-2: #ebedf1;
  --line: #e6e8ec;
  --hairline: rgba(16, 18, 23, .08);
  --text: #0f1115;
  --muted: #5b616c;
  --faint: #8d929b;
  --accent: #477a55;
  --accent-text: #ffffff;
  --accent-soft: rgba(71, 122, 85, .10);
  --danger: #cf2a3e;
  --bar: rgba(22, 24, 29, .92);
  --bar-text: #ffffff;
  --glass: rgba(255, 255, 255, .78);
  --shadow: 0 24px 60px -12px rgba(16, 18, 23, .22), 0 2px 10px rgba(16, 18, 23, .06);
  --shadow-sm: 0 1px 2px rgba(16, 18, 23, .06), 0 3px 10px rgba(16, 18, 23, .05);
  --book-shadow: 0 1px 1px rgba(16, 18, 23, .08), 0 2px 4px rgba(16, 18, 23, .06), 0 14px 26px -12px rgba(16, 18, 23, .35);
  --ui: system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --serif: "Literata", Georgia, serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #121418;
  --surface: #1a1d23;
  --surface-2: #23272f;
  --line: #2a2f38;
  --hairline: rgba(255, 255, 255, .07);
  --text: #eceef2;
  --muted: #9ba2ad;
  --faint: #6b7380;
  --accent: #9fcca8;
  --accent-text: #0e1a12;
  --accent-soft: rgba(159, 204, 168, .13);
  --danger: #ff6b7a;
  --bar: rgba(38, 42, 51, .94);
  --bar-text: #f3f5f8;
  --glass: rgba(18, 20, 24, .78);
  --shadow: 0 24px 60px -12px rgba(0, 0, 0, .7), 0 2px 10px rgba(0, 0, 0, .35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 3px 10px rgba(0, 0, 0, .25);
  --book-shadow: 0 1px 1px rgba(0, 0, 0, .3), 0 14px 28px -10px rgba(0, 0, 0, .75);
  color-scheme: dark;
}
:root[data-theme="black"] {
  --bg: #000000;
  --surface: #0d0f12;
  --surface-2: #16191e;
  --line: #1f232a;
  --hairline: rgba(255, 255, 255, .07);
  --text: #e2e5ea;
  --muted: #8e96a2;
  --faint: #5f6772;
  --accent: #9fcca8;
  --accent-text: #0e1a12;
  --accent-soft: rgba(159, 204, 168, .13);
  --danger: #ff6b7a;
  --bar: rgba(30, 33, 40, .95);
  --bar-text: #f3f5f8;
  --glass: rgba(0, 0, 0, .78);
  --shadow: 0 24px 60px -12px rgba(0, 0, 0, .9);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .6);
  --book-shadow: 0 14px 28px -10px rgba(0, 0, 0, .9);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--ui); font-size: 15px; -webkit-font-smoothing: antialiased; }
body { overflow: hidden; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
svg { stroke-width: 1.5; }

.screen { position: fixed; inset: 0; }
.screen:not([hidden]) { animation: screen-in .22s var(--ease); }
@keyframes screen-in { from { opacity: 0; } }

/* ---------- buttons ---------- */
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; color: var(--muted); position: relative; flex: none; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn.small { width: 28px; height: 28px; border-radius: 8px; }
.icon-btn.small svg { width: 16px; height: 16px; }
.btn { height: 34px; padding: 0 14px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-weight: 550; font-size: 13.5px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; transition: filter .15s, background .15s; }
.btn:hover { filter: brightness(.97); }
:root[data-theme="dark"] .btn:hover, :root[data-theme="black"] .btn:hover { filter: brightness(1.18); }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.primary.danger { background: var(--danger); color: #fff; }
.btn.small { height: 28px; padding: 0 11px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.link-btn { color: var(--faint); font-size: 12.5px; font-weight: 550; padding: 4px 0; }
.link-btn:hover { color: var(--accent); }

/* ---------- library ---------- */
.library { display: flex; flex-direction: column; background: var(--bg); }
.lib-top { display: flex; align-items: center; gap: 28px; padding: calc(14px + var(--safe-top)) 40px 14px; flex: none; position: relative; z-index: 2; transition: box-shadow .2s; }
.lib-top.scrolled { box-shadow: 0 1px 0 var(--hairline); }
.brand { font-family: var(--serif); font-weight: 600; font-size: 22px; letter-spacing: -.015em; display: flex; align-items: baseline; gap: 1px; }
.brand::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 2px; }
.tabs { display: flex; gap: 22px; }
.tab { height: 32px; font-weight: 550; font-size: 14.5px; color: var(--faint); position: relative; transition: color .15s; }
.tab:hover { color: var(--muted); }
.tab.on { color: var(--text); }
.tab.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px; background: var(--text); }
.lib-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.search { position: relative; display: flex; align-items: center; margin-right: 8px; }
.search svg { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.lib-search { width: 190px; height: 34px; border-radius: 999px; border: 1px solid transparent; background: var(--surface); padding: 0 14px 0 34px; outline: none; font-size: 13.5px; transition: width .25s var(--ease), background .15s, border-color .15s; }
.lib-search::placeholder { color: var(--faint); }
.lib-search:focus { width: 260px; border-color: var(--line); background: var(--bg); }
.sync-dot { position: absolute; right: 7px; bottom: 8px; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--bg); background: var(--faint); }
.sync-synced .sync-dot { background: #1fae5b; }
.sync-syncing .sync-dot { background: var(--accent); }
.sync-offline .sync-dot { background: #e0a100; }
.sync-error .sync-dot { background: var(--danger); }
.sync-off .sync-dot { display: none; }

.lib-main { flex: 1; overflow-y: auto; padding: 18px 40px calc(64px + var(--safe-bottom)); }
.lib-main > * { max-width: 1160px; margin-left: auto; margin-right: auto; }

.continue { position: relative; display: flex; gap: 34px; align-items: center; padding: 30px 34px; border-radius: 24px; cursor: pointer; margin-bottom: 48px; isolation: isolate; overflow: hidden; background: var(--surface); }
.continue::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(120% 140% at 0% 50%, var(--tint, transparent) 0%, transparent 62%); opacity: .2; transition: opacity .3s; }
.continue:hover::before { opacity: .3; }
.continue-more { position: absolute; top: 12px; right: 12px; opacity: .45; transition: opacity .15s; }
.continue:hover .continue-more, .continue:focus-within .continue-more { opacity: 1; }
@media (pointer: coarse) { .continue-more { opacity: .8; } }
.continue .cover { transition: transform .3s var(--ease); }
.continue:hover .cover { transform: translateY(-3px) rotate(-.4deg); }
.continue-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; align-items: flex-start; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--muted); margin-bottom: 4px; }
.continue-title { font-family: var(--serif); font-weight: 600; font-size: 32px; line-height: 1.12; margin: 0; letter-spacing: -.02em; }
.continue-author { color: var(--muted); font-size: 15px; }
.continue-place { color: var(--muted); font-size: 13.5px; margin-top: 18px; display: flex; gap: 12px; align-items: center; width: min(360px, 100%); }
.continue-place .progress { flex: 1; }
.continue-when { color: var(--faint); font-size: 12.5px; margin-top: 2px; }

.progress { display: block; height: 3px; border-radius: 3px; background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; }
.progress-bar { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

.lib-bar { display: flex; align-items: baseline; gap: 8px; margin-bottom: 22px; }
.lib-bar h2 { font-size: 15px; margin: 0; font-weight: 650; }
.lib-bar .count { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.shelves { gap: 24px; }
.shelf { font-size: 15px; font-weight: 650; color: var(--faint); display: inline-flex; align-items: baseline; gap: 7px; transition: color .15s; }
.shelf:hover { color: var(--muted); }
.shelf.on { color: var(--text); }
.shelf .count { font-weight: 500; font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 38px 30px; }
.card { cursor: pointer; display: flex; flex-direction: column; gap: 12px; min-width: 0; border-radius: 6px; outline-offset: 6px; }
.card-cover { position: relative; }
.card:hover .cover { transform: translateY(-4px); }
.cover { position: relative; aspect-ratio: 2 / 3; width: 100%; border-radius: 3px 6px 6px 3px; overflow: hidden; background: var(--surface-2); box-shadow: var(--book-shadow); transition: transform .25s var(--ease); }
/* the spine: a soft fold near the left edge, as on a real book */
.cover::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(0, 0, 0, .14) 0, rgba(255, 255, 255, .16) 2.5%, rgba(255, 255, 255, 0) 5%, rgba(0, 0, 0, .04) 7%, rgba(0, 0, 0, 0) 12%); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* A cover made for a book without one (madecovers.js): white paper, a few
   bold shapes, the title in black. Sized by the cover's width. */
.cover-made { background: #fbfbf9; container-type: inline-size; }
.made-art, .made-art svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.made-text { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 4cqw; padding: 10cqw 11cqw 11cqw 14cqw; }
.made-title { font-family: var(--serif); font-weight: 600; line-height: 1.12; letter-spacing: -.01em; color: #15171c; overflow-wrap: break-word; text-wrap: balance; }
.made-title.short { font-size: 12cqw; } .made-title.mid { font-size: 10cqw; } .made-title.long { font-size: 8.4cqw; }
.made-author { font-size: 5.6cqw; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; color: #5b616c; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cover-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(0, 0, 0, .25); z-index: 1; }
.cover-progress span { display: block; height: 100%; background: var(--accent); }
.cover-lg { width: 128px; flex: none; }
.cover-sm { width: 40px; flex: none; border-radius: 2px 4px 4px 2px; }
.cover-sm .made-text { display: none; }
.badge { position: absolute; left: 8px; bottom: 10px; right: 8px; background: rgba(0, 0, 0, .66); backdrop-filter: blur(6px); color: #fff; font-size: 11px; padding: 4px 6px; border-radius: 6px; text-align: center; z-index: 2; }
.card-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-right: 2px; }
.card-title { font-weight: 600; font-size: 13.5px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-author { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot { display: flex; align-items: center; gap: 10px; margin-top: 3px; color: var(--faint); font-size: 12px; min-height: 18px; }
.card-pct { white-space: nowrap; font-variant-numeric: tabular-nums; }
.card-hl, .card-cloud { display: inline-flex; align-items: center; gap: 3px; color: var(--faint); }
.card-hl svg, .card-cloud svg { width: 13px; height: 13px; }
button.card-cloud { padding: 4px; margin: -4px; border-radius: 6px; }
button.card-cloud:hover { color: var(--accent); background: var(--accent-soft); }
@media (pointer: coarse) { button.card-cloud { padding: 10px; margin: -10px; } }
.card-cloud.fetching { font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--accent); }
.card-more { margin: -6px -6px -6px auto; opacity: 0; transition: opacity .15s; }
.card:hover .card-more, .card:focus-within .card-more { opacity: 1; }
@media (pointer: coarse) { .card-more { opacity: .8; } }

.empty-lib { max-width: 420px !important; margin: 14vh auto 0 !important; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-lib h2 { margin: 10px 0 0; font-size: 22px; font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
.empty-lib p { color: var(--muted); line-height: 1.55; margin: 0 0 14px; }
.empty-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; background: var(--accent-soft); color: var(--accent); }
.empty-icon svg { width: 26px; height: 26px; }
/* The written name, on the sign-in screen: deep green on light colours, pale on dark. */
.wordmark { width: 190px; margin: 0 auto 26px; }
.wordmark img { display: block; width: 100%; height: auto; }
.wordmark .is-dark, :root:not([data-theme="light"]) .wordmark img { display: none; }
:root:not([data-theme="light"]) .wordmark .is-dark { display: block; }
.empty-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }
.empty p { margin: 0 0 6px; }

/* all highlights */
.hl-book { margin-bottom: 56px; max-width: 720px !important; }
.hl-book-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.hl-book-head h2 { font-family: var(--serif); font-size: 20px; margin: 0 0 2px; font-weight: 600; letter-spacing: -.01em; }
.hl-book-head .muted { font-size: 13px; }
.hl-book-actions { margin-left: auto; display: flex; gap: 6px; }

/* ---------- highlight lists ---------- */
.hl-list { display: flex; flex-direction: column; }
.hl-chapter { font-size: 11.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); margin: 22px 0 8px; }
.hl-chapter:first-child { margin-top: 0; }
.hl-item { position: relative; padding: 10px 0 10px 18px; }
.hl-item::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--hl); }
.hl-item + .hl-item { border-top: 1px solid var(--hairline); }
.hl-text { text-align: left; font-family: var(--serif); font-size: 16px; line-height: 1.6; color: var(--text); white-space: pre-line; display: block; width: 100%; }
.hl-text:hover { color: var(--accent); }
.hl-note { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--muted); white-space: pre-line; }
.hl-note::before { content: "Note"; display: inline-block; font-weight: 650; color: var(--text); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; margin-right: 8px; }
.hl-actions { display: flex; gap: 16px; height: 0; overflow: hidden; opacity: 0; transition: opacity .15s; }
.hl-item:hover .hl-actions, .hl-item:focus-within .hl-actions { height: auto; margin-top: 6px; opacity: 1; }
@media (pointer: coarse) { .hl-actions { height: auto; margin-top: 6px; opacity: 1; } }

/* tags */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 550; white-space: nowrap; transition: background .15s, color .15s; }
button.tag:hover { background: var(--surface-2); color: var(--text); }
.tag.on { background: var(--text); color: var(--bg); }
.tag-count { font-size: 11px; opacity: .6; font-variant-numeric: tabular-nums; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 34px; max-width: 720px !important; }
.hl-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.hl-tags .tag { height: 22px; padding: 0 8px; font-size: 11.5px; }
.hl-tags .tag::before, .tag-on::before { content: "#"; opacity: .45; margin-right: -3px; }
.tag-field { display: flex; flex-direction: column; gap: 8px; }
.tag-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 42px; padding: 6px 8px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: text; transition: border-color .15s, background .15s; }
.tag-box:focus-within { border-color: var(--accent); background: var(--bg); }
.tag-chips { display: contents; }
.tag-on { background: var(--accent-soft); color: var(--accent); padding-right: 4px; }
.tag-x { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; line-height: 1; color: inherit; opacity: .7; }
.tag-x:hover { opacity: 1; background: color-mix(in srgb, var(--accent) 16%, transparent); }
.tag-input { flex: 1; min-width: 110px; border: 0; background: transparent; outline: none; font-size: 14.5px; padding: 4px 4px; }
.tag-suggest { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-suggest .tag { height: 24px; font-size: 12px; }
.tag-suggest .tag::before { content: "+ "; opacity: .5; white-space: pre; }

/* the Examples tab */
.examples { max-width: 760px !important; }
.ex-intro { color: var(--muted); margin: 0 0 8px; font-size: 14px; }
.ex-group { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -.01em; margin: 38px 0 4px; }
.ex-situation { font-size: 11.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); margin: 22px 0 8px; }
.ex-item { padding: 12px 0 14px; border-top: 1px solid var(--hairline); }
.ex-item h3 { margin: 0 0 6px; font-size: 15px; font-weight: 650; display: flex; align-items: baseline; gap: 8px; }
.ex-item h3 .count { color: var(--faint); font-weight: 500; font-size: 12.5px; }
.ex-place { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; padding: 7px 10px; margin: 0 -10px; border-radius: 10px; }
.ex-place:hover { background: var(--surface); }
.ex-book { font-size: 12px; font-weight: 600; color: var(--accent); }
.ex-where { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.ex-mine { font-size: 11px; color: var(--faint); }

/* places Claude found */
.pointer-bar { max-width: min(560px, calc(100vw - 20px)); }
.pointer-what { display: flex; flex-direction: column; gap: 1px; padding: 2px 10px 2px 8px; font-size: 13px; font-weight: 550; min-width: 0; max-width: 260px; }
.pointer-what span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pointer-kicker { font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; opacity: .6; }
.pointer-heading { margin-top: 30px !important; }
.pointer-item::before { background: transparent !important; border-left: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent); }
.pointer-text { font-family: var(--ui) !important; font-size: 14px !important; color: var(--muted) !important; }
.pointer-text:hover { color: var(--accent) !important; }
.pointer-meta { font-size: 11.5px; color: var(--faint); margin-top: 6px; }

/* the literature course */
.course { max-width: 760px !important; }
.course-intro { color: var(--muted); margin: 0 0 6px; font-size: 14px; }
.cu-part { margin-top: 34px; }
.cu-part-head { display: flex; flex-direction: column; gap: 2px; margin: 0 0 8px; font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.cu-part-num { font-family: var(--ui); font-size: 11.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.cu-later { color: var(--faint); font-size: 13.5px; margin: 4px 0 0; padding: 12px 0; border-top: 1px solid var(--hairline); }
.cu-row { position: relative; display: flex; align-items: flex-start; gap: 14px; width: calc(100% + 24px); text-align: left; padding: 14px 12px; margin: 0 -12px; border-radius: 14px; }
.cu-row::before { content: ""; position: absolute; left: 12px; right: 12px; top: 0; border-top: 1px solid var(--hairline); }
.cu-row:hover::before, .cu-row:hover + .cu-row::before { border-color: transparent; }
.cu-row:hover { background: var(--surface); }
.cu-num { flex: none; width: 28px; font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; line-height: 1.3; }
.cu-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.cu-title { font-size: 15.5px; font-weight: 650; line-height: 1.35; }
.cu-found { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.cu-meta { font-size: 12px; color: var(--faint); }
.cu-meta:empty { display: none; }
.cu-status { flex: none; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface); color: var(--faint); white-space: nowrap; margin-top: 2px; }
.cu-status.cu-reading { background: var(--accent-soft); color: var(--accent); }
.cu-status.cu-done { background: color-mix(in srgb, #1fae5b 14%, transparent); color: #168a48; }
:root:is([data-theme="dark"], [data-theme="black"]) .cu-status.cu-done { color: #5fd38f; }

.cu-page { max-width: 700px !important; padding-bottom: 20px; }
.cu-back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13.5px; font-weight: 550; padding: 4px 8px 4px 2px; margin: 0 0 18px -4px; border-radius: 8px; }
.cu-back:hover { color: var(--text); background: var(--surface); }
.cu-back svg { width: 18px; height: 18px; }
.cu-kicker { font-size: 11.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.cu-h1 { font-family: var(--serif); font-size: 32px; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; margin: 6px 0 10px; }
.cu-lead { font-family: var(--serif); font-size: 18px; line-height: 1.55; color: var(--muted); margin: 0 0 14px; }
.cu-facts { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 13px; margin-bottom: 8px; }
.cu-facts .cu-status { margin-top: 0; }
.cu-intro, .cu-section { font-family: var(--serif); font-size: 17px; line-height: 1.65; }
.cu-intro { color: var(--muted); }
.cu-section { margin-top: 34px; }
.cu-section h2 { font-family: var(--ui); font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text); margin: 0 0 10px; padding-top: 22px; border-top: 1px solid var(--hairline); }
.cu-section h3, .cu-section h4 { font-family: var(--ui); font-size: 15px; font-weight: 650; margin: 24px 0 6px; }
:is(.cu-intro, .cu-section, .cu-sources) p { margin: 0 0 14px; }
:is(.cu-section, .cu-sources) :is(ul, ol) { margin: 0 0 14px; padding-left: 22px; }
:is(.cu-section, .cu-sources) li { margin: 0 0 8px; padding-left: 2px; }
:is(.cu-section, .cu-sources) blockquote { margin: 0 0 14px; padding-left: 14px; border-left: 2px solid var(--line); color: var(--muted); }
:is(.cu-section, .cu-sources) code { font-family: ui-monospace, Menlo, monospace; font-size: .82em; background: var(--surface); padding: 1px 5px; border-radius: 5px; }
:is(.cu-section, .cu-sources) a { color: var(--accent); text-decoration: none; }
:is(.cu-section, .cu-sources) a:hover { text-decoration: underline; }
.md-table { overflow-x: auto; margin: 0 0 14px; }
.md-table table { border-collapse: collapse; font-family: var(--ui); font-size: 13.5px; }
.md-table :is(td, th) { border-bottom: 1px solid var(--hairline); padding: 6px 12px 6px 0; text-align: left; vertical-align: top; }
.cu-opens { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 14px; font-family: var(--ui); }
.cu-open { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 14px; background: var(--surface); transition: background .15s; }
.cu-open:hover { background: var(--surface-2); }
.cu-open.off { opacity: .6; }
.cu-open-icon { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.cu-open-icon svg { width: 18px; height: 18px; }
.cu-open-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.cu-open-where { font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.cu-open-book { font-size: 12.5px; color: var(--muted); }
.cu-open-go { flex: none; font-size: 13px; font-weight: 600; color: var(--accent); }
.cu-open.off .cu-open-go { display: none; }
.cu-toget { font-family: var(--ui); font-size: 14.5px; }
.cu-margin { list-style: none; padding: 0 !important; margin: 4px 0 14px; font-family: var(--ui); counter-reset: none; }
.cu-margin li { padding: 12px 0 12px 16px !important; margin: 0 !important; position: relative; border-top: 1px solid var(--hairline); }
.cu-margin li::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; border-left: 2px dashed rgba(212, 134, 11, .65); }
.cu-margin-where { font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.cu-margin-note { font-family: var(--serif); font-size: 15.5px; line-height: 1.55; color: var(--muted); margin: 4px 0 2px !important; }
.cu-show { color: var(--accent); }
.cu-margin-off { font-size: 12.5px; color: var(--faint); }
.cu-actions { display: flex; gap: 8px; margin: 4px 0 14px; font-family: var(--ui); }
a.btn { text-decoration: none !important; }
.cu-deepwell svg { width: 16px; height: 16px; }
.cu-listen { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--surface); text-decoration: none !important; color: var(--text) !important; font-family: var(--ui); margin: 0 0 14px; }
.cu-listen:hover { background: var(--surface-2); }
.cu-listen-label { font-size: 14.5px; font-weight: 600; color: var(--accent); }
.cu-listen-min { font-size: 12.5px; color: var(--faint); }
.cu-listen-why { font-size: 13.5px; color: var(--muted); line-height: 1.45; margin-top: 4px; }
.cu-finish { display: flex; align-items: center; gap: 12px; margin: 38px 0 10px; padding-top: 22px; border-top: 1px solid var(--hairline); }
.cu-finish-text { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; color: #168a48; }
:root:is([data-theme="dark"], [data-theme="black"]) .cu-finish-text { color: #5fd38f; }
.cu-finish-text svg { width: 18px; height: 18px; stroke-width: 2.2; }
.cu-sources { margin-top: 24px; font-size: 14px; line-height: 1.55; color: var(--muted); }
.cu-sources summary { cursor: pointer; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 6px 0; }
.cu-sources summary:hover { color: var(--muted); }
.cu-sources[open] summary { margin-bottom: 8px; }

/* the course's notes in a book */
.lit-card { left: 50% !important; top: auto !important; bottom: calc(78px + var(--safe-bottom)); transform: translateX(-50%); flex-direction: column; align-items: stretch; gap: 2px; padding: 12px 8px 6px; width: min(460px, calc(100vw - 24px)); border-radius: 18px; }
@keyframes lit-pop { from { opacity: 0; transform: translate(-50%, 6px); } }
.lit-card { animation: lit-pop .18s var(--ease); }
.lit-item { padding: 0 8px 6px; }
.lit-item + .lit-item { border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 8px; }
.lit-item .pointer-kicker { color: #f3b65a; opacity: 1; }
.lit-note { margin: 4px 0 2px; font-family: var(--serif); font-size: 15px; line-height: 1.5; user-select: text; -webkit-user-select: text; }
.lit-actions { display: flex; flex-wrap: wrap; gap: 2px; border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 4px; }
.link-lit .link-kind { background: rgba(212, 134, 11, .14); color: #a5650a; }
:root:is([data-theme="dark"], [data-theme="black"]) .link-lit .link-kind { color: #f3b65a; background: rgba(243, 182, 90, .14); }
.lit-item-row::before { border-left-color: rgba(212, 134, 11, .65) !important; }
.lit-list-note { margin: 6px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); }

/* links to Deep Well */
.link-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 26px; padding: 3px 10px 3px 4px; border-radius: 999px; background: var(--surface); color: var(--text); font-size: 12.5px; font-weight: 550; text-align: left; max-width: 100%; }
button.link-chip:hover { background: var(--surface-2); }
.link-chip.on { background: var(--text); color: var(--bg); }
.link-kind { flex: none; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 3px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.link-unit .link-kind { background: color-mix(in srgb, #0f7a5c 14%, transparent); color: #0f7a5c; }
:root:is([data-theme="dark"], [data-theme="black"]) .link-unit .link-kind { color: #5fd3a6; background: rgba(95, 211, 166, .14); }
.link-chip.on .link-kind { background: color-mix(in srgb, var(--bg) 18%, transparent); color: inherit; }
.link-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-chip .tag-x { margin-right: -4px; }
.hl-links { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.hl-links .link-chip { min-height: 22px; font-size: 11.5px; }
.link-field { display: flex; flex-direction: column; gap: 8px; }
.link-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.link-chips:empty { display: none; }
.link-add { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 8px; border-radius: 999px; border: 1px dashed var(--line); color: var(--muted); font-size: 13px; font-weight: 550; }
.link-add:hover { border-color: var(--accent); color: var(--accent); }
.link-add svg { width: 15px; height: 15px; }
.picker-search { margin: 12px 0 0; }
.picker-list { display: flex; flex-direction: column; }
.picker-group { font-size: 11.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); margin: 20px 0 4px; }
.picker-situation { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 10px 0 2px 2px; }
.picker-row { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; padding: 7px 8px; border-radius: 10px; }
.picker-row:hover { background: var(--surface); }
.picker-row.on { background: var(--accent-soft); }
.picker-sub-row { padding-left: 34px; }
.picker-check { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 6px; border: 1.5px solid var(--line); display: grid; place-items: center; color: var(--accent-text); }
.picker-row.on .picker-check { background: var(--accent); border-color: var(--accent); }
.picker-check svg { width: 13px; height: 13px; stroke-width: 2.4; }
.picker-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.picker-title { font-size: 14px; line-height: 1.35; }
.picker-sub { font-size: 12px; color: var(--faint); line-height: 1.35; }

/* ---------- reader ---------- */
.reader { background: var(--page-bg, var(--bg)); color: var(--page-fg, var(--text)); }
.r-shell { position: absolute; inset: 0; overflow: hidden; }
.r-stage { position: absolute; inset: var(--safe-top) 0 var(--safe-bottom) 0; }
.r-stage foliate-view { display: block; width: 100%; height: 100%; --overlayer-highlight-opacity: .34; --overlayer-highlight-blend-mode: multiply; }
.reader[data-page="dark"] foliate-view, .reader[data-page="black"] foliate-view { --overlayer-highlight-opacity: .32; --overlayer-highlight-blend-mode: screen; }
.reader.scrolled .r-stage { top: calc(var(--safe-top) + 8px); }

.r-top, .r-bottom { position: absolute; left: 0; right: 0; z-index: 5; transition: opacity .25s var(--ease), transform .25s var(--ease); opacity: 0; pointer-events: none; }
.r-top { top: 0; transform: translateY(-4px); display: flex; align-items: center; gap: 4px; padding: calc(10px + var(--safe-top)) 14px 22px; background: linear-gradient(var(--page-bg, var(--bg)) 55%, transparent); }
.r-bottom { bottom: 0; transform: translateY(4px); padding: 26px 28px calc(14px + var(--safe-bottom)); background: linear-gradient(transparent, var(--page-bg, var(--bg)) 45%); }
.reader.chrome .r-top, .reader.chrome .r-bottom { opacity: 1; transform: none; pointer-events: auto; }
.reader .icon-btn { color: color-mix(in srgb, var(--page-fg, var(--text)) 62%, transparent); }
.reader .icon-btn:hover { color: var(--page-fg); background: color-mix(in srgb, var(--page-fg, var(--text)) 7%, transparent); }
.r-heading { flex: 1; min-width: 0; text-align: center; line-height: 1.25; }
.r-title { font-size: 13px; font-weight: 550; opacity: .55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }
.r-chapter { display: none; }
.r-tools { display: flex; gap: 0; }

/* the scrubber: a thin line, a knob on hover */
.r-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; margin: 0 0 8px; background: transparent; cursor: pointer; --p: 0%; }
.r-slider::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--p), color-mix(in srgb, var(--page-fg, var(--text)) 14%, transparent) var(--p)); }
.r-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -5px; border-radius: 50%; background: var(--accent); border: 0; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); transform: scale(.0); transition: transform .15s; }
.r-slider:hover::-webkit-slider-thumb, .r-slider:focus-visible::-webkit-slider-thumb, .r-slider:active::-webkit-slider-thumb { transform: scale(1); }
@media (pointer: coarse) { .r-slider::-webkit-slider-thumb { transform: scale(1); } }
.r-slider::-moz-range-track { height: 3px; border-radius: 3px; background: color-mix(in srgb, var(--page-fg, var(--text)) 14%, transparent); }
.r-slider::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--accent); }
.r-slider::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: var(--accent); }
.r-info { display: flex; justify-content: space-between; gap: 16px; font-size: 12px; opacity: .5; font-variant-numeric: tabular-nums; }
.r-info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* when the bars are hidden: a whisper of where you are */
.r-mini { position: absolute; left: 0; right: 0; bottom: calc(15px + var(--safe-bottom)); text-align: center; font-size: 11px; letter-spacing: .02em; opacity: .38; pointer-events: none; font-variant-numeric: tabular-nums; transition: opacity .25s; z-index: 2; }
.r-line { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); opacity: .55; z-index: 2; transition: width .3s var(--ease), opacity .25s; pointer-events: none; }
.reader.chrome .r-mini, .reader.chrome .r-line { opacity: 0; }
.reader.scrolled .r-mini { display: none; }
.r-edge { position: absolute; top: 25%; bottom: 25%; width: 28px; z-index: 3; opacity: 0; }
.r-edge-left { left: 0; }
.r-edge-right { right: 0; }
@media (pointer: coarse) { .r-edge { display: none; } }
.r-jump { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(76px + var(--safe-bottom)); z-index: 6; display: flex; align-items: center; gap: 10px; padding: 7px 7px 7px 16px; border-radius: 999px; background: var(--bar); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); color: var(--bar-text); box-shadow: var(--shadow); font-size: 13.5px; width: max-content; max-width: calc(100% - 24px); animation: pop .2s var(--ease); }
.r-jump .icon-btn { color: var(--bar-text); }
/* just looking: shown with the bars, out of the way while reading */
.r-peek { transition: opacity .25s var(--ease); opacity: 0; pointer-events: none; animation: none; }
.r-peek .btn:not(.primary) { background: color-mix(in srgb, var(--bar-text) 13%, transparent); color: var(--bar-text); }
.reader.chrome .r-peek { opacity: 1; pointer-events: auto; }
.reader.peeking .r-mini { opacity: .62; }
.reader.peeking.chrome .r-mini { opacity: 0; }
.r-loading, .r-error { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); text-align: center; padding: 24px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* the bar over a selection or a highlight */
.sel-bar { position: fixed; z-index: 40; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 14px; background: var(--bar); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); color: var(--bar-text); box-shadow: var(--shadow); animation: pop .16s var(--ease); user-select: none; -webkit-user-select: none; }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.97); } }
.dots { display: flex; gap: 0; padding: 0 2px; }
.dot { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; }
.dot::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background: var(--dot); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); transition: transform .12s; }
.dot:hover::before { transform: scale(1.12); }
.dot.on::before { box-shadow: 0 0 0 2px rgba(22, 24, 29, 1), 0 0 0 3.5px var(--dot); }
.bar-sep { width: 1px; height: 20px; background: rgba(255, 255, 255, .14); margin: 0 4px; }
.bar-btn { height: 34px; padding: 0 10px; border-radius: 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 550; }
.bar-btn:hover { background: rgba(255, 255, 255, .1); }
.bar-btn svg { width: 17px; height: 17px; }
.sel-bar.has-def { flex-direction: column; align-items: stretch; gap: 0; padding: 4px 4px 10px; }
.sel-row { display: flex; align-items: center; gap: 2px; }
/* The word's first meaning, under the buttons, no wider than they are. */
.sel-def { width: 0; min-width: 100%; margin-top: 4px; padding: 8px 10px 0; border-top: 1px solid rgba(255, 255, 255, .12); font-size: 13.5px; line-height: 1.45; }
.def-head { display: flex; align-items: baseline; gap: 8px; }
.def-word { font-family: var(--serif); font-weight: 600; font-size: 15.5px; }
.def-pos { font-style: italic; font-size: 12.5px; opacity: .65; }
.def-more { margin-left: auto; padding: 3px 9px; border-radius: 8px; font-size: 12.5px; font-weight: 600; opacity: .85; }
.def-more:hover { background: rgba(255, 255, 255, .1); opacity: 1; }
.def-from { font-size: 12.5px; opacity: .65; }
.def-text { margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.def-wait { font-size: 13px; opacity: .65; }
/* The whole entry, in a panel. */
.dict-panel p.def-wait { opacity: 1; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.dict-from { margin: 0 0 4px; color: var(--muted); }
.dict-title { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 4px; font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.dict-lang { font-family: var(--ui); font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.dict-group h3 { margin: 18px 0 8px; font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.dict-group ol { margin: 0; padding-left: 22px; }
.dict-group li { margin: 0 0 9px; font-family: var(--serif); font-size: 15px; line-height: 1.5; }
.dict-group li::marker { color: var(--faint); font-family: var(--ui); font-size: 12.5px; }
.dict-example { display: block; margin-top: 2px; font-size: 14px; font-style: italic; color: var(--muted); }
.dict-source { display: inline-block; margin-top: 16px; font-size: 13px; color: var(--muted); }
.footnote { flex-direction: column; align-items: stretch; max-width: min(420px, calc(100vw - 20px)); padding: 14px 16px 10px; gap: 8px; }
.footnote-text { font-family: var(--serif); font-size: 15px; line-height: 1.55; max-height: 40vh; overflow: auto; }
.footnote-text p { margin: 0 0 8px; }
.footnote .link-btn { color: rgba(255, 255, 255, .65); align-self: flex-end; }

/* ---------- overlays ---------- */
.scrim { position: absolute; inset: 0; background: rgba(8, 10, 14, .26); }
.panel-wrap, .dialog-wrap { position: fixed; inset: 0; z-index: 50; }
.panel-wrap .scrim { opacity: 0; transition: opacity .22s; }
.panel-wrap.show .scrim { opacity: 1; }
.panel { position: absolute; top: 10px; bottom: 10px; width: min(392px, calc(100vw - 20px)); background: var(--bg); color: var(--text); border-radius: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; transition: transform .28s var(--ease), opacity .2s; opacity: 0; }
.panel-right { right: 10px; transform: translateX(24px); }
.panel-left { left: 10px; transform: translateX(-24px); }
.panel-wrap.show .panel { transform: none; opacity: 1; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: calc(16px + var(--safe-top)) 12px 8px 22px; }
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 650; flex: 1; letter-spacing: -.005em; }
.panel-actions { display: flex; align-items: center; gap: 6px; }
.panel-body { flex: 1; overflow-y: auto; padding: 6px 22px calc(24px + var(--safe-bottom)); }

.dialog-wrap { display: grid; place-items: center; padding: 16px; }
.dialog-wrap .scrim { animation: fade-in .18s; }
@keyframes fade-in { from { opacity: 0; } }
.dialog { position: relative; width: min(420px, 100%); background: var(--bg); color: var(--text); border-radius: 20px; box-shadow: var(--shadow); padding: 24px; display: flex; flex-direction: column; gap: 12px; animation: pop .2s var(--ease); }
.dialog h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.dialog p { margin: 0; color: var(--muted); line-height: 1.5; }
.dialog-buttons { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 8px; }
.dialog-buttons .hint { margin-right: auto; color: var(--faint); font-size: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field input { height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 12px; font-size: 15px; color: var(--text); outline: none; transition: border-color .15s, background .15s; }
.field input:focus { border-color: var(--accent); background: var(--bg); }
.form-error { color: var(--danger) !important; font-size: 14px; }
.form-error:empty { display: none; }

.note-dialog { width: min(520px, 100%); }
.note-quote { margin: 0; padding: 2px 0 2px 16px; position: relative; font-family: var(--serif); font-size: 15px; line-height: 1.55; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; white-space: pre-line; }
.note-quote::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; border-radius: 3px; background: var(--hl); }
.note-input { width: 100%; resize: vertical; min-height: 110px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); padding: 12px 14px; font-size: 15px; line-height: 1.5; outline: none; transition: border-color .15s, background .15s; }
.note-input:focus { border-color: var(--accent); background: var(--bg); }

.menu { position: fixed; z-index: 60; min-width: 210px; max-width: 320px; background: var(--glass); backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5); color: var(--text); border: 1px solid var(--hairline); border-radius: 14px; box-shadow: var(--shadow); padding: 5px; animation: pop .14s var(--ease); }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; text-align: left; font-size: 13.5px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--accent); color: var(--accent-text); outline: none; }
.menu-item:hover .menu-icon, .menu-item:focus-visible .menu-icon { color: inherit; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger); color: #fff; }
.menu-icon { display: grid; place-items: center; color: var(--muted); }
.menu-item.danger .menu-icon { color: inherit; }
.menu-icon svg { width: 16px; height: 16px; }
.menu-sep { height: 1px; background: var(--hairline); margin: 5px 8px; }

.toast { position: fixed; z-index: 70; left: 50%; bottom: calc(28px + var(--safe-bottom)); transform: translate(-50%, 10px); opacity: 0; transition: opacity .2s, transform .25s var(--ease); background: var(--bar); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); color: var(--bar-text); padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow); font-size: 13.5px; display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 24px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-action { font-weight: 650; color: #9db8ff; }

/* the Look panel */
.look-group { padding: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.look-group + .look-group { border-top: 1px solid var(--hairline); }
.look-label { font-size: 12px; font-weight: 600; color: var(--faint); letter-spacing: .02em; }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.swatch-chip { width: 100%; aspect-ratio: 1.4; border-radius: 12px; display: grid; place-items: center; font-family: var(--serif); font-size: 18px; border: 1px solid var(--line); background: var(--sw-bg); color: var(--sw-fg); transition: box-shadow .15s; }
.swatch-auto .swatch-chip { background: linear-gradient(135deg, #fff 50%, #15181d 50%); }
.swatch-auto .swatch-chip span { mix-blend-mode: difference; color: #fff; }
.swatch.on { color: var(--text); font-weight: 600; }
.swatch.on .swatch-chip { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.font-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.font-opt { height: 56px; border-radius: 12px; border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11.5px; color: var(--muted); }
.font-opt b { font-size: 19px; font-weight: 500; color: var(--text); }
.font-opt.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--text); }
.segmented { display: flex; padding: 3px; background: var(--surface); border-radius: 12px; gap: 2px; }
.segmented button { flex: 1; height: 30px; border-radius: 9px; font-size: 13px; font-weight: 550; color: var(--muted); padding: 0 6px; white-space: nowrap; transition: background .15s, color .15s; }
.segmented button.on { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper .btn { flex: 1; height: 38px; border-radius: 12px; }
.size-value { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.small-a { font-family: var(--serif); font-size: 13px; }
.big-a { font-family: var(--serif); font-size: 20px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; cursor: pointer; padding: 4px 0; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 38px; height: 23px; border-radius: 12px; background: var(--surface-2); position: relative; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; left: 2.5px; top: 2.5px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--ease); }
.toggle input:checked + .switch { background: var(--accent); }
.toggle input:checked + .switch::after { transform: translateX(15px); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

/* contents */
.toc, .toc ol { list-style: none; margin: 0; padding: 0; }
.toc ol { padding-left: 14px; }
.toc-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 9px; font-size: 14px; line-height: 1.35; color: var(--muted); }
.toc-item:hover { background: var(--surface); color: var(--text); }
.toc-item.current { color: var(--accent); font-weight: 600; background: var(--accent-soft); }

/* search */
.search-input { width: 100%; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; outline: none; font-size: 15px; }
.search-input:focus { border-color: var(--accent); background: var(--bg); }
.search-status { color: var(--faint); font-size: 12.5px; margin: 10px 2px; }
.search-group { margin-bottom: 14px; }
.search-chapter { font-size: 11.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); margin: 10px 0 4px 10px; }
.search-hit { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 9px; font-family: var(--serif); font-size: 14px; line-height: 1.55; color: var(--muted); }
.search-hit:hover { background: var(--surface); color: var(--text); }
.search-hit mark { background: var(--accent-soft); color: var(--accent); font-weight: 600; border-radius: 3px; padding: 0 1px; }

/* cover picker */
.cover-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cover-choice { display: flex; flex-direction: column; gap: 6px; align-items: stretch; text-align: left; font-size: 11.5px; color: var(--muted); }
.cover-choice .cover { transition: transform .2s var(--ease), box-shadow .2s; }
.cover-choice:hover .cover { transform: translateY(-3px); }
.cover-choice.on .cover { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent), var(--book-shadow); }

/* ---------- the Mac window: its own title bar ---------- */
:root[data-platform="mac"] .lib-top { padding-left: 92px; padding-top: 16px; -webkit-app-region: drag; }
:root[data-platform="mac"] .r-top { padding-left: 84px; -webkit-app-region: drag; }
:root[data-platform="mac"] :is(.lib-top, .r-top) :is(button, input, .tabs, .search) { -webkit-app-region: no-drag; }

/* ---------- phones ---------- */
@media (max-width: 720px) {
  .lib-top { flex-wrap: wrap; padding: calc(12px + var(--safe-top)) 18px 8px; gap: 8px 18px; }
  .lib-actions { display: contents; }
  .lib-actions .sync-btn { margin-left: auto; }
  .tabs { order: 3; }
  .search { order: 4; width: 100%; margin: 4px 0 0; }
  .lib-search, .lib-search:focus { width: 100%; height: 38px; }
  .lib-main { padding: 14px 18px calc(48px + var(--safe-bottom)); }
  .continue { gap: 20px; padding: 18px; margin-bottom: 32px; border-radius: 20px; }
  .cover-lg { width: 88px; }
  .continue-title { font-size: 21px; }
  .continue-place { margin-top: 10px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 28px 16px; }
  .hl-book-head { flex-wrap: wrap; }
  .hl-book-actions { margin-left: 56px; }
  .cu-h1 { font-size: 26px; }
  .cu-intro, .cu-section { font-size: 16.5px; }
  .cu-row { gap: 10px; }
  .cu-status { font-size: 11px; padding: 2px 8px; }
  .panel, .panel-left, .panel-right { top: auto; bottom: 0; left: 0; right: 0; width: 100%; height: min(86vh, 720px); border-radius: 22px 22px 0 0; transform: translateY(40px); }
  .panel::before { content: ""; position: absolute; top: 7px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line); }
  .panel-head { padding-top: 20px; }
  .r-top { padding-left: 6px; padding-right: 6px; }
  .r-bottom { padding-left: 18px; padding-right: 18px; }
  .r-heading { text-align: left; padding-left: 4px; }
  .dialog-wrap.note-wrap { place-items: end center; padding: 0; }
  .note-dialog { border-radius: 22px 22px 0 0; padding-bottom: calc(18px + var(--safe-bottom)); }
}
