  :root {
    --bg: #f6f1e7;
    --paper: #fbf8f1;
    --ink: #2b2620;
    --ink-soft: #6b6256;
    --ink-faint: #a39a8c;
    --rule: #e2d9c8;
    --accent: #8a4b2a;
    --accent-soft: #f0dcc9;
    --hl: #f7e3a4;
    --shadow: 0 8px 30px rgba(60, 40, 20, .12);
    /* A group of notes' own colour (label.hue), muted so several on screen stay quiet. */
    --g0: #b07a2a; --g1: #5f7f55; --g2: #4f6c8f; --g3: #a25a5f; --g4: #7a5a8c; --g5: #3f8079;
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  }
  :root[data-theme="dark"] {
    --bg: #17140f; --paper: #1e1a14; --ink: #e8dfcf; --ink-soft: #a09685; --ink-faint: #6e665a;
    --rule: #342d22; --accent: #e0a070; --accent-soft: #3a2a1d; --hl: #5a4a1e;
    --shadow: 0 8px 30px rgba(0, 0, 0, .5);
    --g0: #d9a85a; --g1: #93b588; --g2: #8aa6c8; --g3: #d08e92; --g4: #b293c4; --g5: #7cbab2;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #17140f; --paper: #1e1a14; --ink: #e8dfcf; --ink-soft: #a09685; --ink-faint: #6e665a;
      --rule: #342d22; --accent: #e0a070; --accent-soft: #3a2a1d; --hl: #5a4a1e;
      --shadow: 0 8px 30px rgba(0, 0, 0, .5);
      --g0: #d9a85a; --g1: #93b588; --g2: #8aa6c8; --g3: #d08e92; --g4: #b293c4; --g5: #7cbab2;
    }
  }

  * { box-sizing: border-box; }
  html, body { margin: 0; }
  body { overflow-x: clip; }
  body {
    background: var(--bg); color: var(--ink);
    font-family: var(--serif); line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }
  button { font: inherit; color: inherit; cursor: pointer; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
  }

  .brand { font-family: var(--serif); font-style: italic; color: var(--ink-soft); }
  a.brand { text-decoration: none; }
  a.brand:hover { color: var(--accent); }
  .chip {
    border: 1px solid var(--rule); background: transparent;
    padding: 6px 12px; border-radius: 999px; font-size: 13px; font-family: var(--sans);
  }
  a.chip { color: inherit; text-decoration: none; }
  .chip:hover { border-color: var(--accent); color: var(--accent); }
  .icon-btn { border: 0; background: transparent; padding: 6px 8px; border-radius: 8px; font-size: 16px; }
  .icon-btn:hover { background: var(--accent-soft); }

  /* ---------- focus: stands directly over the passage, in soft italic, set off from it by a rule across the column ---------- */
  /* Its distance from the passage follows the window's width: 30px on a phone, up to 60px on a wide screen. */
  .focus { position: relative; max-width: var(--measure); margin: 0 0 clamp(30px, calc(30px + 30 * (100vw - 390px) / 1050), 60px); }
  .focus::after { content: ""; display: block; height: 1px; margin-top: 14px; background: var(--rule); }
  /* The way back to the search a result was opened from: a tinted band over the focus, growing upward from it (see
     .over). Put away, it closes up; the focus and passage stay where they are. */
  .back-slip {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; max-width: var(--measure); margin-bottom: 12px; padding: 7px 6px 7px 12px; overflow: hidden;
    border-radius: 8px; background: var(--accent-soft); font-family: var(--sans); font-size: 13px;
    transition: height .2s, margin-bottom .2s, padding .2s, opacity .2s;
  }
  .back-slip.closing { margin-bottom: 0; padding-top: 0; padding-bottom: 0; opacity: 0; }
  .back-slip[hidden] { display: none; }
  .back-slip > a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); text-decoration: none; }
  .back-slip > a:hover { color: var(--accent); }
  .back-slip q { font-style: italic; }
  .back-slip-x { flex: none; border: 0; background: none; padding: 2px 6px; border-radius: 6px; color: var(--ink-soft); font-size: 15px; line-height: 1; }
  .back-slip-x:hover { color: var(--accent); background: var(--paper); }
  /* The results either side, under the way back: "‹ Isaiah 22:4 · 3 of 13 · Isaiah 40:2 ›". A long title shortens on
     its side and its number stays. The row is there while they load, so the focus doesn't drop when they come. */
  .back-slip-results {
    display: flex; align-items: baseline; flex-basis: 100%; min-width: 0; min-height: calc(1.5em + 6px); margin: 4px 6px 0 0; padding-top: 5px;
    border-top: 1px solid color-mix(in srgb, var(--ink-faint) 30%, transparent); font-size: 12.5px; color: var(--ink-soft);
  }
  .back-slip-results[hidden] { display: none; }
  .back-slip-step { display: inline-flex; flex: 0 1 auto; min-width: 0; padding: 1px 4px; border-radius: 5px; color: var(--ink-soft); text-decoration: none; }
  .back-slip-step[hidden] { display: none; }
  .back-slip-step:hover { color: var(--accent); background: var(--paper); }
  .back-slip-step span { flex: none; white-space: pre; }
  .back-slip-step .back-slip-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .back-slip-where { flex: 1 0 auto; padding: 0 6px; text-align: center; color: var(--ink-faint); white-space: nowrap; }
  .back-slip-where b { font-weight: 500; color: var(--ink-soft); }
  .back-slip-where .short { display: none; }
  .focus-head {
    display: flex; align-items: flex-start; gap: 7px;
    width: 100%; padding: 0; border: 0; background: none; text-align: left;
  }
  /* A focus with a description or other focuses to note under is a button (it drops them); one without is only read. */
  button.focus-head { cursor: pointer; }
  /* A thought bubble in the keep ribbon's slot, so the focus lines up with the reference below; wrapped lines stay clear of it. */
  .focus-mark { flex: none; width: 17px; height: 16px; margin-top: .4em; fill: none; stroke: var(--ink-faint); stroke-width: 1.3; }
  .focus-title {
    display: inline; margin: 0; font-size: inherit; line-height: inherit; font-weight: 400; font-style: italic; color: var(--ink-soft);
  }
  .focus-line { font-size: clamp(19px, 2.4vw, 22px); line-height: 1.3; text-wrap: balance; }
  /* The chevron rides at the end of the focus's last line. */
  .focus-caret { display: inline-block; margin-left: 6px; vertical-align: .12em; line-height: 0; transition: transform .2s; }
  .focus-caret svg { width: 13px; height: 8px; fill: none; stroke: var(--ink-faint); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  button.focus-head:hover .focus-title { color: var(--accent); }
  button.focus-head:hover .focus-mark, button.focus-head:hover .focus-caret svg { stroke: var(--accent); }
  .focus.open .focus-caret { transform: rotate(180deg); }
  .focus-body {
    display: none; position: absolute; left: -16px; top: calc(100% + 8px); z-index: 25; width: min(560px, calc(100vw - 16px));
    max-height: 60vh; overflow-y: auto;
    background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow);
  }
  .focus.open .focus-body { display: block; }
  .focus-body-in { padding: 14px 16px 16px; color: var(--ink-soft); font-size: 17px; }
  .focus-body-in > p { max-width: 60ch; }
  .focus-body p { margin: 0 0 10px; }
  .focus-body p:last-child { margin-bottom: 0; }
  /* Under the description, the other focuses to note this passage under: one line each, as they stand over the passage. */
  .focus-others { display: block; padding: 12px 16px 14px; font-family: var(--serif); }
  .focus-others:empty { display: none; }
  .focus-body-in + .focus-others:not(:empty) { margin: 0 16px; padding: 12px 0 14px; border-top: 1px solid var(--rule); }
  .pick-head { margin: 0 0 8px; font-family: var(--sans); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint); }
  .pick-filter {
    display: block; width: 100%; margin: 0 0 6px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 8px;
    background: var(--bg); color: var(--ink); font: italic 15px var(--serif);
  }
  .pick-filter::placeholder { color: var(--ink-faint); }
  .pick-filter:focus { outline: none; border-color: var(--accent); }
  .pick-list { list-style: none; margin: 0 -10px; padding: 0; }
  .pick-list li { display: flex; }
  .pick-list li[hidden] { display: none; }
  .pick { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; border-radius: 8px 0 0 8px; text-decoration: none; }
  .pick .focus-mark { width: 14px; height: 13px; margin-top: 0; align-self: center; }
  .pick-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16.5px; font-style: italic; color: var(--ink-soft); }
  .pick-noted { flex: none; font: 11px var(--sans); letter-spacing: .04em; color: var(--accent); }
  .pick-num { flex: none; min-width: 1ch; text-align: right; font: 11px var(--sans); font-variant-numeric: tabular-nums; color: var(--ink-faint); }
  .pick:is(:hover, :focus-visible) { outline: none; background: var(--accent-soft); }
  .pick:is(:hover, :focus-visible) .pick-title { color: var(--ink); }
  .pick:is(:hover, :focus-visible) .focus-mark { stroke: var(--accent); }
  /* Beside each, a target of its own, set off by a hairline and lit on its own: make it current, reading on here. */
  .pick-switch-form { display: flex; flex: none; }
  .pick-switch {
    display: flex; align-items: center; gap: 6px; margin-left: 6px; padding: 0 10px; border: 0; border-left: 1px solid var(--rule);
    border-radius: 0 8px 8px 0; background: none; cursor: pointer; font: 12px var(--sans); color: var(--ink-faint); white-space: nowrap;
  }
  .pick-list li:hover .pick-switch { color: var(--ink-soft); }
  .pick-switch:is(:hover, :focus-visible) { outline: none; color: var(--accent); background: var(--accent-soft); }
  /* Every row's key takes the same room, set or not (none past 9), so the hairlines line up down the list. */
  .pick-switch-num { min-width: 2.2em; text-align: right; font: 10.5px var(--sans); font-variant-numeric: tabular-nums; color: var(--ink-faint); }
  .pick-all { display: block; margin: 6px 0 0 22px; padding: 0; border: 0; background: none; cursor: pointer; font-family: var(--sans); font-size: 12.5px; color: var(--ink-soft); }
  .pick-all:is(:hover, :focus-visible) { color: var(--accent); }
  .pick-all[hidden] { display: none; }
  @media (max-width: 599px) {
    .focus-body { left: -8px; }
  }

  /* Recent places: opened from the rail (or with h; on phones from the menu). */
  .history-panel {
    display: none; position: absolute; z-index: 30; width: min(420px, 92vw);
    max-height: 70vh; overflow-y: auto; padding: 6px; font-family: var(--sans);
    background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  }
  .history-panel.open { display: block; }
  .hist-head { padding: 6px 12px 4px; font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); }
  .hist-empty { margin: 0; padding: 10px 12px 12px; font-size: 14px; color: var(--ink-soft); }
  .hist-item {
    display: grid; grid-template-columns: 1fr auto; column-gap: 12px; padding: 8px 12px; min-height: 44px;
    border-radius: 8px; color: var(--ink); text-decoration: none;
  }
  .hist-item:hover, .hist-item:focus-visible { background: var(--accent-soft); outline: 0; }
  .hist-ref { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hist-when { font-size: 12px; color: var(--ink-soft); white-space: nowrap; align-self: center; }
  .hist-text {
    grid-column: 1 / -1; font-family: var(--serif); font-size: 14px; color: var(--ink-soft);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .hist-kept { display: inline-block; width: 7px; height: 10px; margin-left: 7px; background: var(--accent); vertical-align: middle; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%); }
  .hist-note { display: inline-block; width: 6px; height: 6px; margin-left: 7px; border-radius: 50%; background: var(--accent); vertical-align: middle; }

  /* Keep: a bookmark ribbon beside the passage's reference. The whole row sticks to the top while a long passage scrolls. */
  .now-head {
    position: sticky; top: 0; z-index: 2; display: flex; align-items: center;
    margin-bottom: 4px; padding: 12px 0 10px;
    background: linear-gradient(var(--band) calc(100% - 10px), transparent); /* text scrolling under it fades out instead of being cut */
  }
  .now-head .ref { margin: 0; }
  .keep { position: relative; flex: none; display: flex; white-space: normal; } /* .now keeps line breaks; the popover mustn't */
  .keep-btn {
    display: flex; align-items: center; justify-content: center; padding: 8px 10px; margin: -8px 0 -8px -10px;
    border: 0; background: transparent; color: var(--ink-soft);
  }
  .keep-btn svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; opacity: .6; transition: opacity .15s; }
  .keep-btn:hover svg, .keep-btn:focus-visible svg { opacity: 1; color: var(--accent); }
  .keep-btn.kept svg { fill: var(--accent); stroke: var(--accent); opacity: 1; }
  .keep-toast, .keep-pop {
    position: absolute; left: -10px; top: 100%; margin-top: 6px; z-index: 3; font-family: var(--sans); font-size: 13px; color: var(--ink);
    background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  }
  .keep-toast[hidden], .keep-pop[hidden] { display: none; }
  .keep-toast { display: flex; align-items: center; gap: 12px; padding: 8px 14px; white-space: nowrap; }
  .keep-toast button, .keep-pop-quiet button { border: 0; background: none; padding: 4px 0; color: var(--accent); font-size: 13px; text-decoration: underline; }
  .keep-toast [hidden] { display: none; }
  /* After a save, the toast shows the remark in the passage's own type. */
  .keep-toast-remark { max-width: 22em; overflow: hidden; text-overflow: ellipsis; font-family: var(--serif); font-style: italic; font-size: 14px; color: var(--ink-soft); }
  .keep-toast-remark.cleared { font-family: inherit; font-style: normal; font-size: inherit; }
  .keep-pop { width: min(320px, calc(100vw - 32px)); padding: 12px 14px; }
  .keep-pop label { display: block; margin-bottom: 6px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
  .keep-pop input {
    width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: var(--paper);
    border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px;
  }
  .keep-pop-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
  /* Remove and See all kept step back; Save is the way out. */
  .keep-pop-quiet { display: flex; align-items: center; gap: 14px; }
  .keep-pop-quiet :is(button, a) { font-size: 12px; color: var(--ink-soft); }
  .keep-pop-quiet :is(button, a):hover { color: var(--accent); }
  .keep-save { border: 0; border-radius: 999px; padding: 5px 16px; background: var(--accent); color: var(--bg); font-family: var(--sans); font-size: 13px; font-weight: 600; }
  .keep-save:hover { filter: brightness(1.08); }
  .keep-pop-hint { margin: 6px 0 0; font-size: 11px; color: var(--ink-faint); }
  @media (hover: none) { .keep-pop-hint { display: none; } }

  /* The menu holds everything that isn't reading: one dropdown at every width. */
  .menu { position: relative; display: flex; align-items: center; }
  .menu-btn { display: block; min-width: 44px; min-height: 36px; font-size: 20px; line-height: 1; color: var(--ink-soft); }
  .menu-panel {
    display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 210px;
    max-width: min(400px, calc(100vw - 16px)); /* a long title or chapter name must not push the menu off a phone's screen */
    flex-direction: column; align-items: stretch; gap: 0; padding: 6px;
    background: var(--bg); border: 1px solid var(--rule); border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  }
  .menu-panel.open { display: flex; }
  .menu-panel .menu-item, .menu-panel .signout button {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 40px; padding: 8px 12px;
    border: 0; border-radius: 8px; background: transparent; text-align: left; font: inherit; font-size: 15px;
    color: var(--ink); text-decoration: none; cursor: pointer;
  }
  .menu-panel .menu-item:hover, .menu-panel .signout button:hover { background: var(--accent-soft); color: var(--ink); }
  .menu-panel .signout { width: 100%; }
  /* Random: the item rolls in the default scope; the ▾ reveals the wider scopes. */
  .menu-row { display: flex; align-items: stretch; gap: 2px; }
  .menu-row .menu-item { flex: 1; min-width: 0; }
  .menu-note { min-width: 0; max-width: 11em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--ink-soft); }
  .menu-more { border: 0; border-radius: 8px; background: transparent; padding: 0 12px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
  .menu-more:hover { background: var(--accent-soft); }
  .menu-more[aria-expanded="true"] { transform: rotate(180deg); }
  .menu-sub { margin: 0 0 4px 12px; padding-left: 6px; border-left: 1px solid var(--rule); }
  .menu-sub .menu-item { font-size: 14px; }
  .menu-rule { height: 1px; margin: 4px 6px; background: var(--rule); }
  @media (max-width: 719px) {
    .menu-panel .menu-item, .menu-panel .signout button { min-height: 44px; }
  }

  /* ---------- the rail: the app's tools down the left edge of every signed-in page (shared/_rail) ---------- */
  /* Beside the page in a column of its own (the reader puts it in its grid instead). */
  body:has(> .rail) { display: grid; grid-template-columns: 52px minmax(0, 1fr); min-height: 100vh; }
  body:has(> .rail) > :not(.rail) { grid-column: 2; min-width: 0; width: 100%; } /* auto margins would shrink it to fit */
  .rail {
    position: sticky; top: 0; z-index: 20; align-self: start; height: 100vh; height: 100dvh;
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 8px;
  }
  .rail-item, .rail .history { position: relative; display: flex; }
  .rail-gap { flex: none; height: 10px; }
  /* Notes on this focus's place, kept with no current focus so the icons below don't move. */
  .rail-slot { flex: none; height: 36px; }
  .rail-foot { margin-top: auto; }
  .rail .phone-only { display: none; }
  .rail-btn {
    display: inline-flex; align-items: center; gap: 12px; min-width: 36px; height: 36px; min-height: 0; padding: 0 9px;
    color: var(--ink-faint); text-align: left; text-decoration: none; /* Random and the account are buttons */
  }
  .rail .rail-btn:hover, .rail .rail-btn[aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); }
  .rail .rail-btn[aria-current="page"] { color: var(--accent); }
  .rail-btn svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .rail .menu-panel, .rail .history-panel { left: calc(100% + 8px); right: auto; top: 0; font-family: var(--sans); font-size: 14px; }
  /* The account's popover opens upward from the foot of the rail. */
  .rail .rail-foot .menu-panel { top: auto; bottom: 0; }
  .rail-count { margin-left: 8px; font-size: 12px; color: var(--ink-faint); }
  /* Random's popover: the places alone, under "Pick randomly from"; the default first. */
  .rail-random .menu-default { font-weight: 600; }
  /* The account: its initial in a ring, in place of an icon (you, not a tool). */
  .rail-me {
    flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin: 0 -1px;
    border: 1.5px solid currentColor; border-radius: 50%; font: 600 11px var(--sans);
  }

  /* The labels: pointing at one of its icons (.labels, rail_controller.js) or tabbing into it widens the rail over the
     page at once, each icon's name beside it, so the icons can be learned without waiting on tooltips. Its column
     stays 52px, so nothing beneath moves; an open popover folds them away again, so it sits beside its icon. */
  .rail-label { display: none; font-family: var(--sans); font-size: 14px; color: var(--ink-soft); white-space: nowrap; }
  .rail-label kbd { font: inherit; font-size: 12px; color: var(--ink-faint); margin-left: 10px; }
  .rail-btn:hover .rail-label, .rail-btn[aria-current="page"] .rail-label { color: inherit; }
  @media (min-width: 900px) {
    .rail:is(.labels, :has(:focus-visible)):not(:has(.open)) {
      width: max-content; padding-right: 14px; background: var(--bg); border-right: 1px solid var(--rule); box-shadow: 8px 0 24px rgba(0, 0, 0, .08);
    }
    .rail:is(.labels, :has(:focus-visible)):not(:has(.open)) .rail-label { display: inline; }
    .rail:is(.labels, :has(:focus-visible)):not(:has(.open)) .rail-label-2 { display: flex; }
    .rail:is(.labels, :has(:focus-visible)):not(:has(.open)) :is(.rail-btn, .rail-item, .history) { width: 100%; }
    .rail:is(.labels, :has(:focus-visible)):not(:has(.open)) .rail-btn { padding-right: 14px; }
  }
  /* Two-line labels (Continue reading, Random) fit in the folded button's 36px, so opening the rail moves nothing. */
  .rail-label-2 { flex-direction: column; min-width: 0; line-height: 1.15; }
  /* Continue reading names where it goes on a second line that adds nothing to the rail's width (contain): the work
     title goes first when it won't fit (.tight, rail_controller.js), then the section name ellipsizes; the number stays. */
  .rail-dest { display: flex; contain: inline-size; font-size: 12px; color: var(--ink-faint); }
  .rail-dest .ref-work, .rail-dest .ref-unit { flex: none; white-space: pre; }
  .rail-dest .ref-section { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rail-dest.tight .ref-work { display: none; }
  /* Random's default (and where Search opens) is short enough to widen the rail a little rather than be cut to the width of "Random". */
  .rail-random .rail-dest, .rail-search .rail-dest { display: block; contain: none; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Phones: the ⋯ alone, floating top right; its menu takes in the rest, the tools under Study and then the account. */
  @media (max-width: 899px) {
    body:has(> .rail) { display: block; }
    .rail { position: fixed; top: 8px; right: 6px; height: auto; padding: 0; flex-direction: row; }
    .rail .rail-only, .rail .history-btn { display: none; }
    .rail .phone-only { display: flex; }
    /* It drops from 48px down (44px under a page head's bar) and must end above the reader's note sheet (52px handle); a long menu scrolls inside. */
    .rail .menu .menu-panel {
      left: auto; right: 0; top: calc(100% + 4px); overflow-y: auto; overscroll-behavior: contain;
      max-height: calc(100dvh - 48px - 52px - 8px - env(safe-area-inset-bottom));
    }
    .rail .history-panel { position: fixed; left: 12px; right: 12px; top: 52px; width: auto; }
    /* A page's first line keeps clear of the ⋯. */
    :is(.page, .cards-page, .texts-page) > :first-child { padding-right: 44px; }
  }

  /* ---------- reader: the rail | the passage | the note, docked ---------- */
  .reader { --panel-w: 380px; display: grid; grid-template-columns: 52px minmax(0, 1fr) var(--panel-w); min-height: 100vh; }
  @media (max-width: 1099px) { .reader { --panel-w: 340px; } }

  /* Where you are: the library trail, indented a step per level, and the chapters either side. */
  .trail { list-style: none; margin: 0; padding: 2px 0; }
  .trail a {
    display: block; max-width: 320px; padding: 6px 12px 6px calc(12px + var(--depth, 0) * 12px); border-radius: 8px;
    font-family: var(--sans); font-size: 14px; color: var(--ink-soft); text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .trail a:hover { background: var(--accent-soft); color: var(--ink); }
  .trail a.here { color: var(--ink); font-weight: 600; }
  .trail-sides {
    display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; padding: 8px 12px 4px; border-top: 1px solid var(--rule);
    font-family: var(--sans); font-size: 13px; white-space: nowrap;
  }
  /* Long names take a line each, and are cut short with an ellipsis rather than widening the menu. */
  .trail-sides a { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); text-decoration: none; }
  .trail-sides a:hover { color: var(--accent); }
  .trail-sides .trail-next { margin-left: auto; }
  .menu-trail { margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--rule); }

  /* The reading column: the focus over the passage; the reference row sticks to the top while a long passage scrolls.
     The measure is centred in the column's room (the text still ragged right), and the steps and margins move with it. */
  .reader {
    --measure: 40rem;
    --indent: max(0px, (100vw - 52px - var(--panel-w) - 44px - 56px - var(--measure)) / 2);
    /* One type size for every passage, 22px on a phone growing to 28px at 1200px wide; a long one scrolls. */
    --type: clamp(22px, calc(22px + 6 * (100vw - 390px) / 810), 28px);
    /* Where the passage's first baseline falls: 44% of the window, 35% on a phone (see the phone block). */
    --baseline: 44dvh;
  }
  .reader-col { min-width: 0; padding: 0 56px 110px calc(44px + var(--indent)); touch-action: pan-y pinch-zoom; } /* room at the foot for the steps; a sideways swipe steps */

  /* The way back to a search and the focus hang over the passage, which starts where its first line's baseline falls
     at --baseline, whatever their height: a focus on two lines, or the way back opening, grows upward and the passage
     stays put. Down to it: the reference row (its padding, the ribbon, its margin: 46px) and the first line's
     half-leading and ascent (about 1.1em). */
  .over {
    display: flex; flex-direction: column; justify-content: flex-end;
    min-height: calc(var(--baseline) - 46px - 1.1 * var(--type) - var(--above, 0px)); padding-top: 22px;
  }

  /* ---------- lectio: one passage, large ---------- */
  .lectio { max-width: var(--measure); }
  .now { white-space: pre-line; color: var(--ink); font-weight: 500; --band: var(--bg); font-size: var(--type); line-height: 1.55; text-wrap: pretty; hyphens: auto; }
  /* The reference keeps to one line, so the passage under it starts in the same place: too long, the section name
     ellipsizes (the work title and the number stay whole). The whole of it is its tooltip. */
  .now .ref {
    display: flex; min-width: 0; font-family: var(--sans); font-size: 12px; letter-spacing: .14em;
    text-transform: uppercase; color: var(--accent);
  }
  /* A paragraph's first sentence opens with a pilcrow, set in the line before it. */
  .pilcrow { margin-right: .2em; font-weight: 400; color: var(--accent); opacity: .7; }

  /* ‹ 25 of 31 ›, and the grid of every verse behind the number. Pinned to the foot of the window under the column, so the
     arrows are in the same place whatever the passage's length; the text of a long one scrolls under it and fades out. */
  .steps {
    position: fixed; z-index: 10; left: 52px; right: var(--panel-w); bottom: 0; display: flex; align-items: center; gap: 4px;
    padding: 14px 56px 18px calc(34px + var(--indent)); font-family: var(--sans); background: linear-gradient(transparent, var(--bg) 16px);
  }
  .step { border: 0; border-radius: 8px; background: none; padding: 6px 10px; font-size: 16px; line-height: 1.2; color: var(--ink-faint); }
  .step[hidden] { display: block; visibility: hidden; } /* a missing arrow keeps its room, so nothing slides sideways */

  /* ---------- threads: verses that make one point (see thread_controller) ---------- */
  .tw { width: 15px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
  .thread-mark { display: contents; }
  .in-thread { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--accent); opacity: .8; white-space: nowrap; }
  .in-thread.was { color: var(--ink-faint); opacity: 1; }
  .head-btn { border: 0; background: none; padding: 2px 7px; border-radius: 6px; font: 12px var(--sans); color: var(--accent); cursor: pointer; }
  .head-btn:hover { background: var(--accent-soft); }

  /* The open thread, previewed in the room over the focus while you're on a verse outside it. */
  .tpreview { view-transition-name: thread-preview; padding-bottom: 14px; font-family: var(--sans); }
  .tp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
  .tp-head span { letter-spacing: 0; text-transform: none; color: var(--ink-faint); }
  .tp-line { display: flex; gap: 8px; width: 100%; padding: 3px 8px; margin-left: -8px; border: 0; border-radius: 6px; background: none; text-align: left; cursor: pointer;
    font: 16px/1.45 var(--serif); color: var(--ink-soft); }
  .tp-line:hover { background: var(--accent-soft); color: var(--ink); }
  .tp-line b { flex: none; min-width: 20px; font: 600 11px/1.45rem var(--sans); color: var(--accent); }
  .tp-line span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tp-gap, .tp-more { padding: 1px 0 1px 20px; font-size: 11.5px; color: var(--ink-faint); }

  /* The thread read together in the passage's place; the verse you're on is set apart, full size with room around it,
     the others smaller and dimmed, run together in paragraphs. Each verse's number leads it in the text. */
  .agg { view-transition-name: thread; }
  .now.together .pilcrow { display: none; }
  .agg .tflow { font-size: .74em; line-height: 1.55; }
  .agg .tflow + .tflow { margin-top: .5em; }
  .agg .tv2 { font-weight: 400; color: var(--ink-soft); transition: color .2s; }
  .agg .vn { margin-right: .3em; vertical-align: .6em; font: 600 .6em var(--sans); color: var(--accent); opacity: .7; }
  .agg .tv2.cur { margin: .7em 0; font-weight: 500; color: var(--ink); view-transition-name: current; }
  .agg .tv2.cur .vn { font-size: .45em; }
  .agg > .tv2.cur:first-child { margin-top: 0; }
  .agg .tv2:not(.cur) { cursor: pointer; }
  .agg .tv2:not(.cur):hover { color: var(--ink); }
  .agg .gap2 { display: flex; align-items: center; gap: 10px; margin: .6em 0; font: 12px var(--sans); color: var(--ink-faint); }
  .agg .gap2::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
  html.thread-moving::view-transition-group(*) { animation-duration: .35s; }

  /* The pill, at the end of the steps. */
  .thread-slot { display: contents; }
  .thread-start { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
  .thread-pill { display: inline-flex; align-items: stretch; margin-left: 8px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--rule)); border-radius: 999px; font-size: 13px; overflow: hidden; }
  .thread-pill > * { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 5px 11px; color: var(--accent); white-space: nowrap; font: inherit; font-variant-numeric: tabular-nums; }
  .thread-pill button { cursor: pointer; }
  .thread-pill .thread-label { min-width: 0; }
  .thread-label span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .thread-pill button:hover { background: var(--accent-soft); }
  .thread-pill .thread-tog { border-left: 1px solid color-mix(in srgb, var(--accent) 30%, var(--rule)); color: var(--ink-soft); }
  .thread-pill .thread-tog.in { color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
  .thread-pill .thread-shut, .thread-pill .thread-reopen { border-left: 1px solid color-mix(in srgb, var(--accent) 30%, var(--rule)); color: var(--ink-faint); font-size: 12px; }
  .thread-shut .narrow { display: none; }
  .thread-pill.closed { border-style: dashed; border-color: var(--rule); }
  .thread-pill.closed .thread-label { color: var(--ink-soft); }
  .thread-pill.closed .thread-reopen { color: var(--ink-soft); font-size: 13px; }

  /* A verse no thread holds, with closed threads in this chapter: add it to one, or start anew. */
  .thread-offer {
    position: absolute; bottom: calc(100% + 4px); left: calc(34px + var(--indent)); z-index: 12; width: min(360px, calc(100vw - 32px)); padding: 12px 14px;
    background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow); font: 13px/1.45 var(--sans); color: var(--ink-soft);
  }
  .thread-offer p { margin: 0 0 8px; }
  .thread-offer .pick { display: block; width: 100%; margin-top: 6px; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 9px; background: none; text-align: left; font: 13px var(--sans); color: var(--ink-soft); cursor: pointer; }
  .thread-offer .pick:hover { border-color: var(--accent); color: var(--accent); }
  .thread-offer .pick i { display: block; font: italic 13px var(--serif); color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .thread-offer footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
  .thread-offer .btn { border: 0; border-radius: 7px; padding: 5px 12px; background: var(--accent); color: var(--bg); font: 12.5px var(--sans); cursor: pointer; }
  .thread-offer .quiet { border: 0; background: none; padding: 3px 8px; border-radius: 6px; font: 12.5px var(--sans); color: var(--ink-faint); cursor: pointer; }
  .thread-offer .quiet:hover { color: var(--accent); background: var(--accent-soft); }

  /* The margins step too: a strip either side of the passage, the height of the window. The right one stands just past
     the measure (or the reading column, when that's narrower). */
  /* Its arrow stands level with the passage's first line (its baseline at --baseline, see .over), and holds
     still there while a long passage scrolls. */
  .side {
    position: fixed; z-index: 1; top: 0; bottom: 0; display: flex; align-items: flex-start; justify-content: center; width: 44px;
    padding: 0; border: 0; background: transparent; font: 26px/1 var(--sans); color: var(--ink-faint); cursor: pointer;
  }
  .side[hidden] { display: none; }
  /* Pointing anywhere in the strip lights only its arrow, on a disc like the row's: a lit strip the height of the window distracts. */
  .side span {
    display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin-top: calc(var(--baseline) - .3 * var(--type) - 18px);
    padding-bottom: 3px; border-radius: 50%; transition: background-color .15s, color .15s;
  }
  .side:hover span { color: var(--accent); background: var(--accent-soft); }
  .side-prev { left: calc(52px + var(--indent)); }
  .side-next { left: calc(52px + 44px + var(--indent) + min(var(--measure), 100vw - 52px - var(--panel-w) - 100px) + 4px); }
  .step-of { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
  .step:hover, .step[aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); }
  .unit-grid {
    display: none; position: absolute; left: 0; top: calc(100% + 6px); z-index: 15;
    grid-template-columns: repeat(8, minmax(0, 38px)); gap: 2px; padding: 6px; max-width: calc(100vw - 32px); max-height: min(50vh, 360px); overflow-y: auto;
    background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  }
  .unit-grid.open { display: grid; }
  .unit-grid.above { top: auto; bottom: calc(100% + 6px); }
  .cell {
    position: relative; height: 34px; padding: 0; border: 0; border-radius: 6px; background: none;
    font-family: var(--sans); font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums;
  }
  .cell:hover { background: var(--accent-soft); color: var(--ink); }
  .cell.current { color: var(--accent); font-weight: 700; }
  .cell.has::after {
    content: ""; position: absolute; left: 50%; bottom: 4px; width: 3px; height: 3px; margin-left: -1.5px;
    border-radius: 50%; background: var(--accent);
  }
  .cell.kept::before {
    content: ""; position: absolute; top: 0; right: 5px; width: 5px; height: 7px; background: var(--accent);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%);
  }
  .cell.found { background: color-mix(in srgb, var(--hl) 70%, transparent); color: var(--ink); }
  /* Prose: a row per paragraph, its sentences numbered from 1. */
  .unit-grid.by-group.open { display: block; width: max-content; overflow-x: hidden; }
  .grid-group { display: flex; align-items: flex-start; gap: 4px; }
  .grid-group-name { flex: none; width: 44px; padding-top: 9px; font-family: var(--sans); font-size: 11.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
  .grid-group:has(.current) .grid-group-name { color: var(--accent); }
  .grid-group-cells { display: grid; grid-template-columns: repeat(7, 38px); gap: 2px; }

  /* ¶: the whole paragraph, each sentence a link to itself, the one on screen marked. */
  .step-whole { font-family: var(--serif); margin-left: 8px; }
  .whole-group {
    display: none; position: absolute; left: 0; top: calc(100% + 6px); z-index: 15; width: min(36em, calc(100vw - 32px));
    max-height: 50vh; overflow-y: auto; padding: 12px 16px;
    font-family: var(--serif); font-size: 17px; line-height: 1.6; color: var(--ink-soft);
    background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  }
  .whole-group.open { display: block; }
  .whole-group.above { top: auto; bottom: calc(100% + 6px); }
  .whole-group a { color: var(--ink-soft); text-decoration: none; border-radius: 3px; }
  .whole-group a:hover { color: var(--ink); }
  .whole-group a.has { text-decoration: underline dotted color-mix(in srgb, var(--accent) 55%, transparent); text-underline-offset: 4px; }
  .whole-group a.current { color: var(--ink); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }

  /* Come from a search, its matches in the passage and the whole paragraph, washed like the results' excerpts. */
  .now mark, .whole-group mark { background: var(--hl); color: inherit; border-radius: 2px; box-shadow: 0 0 0 .06em var(--hl); }
  /* Outside the current clause: a fainter wash, the words a little brighter than the dimmed text so they stay legible. */
  .now.clauses .clause:not(.current) mark {
    background: color-mix(in srgb, var(--hl) 50%, var(--bg)); box-shadow: 0 0 0 .06em color-mix(in srgb, var(--hl) 50%, var(--bg));
    color: color-mix(in srgb, var(--ink) 50%, var(--bg));
  }

  /* ;: the passage a clause at a time, the current clause marked and the rest dimmed. */
  .now .clause { border-radius: .12em; transition: color .25s ease, background-color .25s ease; }
  .now.clauses .clause { cursor: pointer; }
  .now.clauses .clause:not(.current) { color: color-mix(in srgb, var(--ink) 26%, var(--bg)); }
  .now.clauses .clause:not(.current):hover { color: color-mix(in srgb, var(--ink) 50%, var(--bg)); background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
  .now.clauses .clause.current { background: var(--accent-soft); box-shadow: 0 0 0 .1em var(--accent-soft); }
  @media (prefers-reduced-motion: reduce) { .now .clause { transition: none; } }
  .step-clauses { min-width: 34px; font-family: var(--serif); font-weight: 700; }
  .step-clauses[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
  /* A pip per clause, the current one long; they open “Break at”. */
  .step-pips { display: inline-flex; align-items: center; gap: 4px; height: 31px; }
  .step-pips i { width: 5px; height: 5px; border-radius: 3px; background: var(--ink-faint); opacity: .55; transition: width .2s, background-color .2s, opacity .2s; }
  .step-pips i.current { width: 14px; background: var(--accent); opacity: 1; }
  .clause-breaks {
    display: none; position: absolute; left: 0; top: calc(100% + 6px); z-index: 15; width: 300px; padding: 10px 12px 12px;
    background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  }
  .clause-breaks.open { display: block; }
  .clause-breaks.above { top: auto; bottom: calc(100% + 6px); }
  .clause-breaks-head { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); }
  .clause-marks { display: flex; gap: 6px; margin: 8px 0 10px; }
  .clause-marks button {
    flex: 1; height: 38px; padding: 0 6px; white-space: nowrap; border: 1px solid var(--rule); border-radius: 8px; background: none;
    font-family: var(--serif); font-size: 20px; font-weight: 700; color: var(--ink-faint);
  }
  .clause-marks button[data-mark=".?!"] { flex: 1.6; }
  .clause-marks button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
  .clause-breaks p { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-soft); }

  /* The work page's chapter numbers. */
  .tick {
    position: relative; width: 30px; height: 30px; border-radius: 50%;
    border: 1px solid var(--rule); background: transparent;
    font-family: var(--sans); font-size: 12px; color: var(--ink-soft); padding: 0;
  }
  .tick:hover { border-color: var(--accent); color: var(--accent); }
  .tick.has::after {
    content: ""; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px;
    border-radius: 50%; background: var(--accent);
  }

  /* ---------- the note: a page docked down the right ---------- */
  .panel {
    position: sticky; top: 0; align-self: start; height: 100vh; height: 100dvh;
    display: flex; flex-direction: column; padding: 26px 28px 18px;
    background: var(--paper); border-left: 1px solid var(--rule);
  }
  .panel-handle { display: none; }
  .panel-label { flex: none; font-family: var(--sans); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint); }
  .panel-head { display: flex; align-items: baseline; gap: .5em; margin-bottom: 14px; }
  .panel-head .panel-label::after { content: "·"; margin-left: .5em; }
  .panel .ref { display: flex; min-width: 0; font-family: var(--sans); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint); }
  /* Too narrow for the whole reference: the work title goes first (lectio_controller adds .tight), then the section name ellipsizes. */
  :is(.panel, .now-head) .ref-work { flex: none; white-space: pre; }
  .panel .ref.tight .ref-work { display: none; }
  :is(.panel, .now-head) .ref-section { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  :is(.panel, .now-head) .ref-unit { flex: none; white-space: pre; }

  /* The reader's sheet turns between two tabs, small caps like a label: the passage's note and the focus. */
  .tabs { flex: none; display: flex; gap: 2px; margin: -6px -10px 14px; font-family: var(--sans); }
  .tab {
    position: relative; display: flex; align-items: center; gap: 7px; min-width: 0; padding: 7px 10px 9px; border: 0; border-radius: 8px 8px 0 0;
    background: none; cursor: pointer; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap;
  }
  .tab:hover { color: var(--ink-soft); }
  .tab[aria-selected="true"] { color: var(--ink); }
  .tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 2px; height: 2px; border-radius: 1px; background: var(--accent); }
  /* Only the passage's tab gives up room (its reference shortens); the focus tab keeps its width. */
  .tab-unit { flex: 0 1 auto; }
  .tab-focus { flex: none; }
  .tab-name { flex: none; }
  .tab .ref { color: inherit; }
  .tab .focus-mark { width: 13px; height: 12px; margin: 0; stroke: currentColor; }
  /* A dot on the passage's tab while its note is being written under another focus. */
  .tab-under { display: none; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
  .panel:has(.note-under) .tab-under { display: inline-block; }
  .tab-count { letter-spacing: 0; font-variant-numeric: tabular-nums; color: var(--ink-faint); }
  .tab .key { margin-left: 2px; font: 10px var(--sans); color: var(--ink-faint); opacity: 0; transition: opacity .15s; }
  .tabs:hover .key { opacity: 1; }
  .pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .pane[hidden] { display: none; }

  /* The Thread tab, there while there's a thread to show: the row wraps when the three don't fit. */
  .tabs:has(.tab-thread:not([hidden])) { flex-wrap: wrap; }
  .tab-thread { flex: 0 1 auto; color: var(--accent); }
  .tab-thread:hover, .tab-thread[aria-selected="true"] { color: var(--accent); }
  .tab-thread[hidden] { display: none; }
  .tab-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  /* Its note takes only the room it needs, so what's said of the thread follows it. */
  #sheet_pane_thread { overflow-y: auto; }
  #sheet_pane_thread .composer { flex: 0 1 auto; min-height: 7.5rem; }
  .thread-own { flex: none; margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--rule); font: 13px/1.5 var(--sans); color: var(--ink-faint); }
  .thread-foot { flex: none; display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-bottom: 8px; font: 12px/1.4 var(--sans); color: var(--ink-faint); }
  .thread-foot button { flex: none; border: 1px solid var(--rule); border-radius: 6px; padding: 4px 9px; background: none; font: 12.5px var(--sans); color: var(--ink-soft); white-space: nowrap; cursor: pointer; }
  .thread-foot button:hover { color: var(--accent); background: var(--accent-soft); }

  /* The focus tab: a list, not an open editor. A blank slip to start a note on the whole focus, then those notes,
     newest first; the one you open becomes its editor in place. */
  .fs-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -10px; padding: 0 10px 12px; }
  .fs-new {
    display: block; width: 100%; margin: 0 0 8px; padding: 12px 14px; border: 1px dashed var(--rule); border-radius: 10px; background: none;
    text-align: left; cursor: pointer; font-family: var(--serif); font-size: 16px; font-style: italic; color: var(--ink-faint);
  }
  .fs-new[hidden] { display: none; }
  .fs-new:hover { border-color: var(--accent); color: var(--accent); }
  .fs-new kbd { float: right; font: 12px var(--sans); color: var(--ink-faint); }
  .fs-empty { margin: 4px 2px 0; font-size: 14px; line-height: 1.5; font-style: italic; color: var(--ink-faint); }
  .fs-list:has(.fs-note) .fs-empty { display: none; }
  .fs-note { position: relative; padding: 12px 4px; border-bottom: 1px solid var(--rule); }
  .fs-open { position: absolute; inset: 0; z-index: 1; width: 100%; padding: 0; border: 0; border-radius: inherit; background: none; cursor: pointer; }
  .fs-note:not(.open):hover .fs-text { color: var(--ink); }
  .fs-note:not(.open):hover .fs-num { color: var(--accent); }
  .fs-meta { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-family: var(--sans); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint); }
  .fs-num { color: var(--ink-soft); }
  .fs-fresh { letter-spacing: .1em; color: var(--accent); }
  .fs-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 15.5px; line-height: 1.5; color: var(--ink-soft); white-space: pre-line; }
  .fs-editor { display: none; }
  .fs-note.open { margin: 8px 0; padding: 12px 14px 4px; border: 1px solid var(--rule); border-radius: 10px; background: var(--bg); }
  /* Open, the card stands on its own, not under the rule of the note above it. */
  .fs-note:has(+ .fs-note.open) { border-bottom-color: transparent; }
  .fs-note.open :is(.fs-open, .fs-text) { display: none; }
  .fs-note.open .fs-num { color: var(--accent); }
  .fs-note.open .fs-editor { display: flex; flex: none; }
  .fs-note .fs-editor :is(turbo-frame, form, lexxy-editor) { flex: none; }
  .fs-note .fs-editor lexxy-editor { --lexxy-color-canvas: var(--bg); --lexxy-editor-rows: 2lh; }
  .fs-note .fs-editor .lexxy-editor__content { flex: none; min-height: 2lh; overflow: visible; }
  .fs-note .fs-editor lexxy-toolbar { margin-top: 4px; padding-top: 4px; }
  /* The status rides the meta line, top right, rather than taking a row of its own under the toolbar; on a new note it
     covers "new" while it has something to say. */
  .fs-note .fs-editor .autosave-status { position: absolute; top: 12px; right: 14px; margin: 0; padding-left: 8px; min-height: 0; font-size: 11px; line-height: 15px; background: var(--bg); }
  .fs-note .fs-editor .autosave-status:empty { display: none; }
  .fs-foot { flex: none; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 13px; }
  .fs-foot a { color: var(--ink-soft); text-decoration: none; }
  .fs-foot a:hover { color: var(--accent); }

  /* The passage's note under another focus: that focus heads it, on a slip of its own colour, with the way back. */
  .note-under { flex: none; margin: -4px -12px 14px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); }
  .note-under-focus { display: flex; align-items: flex-start; gap: 7px; margin: 0; font-family: var(--serif); font-size: 17px; line-height: 1.35; }
  .note-under-focus .focus-mark { width: 14px; height: 13px; margin-top: .3em; stroke: var(--accent); }
  .note-under-title { font-style: italic; color: var(--ink); }
  .note-under-back { display: inline-block; margin: 8px 0 0 21px; font-size: 12.5px; color: var(--ink-soft); text-decoration: none; }
  .note-under-back:hover { color: var(--accent); }
  .note-under-back kbd { margin-left: 6px; font: 11px var(--sans); color: var(--ink-faint); }
  /* Under the current focus's note: the other focuses with a note on this passage, each opening it here. */
  .note-under-archived { margin: 4px 0 0 21px; font: 12.5px var(--sans); color: var(--ink-faint); }
  /* At the note's foot, the whole note away from "← Back": making that focus current, reading on here. */
  .note-under-foot {
    flex: none; display: flex; align-items: baseline; gap: 10px; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--rule);
    font: 13px var(--sans); color: var(--ink-faint);
  }
  .note-under-foot > span { flex: 1; min-width: 0; }
  .composer .note-under-foot form { flex: none; display: block; }
  .note-under-foot i { font-family: var(--serif); font-size: 14.5px; color: var(--ink-soft); }
  .note-under-switch {
    padding: 3px 10px; border: 1px solid var(--accent); border-radius: 999px; background: none; cursor: pointer;
    font: 12.5px var(--sans); color: var(--accent); white-space: nowrap;
  }
  .note-under-switch:hover { background: var(--accent); color: var(--paper); }
  .note-read { flex: 1; min-height: 0; font-size: 17px; overflow-y: auto; }
  .note-read .lexxy-content > :first-child { margin-top: 0; }
  .note-also { flex: none; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--ink-faint); }
  .note-also-focus { font-family: var(--serif); font-size: 14.5px; font-style: italic; color: var(--ink-soft); text-decoration: none; }
  .note-also-focus:hover { color: var(--accent); }

  /* The editor takes whatever height the panel has left; long notes scroll inside it. */
  .composer { flex: 1; min-height: 0; display: flex; flex-direction: column; font-family: var(--sans); }
  .composer turbo-frame, .composer form { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .primary { background: var(--accent); color: var(--paper); border: 0; border-radius: 999px; padding: 7px 16px; font-family: var(--sans); font-size: 14px; }
  .primary:hover { filter: brightness(1.08); }

  /* Phones: the reading column alone; the ⋯ floats top right (see the rail) and the note is a bottom sheet. */
  @media (max-width: 899px) {
    /* The passage sits higher on a phone: at 44% the gap over the focus is too much for the small screen. */
    .reader { display: block; --indent: 0px; --baseline: 35dvh; }
    .reader-col { padding: 0 16px 140px; }
    /* The steps stand on the sheet's handle, the two one footer; the sheet covers them when it opens. No margins to
       step in: swiping does that. */
    .steps { left: 0; right: 0; bottom: calc(52px + env(safe-area-inset-bottom)); padding: 2px 16px 0 6px; background: var(--bg); }
    .steps .step { min-width: 44px; min-height: 44px; }
    .side { display: none; }
    /* The pill sits at the right of the steps row, on the sheet's handle, so it's always in view. */
    .thread-pill, .thread-start { margin-left: auto; min-width: 0; }
    .thread-pill > * { min-height: 36px; padding-inline: 8px; }
    .thread-pill .thread-label .tw { display: none; } /* the room goes to the verses */
    .thread-shut .wide { display: none; }
    .thread-shut .narrow { display: inline; }
    .thread-pill .thread-shut.discard { justify-content: center; min-width: 36px; }
    .thread-offer { left: 8px; }
    /* On a short window (a phone on its side) the focus can come up level with the ⋯: it keeps clear of it, its rule still
       running the column's width. */
    .over { padding-top: 18px; }
    .focus { padding-right: 44px; }
    .focus::after { margin-right: -44px; }
    .back-slip { margin-right: 40px; }
    .back-slip-where .long { display: none; }
    .back-slip-where .short { display: inline; }

    .panel {
      position: fixed; left: 0; right: 0; bottom: var(--kb, 0px); top: auto; z-index: 30;
      height: calc(var(--vvh, 100vh) - 16px - env(safe-area-inset-top));
      padding: 0 16px env(safe-area-inset-bottom); border: 0; border-top: 1px solid var(--rule); border-radius: 14px 14px 0 0;
      box-shadow: var(--shadow);
      transform: translateY(calc(100% - 52px - env(safe-area-inset-bottom)));
      transition: transform .28s cubic-bezier(.2,.8,.2,1);
    }
    .panel.open { transform: none; }
    /* Offscreen controls must not take keyboard focus; hide them once the slide-down finishes. */
    .panel > :not(.panel-handle) { transition: visibility 0s .28s; }
    .panel:not(.open) > :not(.panel-handle) { visibility: hidden; }
    .panel.open > :not(.panel-handle) { transition-delay: 0s; }
    /* Closed, the handle shows the tab it's on: the passage and its note's first line, or the focus and the open
       note's first line (or how many there are). Open, the tabs show under it. */
    .panel-handle {
      display: flex; align-items: center; gap: 10px; position: relative; flex: none;
      width: 100%; height: 52px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer;
      font-family: var(--sans);
    }
    .panel-handle::before { content: ""; position: absolute; top: 6px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: var(--rule); }
    .handle-tab { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
    .panel:not(.on-focus) .handle-focus, .panel:not(.on-thread) .handle-thread, .panel:is(.on-focus, .on-thread) .handle-unit { display: none; }
    .panel-handle .handle-thread .ref { max-width: 68%; color: var(--accent); letter-spacing: .12em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .panel.open .handle-tab { visibility: hidden; }
    .panel-handle .ref { flex: 0 1 auto; max-width: 55%; }
    .panel.open .panel-handle .preview { display: none; }
    .tabs { margin-top: 0; }
    .tab .key, .fs-new kbd, .pick-num, .pick-switch-num, .note-under-back kbd { display: none; }
    .panel:has(.note-under) .handle-unit .ref { color: var(--accent); }
    .preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--serif); font-size: 15px; color: var(--ink-soft); }
    .preview.empty { font-style: italic; color: var(--ink-faint); }
    .panel-handle .go { flex: none; color: var(--ink-faint); }
    .panel-head { display: none; }
  }

  /* ---------- all-notes view ---------- */
  .fv-item { margin: 0 0 28px; }
  .fv-ref { font-family: var(--sans); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); background: none; border: 0; padding: 0; }
  .fv-ref:hover { text-decoration: underline; }
  .fv-quote { font-style: italic; color: var(--ink-soft); margin: 4px 0 10px; font-size: 16px; }
  .fv-note { padding-left: 14px; border-left: 3px solid var(--accent-soft); margin-bottom: 8px; font-size: 17px; }

