/* Genkan: one set of tokens, three kinds of element (the input, the row, the gutter). See docs/design-v0.1.md section 6.
   The colours are one cloth: indigo-dyed cotton, as the curtain at an entrance is. Bleached white for the paper, the
   darkest dip of indigo where black would be, the palest dip under a card, one blue that acts, and one yellow, indigo's
   opposite, kept for what was marked (an excerpt, a match). The names are the traditional ones. */
:root {
  --paper: #FFFFFF;
  --ink: #1B1D36;      /* kachi-iro: the darkest indigo, in place of black */
  --mute: #5F6F80;     /* ai-nezumi: indigo grey */
  --line: #DCE3EA;
  --accent: #1E50A2;   /* ruri */
  --tint: rgba(30, 80, 162, .08);
  --hit: rgba(30, 80, 162, .16);
  --mark: rgba(248, 181, 0, .42); /* yamabuki */
  --mark-g: rgba(105, 176, 118, .42); --mark-b: rgba(89, 150, 222, .36); --mark-r: rgba(226, 104, 110, .36); /* the other colours an excerpt can be kept in */
  --err: #B7282E;      /* akane */
  --card: #EEF3F6;     /* kamenozoki: one dip in the vat */
  --card-sel: #E0E9F2;
  /* One serif voice, for the threshold (the input) and what it names: group labels, a room's title, a book's. Song
     and Mincho for the Chinese, Iowan for the Latin; all of them ship with the Mac and the iPhone. */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", "STSong", "Hiragino Mincho ProN", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-input: 28px;
  --fs-row: 15px;
  --fs-meta: 13px;
  --fs-mono: 14px;
  --gutter: 96px;
  --max: 720px;
  --pad-top: 112px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0F1120;  /* the same cloth at night: deep navy, not black */
    --ink: #E6ECF4;
    --mute: #8C99AC;
    --line: #272C43;
    --accent: #8FB2EE;
    --tint: rgba(143, 178, 238, .14);
    --hit: rgba(143, 178, 238, .3);
    --mark: rgba(248, 181, 0, .34);
    --mark-g: rgba(105, 190, 120, .36); --mark-b: rgba(110, 165, 240, .38); --mark-r: rgba(235, 110, 118, .38);
    --err: #FF8A80;
    --card: #191D33;
    --card-sel: #212A47;
  }
}
@media (max-width: 640px) {
  :root { --fs-input: 22px; --fs-row: 16px; --fs-mono: 16px; --pad-top: 36px; } /* 16px keeps iOS from zooming into fields */
}

html { background: var(--paper); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-row);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
.wrap {
  max-width: var(--max); margin: 0 auto; box-sizing: border-box;
  padding: calc(var(--pad-top) + env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) calc(96px + env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The input */
.omni {
  display: block; width: 100%; box-sizing: border-box;
  font: inherit; font-family: var(--serif); font-size: var(--fs-input); line-height: 1.25; letter-spacing: 0;
  color: var(--ink); background: transparent;
  border: 0; border-bottom: 2px solid var(--accent); border-radius: 0; outline: 0; /* the threshold: always there, always indigo */
  padding: 0 0 13px; margin: 0; -webkit-appearance: none; appearance: none;
}
.omni::placeholder { color: var(--mute); opacity: 1; }
html.drop .omni { border-bottom-color: var(--ink); }

/* Spacing between blocks */
.results:not(:empty) { margin-top: 28px; }
.list { margin-top: 40px; display: flex; flex-direction: column; gap: 20px; }
.list:empty { display: none; }
.info.earlier { padding-left: calc(var(--gutter) + 16px); } /* under the rows, on their line: the way to everything older */
.info.earlier .act { font-size: var(--fs-meta); }
.info.earlier .act + .act { margin-left: 20px; }
@media (max-width: 640px) { .info.earlier { padding-left: 0; } }
.results:not(:empty) + .list { margin-top: 36px; }

/* One kind of row: gutter, body, right side */
.grp { display: flex; gap: 16px; align-items: flex-start; }
.g { flex: none; width: var(--gutter); color: var(--mute); font-family: var(--serif); font-size: 14px; line-height: 1.45; padding-top: 6px; }
.g.link { font: inherit; font-family: var(--serif); font-size: 14px; line-height: 1.45; text-align: left; background: none; border: 0; padding-left: 0; padding-right: 0; padding-bottom: 0; cursor: pointer; }
.g.link:hover { color: var(--accent); }
.ls { flex: 1 1 auto; min-width: 0; }
/* The pinned bookmarks: tiles in a row, a letter and a name each */
.grp.dial { margin-bottom: 14px; }
.grp.dial .ls { margin-left: -5px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 10px; }
.tile { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 5px 8px 5px 5px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.tile:hover { background: var(--tint); }
.tile .mono { flex: none; width: 26px; height: 26px; border-radius: 6px; background: var(--card); color: var(--accent); font-family: var(--serif); font-size: 15px; line-height: 26px; text-align: center; }
.tile .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-meta); }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) fit-content(34%); column-gap: 24px; align-items: baseline;
  padding: 6px 12px; margin: 0 -12px; border-radius: 6px; cursor: default;
}
/* A long list is hundreds of rows, most of them below the window: those are not laid out or painted until they
   come near it, which is most of what a keystroke in a search costs. Each keeps the height it last had. */