/* ---------- sign in ---------- */
.signin { max-width: 340px; margin: 18vh auto 0; padding: 0 20px; text-align: center; }
.signin .brand { font-size: 28px; font-weight: 400; margin: 0 0 24px; }
.signin-form { display: flex; flex-direction: column; gap: 10px; }
.signin-form input[type="email"], .signin-form input[type="password"], .signin-form input[type="text"], .signin-form textarea {
  font: inherit; font-family: var(--sans); font-size: 15px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 10px; padding: 11px 12px;
}
.signin-form input:focus, .signin-form textarea:focus { border-color: var(--accent); }
.signin-form .primary { padding: 11px 16px; margin-top: 4px; }
.signin-alert, .signin-notice { font-family: var(--sans); font-size: 14px; margin: 0 0 14px; }
.signin-alert { color: #b3402a; }
.signin-notice { color: var(--ink-soft); }

.signout { margin: 0; }
.signin-form + .signin-notice { margin-top: 6px; }
.invite-new { border: 1px solid var(--accent); border-radius: 10px; padding: 4px 16px 16px; margin: 0 0 22px; }
.invite-link { width: 100%; box-sizing: border-box; font-family: ui-monospace, monospace; font-size: 13px; padding: 9px 10px; margin: 0 0 6px; border: 1px solid var(--rule); border-radius: 8px; background: transparent; color: var(--ink); }
.invite-form { max-width: none; margin: 0 0 8px; }

/* ---------- foci pages ---------- */
a:not(.chip):not(.page-trail a):not(.brand):not(.tick):not(.work-link):not(.menu-item):not(.as-work a):not(.rail a):not(.whole-group a):not(.card-new):not(.note-under-back):not(.note-also-focus):not(.card-act):not(.kept-act):not(.cards-more a):not(.back-slip a):not(.scope-item):not(.rr-chip-face):not(.page-act) { color: var(--accent); }
.inline-form { display: inline; margin: 0; }
.page { max-width: 40em; margin: 0 auto; padding: 22px 16px 80px; }
/* Above the title: the way up (helpers page_head), quietly, and the page's actions at the right. */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 32px; margin-bottom: 4px; font-family: var(--sans); }
.page-trail ol { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.page-trail li + li::before { content: "›"; margin: 0 7px; color: var(--ink-faint); }
.page-trail a { color: var(--ink-soft); text-decoration: none; }
.page-trail a:hover { color: var(--accent); }
/* On a phone the head is a bar fixed to the top, holding the ⋯ at its right; the page starts under it, and whatever sticks
   (the compare card) sticks just below it. The trail gives way with an ellipsis before it can run under the ⋯. */
@media (max-width: 899px) {
  :root { --bar: 44px; }
  .page-head { position: fixed; top: 0; left: 0; right: 0; z-index: 20; height: var(--bar); min-height: 0; margin: 0; padding: 0 56px 0 16px; background: var(--bg); }
  body:has(.page-head) { padding-top: var(--bar); }
  body:has(.page-head) .rail { top: calc((var(--bar) - 36px) / 2); z-index: 21; } /* over the bar, or a tap on the ⋯ lands on it */
  html:not(:has(.comparing)) { scroll-padding-top: var(--bar); } /* a row scrolled into view stops under the bar, not behind it (comparing counts the card's top itself) */
  .page-head > * { min-width: 0; }
  .page-trail { overflow: hidden; }
  .page-trail ol { flex-wrap: nowrap; }
  .page-trail li { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .page-trail li:last-child { flex: 0 1 auto; }
  .page-actions { flex: none; white-space: nowrap; }
}
.page-title { font-size: clamp(26px, 4.5vw, 36px); font-weight: 400; margin: 6px 0 20px; }
.page-sub { font-family: var(--sans); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin: 26px 0 10px; }
.page-empty { color: var(--ink-soft); font-style: italic; }
.list-row { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.list-row-title { font-size: 20px; font-style: italic; }
.list-row-title.as-work { font-style: normal; }
/* A single-work collection (the Bible) reads as a work, like the links on a collection page. */
.list-row-title.as-work a { color: var(--ink); text-decoration: none; }
.list-row-title.as-work a:hover { color: var(--accent); }
.list-row-desc { color: var(--ink-soft); font-size: 16px; margin-top: 4px; }
.list-row-meta { font-family: var(--sans); font-size: 13px; color: var(--ink-soft); margin-top: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- the focuses page: an index card per focus ---------- */
.cards-page { max-width: 1040px; margin: 0 auto; padding: 22px 16px 80px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 180px; padding: 20px 20px 16px;
  border: 1px solid var(--rule); border-radius: 4px; box-shadow: 0 1px 0 var(--rule), 0 2px 8px rgba(60, 40, 20, .05);
  background: var(--paper);
}
/* the date line, with an index card's faint rule under it, edge to edge */
.card-label { margin: 0 -20px 6px; padding: 0 20px 12px; border-bottom: 1px solid var(--accent-soft); font-family: var(--sans); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }
.card-title { margin: 0; font-size: 20px; font-weight: 400; font-style: italic; line-height: 1.3; }
.card-desc { margin: 0; color: var(--ink-soft); }
.card-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* the notes line and the actions share a row when there's room; otherwise the actions drop under it, at the right */
.card-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 8px; margin-top: auto; padding-top: 8px; }
.card-notes { flex: 1 1 14em; font-family: var(--sans); font-size: 13px; color: var(--ink-soft); }
.card-foot .chip { flex: none; white-space: nowrap; }

/* Editing, archiving and deleting a focus are done from its card (editing from its notes page too), not the reader.
   All faint until pointed at; Delete only asks (a page of its own), so it needn't stand apart. */
.card-acts { display: flex; align-items: baseline; gap: 14px; flex: none; margin-left: auto; }
.card-act { padding: 0; border: 0; background: none; font-family: var(--sans); font-size: 13px; line-height: inherit; color: var(--ink-faint); text-decoration: none; }
.card-act:hover { color: var(--accent); }
.card-act-delete:hover { color: var(--g3); }

/* A past card is one big button that makes it current. */
.card-pick { position: absolute; inset: 0; z-index: 1; width: 100%; padding: 0; border: 0; border-radius: inherit; background: none; cursor: pointer; }
.card-past :is(.card-notes a, .card-acts) { position: relative; z-index: 2; }
/* (not while pointing at its notes link, Edit, Archive or Delete, which don't make it current) */
.card-past:hover:not(:has(.card-notes a:hover, .card-act:hover)) { border-color: var(--accent); }
.card-past:hover:not(:has(.card-notes a:hover, .card-act:hover)) .card-title { color: var(--accent); }

/* the current focus: twice as wide, a ribbon, and the way back into reading */
.card-current { grid-column: span 2; border-color: var(--accent); }
.card-current .card-title { font-size: clamp(24px, 3.6vw, 30px); padding-right: 36px; }
.card-ribbon { position: absolute; top: -1px; right: 22px; width: 18px; height: 34px; background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); }
/* Just made current: the card moves into place (a view transition, see foci/index), then its ribbon unrolls onto it. */
.card-arrived .card-ribbon { transform-origin: top; animation: ribbon-lay .15s .3s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes ribbon-lay { from { transform: scaleY(0); } }
/* The cards don't stretch to fit as they change shape: each crossfades at its own size, pinned top-left, while its
   box moves. Only the cards move; the rest of the page doesn't fade. */
::view-transition-group(*) { animation-duration: .3s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); overflow: clip; border-radius: 4px; }
::view-transition-old(*), ::view-transition-new(*) { animation-duration: .3s; height: 100%; object-fit: none; object-position: left top; }
::view-transition-group(root) { border-radius: 0; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
.card-continue {
  display: block; margin: 6px 0 4px; padding: 12px 16px; border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0;
  background: var(--bg); text-decoration: none; transition: background .15s;
}
.card-continue:hover { background: var(--accent-soft); }
.card-continue-go { display: block; font-family: var(--sans); font-size: 15px; font-weight: 600; }
.card-elsewhere { align-self: flex-start; margin: -2px 0 4px 19px; font-family: var(--sans); font-size: 14px; text-decoration: none; }
.card-elsewhere:hover { text-decoration: underline; }
.card-passage { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-top: 4px; color: var(--ink); font-size: 17px; }

.card-new { align-items: center; justify-content: center; text-align: center; background: transparent; box-shadow: none;
  border-style: dashed; color: var(--ink-soft); text-decoration: none; font-style: italic; }
.card-new:hover { border-color: var(--accent); color: var(--accent); }
.card-new-plus { font-size: 28px; font-style: normal; line-height: 1; }
@media (max-width: 600px) { .card-current, .card-none { grid-column: auto; } .card-new { min-height: 120px; } }

/* No focus current (it was archived): the wide slot asks you to choose one. */
.card-none { grid-column: span 2; justify-content: center; gap: 10px; background: transparent; box-shadow: none; }
.card-none .card-title { color: var(--ink-soft); }
.card-none p { margin: 0; font-family: var(--sans); font-size: 14px; color: var(--ink-faint); }

/* The way to the archive, under the cards: quiet, and only when something is in it. */
.cards-more { margin: 26px 2px 0; font-family: var(--sans); font-size: 14px; }
.cards-more a { color: var(--ink-soft); text-decoration: none; }
.cards-more a:hover { color: var(--accent); }
.cards-more small { margin-left: 4px; font-size: inherit; color: var(--ink-faint); }

/* The archive: cards laid flat, no shadow, the title in soft ink. Not buttons. */
.archive-lede { max-width: 40em; margin: -10px 0 22px; font-family: var(--sans); font-size: 14px; color: var(--ink-faint); }
.card-archived { min-height: 150px; background: transparent; box-shadow: none; }
.card-archived .card-title { color: var(--ink-soft); }
.card-archived .card-desc { color: var(--ink-faint); }

/* Before deleting a focus: one column, the focus as its card laid flat, what goes with it, the ways to keep its notes,
   then the one button, in the rose of the label palette (there's no red here). */
.delete-page { max-width: 620px; margin: 0 auto; padding: 22px 16px 80px; }
.delete-page .page-title { margin-bottom: 18px; }
.delete-card { min-height: 0; margin-bottom: 26px; background: transparent; box-shadow: none; }
.delete-card .card-notes { color: var(--ink-faint); }
.delete-what { margin: 0 0 12px; font-size: 18px; line-height: 1.55; }
.delete-what ul { margin: 8px 0 0; padding-left: 1.2em; font-size: 16px; color: var(--ink-soft); }
.delete-what li { margin: 2px 0; }
.delete-final { margin: 0 0 22px; font-size: 16px; font-style: italic; color: var(--ink-soft); }
.delete-keep { display: grid; gap: 6px; margin: 0 0 26px; padding: 12px 16px; border-left: 2px solid var(--rule); font-family: var(--sans); font-size: 14px; color: var(--ink-soft); }
.delete-keep button { padding: 0; border: 0; background: none; font: inherit; color: var(--accent); }
.delete-keep :is(button, a):hover { text-decoration: underline; }
.delete-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; font-family: var(--sans); font-size: 14px; }
.delete-go { padding: 8px 16px; border: 0; border-radius: 6px; background: var(--g3); color: var(--paper); font: inherit; font-weight: 600; }
.delete-go:hover { filter: brightness(1.08); }

/* Just archived or unarchived: a word of it at the foot of the page, with Undo, going after a while. */
.focus-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50; display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
  padding: 9px 16px; border-radius: 8px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow);
  font-family: var(--sans); font-size: 14px; transform: translateX(-50%); animation: toast-go .4s 8s both;
}
.focus-toast span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-toast button { flex: none; padding: 0; border: 0; background: none; color: var(--accent-soft); font-size: 14px; text-decoration: underline; }
.focus-toast:hover, .focus-toast:focus-within { animation-play-state: paused; }
/* In the reader, over the steps at the window's foot (on phones, over the steps on the sheet's handle). */
.reader ~ .focus-toast { bottom: 76px; }
@media (max-width: 899px) { .reader ~ .focus-toast { bottom: calc(52px + 48px + 16px + env(safe-area-inset-bottom)); } }
@keyframes toast-go { to { opacity: 0; visibility: hidden; } }

/* ---------- notes ---------- */

/* Lexxy, themed to the paper palette (it follows light/dark through our variables). */
lexxy-editor, .lexxy-content {
  --lexxy-color-ink: var(--ink);
  --lexxy-color-text: var(--ink);
  --lexxy-color-ink-medium: var(--ink-soft);
  --lexxy-color-text-subtle: var(--ink-soft);
  --lexxy-color-ink-lighter: var(--rule);
  --lexxy-color-ink-lightest: var(--accent-soft);
  --lexxy-color-canvas: var(--bg);
  --lexxy-color-accent-dark: var(--accent);
  --lexxy-color-link: var(--accent);
  --lexxy-color-selected: var(--accent-soft);
  --lexxy-color-selected-hover: var(--accent-soft);
  --lexxy-color-code-bg: var(--accent-soft);
  font-family: var(--serif);
}
/* In the note panel the editor is borderless on the paper; its toolbar sits below the text, behind a rule, and only
   shows while you're writing (always, on a phone's opened sheet). */
.composer lexxy-editor {
  --lexxy-color-canvas: var(--paper); --lexxy-editor-padding: 0;
  font-size: 17px; border: 0; border-radius: 0; background: transparent;
  flex: 1; min-height: 0; display: flex; flex-direction: column;
}
.composer .lexxy-editor__content { flex: 1; min-height: 3lh; overflow-y: auto; }
.composer .lexxy-editor__content:focus-visible { outline: none; }
/* The placeholder reads like the prototype's: italic, in faint ink. */
.composer .lexxy-editor--empty .lexxy-editor__content::before { color: var(--ink-faint); opacity: 1; font-style: italic; }
.composer lexxy-toolbar {
  order: 2; --lexxy-toolbar-icon-size: .73em; --lexxy-toolbar-button-size: 1.4lh;
  margin-top: 10px; padding-top: 8px; border-block-end: 0; border-block-start: 1px solid var(--rule);
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility 0s .2s;
}
.composer:focus-within lexxy-toolbar { opacity: 1; visibility: visible; transition-delay: 0s; }
/* With the toolbar at the bottom, its dropdowns open upward. */
.composer lexxy-toolbar [data-dropdown-panel] { inset-block-end: 100%; }
.autosave-status { flex: none; margin: 6px 0 0; min-height: 18px; line-height: 18px; font-family: var(--sans); font-size: 12px; color: var(--ink-faint); }
@media (max-width: 899px) {
  .composer lexxy-toolbar { opacity: 1; visibility: visible; }
}