#list .grp:not(.table) .row { content-visibility: auto; contain-intrinsic-size: auto 40px; }
.row.sel { background: var(--tint); }
.row.off .t { color: var(--mute); } /* a feature switched off in the features list */
.row:hover .t { color: var(--accent); }
.main { min-width: 0; overflow-wrap: anywhere; }
.t { color: inherit; text-decoration: none; }
.t.long { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.d { color: var(--mute); font-size: var(--fs-meta); margin-left: 10px; }
.d.site { font: inherit; font-size: var(--fs-meta); background: none; border: 0; padding: 0; cursor: pointer; }
.d.site:hover { color: var(--accent); }
.t.long + .d { margin-left: 0; }
/* A book's row: its cover, then its title and details */
.main.book { display: flex; align-items: center; gap: 14px; }
.main.book .words { min-width: 0; flex: 1 1 auto; }
.main.book .t { font-family: var(--serif); font-size: 16px; } /* a book is named in the serif voice wherever it is named */
.cover { flex: none; width: 30px; height: 42px; object-fit: cover; border-radius: 2px; background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.cover.none { display: inline-flex; align-items: center; justify-content: center; font-size: 8px; letter-spacing: .04em; color: var(--mute); }
.row:has(> .main.book) { align-items: center; } /* under a cut title, not beside it */
.tags, .right { color: var(--mute); font-size: var(--fs-meta); white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; justify-content: flex-end; column-gap: 12px; white-space: normal; }
.tags span { white-space: nowrap; }
.tags .tag { font: inherit; font-size: var(--fs-meta); color: inherit; background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap; }
.tags .tag:hover { color: var(--accent); }
.mono { font-family: var(--mono); font-size: var(--fs-mono); white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.sub { display: block; color: var(--mute); font-size: var(--fs-meta); }
.err { color: var(--err); }
.act { font: inherit; font-size: var(--fs-meta); color: var(--mute); background: none; border: 0; padding: 0; cursor: pointer; }
a.act { text-decoration: none; } /* a way out of the site that stands among buttons (an article's own page) */
.act:hover { color: var(--accent); }
.act.err { color: var(--err); }
.acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 20px; padding-top: 4px; }
.more { letter-spacing: .1em; }
@media (hover: hover) and (pointer: fine) { /* with a mouse the … waits for the pointer or the selection */
  .row { position: relative; }
  .more { position: absolute; right: 0; top: 6px; width: 12px; opacity: 0; } /* in the row's own margin, so what a row ends with ends on the page's right edge */
  .row.inset > .main .words { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* a book's long title is cut, not wrapped */
  .row:hover .more, .row.sel .more, .more:focus-visible, .more[aria-expanded="true"] { opacity: 1; }
  .cacts .more { position: static; width: auto; opacity: 1; } /* in a card it stands with the others */
  /* A word that is a button is easier to hit than it looks: its target reaches half way into the gap on either side
     and above and below the line, so there is nowhere between two of them that does nothing. */
  .cacts .act { padding: 6px 7px; margin: -6px -7px; }
  .acts .act { padding: 6px 10px; margin: -6px -10px; }
  .tags .tag, .tags .act { padding: 5px 6px; margin: -5px -6px; }
}
@media (pointer: coarse) { /* finger-sized targets without moving the text; the … sits in the row's corner */
  .act, .page { touch-action: manipulation; }
  .act { padding: 8px 0; margin: -8px 0; }
  .row { position: relative; }
  .row.hasmore, .row.sel.hasmore { padding-right: 44px; }
  .more { position: absolute; right: 0; top: 4px; padding: 10px 14px; margin: 0; }
  .claim input[type=password] { font-size: 16px; } /* iOS zooms into smaller fields */
}
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 8px; border: 1px solid var(--line); }
.info { color: var(--mute); font-size: var(--fs-meta); padding: 6px 0; }
.info.err { color: var(--err); }

/* The catalog (`?`): two columns on a wide screen, so the whole of it is close to one screenful */
@media (min-width: 641px) {
  .grp.cat > .ls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px; }
  .grp.cat > .ls > .info { grid-column: 1 / -1; }
}

/* The text area: long input lives here while the input above names the tool */
.panel:not([hidden]) { margin-top: 28px; }
.panel:not([hidden]) + .results:not(:empty) { margin-top: 20px; }
.src {
  display: block; width: 100%; box-sizing: border-box;
  font-family: var(--mono); font-size: var(--fs-mono); line-height: 1.5; color: var(--ink); background: transparent;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 9px 0; margin: 0;
  resize: none; outline: 0; overflow: auto; overflow-wrap: anywhere;
}
.src:focus { border-bottom-color: var(--accent); }
.src::placeholder { color: var(--mute); opacity: 1; }
.count { padding-top: 4px; }
.count:empty { display: none; }
.results .mono { max-height: 50vh; overflow: auto; }
/* A picture in a note: as wide as the text at most, never taller than most of the window */
.npic { display: block; max-width: 100%; max-height: 70vh; height: auto; margin: .5em 0; border-radius: 4px; box-shadow: 0 0 0 1px var(--line); }
.npic[src] { cursor: zoom-in; }
.picview { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(8, 10, 22, .86); cursor: zoom-out; }
.picview img { max-width: 100%; max-height: 100%; border-radius: 4px; box-shadow: 0 8px 40px rgba(0, 0, 0, .5); }
.npic:not([src]) { width: 120px; height: 80px; background: var(--card); }
.npic.missing { width: 120px; height: 80px; background: repeating-linear-gradient(45deg, var(--card), var(--card) 6px, transparent 6px, transparent 12px); }
.card .npic, .slip .npic { max-height: 220px; }
.hit { background: var(--hit); color: var(--accent); border-radius: 2px; }
.hit + .hit { box-shadow: -1px 0 0 var(--paper); } /* adjacent matches stay two marks */
.hit.zero { border-left: 2px solid var(--accent); margin-right: -2px; background: none; }
.qr { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; margin: 2px 0 4px; } /* always dark on white so cameras read it */

/* The page tools: one thumbnail per page, a line between files */
.files { padding-top: 9px; }
.frow { display: flex; gap: 14px; align-items: baseline; line-height: 1.55; }
.fname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow .d { margin-left: 0; white-space: nowrap; }
.bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 24px; padding: 6px 0 0; }
.bgroup { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.act.primary { color: var(--accent); }
.act.primary:hover { color: var(--ink); }
.pstatus:empty { display: none; }
.bar .act:disabled { opacity: .4; cursor: default; }
.bar .act:disabled:hover { color: var(--mute); }
.pages { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; padding: 10px 0 4px; }
.pages[hidden] { display: none; } /* the attribute alone loses to the flex rule above */
.page { width: 160px; border-radius: 4px; }
.page:focus-visible { outline: 0; }
.page:focus-visible canvas { outline: 2px dashed var(--accent); outline-offset: 3px; } /* keyboard focus; selection is the solid ring */
.page canvas { display: block; width: 160px; height: 226px; box-sizing: content-box; background: #fff; border: 1px solid var(--line); border-radius: 3px; }
.page.sel canvas { border-color: transparent; box-shadow: 0 0 0 2px var(--accent); }
.page.sel .num { color: var(--accent); }
.page.dragging { opacity: .4; }
.page.before { box-shadow: -8px 0 0 -6px var(--accent); }
.page.after { box-shadow: 8px 0 0 -6px var(--accent); }
.page canvas:not(.drawn) { background: var(--tint); border-color: transparent; }
.page canvas.failed { background: var(--tint); }
.page .num { color: var(--mute); font-size: var(--fs-meta); text-align: center; padding-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page .tag::before { content: ' · '; }
.big { padding-top: 10px; }
.big:focus-visible { outline: 0; }
.bigbar { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline; padding: 0 0 8px; }
.bigcap { flex: 1 1 auto; color: var(--mute); font-size: var(--fs-meta); }
.big canvas { display: block; max-width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 3px; }
.page:hover canvas { border-color: var(--accent); }

/* Notes */
.ntext { white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.ntext.full { display: block; -webkit-line-clamp: none; overflow: visible; }
.ntext.clipped { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 1.7em), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 1.7em), transparent); } /* there is more of it */
/* Lines cannot be counted through a table (the count stops at its first row), so a note with one is cut by height. */
.ntext:has(.tbl):not(.full) { display: block; -webkit-line-clamp: none; max-height: 13.5em; }
.nbody { grid-column: 1 / -1; min-width: 0; overflow-wrap: anywhere; margin-top: 2px; } /* the rest of a multi-line note, under its first line and the metadata */
.ntext.veiled { filter: blur(6px); user-select: none; }
.ntext .p + .p, .ntext .p + ul, .ntext .p + ol, .ntext ul + .p, .ntext ol + .p, .ntext .code + .p, .ntext .p + .code { margin-top: .5em; }
.ntext .h + ul, .ntext .h + ol, .ntext .h + .p, .ntext .h + .code { margin-top: .5em; } /* a heading stands off what follows as a first line does */
.ntext .lead, .ntext .h { font-weight: 600; }
.card .ntext .h, .card .ntext .lead { font-family: var(--serif); font-size: 16px; } /* a card's title, in the voice of the threshold */
.ntext .h1 { font-size: 1.1em; }
.ntext ul, .ntext ol { margin: 0; padding-left: 1.4em; white-space: normal; }
.ntext li { margin: 0; }
.ntext li > ul, .ntext li > ol { padding-left: 1.3em; }
.ntext .quote { border-left: 2px solid var(--line); padding-left: .8em; color: var(--mute); }
.ntext hr { border: 0; border-top: 1px solid var(--line); margin: .6em 0; }
.ntext .p + .quote, .ntext .quote + .p, .ntext ul + .quote, .ntext ol + .quote, .ntext .quote + ul, .ntext .quote + ol, .ntext .h + .quote { margin-top: .5em; }
.ntext em { font-style: italic; }
.ntext li.task { list-style: none; margin-left: -1.4em; padding-left: 1.4em; position: relative; }
.ntext li.task > input { position: absolute; left: 0; top: .3em; width: 1em; height: 1em; margin: 0; accent-color: var(--accent); cursor: pointer; }
.ntext li.task > input:disabled { cursor: default; }
.ntext li.task.done > span { color: var(--mute); text-decoration: line-through; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
.ntext code { font-family: var(--mono); font-size: .92em; background: var(--tint); border-radius: 3px; padding: 0 .3em; }
.ntext .code { font-family: var(--mono); font-size: var(--fs-mono); white-space: pre; overflow-x: auto; margin: 0; padding: 6px 10px; background: var(--tint); border-radius: 6px; }
.ntext strong { font-weight: 600; }
/* A table: ruled under its head and between its rows, as wide as its words; wider than the note, it scrolls in place. */
.ntext .tbl { overflow-x: auto; white-space: normal; }
.ntext .tbl table { border-collapse: collapse; font-size: .95em; font-variant-numeric: tabular-nums; width: max-content; max-width: 44em; } /* its own width, up to a page's; a cell wraps past that */
.ntext .tbl th, .ntext .tbl td { padding: 3px 18px 3px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); overflow-wrap: normal; }
.ntext .tbl th { font-weight: 600; border-bottom-color: var(--mute); white-space: nowrap; }
.ntext .tbl tbody tr:last-child td { border-bottom: 0; }
.ntext .tbl th:last-child, .ntext .tbl td:last-child { padding-right: 0; }
.ntext .tbl .a-center { text-align: center; }
.ntext .tbl .a-right { text-align: right; }
.ntext .p + .tbl, .ntext .tbl + .p, .ntext .h + .tbl, .ntext ul + .tbl, .ntext ol + .tbl, .ntext .tbl + ul, .ntext .tbl + ol, .ntext .quote + .tbl, .ntext .tbl + .quote { margin-top: .5em; }
.ntext a { color: var(--accent); text-decoration: none; }
.ntext a:hover { text-decoration: underline; }
.tags .age { white-space: nowrap; }
.tags .prog { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tags .prog.all { opacity: .6; }
.tags .act { font-size: var(--fs-meta); }

/* The table: notes not yet put away, as cards. The text, then one line with the age and tags and the actions, which wait
   for the pointer or the selection so that they are never far from it. */
.row.card { display: flex; flex-direction: column; row-gap: 6px; }
.card .main { flex: 1 1 auto; align-self: stretch; } /* as wide as the slip and no wider, whatever it holds (a table scrolls inside it) */
.cfoot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 16px; }
.cfoot .tags { justify-content: flex-start; }
.cacts { display: flex; flex-wrap: wrap; gap: 12px 14px; margin-left: auto; }
@media (min-width: 641px) {
  .table > .ls { padding-top: 6px; }
  .cols { display: flex; gap: 12px; align-items: flex-start; } /* app.js deals the cards into the columns that fit */
  .col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
  .table .edit { padding: 12px 14px; border-radius: 4px; background: var(--card); box-shadow: inset 0 0 0 1px var(--accent); } /* edited where it is: the card turns into its form */
  .table .edit .hint { display: none; }
  .table .row { margin: 0; }
  /* A note on the table is a slip of paper: an outline on the page's own white, filled only under the pointer. */
  .row.card, .row.card.sel { --bg: var(--paper); position: relative; padding: 12px 14px 10px; border-radius: 4px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
  .row.card:hover { --bg: var(--card); }
  .row.card.sel { --bg: var(--card); box-shadow: inset 0 0 0 1px var(--accent); }
  .card .ntext { -webkit-line-clamp: 5; }
}
@media (min-width: 641px) and (hover: hover) and (pointer: fine) { /* over the end of the age and tags line, so every card keeps one line of footer */
  .cacts { position: absolute; right: 14px; bottom: 12px; padding-left: 28px; background: linear-gradient(to right, transparent, var(--bg) 22px); opacity: 0; } /* what is under them fades out instead of being cut */
  .card:hover .cacts, .card.sel .cacts, .cacts:focus-within { opacity: 1; }
  .card.open .cacts, .card.menu .cacts { position: static; padding-left: 0; background: none; } /* expanded, or the … pressed: the actions get a line of their own */
  .card.menu .cacts { opacity: 1; }
}
@media (min-width: 641px) { /* the table hangs from the same line as every row: its label in the margin, two columns of slips beside it */
  .cols.one { max-width: calc(50% - 6px); } /* a single note is a slip, not a banner */
  .cols + .cols { margin-top: 12px; }
  .cols.sheet { display: block; } /* a long note opened: across the table, read top to bottom as it was written */
  .cols.sheet .ntext.full { max-width: 44em; } /* a line no longer than reads well */
}

/* Rooms: full-page places over the home page (room.js). A bar on top, the room's body under it with its own scroll. */
html.inroom .wrap { display: none; }
html.inroom, html.inroom body { overflow: hidden; }
.room { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--paper); padding-top: env(safe-area-inset-top, 0px); }
.room[hidden] { display: none; }
.rwait { padding: 24px; }
.rbar {
  flex: none; display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; border-bottom: 1px solid var(--line); font-size: var(--fs-meta);
  padding: 10px max(20px, env(safe-area-inset-right, 0px)) 10px max(20px, env(safe-area-inset-left, 0px));
}
.rbar { position: relative; }
.rprog { position: absolute; left: 0; bottom: -1px; height: 2px; background: var(--accent); opacity: .6; transition: width .25s; pointer-events: none; } /* how far along the book is */
.rprog[hidden] { display: none; }
.rback { white-space: nowrap; }
.rtitle.canrename { cursor: text; }
.rtitle.canrename:hover { text-decoration: underline dotted var(--mute); text-underline-offset: 4px; }
.rrename { font: inherit; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--accent); border-radius: 0; padding: 0; outline: 0; width: min(100%, 48ch); }
/* A menu under a button of the bar (rooms/menu.js) */
.rmenu { position: relative; display: inline-flex; }
.rmenu > .act::after { content: ' ▾'; font-size: .8em; opacity: .7; }
.rmenupanel { position: absolute; right: 0; top: calc(100% + 12px); z-index: 6; display: grid; gap: 8px; min-width: 230px; padding: 10px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 28px rgba(0, 0, 0, .14); }
.rmenupanel[hidden] { display: none; }
.rmenuline { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; white-space: nowrap; }
.rmenuname { color: var(--mute); }
.rmenuset { display: inline-flex; align-items: baseline; gap: 14px; }
.rzoomnow { min-width: 4ch; text-align: center; }
.rwhere { max-width: 30ch; overflow: hidden; text-overflow: ellipsis; }
/* The library: a wall of covers, and one book's page */
.rscroll.lib { background: var(--paper); }
.libpage { max-width: 1040px; margin: 0 auto; padding: 28px 28px 80px; }
.libpage.one { max-width: 760px; }
.libtags { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 18px; font-size: var(--fs-meta); color: var(--mute); }
.libtags .tag { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.libtags .tag[aria-pressed="true"] { color: var(--accent); }
.libhead { margin: 30px 0 14px; font-family: var(--serif); font-size: 14px; color: var(--mute); }
.libhead .n { margin-left: .7em; opacity: .7; }
.libpage > .libhead:first-child, .libtags + .libhead { margin-top: 0; }
.libwall { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 26px 22px; }
.libbook { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 0; font: inherit; color: var(--ink); background: none; border: 0; text-align: left; cursor: pointer; }
.libcover { position: relative; display: block; aspect-ratio: 5 / 7; border-radius: 3px; overflow: hidden; background: var(--card); box-shadow: 0 0 0 1px var(--line); margin-bottom: 4px; }
.libbook:hover .libcover, .libbook:focus-visible .libcover { box-shadow: 0 0 0 1px var(--accent), 0 6px 18px rgba(0, 0, 0, .12); }
.libpic { display: block; width: 100%; height: 100%; object-fit: cover; }
.libpic.none, .libbig.none { display: flex; align-items: center; justify-content: center; font-size: 11px; letter-spacing: .06em; color: var(--mute); }
.libprog { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); }
.libtitle { font-size: var(--fs-meta); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.libsub { font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.libbook.away .libpic { opacity: .45; }
.libnote { margin-top: 40px; }
.libone { display: flex; gap: 28px; align-items: flex-start; }
.libbig { flex: none; width: 150px; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 3px; background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.libinfo { flex: 1 1 auto; min-width: 0; display: grid; gap: 8px; }
.libname, .libtagbox { font: inherit; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid transparent; border-radius: 0; padding: 2px 0; outline: 0; width: 100%; -webkit-appearance: none; appearance: none; }
.libname { font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; cursor: text; }
.libname:hover, .libtagbox:hover { border-bottom-color: var(--line); }
.libname:focus, .libtagbox:focus { border-bottom-color: var(--accent); }
.libtagbox { font-size: var(--fs-meta); color: var(--mute); }
.libplace { font-size: var(--fs-meta); }
.libacts { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 6px; font-size: var(--fs-meta); }
.libquote { padding: 2px 0 2px 14px; border-left: 2px solid var(--line); margin: 0 0 16px; }
.libtext { line-height: 1.6; overflow-wrap: anywhere; }
.libwhere { font-size: var(--fs-meta); margin-top: 2px; }
.libfoot { display: flex; align-items: baseline; gap: 16px; }
.libdrop { font-size: var(--fs-meta); color: var(--mute); opacity: 0; }
.libquote:hover .libdrop, .libdrop:focus-visible { opacity: 1; }
@media (hover: none) { .libdrop { opacity: 1; } }
.libthought { margin-top: 6px; }
.rthought { display: block; margin-top: 3px; color: var(--accent); } /* the reader's own words under an excerpt */
.libnotelink { display: block; text-align: left; padding: 3px 0; font-size: var(--fs-row); color: var(--accent); }
@media (max-width: 640px) {
  .libpage { padding: 18px 16px 64px; }
  .libwall { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 20px 14px; }
  .libone { gap: 16px; }
  .libbig { width: 96px; }
  .libname, .libtagbox { font-size: 16px; }
}
/* The notes that link to a thing, as a line of their names; the list [[ opens in a note's text area */
.refs, .wrefs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; margin-top: 8px; font-size: var(--fs-meta); }
.refs .sub, .wrefs .sub { display: inline; }
.ref { color: var(--accent); }
.wrefs { flex: none; padding: 6px 32px 0; padding-inline: max(32px, calc((100% - 720px) / 2)); margin-top: 0; }
.wrefs[hidden] { display: none; }
.linkpick { position: fixed; z-index: 20; min-width: 240px; max-width: min(92vw, 420px); padding: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 28px rgba(0, 0, 0, .16); font-size: var(--fs-meta); }
.linkpick[hidden] { display: none; }
.lprow { display: flex; gap: 10px; align-items: baseline; width: 100%; box-sizing: border-box; padding: 5px 9px; font: inherit; color: var(--ink); background: none; border: 0; border-radius: 5px; text-align: left; cursor: pointer; }
.lprow.sel, .lprow:hover { background: var(--tint); }
.lpkind { flex: none; width: 4.5em; color: var(--mute); }
.lpname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The button by selected text that keeps it as an excerpt (rooms/excerpt.js) */
.excerptbar { position: fixed; z-index: 8; display: flex; align-items: stretch; font-size: var(--fs-meta); line-height: 1.4; color: #fff; background: #1E50A2; border-radius: 6px; box-shadow: 0 2px 12px rgba(0, 0, 0, .25); white-space: nowrap; overflow: hidden; }
.excerptbar[hidden], .excerptbar [hidden] { display: none; }
.excerptbtn, .excerptplus { font: inherit; color: inherit; background: none; border: 0; padding: 4px 11px; cursor: pointer; }
.excerptplus { border-left: 1px solid rgba(255, 255, 255, .28); opacity: .85; }
.excerptbtn:hover, .excerptplus:hover { background: rgba(255, 255, 255, .14); opacity: 1; }
.excerptbtn:disabled { cursor: default; }
.excerptbar.kept .excerptplus { opacity: 1; }
.excerptnote { font: inherit; color: #fff; background: transparent; border: 0; outline: 0; padding: 4px 11px; width: min(60vw, 320px); }
.excerptnote::placeholder { color: rgba(255, 255, 255, .7); }
.exdots { display: flex; align-items: center; gap: 7px; padding: 0 10px; border-left: 1px solid rgba(255, 255, 255, .28); }
.exdot { width: 13px; height: 13px; padding: 0; border: 0; border-radius: 50%; background: #F8B500; cursor: pointer; box-shadow: 0 0 0 1px rgba(255, 255, 255, .5); }
.exdot[data-c="g"] { background: #69B076; } .exdot[data-c="b"] { background: #7FB2EE; } .exdot[data-c="r"] { background: #E2686E; }
.exdot[aria-pressed="true"] { box-shadow: 0 0 0 2px #1E50A2, 0 0 0 3.5px #fff; }
.exfilter { display: flex; align-items: center; gap: 6px; padding: 2px 14px 10px; color: var(--mute); font-size: 12px; }
.exfilter .exdot { box-shadow: 0 0 0 1px var(--line); }
.exfilter .exdot[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--accent); }
.exfilter .n { margin-right: 8px; font-variant-numeric: tabular-nums; }
.libquote[data-c="g"] { border-left-color: #69B076; } .libquote[data-c="b"] { border-left-color: #7FB2EE; } .libquote[data-c="r"] { border-left-color: #E2686E; }
.libhead + .exfilter { padding-left: 0; }
.rhit { border-left: 3px solid transparent; }
.rhit[data-c="g"] { border-left-color: #69B076; } .rhit[data-c="b"] { border-left-color: #7FB2EE; } .rhit[data-c="r"] { border-left-color: #E2686E; }
.rtitle { flex: 1 1 120px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--serif); font-size: 16px; }
.rtools, .rtoolset { display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; justify-content: flex-end; }
.rtoolset[hidden] { display: none; }
.rtools .act { font-size: var(--fs-meta); white-space: nowrap; }
.rtools .act[aria-pressed="true"] { color: var(--accent); }
.rviews { display: flex; gap: 2px; }
.rtools .rview { padding: 3px 10px; border-radius: 6px; }
.rtools .rview[aria-pressed="true"] { background: var(--tint); }
.rcount { color: var(--mute); white-space: nowrap; }
.rcount.err { color: var(--err); white-space: normal; }
.rsearch, .rpageno, .wtags {
  font: inherit; font-size: var(--fs-meta); color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; padding: 2px 0; outline: 0; -webkit-appearance: none; appearance: none;
}
.rsearch:focus, .rpageno:focus, .wtags:focus { border-bottom-color: var(--accent); }
.rsearch { width: 16ch; }
.rpageno { width: 5ch; text-align: right; }
.rzoom { min-width: 4ch; text-align: center; }
.rpagebox { display: inline-flex; align-items: baseline; gap: 12px; white-space: nowrap; }
.rtoolset { column-gap: 28px; } /* the groups stand apart: getting around, zoom, the page, the dark */
.rbody { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.rbody[hidden] { display: none; }
.rframe { flex: 1 1 auto; min-height: 0; display: flex; position: relative; }
.rside { flex: none; width: 300px; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--paper); }
.rside[hidden] { display: none; }
.rsidehead { flex: none; display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; color: var(--mute); font-size: var(--fs-meta); }
.rsidelist { flex: 1 1 auto; overflow: auto; padding-bottom: 24px; }
.rsidelist .info { padding: 9px 14px; }
.rlink { display: block; width: 100%; box-sizing: border-box; text-align: left; font: inherit; font-size: var(--fs-meta); line-height: 1.5; color: var(--ink); background: none; border: 0; padding: 5px 14px 5px 12px; cursor: pointer; overflow-wrap: anywhere; }
.rlink:hover { background: var(--tint); }
.rlink.cur { color: var(--accent); } /* the entry of the contents being read */
.rhitpage { color: var(--mute); margin-right: 8px; white-space: nowrap; }
.rscroll { flex: 1 1 auto; min-width: 0; overflow: auto; outline: 0; background: var(--card); }
.rscroll.eread { background: var(--paper); }

/* The margin: the book's note beside the book, at the reader's right; its edge drags */
.rmargin { flex: none; width: clamp(280px, 34%, 440px); display: flex; flex-direction: column; min-height: 0; position: relative; border-left: 1px solid var(--line); background: var(--paper); }
.rmargin[hidden] { display: none; }
.rmgrip { position: absolute; inset: 0 auto 0 -4px; width: 8px; cursor: col-resize; z-index: 1; touch-action: none; }
.rmgrip:hover, .rmgrip.on { background: var(--tint); }
html.dragging, html.dragging * { user-select: none; -webkit-user-select: none; cursor: col-resize !important; }
.rmhead { align-items: baseline; flex-wrap: wrap; row-gap: 4px; padding: 10px 18px; }
.rmacts { display: inline-flex; gap: 14px; margin-left: auto; }
.rmstatus { margin-left: 10px; }
.rmstatus.err { color: var(--err); }
.rmtext { flex: 1 1 auto; min-height: 0; resize: none; border: 0; outline: 0; margin: 0; border-radius: 0; background: transparent; color: var(--ink); font: inherit; font-size: 15px; line-height: 1.7; padding: 6px 18px 48px; overflow: auto; overflow-wrap: anywhere; }
.rmtext[hidden], .rmview[hidden] { display: none; }
.rmtext::placeholder { color: var(--mute); opacity: 1; }
.rmview { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 6px 18px 48px; font-size: 15px; line-height: 1.7; }
.rmview .h { font-family: var(--serif); }
.rmview .h1 { font-size: 19px; line-height: 1.35; }

/* The PDF reader: white pages on the card grey, each a canvas with the file's text over it, transparent, for selecting.
   The text layer's rules are the ones pdf.js expects of its host page (its viewer's stylesheet, cut to what is used). */
.rpages { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px; min-width: min-content; box-sizing: border-box; }
.rpage { position: relative; flex: none; background: #fff; box-shadow: 0 0 0 1px var(--line); --scale-round-x: 1px; --scale-round-y: 1px; }
.rpage canvas { display: block; width: 100%; height: 100%; }
.rpages.area { cursor: crosshair; touch-action: none; }
.rpages.area .textLayer, .rpages.area .rlinks { pointer-events: none; }
.rarea { position: absolute; z-index: 3; border: 1.5px solid var(--accent); background: var(--hit); pointer-events: none; }
.rpeek { position: fixed; z-index: 9; overflow: hidden; background: #fff; border-radius: 6px; box-shadow: 0 0 0 1px var(--line), 0 6px 28px rgba(0, 0, 0, .28); pointer-events: none; }
.rpeek[hidden] { display: none; }
.rpeek canvas { display: block; }
.rpeek.night canvas { filter: invert(1) hue-rotate(180deg); }
.rpeekno { position: absolute; right: 8px; bottom: 6px; padding: 1px 7px; border-radius: 4px; font-size: 12px; color: #fff; background: rgba(30, 80, 162, .9); }
.rhit .npic { max-height: 120px; margin: 4px 0 0; }
.libtext .npic { max-height: 320px; }
.rpages.two { display: grid; grid-template-columns: auto auto; justify-content: center; align-items: start; gap: 12px 4px; } /* a spread: 1 and 2, 3 and 4 */
.rpages.two .rpage:nth-child(odd) { justify-self: end; }
.rpages.two .rpage:nth-child(odd):last-child { grid-column: 1 / -1; justify-self: center; }
.rthumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 10px; padding: 4px 14px 0; }
.rthumb { display: block; padding: 0; border: 0; background: none; font: inherit; color: var(--mute); cursor: pointer; text-align: center; }
.rthumbpic { display: block; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.rthumbpic canvas { display: block; width: 100%; height: 100%; }
.rthumbno { display: block; font-size: 12px; line-height: 1.6; font-variant-numeric: tabular-nums; }
.rthumb:hover .rthumbpic { box-shadow: 0 0 0 1px var(--mute); }
.rthumb.cur .rthumbpic { box-shadow: 0 0 0 2px var(--accent); }
.rside.night .rthumbpic { background: #000; }
.rside.night .rthumbpic canvas { filter: invert(1) hue-rotate(180deg); }
.rthumb.cur .rthumbno { color: var(--accent); }
.textLayer {
  color-scheme: only light; position: absolute; inset: 0; overflow: clip; opacity: 1; line-height: 1; text-align: initial; letter-spacing: normal; word-spacing: normal;
  -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; z-index: 0;
  --min-font-size: 1; --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size)); --min-font-size-inv: calc(1 / var(--min-font-size));
}
.textLayer span, .textLayer br { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; -webkit-user-select: text; user-select: text; }
.textLayer > :not(.markedContent), .textLayer .markedContent span:not(.markedContent) {
  z-index: 1; --font-height: 0; font-size: calc(var(--text-scale-factor) * var(--font-height)); --scale-x: 1; --rotate: 0deg;
  transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));
}
.textLayer .markedContent { display: contents; }
.textLayer span[role="img"] { -webkit-user-select: none; user-select: none; cursor: default; }
.textLayer ::selection { background: rgba(30, 80, 162, .28); color: transparent; }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; -webkit-user-select: none; user-select: none; }
.textLayer.selecting .endOfContent { top: 0; }
/* The file's links, over the text; a search's matches, drawn on the text itself (find.js) */
.rlinks { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.rlinks a { position: absolute; pointer-events: auto; border-radius: 2px; }
.rlinks a:hover { background: var(--tint); box-shadow: 0 0 0 1px var(--accent); }
::highlight(genkan-hit) { background-color: rgba(248, 181, 0, .62); color: inherit; } /* also the words searched for, in the home page's list */
.textLayer ::highlight(genkan-hit) { color: transparent; }
::highlight(genkan-excerpt) { background-color: var(--mark); color: inherit; } /* a passage kept as an excerpt */
.textLayer ::highlight(genkan-excerpt) { color: transparent; }
::highlight(genkan-excerpt-g) { background-color: var(--mark-g); color: inherit; }
::highlight(genkan-excerpt-b) { background-color: var(--mark-b); color: inherit; }
::highlight(genkan-excerpt-r) { background-color: var(--mark-r); color: inherit; }
.textLayer ::highlight(genkan-excerpt-g), .textLayer ::highlight(genkan-excerpt-b), .textLayer ::highlight(genkan-excerpt-r) { color: transparent; }
/* Inverted for the dark: the page as drawn, turned over, with the hues put back so pictures keep their colours roughly */
.rpages.night .rpage { background: #000; }
.rpages.night .rpage canvas { filter: invert(1) hue-rotate(180deg); }

/* The page tools, in the same room */
.rbench { overflow: auto; }
.bench { width: 100%; max-width: 1240px; margin: 0 auto; box-sizing: border-box; padding: 12px 24px 64px; }
.bench .big canvas { margin: 0 auto; }

/* The EPUB reader: the book's text in this page's type; none of the book's own styles come along */
.etext { max-width: 680px; margin: 0 auto; padding: 36px 24px 8px; font-size: 17px; line-height: 1.8; overflow-wrap: anywhere; }
.etext p { margin: 0 0 .9em; }
.etext h1, .etext h2, .etext h3, .etext h4, .etext h5, .etext h6 { font-weight: 600; line-height: 1.35; margin: 1.6em 0 .7em; }
.etext h1 { font-size: 1.5em; }
.etext h2 { font-size: 1.3em; }
.etext h3 { font-size: 1.15em; }
.etext h4, .etext h5, .etext h6 { font-size: 1em; }
.esec > :first-child, .esec > div:first-child > :first-child { margin-top: 0; }
.esec[hidden] { display: none; }
.esec.pic img { height: calc(100vh - 96px); width: auto; max-width: 100%; object-fit: contain; margin: 0 auto; } /* a page of a picture book */
.esec.pic + .esec.pic { margin-top: 14px; }
.esec + .esec { margin-top: 2.4em; } /* the book's files follow one another down the page */
.etext img { display: block; max-width: 100%; height: auto; margin: 1em auto; }
.etext a { color: var(--accent); text-decoration: none; }
.etext a:hover { text-decoration: underline; }
.etext blockquote { margin: 1em 0; padding-left: 1em; border-left: 2px solid var(--line); color: var(--mute); }
.etext pre, .etext code { font-family: var(--mono); font-size: .88em; }
.etext pre { overflow-x: auto; padding: 10px 12px; background: var(--card); border-radius: 6px; line-height: 1.5; }
.etext table { border-collapse: collapse; margin: 1em 0; font-size: .92em; }
.etext td, .etext th { border: 1px solid var(--line); padding: 4px 8px; vertical-align: top; }
.etext hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.etext ul, .etext ol { padding-left: 1.6em; }
.enav { max-width: 680px; margin: 0 auto; padding: 24px 24px 72px; display: flex; justify-content: space-between; gap: 16px; }
.enav .act:disabled { opacity: .4; cursor: default; }
.enav[hidden] { display: none; }
.eend { height: calc(100vh - 200px); }
.eread > .enav:first-child { padding-top: 20px; padding-bottom: 0; }
.eread.f-serif .etext { font-family: var(--serif); line-height: 1.85; } /* a book is set as books are */
.eread.w-narrow .etext, .eread.w-narrow .enav { max-width: 540px; }
.eread.w-wide .etext, .eread.w-wide .enav { max-width: 840px; }
/* The paper: the page's own by default, or one of two that do not follow the system */
.eread.paper-sepia { --paper: #F5EDDA; --ink: #43382A; --mute: #8B7B62; --line: #E2D7BD; --card: #ECE2CA; --accent: #8C4A12; --tint: rgba(140, 74, 18, .1); background: var(--paper); color: var(--ink); }
.eread.paper-dark { --paper: #0F1120; --ink: #DDE4EE; --mute: #8C99AC; --line: #272C43; --card: #191D33; --accent: #8FB2EE; --tint: rgba(143, 178, 238, .14); background: var(--paper); color: var(--ink); }

/* The writing room: the text and what it draws, side by side; with the preview off the text sits alone in a column */
.wsplit { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.wsplit.solo { grid-template-columns: minmax(0, 780px); justify-content: center; }
.wsplit.solo .wview { display: none; }
/* An earlier version of the page, laid over it until it is put back or left. */
.rbody:has(> .wold) { position: relative; }
.wold { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; background: var(--paper); }
.wold[hidden] { display: none; }
.woldbar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; padding: 10px 32px; padding-inline: max(32px, calc((100% - 720px) / 2)); border-bottom: 1px solid var(--line); }
.wold .wview { flex: 1; min-height: 0; }
.rmenupanel .wver { display: flex; justify-content: space-between; gap: 24px; white-space: nowrap; text-align: left; }
.rmenupanel:has(.wver) { max-height: 60vh; overflow: auto; }
.wpane { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.wsplit.solo .wpane { border-right: 0; }
.wtext {
  flex: 1 1 auto; min-height: 0; resize: none; border: 0; outline: 0; margin: 0; border-radius: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 16px; line-height: 1.7; padding: 28px 32px 12px; overflow: auto; overflow-wrap: anywhere;
  padding-inline: max(32px, calc((100% - 720px) / 2)); /* a line of text no wider than reads well, in the middle of its half */
}
.wtext::placeholder { color: var(--mute); opacity: 1; }
/* The outline of a page: its headings in a column of their own, before the text */
.woutline { overflow: auto; padding: 30px 14px 40px 24px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; }
.woutline[hidden] { display: none; }
.wsplit.outlined { grid-template-columns: 220px minmax(0, 1fr) minmax(0, 1fr); }
.wsplit.outlined.solo { grid-template-columns: 220px minmax(0, 780px); }
.wohead { flex: none; text-align: left; font-size: var(--fs-meta); line-height: 1.45; color: var(--mute); padding: 3px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wohead:hover { color: var(--ink); }
.wohead.cur { color: var(--accent); }

/* The notes room (rooms/notes.js): the list of every note beside the one selected, drawn in full */
.nroom { flex-direction: row; background: var(--paper); }
.nlist { flex: none; width: min(420px, 40%); overflow: auto; outline: 0; border-right: 1px solid var(--line); padding: 18px 0 60px; }
.nfilters { padding: 0 22px 8px; }
.nkinds { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: var(--fs-meta); margin-bottom: 10px; }
.nkinds .n { margin-left: 5px; color: var(--mute); font-variant-numeric: tabular-nums; }
.nfilters .libtags { margin-bottom: 8px; }
.nrow { display: block; width: 100%; box-sizing: border-box; text-align: left; font: inherit; color: var(--ink); background: none; border: 0; border-left: 2px solid transparent; padding: 10px 22px 10px 20px; cursor: pointer; }
.nrow:hover { background: var(--tint); }
.nrow.sel { background: var(--card); border-left-color: var(--accent); }
.ntitle { font-family: var(--serif); font-size: 16px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ntitle.veiled { filter: blur(5px); user-select: none; }
.nsum { margin-top: 2px; font-size: var(--fs-meta); line-height: 1.5; color: var(--mute); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.nmeta { display: flex; gap: 12px; margin-top: 4px; font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; font-variant-numeric: tabular-nums; }
.nmeta .ontable { color: var(--accent); }
.nmeta .ntags { overflow: hidden; text-overflow: ellipsis; }
.nrows > .info { padding: 16px 22px; }
.nread { flex: 1 1 auto; min-width: 0; overflow: auto; }
.npage { max-width: 720px; margin: 0 auto; padding: 34px 40px 80px; }
.nbodytext { font-size: 16px; line-height: 1.7; }
.nbodytext .h { font-family: var(--serif); }
.nbodytext .h1 { font-size: 22px; line-height: 1.35; }
.nbodytext .h2 { font-size: 18px; }
/* On a page read in full a heading stands off what came before it. */
.nbodytext .h:not(:first-child), .wview .h:not(:first-child) { margin-top: 1.1em; }
.nbodytext .h + .h, .wview .h + .h { margin-top: .5em; }
.nfacts { margin-top: 30px; padding-top: 12px; border-top: 1px solid var(--line); }
.npage .refs { margin-top: 10px; }
.npage .libacts { margin-top: 14px; }
@media (max-width: 760px) {
  .nread { display: none; }
  .nlist { width: 100%; border-right: 0; }
}
/* Taking an excerpt out, under its entry in a reader's list */
.rdrop { display: block; margin: -2px 12px 4px auto; font-size: 12px; color: var(--mute); opacity: 0; }
.rlink:hover + .rdrop, .rdrop:hover, .rdrop:focus-visible { opacity: 1; }
@media (hover: none) { .rdrop { opacity: 1; } }
.wcount { flex: none; padding: 4px 32px 10px; padding-inline: max(32px, calc((100% - 720px) / 2)); }
.wview { overflow: auto; padding: 28px 32px 72px; padding-inline: max(32px, calc((100% - 720px) / 2)); font-size: 16px; line-height: 1.7; white-space: pre-wrap; }
.wtags { width: 18ch; }
.wview .h { font-family: var(--serif); }
.wview .h1 { font-size: 22px; line-height: 1.35; }
.wview .h2 { font-size: 18px; }
@media (max-width: 640px) {
  .rbar { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .rside { position: absolute; inset: 0 auto 0 0; width: min(86vw, 320px); z-index: 2; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .2); }
  .rmargin { position: absolute; inset: 0; width: auto !important; z-index: 3; border-left: 0; } /* over the book: one at a time */
  .rmgrip { display: none; }
  .rtools { flex: 1 1 100%; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } /* one line of controls, pushed sideways when they do not fit */
  .rtools::-webkit-scrollbar { display: none; }
  .wtags { width: 9ch; flex: 1 1 9ch; min-width: 0; } /* the writing room's controls all in sight: the tags take what is left */
  .woldbar { padding-inline: 16px; }
  .rtoolset { flex-wrap: nowrap; flex: none; column-gap: 16px; }
  .rtools > * { flex: none; }
  .rviews { margin-left: auto; }
  .rsearch { width: 8ch; }
  .rsearch, .rpageno, .wtags { font-size: 16px; } /* iOS zooms into smaller fields */
  .wsplit, .wsplit.solo { grid-template-columns: minmax(0, 1fr); } /* one pane at a time: the preview button swaps them */
  .wsplit:not(.solo) .wpane { display: none; }
  .wtext, .wview { padding-inline: 16px; }
  .wcount { padding-inline: 16px; }
  .rmenupanel { position: fixed; left: 12px; right: 12px; top: auto; margin-top: 30px; } /* across the window, under its button */
  .bench { padding: 8px 16px 56px; }
  .etext, .enav { padding-left: 18px; padding-right: 18px; }
}

/* Inline editing */
.edit { display: grid; gap: 6px; grid-template-columns: minmax(0, 1fr); }
.edit textarea {
  font: inherit; font-size: var(--fs-row); line-height: 1.5; color: var(--ink); background: transparent;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 4px 0; outline: 0; width: 100%; box-sizing: border-box; resize: none;
}
.edit textarea:focus { border-bottom-color: var(--accent); }
.edit input {
  font: inherit; font-size: var(--fs-row); color: var(--ink); background: transparent;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 4px 0; outline: 0; width: 100%; box-sizing: border-box;
}
.edit input:focus { border-bottom-color: var(--accent); }
.edit .hint { color: var(--mute); font-size: var(--fs-meta); }
.edit .acts { padding-top: 0; align-items: baseline; }
@media (pointer: coarse) { .edit .hint { display: none; } } /* the keys it names do not exist on a phone */

/* Footer status and the claim form */
.status { margin-top: 40px; color: var(--mute); font-size: var(--fs-meta); }
.status:empty { display: none; }
.claim { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.claim input[type=password] {
  font: inherit; font-size: var(--fs-meta); color: var(--ink); background: transparent;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 2px 0; width: 22ch; outline: 0;
}
.claim input[type=password]:focus { border-bottom-color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.omni:focus-visible, .edit input:focus-visible, .edit textarea:focus-visible, .claim input:focus-visible, .src:focus-visible, .room input:focus-visible, .wtext:focus-visible, .rmtext:focus-visible, .nlist:focus-visible, .rscroll:focus-visible { outline: 0; }

@media (max-width: 640px) {
  .wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
  .grp { flex-direction: column; gap: 0; align-items: stretch; } /* rows and the text area span the full width */
  .g { width: auto; padding: 16px 0 2px; }
  .row { grid-template-columns: minmax(0, 1fr); row-gap: 2px; padding: 10px 0; margin: 0; border-radius: 0; }
  .row.sel { padding: 10px 12px; margin: 0 -12px; border-radius: 6px; }
  .right { white-space: normal; }
  .tags { justify-content: flex-start; }
  .list { gap: 8px; }
  .row > .act { justify-self: start; }
  .row > .tags, .row > .right { order: 1; } /* under the whole note, not between its first line and the rest */
  .main.book { align-items: flex-start; }
  .main.book .cover { margin-top: 3px; }
  .row:has(> .main.book) > .right { padding-left: 44px; } /* a book's place: under its name, past the cover */
  .row > .acts { order: 2; }
  .cfoot { justify-content: flex-start; column-gap: 12px; }
  .cacts { margin-left: 0; gap: 12px; }
  .cacts .extra { display: none; }
  .pages { gap: 12px; }
}