/* ---------- list pages ---------- */
.page-lede { color: var(--ink-soft); font-family: var(--sans); font-size: 13px; margin: 0 0 28px; }
a.fv-ref { text-decoration: none; }
a.fv-ref:hover { text-decoration: underline; }
.page-actions { display: flex; gap: 8px; }
.page-actions .chip { white-space: nowrap; }
@media (max-width: 599px) { .page-actions .wide-only { display: none; } }
/* Actions as quiet words beside the trail (a focus's notes page: Copy as Markdown · Download .md), not chips. */
.page-actions.quiet { gap: 0; font-size: 13px; }
.page-actions.quiet > * + *::before { content: "·"; margin: 0 7px; color: var(--ink-faint); }
.page-act { border: 0; background: none; padding: 0; font: inherit; color: var(--ink-faint); text-decoration: none; white-space: nowrap; cursor: pointer; }
.page-act:hover { color: var(--accent); }
.fv-quote { white-space: pre-line; }

/* ---------- Kept (keeps/index) ---------- */
/* One column, one stream, newest first, like a commonplace book: passages copied out in the text's type with your
   remark under them in italics, and ideas that are only your words, under quiet month heads. */
.kept-head { display: flex; align-items: flex-start; gap: 8px; }
.kept-title { margin: 0; font-size: clamp(24px, 4vw, 30px); font-weight: 400; line-height: 1.25; }
.kept-mark { flex: none; width: 20px; height: 20px; margin-top: .35em; fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; }
.kept-desc { margin: 8px 0 0; font-size: 15px; color: var(--ink-faint); max-width: 34em; text-wrap: pretty; }
.kept-desc kbd { font: inherit; }
@media (hover: none) { .kept-key { display: none; } }
.kept-page > .page-empty { margin-top: 28px; }

/* Jotting an idea, or writing one again: a plain field in place of the slip (or the idea). */
.kept-page > .jot { margin: 26px 0 8px; }
.jot-open {
  display: flex; align-items: baseline; justify-content: space-between; width: 100%; padding: 12px 16px;
  border: 1px dashed var(--rule); border-radius: 8px; background: none; color: var(--ink-soft);
  font: 15px var(--sans); text-align: left;
}
.jot-open:hover { border-color: var(--accent); color: var(--accent); }
.jot-open[hidden], .idea-text[hidden] { display: none; }
.jot-open kbd { font: 12px var(--sans); color: var(--ink-faint); }
.jot-form textarea {
  display: block; width: 100%; min-height: 4.6em; padding: 12px 16px; resize: none; field-sizing: content;
  border: 1px solid var(--accent); border-radius: 8px; background: var(--paper); color: var(--ink);
  font: 18px/1.45 var(--serif); outline: none;
}
.jot-form textarea::placeholder { color: var(--ink-faint); }
.jot-foot { display: flex; justify-content: space-between; gap: 12px; margin: 6px 0 0; font: 12px var(--sans); color: var(--ink-faint); }
.jot-left.near { color: var(--accent); }
@media (hover: none) { .jot-open kbd, .jot-keys { display: none; } }

.kept-month { margin: 34px 0 0; font: 600 11px var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }
.entry { padding: 22px 0; border-bottom: 1px solid var(--rule); }
.kept-month + .entry { padding-top: 14px; }
.entry-top { display: flex; align-items: baseline; gap: 10px; }
.entry-ref { font: 600 13px var(--sans); color: var(--accent); text-decoration: none; }
a.entry-ref:hover { text-decoration: underline; text-underline-offset: 3px; }
.entry-set-aside .entry-ref { color: var(--ink-faint); } /* its passage is gone: nothing to open */
.entry-date { margin-left: auto; font: 12px var(--sans); color: var(--ink-faint); white-space: nowrap; }
.entry-why { margin: 2px 0 0; font: 12px var(--sans); color: var(--ink-faint); }
.entry-quote { margin: 8px 0 0; font-size: 17px; line-height: 1.55; color: var(--ink-soft); white-space: pre-line; }
.entry-quote.clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.entry-more { margin-top: 4px; border: 0; background: none; padding: 0; color: var(--accent); font: 12px var(--sans); cursor: pointer; }
.entry-more:hover { text-decoration: underline; }
.entry-remark { margin: 10px 0 0; font-size: 17px; line-height: 1.5; font-style: italic; color: var(--ink); white-space: pre-line; }

/* An idea: only your words, so they carry the entry: a little larger, upright, in full ink. */
.idea-top { display: flex; align-items: baseline; gap: 10px; }
.idea-top .jot { flex: 1; min-width: 0; }
.idea-top:has(.jot-form:not([hidden])) .entry-date { display: none; }
.idea-text { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: text; }
.idea-line { display: block; font-size: 20px; line-height: 1.4; color: var(--ink); text-wrap: pretty; }
.idea-rest { display: block; margin-top: 6px; font-size: 16px; line-height: 1.5; font-style: italic; color: var(--ink-soft); white-space: pre-line; }

/* Every entry's actions: quiet links at its foot, as on a focus's card, that wait until you point at the entry
   (always there on touch). */
.kept-acts { display: flex; align-items: baseline; gap: 14px; margin-top: 12px; opacity: 0; transition: opacity .15s; }
.entry:is(:hover, :focus-within) .kept-acts { opacity: 1; }
.entry:has(.jot-form:not([hidden])) .kept-acts { visibility: hidden; }
@media (hover: none) { .kept-acts { opacity: 1; } }
.kept-act { padding: 0; border: 0; background: none; font: 13px var(--sans); line-height: inherit; color: var(--ink-faint); text-decoration: none; }
.kept-act:hover { color: var(--accent); }
.kept-act-remove:hover { color: var(--g3); }

@media (max-width: 560px) {
  .idea-line { font-size: 18px; }
  .entry-quote { font-size: 16px; }
}

/* ---------- library pages ---------- */
.works { display: flex; flex-direction: column; }
.work-link { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink); }
.work-link:hover .work-link-title { color: var(--accent); }
.work-link-title { font-size: 20px; }
.work-link-meta { font-family: var(--sans); font-size: 13px; color: var(--ink-soft); }
.chapters { margin-top: 8px; }
a.tick { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink-soft); }
.section-list { list-style: none; margin: 0; padding: 0; columns: 2 18em; column-gap: 32px; }
.section-list li { padding: 6px 0; break-inside: avoid; display: flex; align-items: center; gap: 8px; }
.section-list a { color: var(--ink); text-decoration: none; }
.section-list a:hover { color: var(--accent); }
.noted-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.page-actions .chip.current { border-color: var(--accent); color: var(--accent); }
.start-from { margin-bottom: 18px; }

/* ---------- search ---------- */
.search-form { display: flex; gap: 8px; align-items: center; margin: 0 0 24px; font-family: var(--sans); }
.search-form input[type="search"] {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 10px; padding: 9px 12px;
}
.search-form input[type="search"]:focus { border-color: var(--accent); outline: none; }
.search-form .chip { padding: 9px 14px; }
.search-scopes { display: flex; flex-wrap: wrap; gap: 8px; margin: -12px 0 22px; }
.search-scopes .chip.current { border-color: var(--accent); color: var(--accent); }
/* "Somewhere else…" (searches/_picker): dashed, a way out of the chain rather than a place in it; it opens a filter over
   every title, and before anything is typed the shelves, Your Texts, places searched lately and the whole library. */
.search-scopes { position: relative; align-items: center; }
.search-scopes .chip-else { color: var(--ink-soft); border-style: dashed; }
.search-scopes .chip-else[aria-expanded="true"] { border-style: solid; border-color: var(--accent); color: var(--accent); }
.scope-pop {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(360px, 100%);
  display: flex; flex-direction: column; padding: 6px; font-family: var(--sans);
  background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.scope-pop[hidden], .scope-pop [hidden] { display: none; }
.scope-pop input {
  margin: 2px 2px 6px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px;
  background: var(--paper); color: var(--ink); font: 16px var(--sans); /* 16px, or iOS zooms in on it */
}
.scope-pop input:focus { border-color: var(--accent); outline: none; }
.scope-list { max-height: min(360px, 55vh); overflow-y: auto; overscroll-behavior: contain; }
.scope-item {
  display: flex; flex-direction: column; padding: 7px 12px; border-radius: 8px; font-size: 15px;
  color: var(--ink); text-decoration: none;
}
.scope-item small { font-size: 12px; color: var(--ink-faint); }
.scope-item:hover, .scope-item[aria-selected="true"] { background: var(--accent-soft); }
.scope-none { margin: 0; padding: 10px 12px; font-size: 13px; font-style: italic; color: var(--ink-soft); }
.scope-foot { margin: 4px 6px 2px; padding-top: 6px; border-top: 1px solid var(--rule); font-size: 11px; color: var(--ink-faint); }
@media (hover: none) { .scope-foot { display: none; } }
@media (max-width: 719px) { .scope-item { min-height: 44px; justify-content: center; } }
.search-hint { color: var(--ink-soft); font-family: var(--sans); font-size: 13px; }
/* On the empty search page, the way back to the last search. */
.search-last { margin: -12px 0 24px; color: var(--ink-soft); font-family: var(--sans); font-size: 13px; }
.search-last q { font-style: italic; }
/* A query with quote marks of its own is shown as typed (lastSearch.name). */
q.verbatim { quotes: none; }
.search-summary { margin-bottom: 10px; }
.search-works { margin: 0 0 28px; font-family: var(--sans); font-size: 13px; }
.search-works summary { cursor: pointer; color: var(--ink-soft); width: max-content; margin-bottom: 8px; }
.search-works summary:hover { color: var(--accent); }
.search-counts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-family: var(--sans); font-size: 13px; }
.search-counts a { text-decoration: none; }
.search-counts a:hover { text-decoration: underline; }
.search-counts span { color: var(--ink-soft); }
.search-by { text-transform: none; letter-spacing: 0; color: var(--ink-soft); }
.search-excerpt { font-style: normal; color: var(--ink); }
/* The result you opened, when Search brings you back to it: on a card tinted like the reader's band back to it, the
   text kept in line with the others'. Edge to edge on phones. */
.search-result.returned { margin-left: -14px; margin-right: -14px; padding: 10px 14px 1px; background: var(--accent-soft); border-radius: 8px; }
@media (max-width: 599px) { .search-result.returned { margin-left: -16px; margin-right: -16px; padding: 10px 16px 1px; border-radius: 0; } }
.search-excerpt mark { background: var(--hl); color: inherit; border-radius: 2px; padding: 0 1px; }
.search-pages { display: flex; align-items: center; justify-content: center; gap: 14px; font-family: var(--sans); font-size: 13px; color: var(--ink-soft); margin-top: 8px; }
