/* rchan UX layer — Yotsuba-clone design system + functional components.
   Loaded site-wide via the router.

   ============================ DESIGN SYSTEM ============================
   EXACT COPY of 4chan's yotsubluenew.716.css structure & typography,
   re-palette'd to CREAM, with SQUARE offset shadows. Legacy tokens (still
   drive the yotsuba-clone reply/OP cells, links, nav — untouched by the
   catalog-card token contract below):

   - Base type: "Liberation Sans", "Arial", "sans-serif" @ .833rem (10pt at the 16px
     browser default — rem so user font-size preferences scale the site).
     Meta text x-small (backlinks, subtitles, footer), page list + board
     nav .8125rem (13px), board title 1.75rem (28px) Tahoma.
   - Palette (cream mapping of yotsuba blue):
       page bg        #EEEEE4   (4chan #EEF2FF)
       cell bg        #E6E6DA   (4chan #D6DAF0)
       cell border    #CFCFC4   (4chan #B7C5D9)
       text           #393939   (4chan #000)
       link           #274a6b   (4chan #34345C)   hover #c8102e (#DD0000)
       name           #3a6b2e   (4chan #117743)
       subject        #0d5b73   (4chan #0F0C5D)
       greentext      #5b8a2b   (4chan #789922)
       quotelink      #8a2b1f   (4chan #D00), always underlined
   - Structure: replies are shrink-wrapped cells (display:table, padding 2px,
     border right+bottom only) on the page background; the OP has NO cell —
     it sits directly on the page. Messages are indented (blockquote-style
     margins). hr = 1px top border in the cell-border colour.
   - Shadows (square, no blur): cells 2px 2px 0 rgba(0,0,0,.1);
     floating panels 4px 4px 0 rgba(0,0,0,.18). Radius: 0 everywhere.
   - Exception kept by request: file info uses Roboto Mono (self-hosted).
   ======================================================================= */

/* ============================ TOKEN CONTRACT ============================
   Light Cream's half of the shared catalog-card contract (Cream (Dark)'s is
   defined at html.rchan-warmdark, further down) — same custom-property
   names, values tuned for a warm-ivory ground. The SHARED CATALOG CARD
   SYSTEM block (also further down, after both token sets exist) is written
   ONCE against these names; only the values differ per theme. --accent is
   darkened from the initially-proposed #5E7D6C (3.87:1 on --ground, under
   AA) to #547163 (4.57:1) — same sage hue, verified against WCAG AA 4.5:1.
   ========================================================================== */
body.theme_cream {
  --ground: #EFEDE4; --surface: #F7F5EE; --surface-2: #FFFFFF;
  --ink: #2A2721; --ink-soft: #5A554A; --ink-faint: #8A8477;
  --line: #D8D4C6; --line-hover: #C2BCA8;
  --accent: #547163; --sage-text: #4F7355; --wine: #8A4A4A;
  --shadow-rest: 0 1px 2px rgba(42,39,33,.06), 0 2px 8px rgba(42,39,33,.05);
  --shadow-hover: 0 4px 16px rgba(42,39,33,.12);
  --card-hover-bg: #F7F5EE;   /* = --surface: light stays put on hover, the border does the work */
}

/* ---------- Base (yotsuba: body / links / hr / images) ---------- */
html body {
  font-family: "Liberation Sans", "Arial", "sans-serif";
  font-size: .833rem;
  color: #393939;
  background: #EEEEE4;   /* outranks global.css's body{#EEF2FF + fade-blue image} */
  margin-left: 0; margin-right: 0; margin-top: 5px;
  padding-left: 5px; padding-right: 5px;
  -webkit-text-size-adjust: 100%;
}
/* body prefix: global.css sets `a { text-decoration: underline }` and loads after us */
body a, body a:visited { color: #274a6b; text-decoration: none; }
body a:hover { color: #c8102e !important; text-decoration: none; }
img { border: none; }
body hr { border: none; border-top: 1px solid #CFCFC4; height: 0; }

@font-face {
  font-family: "Roboto Mono";
  src: url("/.rchan/robotomono.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Type sizes (body prefix outranks engine %-rules; all fixed) ---------- */
body .postInfo, body .opHead, body .divMessage, body .panelIp, body .panelProxyIp,
  body .contentOmissionIndicator, body .labelOmission, body .labelId,
  body .panelASN, body .panelBypassId,
  body .panelUploads, body .opUploadPanel { font-size: .833rem; }
body input, body select, body textarea { font-size: .833rem; }
body #postingForm button, body #qrbutton { font-size: .833rem; }
body #postingForm label, body .divRefresh label, body .divRefresh input,
body .spoilerCheckbox, body #boardContentLinks { font-size: .833rem; }
body .panelBacklinks { font-size: x-small; }                     /* 4chan .backlink */
/* (catalog card sizes live in the catalog section below, 4chan-exact) */
body .sideCatalogCell, body .small { font-size: x-small; }

/* ---------- Rotating board banner (above the board title) ----------
   Hide the native #bannerImage (board/thread/overboard templates only —
   catalog never had one) — buildBanner()/#rchan-bannerwrap is our own
   client-side replacement: it skips rendering entirely for boards with no
   REAL uploaded banner (never shows the engine's stock defaultBanner.png),
   and adds click-to-reroll. Showing both stacks two copies of the same
   image once a board has a real banner uploaded. */
#bannerImage { display: none !important; }
#rchan-bannerwrap { text-align: center; margin-top: 70px; }
#rchan-banner {
  max-width: min(300px, 92vw); height: auto; cursor: pointer;
  border: 1px solid #CFCFC4; box-shadow: 2px 2px 0 rgba(0,0,0,.1);
  background: #E6E6DA;
}
.theme_dark #rchan-banner { border-color: #2c2f36; }
/* the banner absorbs the clear-the-nav offset the headers usually carry */
#rchan-bannerwrap + .boardHeader { margin-top: 8px; }
body #rchan-bannerwrap + #catalogId { margin-top: .4em; }

/* ---------- Per-board accent (hue set as --bah on <html> by ux.js) ----------
   Only the HUE is per-board; saturation/lightness stay on-palette per theme,
   so every board keeps the design system while reading as its own place. */
.rchan-accented .boardHeader p#labelName,
.rchan-accented #catalogId, .rchan-accented #catalogId .title, .rchan-accented #labelBoard,
.rchan-accented .rchan-empty-title { color: hsl(var(--bah, 210), 34%, 32%); }
.rchan-accented body.theme_dark .boardHeader p#labelName,
.rchan-accented body.theme_dark #catalogId, .rchan-accented body.theme_dark #catalogId .title,
.rchan-accented body.theme_dark #labelBoard,
.rchan-accented body.theme_dark .rchan-empty-title { color: hsl(var(--bah, 210), 26%, 72%); }
.rchan-accented #rchan-formtoggle:hover, .rchan-accented .rchan-empty-cta:hover {
  background: hsl(var(--bah, 210), 42%, 36%); border-color: hsl(var(--bah, 210), 42%, 36%); color: #fff;
}

/* ---------- Board header (yotsuba: .boardTitle / .boardSubtitle) ---------- */
.boardHeader { text-align: center; clear: both; margin-top: 70px; }
.boardHeader p#labelName, #catalogId {
  font-family: Tahoma, sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -2px;   /* 4chan boardTitle — exact copy */
  margin-top: 0;
  color: #393939;
}
/* body prefix: the engine's catalog.css loads after us and sets
   `#catalogId { margin: 1.5em 0 1em 0 }` at equal specificity — without the
   prefix this rule (and the old 70px one) never applied. */
body #catalogId { margin-top: 3em; }   /* clear the fixed nav, like .boardHeader on board/thread pages */
#catalogId .title { font-family: inherit; font-size: 1.75rem; }
#labelBoard { font-size: 1.75rem; font-family: inherit; }   /* "/board/" link in the catalog heading */
.boardHeader p#labelDescription { font-size: x-small; color: #393939; }
.theme_dark .boardHeader p#labelName, .theme_dark .boardHeader p#labelDescription,
.theme_dark #catalogId { color: #c9ccd1; }
/* cream: board/catalog title in the DISPLAY optical serif (New York Large,
   Semibold), with a tasteful raised letterpress (light top catch + soft drop). */
body.theme_cream .boardHeader p#labelName,
body.theme_cream #catalogId, body.theme_cream #catalogId .title, body.theme_cream #labelBoard {
  font-family: "New York Large", Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -.5px;
  /* letterpress: crisp white edge-catch below (no blur), warm ambient drop
     below with more blur than offset. Warmed black so it reads as depth on
     the ivory, not a grey sticker. */
  text-shadow: 0 1px 0 rgba(255,255,255,.6), 0 2px 3px rgba(42,39,33,.12);
}
/* cream: thread subjects in Arial (bold), keeping their hue */
body.theme_cream .labelSubject {
  font-family: "Liberation Sans", "Arial", "sans-serif"; font-weight: 700;
}
/* board title (#labelName, index/thread) doubles as a one-click refresh. The
   class is added by ux.js only where it wires the handler (never where the
   title is already a link), so the affordance shows exactly where it works. */
#labelName.rchan-titlerefresh { cursor: pointer; transition: color .15s ease; }
/* :root + !important: the per-theme title colours (e.g. html.rchan-warmdark
   .boardHeader p#labelName { color:… !important }) are (1,2,2) !important rules
   declared later — this must be a MORE specific !important to shift on hover.
   :root lifts it to (1,3,0). --accent falls back to the site red. */
:root #labelName.rchan-titlerefresh:hover { color: var(--accent, #c8102e) !important; }

/* ---------- Posts (yotsuba: div.post / div.reply / div.op) ---------- */
.postCell { margin: 4px 0; }
/* replies: shrink-wrapped cell, border right+bottom only, on the page bg */
body .innerPost {
  background: #E6E6DA;
  border: 1px solid #CFCFC4;
  border-left: none;
  border-top: none;
  border-radius: 5px;
  padding: 2px;
  box-shadow: 2px 2px 0 rgba(0,0,0,.1);   /* square shadow kept */
}
/* the OP has no cell: it sits directly on the page background */
body .innerOP {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}
.innerPost:target, .innerOP:target { box-shadow: 0 0 0 2px #c8102e88; }
/* ---- Canonical chan post flow (block + float, NOT flex) ----
   Row 1: header (.postInfo/.opHead) — block, full width (the OP's DOM puts its
          file panel first; ux.js moves the header above it — fixOpHeaderOrder).
   Row 2: file-info line (.uploadDetails) — block, full width (engine default).
   Row 3: thumbnail floats left (engine: .imgLink/.uploadCell img float:left),
          message text starts at the thumb's TOP beside it and wraps to full
          width below a longer thumb.
   Flex was tried and reverted: a flex message column top-aligns with the file-
   info LINE (the panel is one flex item), leaving short messages floating
   mid-air right of the metadata. The float's old jank — one-word slivers next
   to huge thumbs — can't recur because thumbs are display-capped at 180px/42vw
   below, which always leaves a wide text column. flow-root contains the float
   inside the post box (padding-bottom kept the old display:table's breathing
   room). */
body .innerPost { display: flow-root; padding: 2px 6px 6px; }
body .innerOP { display: flow-root; }
/* message: blockquote-style indentation (4chan blockquote.postMessage) */
body .divMessage {
  display: block;
  margin: 13px 40px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
/* cream: body copy in Arial 10pt (titles stay serif; body reads as plain sans). */
body.theme_cream .divMessage {
  font-family: "Liberation Sans", "Arial", "sans-serif";
  font-size: 10pt;
  line-height: 1.5;
  color: #2A2620;                       /* warm charcoal, not #000 */
}
/* header line: name green bold, subject blue bold, post No. black -> red hover */
.linkName, .labelName { color: #3a6b2e; font-weight: 700; }
.labelSubject { color: #0d5b73; font-weight: 700; }
.linkQuote, .linkSelf { color: #393939; }
.linkQuote:hover, .linkSelf:hover { color: #c8102e !important; }
/* quotes */
.greenText { color: #5b8a2b; }
.redText { color: #b5341f; }
.quoteLink, .panelBacklinks a { color: #8a2b1f !important; text-decoration: underline; }
/* cream: greentext/redtext read as quoted PROSE — exactly the body register,
   differing in COLOUR only. The engine sets a font on .greenText that beats the
   inherited serif, so pull family/size/weight/style/tracking back from .divMessage. */
body.theme_cream .divMessage .greenText, body.theme_cream .divMessage .redText {
  font-family: inherit !important; font-size: inherit !important; font-weight: inherit !important;
  font-style: normal !important; letter-spacing: normal !important; line-height: inherit !important;
}
/* file info in Courier. NOTE: no overflow/nowrap layers here — the engine
   already ellipsizes long filenames (.originalNameLink caps at 155px and
   expands to 100% on hover); clipping the parent broke that hover reveal,
   and overflow:hidden on .panelUploads would trap the floated thumbnail. */
.panelUploads, .opUploadPanel {
  font-family: "Courier New", Courier, monospace;
}
/* The engine's own posting.css supplies the canonical float layout
   (.imgLink { float:left }, .uploadCell img { float:left; margin-right:1em },
   .uploadDetails block row) — nothing to override here. Click-to-expand is the
   one exception: a full-size image must NOT be floated (text would wrap beside
   a huge image again — the original jank); unfloat it so it takes the full post
   width and the message reflows below. */
.innerPost .imgLink:has(.imgExpanded), .innerOP .imgLink:has(.imgExpanded) {
  float: none; display: block;
}
/* thumbnails: never overflow */
.imgLink img, .imgExpanded { max-width: 100%; height: auto; }
/* Thumbnail DISPLAY size, decoupled from source resolution. The engine
   regenerates LARGE thumbs (thumbSize 480 = a retina SOURCE); cap the on-screen
   box at 180px so a 480px thumb renders at ~2.6x density — crisp on any phone —
   without a wide thumb dominating the post or slivering the text beside it.
   (This also overrides posting.css's `.uploadCell img { max-width: 125px }`,
   meant for the compose-form preview but leaking onto every rendered thumbnail
   because domManipulator reuses <figure class="uploadCell">.) .imgExpanded is
   exempt — click-to-expand shows full size. Mobile cap (42vw) below. */
body .innerPost .uploadCell img:not(.imgExpanded), body .innerOP .uploadCell img:not(.imgExpanded) {
  max-width: 180px !important; max-height: 180px !important;
  width: auto !important; height: auto !important;
}
@media (max-width: 599px) {
  body .innerPost .uploadCell img:not(.imgExpanded), body .innerOP .uploadCell img:not(.imgExpanded) {
    max-width: 42vw !important; max-height: 55vh !important;
  }
}

/* ---------- Form/table colours (cream) ---------- */
/* posting-form label cells (4chan table.postForm td:first-child = #98E + black border) */
body #postingForm th {
  background: #DCDCCF;
  color: #393939;
  font-weight: 700;
  border: 1px solid #393939;
  padding: 0 5px;
  font-size: .833rem;
}
/* page list (4chan div.pagelist: cell bg, right+bottom border, 13px) */
body .pageLink, body #divPages a, body .pagesDiv a {
  font-size: .8125rem;
  background: #E6E6DA;
  border-right: 1px solid #CFCFC4;
  border-bottom: 1px solid #CFCFC4;
  padding: 3px 7px;
  display: inline-block;
  margin: 0 2px 2px 0;
}
/* board nav — 13px, roomy spacing (per request; 4chan has 9pt).
   The engine pins nav to the top with a hardcoded height:18px and a blue bg;
   give the taller bar a real (auto) height, cream colours, and push the page
   content + side catalog down by the new ~42px so nothing sits underneath. */
body nav, body #dynamicHeader {
  font-size: .8125rem;
  height: auto;
  box-sizing: border-box;      /* engine sets width:100%; without this the 6px
                                  side padding overflows the viewport -> h-scrollbar */
  padding: 4px 6px 6px 6px;
  background: #E6E6DA;
  border-bottom: 1px solid #CFCFC4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12);   /* subtle lift off the page — it's a fixed bar, give it some elevation */
}
/* icon-only nav at ALL widths: the engine paints text labels via ::after
   (#navLinkHome::after{content:'home'} etc.) and only blanks them in its
   <=812px media query — blank them globally, plus the "[ / / ]" separators */
body #navLinkSpan a::after, body #navOptionsSpan a::after { content: ''; }
#navLinkSpan > span, #navOptionsSpan > span { display: none; }
/* With the ::after labels blanked, the engine's glyph-spacing rule
   (`#navLinkSpan .coloredIcon:before { margin-right: .25em }`) pads nothing
   but air INSIDE each anchor: the hover/hit box and tooltip anchor extend
   ~4px right of the visible glyph, so highlight != glyph (offset ring).
   Zero it on every theme. */
body #navLinkSpan .coloredIcon::before, body #navOptionsSpan .coloredIcon::before { margin-right: 0; }
body #dynamicHeader a, body nav a { display: inline-block; vertical-align: middle; }
/* kill global.css's `nav span, nav a { margin: 0 .2em }` */
body nav span, body nav a, body #dynamicHeader span, body #dynamicHeader a { margin: 0; }
/* nav layout: board links pinned LEFT, navLinkSpan (site links + theme picker)
   pinned RIGHTMOST, settings just inside it. DOM order is navLinkSpan,
   navBoardsSpan, navOptionsSpan — flex `order` swaps them without touching
   the engine markup (its float:left/right rules are ignored under flex). */
/* left:0 — the engine's nav is position:fixed with no `left`, so it inherits
   the body's 5px side padding as a phantom left offset */
body nav, body #dynamicHeader { display: flex !important; flex-wrap: wrap; align-items: center; left: 0; }
body #navBoardsSpan { order: 0; margin-right: auto !important; }
body #navOptionsSpan { order: 1; margin-right: 8px; }
body #navLinkSpan { order: 2; }
/* thread status line: rides the nav between boards (left) and the right
   cluster; its own auto right-margin splits the free space with boards',
   landing it ~centered */
#rchan-threadstat {
  order: 0; margin-right: auto;
  padding: 0 18px;   /* guaranteed gap to the nav clusters even when the flex auto-margins collapse */
  font-size: x-small; font-weight: 700; opacity: .85;
  white-space: nowrap; align-self: center;
  display: inline-flex; align-items: center;
}
#rchan-threadstat .rchan-ts-seg { display: inline-flex; align-items: center; gap: 3px; cursor: default; }
#rchan-threadstat .rchan-ts-seg svg { display: block; flex: none; opacity: .7; }
#rchan-threadstat .rchan-ts-dot { margin: 0 6px; opacity: .55; }

/* ================= Cream navbar: normalized fixed-box flex ==================
   The right cluster (galbtn/expandbtn/findbtn + #navLinkSpan icons + theme
   <select>) had mismatched sizes, spacing and baseline drift. Give the bar one
   ~40px flex row (gap owns ALL spacing), and make every icon/button an identical
   28x28 centered box, glyphs normalised to ~16px. Scoped to the Cream themes;
   Brutalist/Academia keep their own nav treatments. =========================== */
body.theme_cream nav, body.theme_cream #dynamicHeader,
html.rchan-warmdark nav, html.rchan-warmdark #dynamicHeader {
  min-height: 40px; align-items: center !important;
}
body.theme_cream, html.rchan-warmdark body { margin-top: 42px; }  /* clear the 40px bar */
/* the icon container is a flex row; gap owns spacing between its items */
body.theme_cream #navLinkSpan, html.rchan-warmdark #navLinkSpan {
  display: inline-flex !important; align-items: center;
}
/* every clickable in the right cluster → identical 28x28 centered box */
body.theme_cream #navLinkSpan > a.coloredIcon,
body.theme_cream #rchan-galbtn, body.theme_cream #rchan-expandbtn, body.theme_cream #rchan-findbtn,
html.rchan-warmdark #navLinkSpan > a.coloredIcon,
html.rchan-warmdark #rchan-galbtn, html.rchan-warmdark #rchan-expandbtn, html.rchan-warmdark #rchan-findbtn {
  display: inline-flex !important; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0 !important; margin: 0 !important;
  box-sizing: border-box; border-radius: 4px; align-self: center; line-height: 1;
}
/* glyphs unified to ~16px within their 28px boxes (font-icons + svgs) */
body.theme_cream #navLinkSpan > a.coloredIcon,
html.rchan-warmdark #navLinkSpan > a.coloredIcon { font-size: 16px; }
/* Inside the flex box the ::before pseudo IS the flex item being centered:
   strip the 'Icons' font's line-box slack (and any residual margin) so the
   glyph sits dead-center of its 28x28 ring; the blanked ::after would be a
   second zero-width flex item — remove it so it can't skew centering. */
body.theme_cream #navLinkSpan > a.coloredIcon::before,
html.rchan-warmdark #navLinkSpan > a.coloredIcon::before { display: block; line-height: 1; margin: 0; }
body.theme_cream #navLinkSpan > a.coloredIcon::after,
html.rchan-warmdark #navLinkSpan > a.coloredIcon::after { display: none; }
body.theme_cream #navLinkSpan > a.coloredIcon svg,
html.rchan-warmdark #navLinkSpan > a.coloredIcon svg { width: 16px; height: 16px; display: block; }
body.theme_cream #rchan-galbtn svg, body.theme_cream #rchan-expandbtn svg, body.theme_cream #rchan-findbtn svg,
html.rchan-warmdark #rchan-galbtn svg, html.rchan-warmdark #rchan-expandbtn svg, html.rchan-warmdark #rchan-findbtn svg {
  width: 16px !important; height: 16px !important; display: block;
}
/* theme <select>: match the box height, set slightly apart from the icons */
body.theme_cream #themeSelector, html.rchan-warmdark #themeSelector {
  height: 28px; padding: 0 8px; margin-left: 12px; box-sizing: border-box;
  align-self: center; font-size: 12px; line-height: 1;
}
/* light cream: give the select the theme's surface + border (dark gets its
   colours from the warmdark `select` rule); style the option list on both. */
body.theme_cream #themeSelector {
  background: #E6E6DA; color: #393939; border: 1px solid #CFCFC4; cursor: pointer;
}
body.theme_cream #themeSelector:hover { background: #DCDCCF; border-color: #b7b7a8; }
body.theme_cream #themeSelector option { background: #E6E6DA; color: #393939; }
html.rchan-warmdark #themeSelector { cursor: pointer; }
html.rchan-warmdark #themeSelector option { background: #2A2A28; color: #E8E6DF; }
/* uniform hover target: soft surface behind the box */
body.theme_cream #navLinkSpan > a.coloredIcon:hover, body.theme_cream #rchan-galbtn:hover,
body.theme_cream #rchan-expandbtn:hover, body.theme_cream #rchan-findbtn:hover { background: #DCDCCF; }
html.rchan-warmdark #navLinkSpan > a.coloredIcon:hover, html.rchan-warmdark #rchan-galbtn:hover,
html.rchan-warmdark #rchan-expandbtn:hover, html.rchan-warmdark #rchan-findbtn:hover { background: #363634; }
/* status counters: one flex item, vertically centered, quiet */
body.theme_cream #rchan-threadstat, html.rchan-warmdark #rchan-threadstat { align-self: center; font-size: 11px; }

/* mobile twin of the status line: in-flow strip under the OP (see mobile block) */
#rchan-mstats {
  display: none; flex-wrap: wrap; align-items: center; gap: 2px 0;
  margin: 6px 4px; padding: 4px 8px;
  font-size: x-small; font-weight: 700; opacity: .9;
  background: #E6E6DA; border: 1px solid #CFCFC4;
}
#rchan-mstats .rchan-ts-seg { display: inline-flex; align-items: center; gap: 3px; }
#rchan-mstats .rchan-ts-seg svg { display: block; flex: none; opacity: .7; }
#rchan-mstats .rchan-ts-dot { margin: 0 5px; opacity: .55; }
.theme_dark #rchan-mstats { background: #1f2126; border-color: #2c2f36; }
/* lifecycle chips (bump limit / cyclic / page position) */
.rchan-ts-chip, .rchan-flagchip {
  display: inline-block; padding: 0 6px; vertical-align: middle;
  background: #DCDCCF; color: #393939; border: 1px solid #CFCFC4;
  font-size: x-small; font-weight: 700; white-space: nowrap; cursor: default;
}
.rchan-flagchip { margin-left: 5px; }
.rchan-ts-chip.rchan-ts-warn, .rchan-flagchip.rchan-ts-warn {
  background: #c8102e; color: #fff; border-color: #c8102e;
}
.theme_dark .rchan-ts-chip, .theme_dark .rchan-flagchip {
  background: #262a31; color: #c9ccd1; border-color: #333;
}
.theme_dark .rchan-ts-chip.rchan-ts-warn, .theme_dark .rchan-flagchip.rchan-ts-warn {
  background: #8f0c21; color: #fff; border-color: #8f0c21;
}
html body { margin-top: 36px; }              /* clear the fixed nav */
body #sideCatalogDiv { top: 36px; height: calc(100vh - 36px); }
/* #rchan-nav is now a full-width sticky FOOTER bar (was a floating corner
   stack, needed no clearance) — give the page bottom room so the global
   footer (Rules/Contact) and the last post/reply box aren't hidden under it. */
html body { padding-bottom: 60px; box-sizing: border-box; }
/* footer (4chan #absbot: x-small) */
body footer { font-size: x-small; }

/* ---------- Dark theme (selectable) ---------- */
body.theme_dark, .theme_dark { background: #16171b !important; color: #c9ccd1 !important; }
.theme_dark a { color: #7fb0e0; }
.theme_dark .innerPost,
.theme_dark .catalogCell, .theme_dark .sideCatalogCell, .theme_dark .markedPost,
.theme_dark #quick-reply table, .theme_dark #postingForm, .theme_dark #postingTable,
.theme_dark #postingForm td, .theme_dark .floatingMenu, .theme_dark #newPostFieldset,
.theme_dark #divLatestPosts .latestPostCell, .theme_dark .topBoards a {
  background: #1f2126 !important; color: #c9ccd1 !important; border: 1px solid #2c2f36 !important;
}
.theme_dark .innerPost { border-left: none !important; border-top: none !important; }
.theme_dark .innerOP { background: transparent !important; border: none !important; }
.theme_dark #postingForm th, .theme_dark .modalTableBody th { background: #262a31 !important; color: #c9ccd1 !important; border-color: #2c2f36 !important; }
.theme_dark nav, .theme_dark #dynamicHeader { background: #1f2126 !important; }
.theme_dark .divMessage { color: #c9ccd1 !important; }
.theme_dark .greenText { color: #8ec07c !important; }
.theme_dark .redText { color: #e06c75 !important; }
.theme_dark .labelSubject { color: #79c0ff !important; }
.theme_dark .linkName, .theme_dark .labelName { color: #8ec07c !important; }
.theme_dark .linkQuote, .theme_dark .linkSelf { color: #c9ccd1; }
.theme_dark .quoteLink, .theme_dark .panelBacklinks a { color: #e0987f !important; }
.theme_dark input, .theme_dark textarea, .theme_dark select {
  background: #14151a !important; color: #c9ccd1 !important; border: 1px solid #333 !important;
}
.theme_dark .pageLink, .theme_dark #divPages a { background: #1f2126; border-color: #2c2f36; }

/* ---------- Homepage: "Your threads" chips ---------- */
#rchan-yours { max-width: 720px; margin: 12px auto 0; }
#rchan-yours-head {
  font-size: .833rem; font-weight: 700; margin-bottom: 5px; text-align: center;
}
.rchan-yours-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.rchan-yours-chip {
  display: inline-block; max-width: 260px; padding: 3px 10px; cursor: pointer;
  background: #E6E6DA; color: #393939; border: 1px solid #CFCFC4;
  font: inherit; font-size: x-small; font-weight: 700; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rchan-yours-chip:hover { border-color: #c8102e; color: #c8102e; }
.rchan-yours-chip.rchan-yours-unread { border-color: #2ea043; box-shadow: inset 3px 0 0 #2ea043; }
.theme_dark .rchan-yours-chip { background: #262a31; color: #c9ccd1; border-color: #333; }
.theme_dark .rchan-yours-chip:hover { border-color: #e06c75; color: #e06c75; }
.theme_dark .rchan-yours-chip.rchan-yours-unread { border-color: #2ea043; }

/* ---------- Site-wide presence ("N anons browsing now") ---------- */
#rchan-sitestat {
  text-align: center; margin: 10px auto 2px;
  font-size: .833rem; font-weight: 700; opacity: .85;
}
#rchan-sitestat-nav {
  order: 0; margin-right: auto; padding: 0 18px;
  font-size: x-small; font-weight: 700; opacity: .85;
  white-space: nowrap; align-self: center;
  display: inline-flex; align-items: center; gap: 3px; cursor: default;
}
#rchan-sitestat-nav svg { display: block; flex: none; opacity: .7; }
.rchan-sitedot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #2ea043; vertical-align: baseline; margin-right: 2px;
  animation: rchan-pulse 2.2s ease-in-out infinite;
}
@keyframes rchan-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (max-width: 640px) { #rchan-sitestat-nav { display: none; }
}

/* ---------- Back office: login / account / management pages ----------
   Every reader surface got the design system; these were still raw engine
   chrome (and unreadable in dark). All of them share #settingsFieldset
   (login also wraps it in #settingsWrapper), so one keyed pass covers
   login, registration, recovery, account, board + global management. */
#settingsWrapper { max-width: 640px; margin: 26px auto; padding: 0 10px; }
#settingsFieldset {
  max-width: 640px; margin: 26px auto; display: block;
  border: 1px solid #CFCFC4; background: #E6E6DA;
  box-shadow: 4px 4px 0 rgba(0,0,0,.18); padding: 14px 18px 18px;
}
#settingsWrapper #settingsFieldset { margin: 0 0 18px; max-width: none; }
#settingsFieldset legend {
  font-weight: 700; font-size: .9rem; padding: 2px 12px;
  background: #DCDCCF; border: 1px solid #CFCFC4;
}
#settingsFieldset form {
  margin: 10px 0; padding: 10px 0 4px;
  border-top: 1px dashed #CFCFC4;
}
#settingsFieldset form:first-of-type { border-top: 0; }
#settingsFieldset input[type=text], #settingsFieldset input[type=password],
#settingsFieldset input[type=email], #settingsFieldset input[type=number],
#settingsFieldset select, #settingsFieldset textarea {
  box-sizing: border-box; margin: 4px 0; padding: 6px 8px; max-width: 100%;
  border: 1px solid #CFCFC4; background: #fff; color: #393939;
}
#settingsFieldset input.loginField, #settingsFieldset input.registerField,
#settingsFieldset input.recoverField { display: block; width: 100%; }
#settingsFieldset button, #settingsFieldset input[type=submit] {
  cursor: pointer; padding: 5px 16px; margin: 6px 4px 6px 0;
  border: 1px solid #CFCFC4; background: #DCDCCF; color: #393939;
  font: inherit; font-size: .833rem; font-weight: 700;
}
#settingsFieldset button:hover, #settingsFieldset input[type=submit]:hover {
  background: #c8102e; color: #fff; border-color: #c8102e;
}
#settingsFieldset .captchaImage { background: #fff; border: 1px solid #CFCFC4; display: block; margin: 6px 0; }
#settingsFieldset a { text-decoration: underline; }
#settingsFieldset hr { border: 0; border-top: 1px solid #CFCFC4; }
.theme_dark #settingsFieldset { background: #1f2126; border-color: #2c2f36; color: #c9ccd1; }
.theme_dark #settingsFieldset legend { background: #262a31; border-color: #2c2f36; color: #c9ccd1; }
.theme_dark #settingsFieldset form { border-color: #2c2f36; }
.theme_dark #settingsFieldset input[type=text], .theme_dark #settingsFieldset input[type=password],
.theme_dark #settingsFieldset input[type=email], .theme_dark #settingsFieldset input[type=number],
.theme_dark #settingsFieldset select, .theme_dark #settingsFieldset textarea {
  background: #0f1013; color: #d7dae0; border-color: #2c2f36;
}
.theme_dark #settingsFieldset button, .theme_dark #settingsFieldset input[type=submit] {
  background: #262a31; color: #c9ccd1; border-color: #333;
}
.theme_dark #settingsFieldset hr { border-color: #2c2f36; }

/* ---------- Front page: board list as cards ---------- */
#divBoards.topBoards { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
#divBoards.topBoards a {
  display: inline-block; padding: 8px 14px;
  background: #E6E6DA; border: 1px solid #CFCFC4; border-left: none; border-top: none;
  box-shadow: 2px 2px 0 rgba(0,0,0,.1); font-weight: 700;
}

/* ---------- Homepage: active threads strip ---------- */
#rchan-active { text-align: center; margin: 14px auto 4px; max-width: 940px; }
#rchan-active-head { font-weight: 700; font-size: .833rem; margin-bottom: 7px; }
.rchan-active-cell {
  display: inline-flex; align-items: center; gap: 8px; text-align: left;
  margin: 4px; padding: 5px 10px 5px 5px; max-width: 285px;
  background: #E6E6DA; border: 1px solid #CFCFC4; border-left: none; border-top: none;
  box-shadow: 2px 2px 0 rgba(0,0,0,.1); vertical-align: top;
}
.rchan-active-cell img { width: 44px; height: 44px; object-fit: cover; flex: none; }
.rchan-active-text { min-width: 0; }
.rchan-active-title {
  display: block; font-weight: 700; max-width: 215px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rchan-active-meta { display: block; font-size: x-small; opacity: .85; }
.theme_dark .rchan-active-cell { background: #1f2126; border-color: #2c2f36; }

/* ---------- Nav buttons: horizontal sticky footer bar ---------- */
#rchan-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9999;
  display: flex; flex-direction: row; flex-wrap: wrap;
  align-items: center; justify-content: center;
  width: 100%; box-sizing: border-box; padding: 6px 10px;
}
#rchan-nav button {
  width: 40px; height: 40px; border: 0; cursor: pointer;
  font-size: 1.125rem; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: #274a6b; color: #fff; box-shadow: 2px 2px 0 rgba(0,0,0,.1);
  opacity: .82; transition: opacity .12s ease;
}
#rchan-nav button svg { display: block; }
#rchan-nav button:hover { opacity: 1; }
#rchan-nav button.rchan-on { background: #2ea043; opacity: 1; }   /* notifications enabled */

/* ---------- "(You)" — your own posts + quotes pointing at them ---------- */
.innerPost.rchan-you { box-shadow: inset 4px 0 0 #c8102e, 2px 2px 0 rgba(0,0,0,.1) !important; }
.innerOP.rchan-you { box-shadow: inset 4px 0 0 #c8102e !important; }
.theme_cream .rchan-you { background: #f4e9e3 !important; }
.theme_dark .rchan-you { background: #2a2126 !important; }
.quoteLink[data-you] { font-weight: 700; }

/* ---------- Hover-zoom preview (image + video pop-out) ---------- */
#rchan-zoom, #rchan-vidzoom {
  position: fixed; z-index: 10000; pointer-events: none; display: none;
  max-width: 90vw; max-height: 90vh;
  box-shadow: 4px 4px 0 rgba(0,0,0,.18); background: #0008;
}

/* ---------- Catalog last-replies hover preview (4chan-style) ---------- */
#rchan-catprev {
  position: fixed; z-index: 10003; width: 360px; pointer-events: auto;
  display: none; text-align: left; font-size: .833rem; box-sizing: border-box;
  background: #EEEEE4; border: 1px solid #CFCFC4;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  padding: 4px; max-height: 320px; overflow-y: auto; overscroll-behavior: contain;
  opacity: 0; transition: opacity .15s ease;
}
#rchan-catprev.rchan-catprev-show { opacity: 1; }
.rchan-catprev-post {
  background: #E6E6DA; border: 1px solid #CFCFC4; border-left: none; border-top: none;
  padding: 2px 6px; margin: 3px 0;
}
.rchan-catprev-name { color: #3a6b2e; font-weight: 700; }
.rchan-catprev-id { color: #393939; font-size: x-small; }
.rchan-catprev-msg { margin: 2px 0 1px; word-break: break-word; overflow-wrap: anywhere; max-height: 6em; overflow: hidden; }
.rchan-catprev-empty { padding: 4px 6px; font-size: x-small; opacity: .85; }
.theme_dark #rchan-catprev { background: #16171b; border-color: #2c2f36; }
.theme_dark .rchan-catprev-post { background: #1f2126; border-color: #2c2f36; }
.theme_dark .rchan-catprev-id { color: #c9ccd1; }

/* ---------- Instant styled tooltip (icon labels) ---------- */
#rchan-tip {
  position: fixed; z-index: 10001; display: none; pointer-events: none;
  background: #2e2e2e; color: #fdfdfb; font-size: x-small; font-weight: 700;
  line-height: 1.25; padding: 5px 9px; white-space: nowrap;
  max-width: 62vw; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 4px 4px 0 rgba(0,0,0,.18); border: 1px solid rgba(0,0,0,.15);
}
.theme_dark #rchan-tip { background: #0f1013; color: #e6e8ec; border-color: #2c2f36; }
.coloredIcon[data-tooltip] { cursor: pointer; }

/* ---------- Catalog toolbar (sort + card size) + native search tools ---------- */
/* One row, two structural groups: native #divTools (search/refresh — DOM-moved
   into the bar by buildCatalogTools) pinned LEFT, #rchan-catctrl (count +
   sort/size/view) pinned RIGHT via space-between — deliberately NOT an auto
   margin, which theme rules (warmdark's `#divTools { margin: 0 !important }`,
   the themes' catcount autos) can silently defeat. catctrl's margin-left:auto
   keeps it right even if divTools is missing. flex-wrap keeps phones sane:
   the native tools take their own line and the controls wrap under. */
#rchan-cattools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 8px; margin: 10px 8px 2px; font-size: .833rem; font-weight: 700; }
/* CLS: router-injected placeholder (see nginx sub_filter) reserving this
   bar's space before buildCatalogTools() populates it — see that function
   for how the two IDs hand off. min-height only; margin matches #rchan-
   cattools itself so the reserved block sits in the same place. */
#rchan-cattools-slot { display: block; min-height: 124px; margin: 10px 8px 2px; box-sizing: border-box; }
#rchan-cattools #divTools { margin: 0; text-align: left; font-weight: 400; }
#rchan-catctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-left: auto; }
#rchan-cattools label { margin: 0; }
#rchan-cattools select { margin-left: 5px; padding: 3px 8px; font: inherit; cursor: pointer; }
#divTools { text-align: center; margin: 4px 0 2px; font-size: .833rem; }
#divTools input[type=text] { padding: 3px 8px; margin: 0 4px; }
#divTools #catalogRefreshButton { padding: 3px 10px; cursor: pointer; margin: 0 4px; font: inherit; }
/* deep search: reply-level board search toggle + status */
#rchan-deeplab {
  display: inline-flex; align-items: center; gap: 3px; margin-left: 6px;
  font-size: x-small; font-weight: 700; cursor: pointer; vertical-align: middle;
}
#rchan-deepnote { font-size: x-small; opacity: .8; margin-left: 8px; }
.rchan-deephide { display: none !important; }
.theme_dark #divTools #catalogRefreshButton { background: #1f2126; color: #c9ccd1; border: 1px solid #333; }

/* ---------- Catalog grid: 4chan catalog_yotsuba_b_new.705.css, exact ----------
   4chan threads are BARE inline-blocks on the page background — no card box,
   no border. The shadow sits on the THUMBNAIL (4chan: 0 0 5px blur; ours:
   square per the system). meta = 11px "R / I / P" line; teaser padded 15px. */
/* LynxChan reuses #divThreads on thread/board pages too (4chan's #threads is
   catalog-only) — scope the centering to when it actually holds catalog cells */
body #divThreads:has(.catalogCell) { padding: 20px 0; text-align: center; }
body .catalogCell {
  background: transparent;
  border: none;
  box-shadow: none;
  vertical-align: top;
  display: inline-block;
  word-wrap: break-word;
  overflow: hidden;
  margin: 5px 2px 20px;
  padding: 5px 0 3px 0;
  position: relative;
  cursor: pointer;         /* the whole card opens the thread — onCatCellOpen, every theme */
  width: 180px;            /* 4chan .extended-small (teaser shown) */
  height: auto;
  max-height: 320px;
}
body .catalogCell .linkThumb img {
  display: block;
  margin: auto;
  min-width: 50px; min-height: 50px;
  box-shadow: 2px 2px 0 rgba(0,0,0,.1);   /* square shadow kept (4chan: 0 0 5px .25) */
}
body .catalogCell .threadStats {
  cursor: help;
  font-size: .6875rem;
  line-height: 0;
  margin: 2px 0 1px;
}
body .catalogCell .labelSubject, body .catalogCell .divMessage {
  display: block;
  padding: 0 15px;
  margin: 0;
  font-size: .833rem;
}
body .catalogCell .labelSubject { font-weight: 700; padding: 0; }
/* Size dropdown (4chan's small/large modes; large = default) */
.rchan-cat-s  .catalogCell { width: 165px; max-height: 250px; }
.rchan-cat-s  .linkThumb img { max-width: 150px; max-height: 150px; }
.rchan-cat-l  .catalogCell { width: 270px; max-height: 410px; }
.rchan-cat-l  .linkThumb img { max-width: 250px; max-height: 250px; }

/* keep big cards from blowing up narrow screens */
@media (max-width: 640px) {
  .rchan-cat-l .catalogCell, .rchan-cat-xl .catalogCell { width: 46vw; }
  .rchan-cat-l .linkThumb img, .rchan-cat-xl .linkThumb img { max-width: 42vw; max-height: 42vw; }
}

/* ================= Infinite scroll: generic ornaments =======================
   Base layer so index/catalog infinite scroll looks reasonable under EVERY
   theme; Academia's more specific `.theme_academia .rchan-*` rules (further
   down) refine these further and win on specificity. Keyframes are declared
   once here — @keyframes aren't selector-scoped, so Academia's rules just
   reference them by name. ============================================== */
.rchan-pagedivider {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 18px 0; color: #6b6b66; font-size: .8125rem;
}
.rchan-pagedivider::before, .rchan-pagedivider::after {
  content: ""; flex: 1; max-width: 120px; height: 1px; background: #CFCFC4;
}
.rchan-scroll-loader { text-align: center; padding: 18px 0; }
.rchan-scroll-loader .rchan-ellipsis { font-size: 22px; color: #6b6b66; letter-spacing: .18em; line-height: 1; }
.rchan-scroll-loader .rchan-ellipsis span { animation: rchan-dot 1.2s infinite; }
.rchan-scroll-loader .rchan-ellipsis span:nth-child(2) { animation-delay: .2s; }
.rchan-scroll-loader .rchan-ellipsis span:nth-child(3) { animation-delay: .4s; }
@keyframes rchan-dot { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }
.rchan-scroll-end {
  text-align: center; padding: 24px 0; text-transform: uppercase;
  letter-spacing: .18em; font-size: .6875rem; color: #6b6b66; font-weight: 700;
}
@media (prefers-reduced-motion: reduce) { .rchan-scroll-loader .rchan-ellipsis span { animation: none; opacity: .6; }
}
/* new threads/cards fade+rise in as they're appended or revealed */
.opCell.rchan-appeared, .catalogCell.rchan-appeared { animation: rchan-rise 240ms cubic-bezier(.2,.8,.2,1) both; }
@keyframes rchan-rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .opCell.rchan-appeared, .catalogCell.rchan-appeared { animation: none; }
}
/* Click-to-embed external video: one inline ▶ affordance + the player it opens */
.rchan-embed-btn {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  width: 18px; height: 18px; margin: 0 2px; padding: 0; cursor: pointer;
  border: none; border-radius: 4px; background: rgba(200,16,46,.12); color: #c8102e;
  transition: background .12s;
}
.rchan-embed-btn:hover, .rchan-embed-btn.rchan-embed-on { background: rgba(200,16,46,.24); }
.rchan-embed { position: relative; width: 100%; max-width: 560px; aspect-ratio: 16 / 9; margin: 6px 0; }
.rchan-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 6px; background: #000; }
/* Dead quote (>>NNN pointing at a deleted/pruned post) — muted, not alarming */
.rchan-deadquote { display: inline-block; padding: 4px 8px; font-style: italic; opacity: .6; font-size: .85em; }
/* Progressive thread rendering: keep scroll anchoring on so above-viewport
   inserts (WS pushes, late images) never shove the reader's content down. */
body, .divPosts { overflow-anchor: auto; }
/* "N earlier posts" stub — one quiet clickable bar, only on long threads */
.rchan-earlier-stub {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin: 8px auto 12px; padding: 7px 16px; width: fit-content; cursor: pointer;
  border: 1px solid #d5d5c8; border-radius: 999px; background: transparent;
  color: #6b6b66; font-size: .78rem; font-weight: 600; letter-spacing: .02em;
  text-transform: uppercase; user-select: none; transition: background .12s, border-color .12s;
}
.rchan-earlier-stub:hover, .rchan-earlier-stub:focus-visible { background: rgba(0,0,0,.05); border-color: #b8b8a8; outline: none; }
.theme_dark .rchan-earlier-stub { border-color: #2c2f36; color: #8b929e; }
.theme_dark .rchan-earlier-stub:hover, .theme_dark .rchan-earlier-stub:focus-visible { background: rgba(255,255,255,.06); border-color: #3a3f47; }
html.rchan-warmdark .rchan-earlier-stub { border-color: #454542; color: #9b9b94; }
html.rchan-warmdark .rchan-earlier-stub:hover, html.rchan-warmdark .rchan-earlier-stub:focus-visible { background: rgba(255,255,255,.05); border-color: #56564f; }
.theme_dark .rchan-pagedivider, .theme_dark .rchan-scroll-loader .rchan-ellipsis, .theme_dark .rchan-scroll-end { color: #8b929e; }
.theme_dark .rchan-pagedivider::before, .theme_dark .rchan-pagedivider::after { background: #2c2f36; }
html.rchan-warmdark .rchan-pagedivider, html.rchan-warmdark .rchan-scroll-loader .rchan-ellipsis, html.rchan-warmdark .rchan-scroll-end { color: #9b9b94; }
html.rchan-warmdark .rchan-pagedivider::before, html.rchan-warmdark .rchan-pagedivider::after { background: #454542; }
/* catalog markers are inserted OUTSIDE #divThreads (a CSS grid there) so they
   never become a fixed-height grid row; index markers sit inline in normal
   block flow (#divThreads isn't a grid on index pages) and need no such care. */
.rchan-cat-scroll-marker { margin: 8px 16px; }

/* ================= Cream catalog: uniform grid + fixed-height cards ==========
   The default catalog packs inline-block cells sized from content → ragged rows
   and orphan gaps. Give the Cream themes a real grid with fixed-height cards:
   thumb band → subject → teaser (fills + scrolls) → stat line pinned at bottom.
   Nothing sizes from content. Scoped to the Cream themes via :is(). ========== */
:is(body.theme_cream, html.rchan-warmdark body) #divThreads:has(.catalogCell) {
  display: grid !important; gap: 16px; padding: 20px 16px !important; text-align: left;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); grid-auto-rows: 360px;
}
:is(body.theme_cream, html.rchan-warmdark body).rchan-cat-s #divThreads:has(.catalogCell) {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); grid-auto-rows: 260px;
}
:is(body.theme_cream, html.rchan-warmdark body) .catalogCell {
  display: flex !important; flex-direction: column; width: auto !important;
  height: 100%; max-height: none !important; min-height: 0;
  margin: 0 !important; padding: 0 !important; overflow: hidden;
  position: relative; text-align: left; cursor: pointer;
}
/* thumb band: fixed height, cover-cropped for uniform cards */
:is(body.theme_cream, html.rchan-warmdark body) .catalogCell > a.linkThumb {
  order: 0; flex: none; display: block; width: 100%; height: 180px; overflow: hidden;
}
:is(body.theme_cream, html.rchan-warmdark body).rchan-cat-s .catalogCell > a.linkThumb { height: 120px; }
:is(body.theme_cream, html.rchan-warmdark body) .catalogCell > a.linkThumb img {
  width: 100% !important; height: 100% !important; max-width: none !important; max-height: none !important;
  min-width: 0 !important; min-height: 0 !important; object-fit: cover; display: block;
  margin: 0 !important; box-shadow: none !important;
}
/* subject line (the <p> holding .labelSubject) */
:is(body.theme_cream, html.rchan-warmdark body) .catalogCell > p:not(.threadStats) {
  order: 1; flex: none; margin: 0; padding: 6px 10px 0; line-height: 1.25;
}
/* teaser: fills the remaining space and scrolls in place (long OPs no longer clip) */
:is(body.theme_cream, html.rchan-warmdark body) .catalogCell > .divMessage {
  order: 2; flex: 1 1 auto; min-height: 0; margin: 0; padding: 4px 10px 8px;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  font-size: .833rem; line-height: 1.42; text-align: left;
}
:is(body.theme_cream, html.rchan-warmdark body) .catalogCell > .divMessage::-webkit-scrollbar { width: 6px; }
:is(body.theme_cream, html.rchan-warmdark body) .catalogCell > .divMessage::-webkit-scrollbar-track { background: transparent; }
body.theme_cream .catalogCell > .divMessage { scrollbar-color: #CFCFC4 transparent; }
body.theme_cream .catalogCell > .divMessage::-webkit-scrollbar-thumb { background: #CFCFC4; border-radius: 3px; }
html.rchan-warmdark .catalogCell > .divMessage { scrollbar-color: #454542 transparent; }
html.rchan-warmdark .catalogCell > .divMessage::-webkit-scrollbar-thumb { background: #454542; border-radius: 3px; }
/* stat line pinned at the bottom (teaser's flex:1 pushes it down) */
:is(body.theme_cream, html.rchan-warmdark body) .catalogCell > p.threadStats {
  order: 3; flex: none; margin: 0 !important; padding: 5px 10px; line-height: 0;
  border-top: 1px solid rgba(128,128,120,.28); font-size: .6875rem;
}

/* ---------- Work-safe mode: media blurred until hovered ---------- */
body.rchan-ws .imgLink img, body.rchan-ws .linkThumb img, body.rchan-ws .imgExpanded,
body.rchan-ws video:not(#rchan-vidzoom), body.rchan-ws #rchan-banner,
body.rchan-ws .dragAndDropThumb, body.rchan-ws .rchan-active-cell img,
body.rchan-ws .rchan-gal-thumb img, body.rchan-ws .flagPreview {
  filter: blur(12px); transition: filter .12s ease;
}
body.rchan-ws .imgLink img:hover, body.rchan-ws .linkThumb img:hover,
body.rchan-ws .imgExpanded:hover, body.rchan-ws video:hover,
body.rchan-ws #rchan-banner:hover, body.rchan-ws .dragAndDropThumb:hover,
body.rchan-ws .rchan-active-cell img:hover, body.rchan-ws .rchan-gal-thumb img:hover {
  filter: none;
}
/* deliberate viewing surfaces stay clear: gallery main stage + hover pop-outs */
body.rchan-ws .rchan-gal-main img, body.rchan-ws .rchan-gal-main video,
body.rchan-ws #rchan-zoom { filter: none; }

/* ---------- Catalog: dim threads you've already read ---------- */
.catalogCell.rchan-visited { opacity: .5; transition: opacity .15s ease; }
.catalogCell.rchan-visited:hover { opacity: 1; }

/* ---------- Catalog: watch button on every card ---------- */
.catalogCell { position: relative; }
.rchan-catwatch {
  position: absolute; top: 2px; right: 2px; z-index: 2;
  border: 0; cursor: pointer; padding: 4px;
  /* min-width/height (Lighthouse tap-targets wants >=24px; padding+icon alone
     landed at 22px). 28px instead of exactly 24px — landing precisely on the
     threshold still failed the audit (sub-pixel/rounding at the boundary),
     so a few px of margin actually clears it. Icon's own drawn size unchanged. */
  min-width: 28px; min-height: 28px; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); color: #fff; line-height: 0;
  opacity: 0; transition: opacity .12s ease;
}
/* hover-reveal only on real hover-capable pointers — an ancestor :hover-only
   reveal on touch trips WebKit's "first tap = hover, second tap = click" quirk
   for EVERY tap on a descendant (incl. the thumbnail). Touch/no-hover shows it
   at rest instead of gating on a hover that touch can't sustain anyway. */
@media (hover: hover) and (pointer: fine) {
  .catalogCell:hover .rchan-catwatch { opacity: 1; }
}
@media (hover: none), (pointer: coarse) {
  .rchan-catwatch { opacity: 1; }
}
.rchan-catwatch:focus-visible, .rchan-catwatch.rchan-on { opacity: 1; }
.rchan-catwatch:hover { background: #c8102e; }
.rchan-catwatch.rchan-on { color: #2ea043; }
.rchan-catwatch svg { display: block; }
@media (hover: none) { .rchan-catwatch { opacity: .85; }
}   /* no hover to reveal it on touch */

/* ---------- Empty board state: an invitation, not a void ---------- */
#rchan-empty { text-align: center; margin: 70px auto 40px; max-width: 480px; }
.rchan-empty-title {
  font-family: Tahoma, sans-serif; font-size: 1.75rem; font-weight: 700;
  letter-spacing: -2px; color: #393939;
}
.rchan-empty-sub { margin: 8px 0 18px; font-size: .833rem; opacity: .85; }
.rchan-empty-cta {
  padding: 8px 22px; cursor: pointer; font: inherit;
  font-size: .833rem; font-weight: 700;
  border: 1px solid #CFCFC4; background: #E6E6DA; color: #393939;
  box-shadow: 2px 2px 0 rgba(0,0,0,.1);
}
.rchan-empty-cta:hover { background: #c8102e; color: #fff; border-color: #c8102e; }
.theme_dark .rchan-empty-title { color: #c9ccd1; }
.theme_dark .rchan-empty-cta { background: #262a31; color: #c9ccd1; border-color: #333; }

/* ---------- Watcher unread badge (native counter, restyled) ---------- */
   watcher.js appends a <span> counter to #watcherButton and fills it only
   when watched threads have new replies — style the non-empty state as a
   red corner badge. */
#watcherButton { position: relative; }
#watcherButton span:not(:empty) {
  position: absolute; top: -8px; right: -11px;
  background: #c8102e; color: #fff !important;
  font-family: "Liberation Sans", "Arial", "sans-serif";
  font-size: .5625rem; font-weight: 700; line-height: 1;
  padding: 2px 4px;
  box-shadow: 1px 1px 0 rgba(0,0,0,.15);
  pointer-events: none;
}

/* ---------- Side catalog refresh (word swapped for SVG in ux.js) ---------- */
body #sideCatalogRefreshButton {
  display: inline-flex; align-items: center;
  padding: 2px 4px; background: none; border: none; cursor: pointer;
  color: #274a6b;
}
body #sideCatalogRefreshButton:hover { color: #c8102e; }
.theme_dark #sideCatalogRefreshButton { color: #9fc4e8; }
.theme_dark #sideCatalogRefreshButton:hover { color: #d6e8f8; }

/* ---------- Icons legibility per theme ---------- */
.theme_dark .coloredIcon, .theme_dark .unhideButton, .theme_dark .embedButton,
.theme_dark #showFormsButton, .theme_dark #favouriteButton, .theme_dark .watchButton {
  color: #9fc4e8 !important;
}
.theme_dark .coloredIcon:hover, .theme_dark .watchButton:hover, .theme_dark #favouriteButton:hover { color: #d6e8f8 !important; }
.coloredIcon, .unhideButton, .embedButton, #favouriteButton, .watchButton { color: #274a6b; }
.coloredIcon:hover, .watchButton:hover, #favouriteButton:hover { color: #c8102e; }
.checkedFavouriteButton { color: #f2b21e !important; }   /* favourited = gold, any theme */
#watcherButton, #galleryLink, #favouriteButton, .watchButton, .hideButton { cursor: pointer; }

/* ---------- Quote hover-preview (tooltips.js div.quoteTooltip) ---------- */
.quoteTooltip {
  position: absolute; z-index: 10002; max-width: min(680px, 92vw);
  box-shadow: 4px 4px 0 rgba(0,0,0,.18); overflow: hidden;
  background: #E6E6DA; border: 1px solid #CFCFC4;
}
.quoteTooltip .innerPost, .quoteTooltip .innerOP {
  margin: 0 !important; box-shadow: none; display: block; border: none; background: #E6E6DA;
}
.theme_dark .quoteTooltip, .theme_dark .quoteTooltip .innerPost, .theme_dark .quoteTooltip .innerOP { background: #1f2126 !important; border-color: #2c2f36; }

/* ---------- Poster ID pills ---------- */
/* posting.css (loads after us) paints .labelId white with a BLACK text-shadow
   outline + 5px radius — unreadable with our luminance-picked black text on
   light pills, and off-system. body prefix outranks it. */
body .labelId {
  text-shadow: none; border-radius: 0;
  display: inline-block; padding: 0 5px; line-height: 1.5;
  font-size: x-small; font-weight: 700; cursor: pointer;
}
/* Pill colour: hue comes per-ID from ux.js (--idh custom property); each
   theme renders it at its own muted sat/lightness so the SAME hue identity
   sits on-palette in cream and dark. !important beats the engine's inline
   background-color:#<id>. */
body .labelId.rchan-idpill {
  background-color: hsl(var(--idh, 0), 28%, 66%) !important;
  color: #393939 !important;
}
.theme_dark .labelId.rchan-idpill {
  background-color: hsl(var(--idh, 0), 22%, 34%) !important;
  color: #c9ccd1 !important;
}
/* Click-to-highlight is native (posting.processIdLabel swaps the cell class
   innerPost -> markedPost) but markedPost was painted IDENTICALLY to a normal
   reply in both themes, so the feature was invisible. Give it the reply-cell
   structure (the class swap drops .innerPost styling) + a gold-bar tint.
   body.theme_cream out-specifies the injected head <style>, which loads after
   this sheet. */
body .markedPost, body.theme_cream .markedPost {
  background: #EFE8CF !important;
  border: 1px solid #CFCFC4; border-left: none; border-top: none;
  display: table; padding: 2px;
  box-shadow: inset 4px 0 0 #f2b21e, 2px 2px 0 rgba(0,0,0,.1) !important;
}
body.theme_dark .markedPost {
  background: #2b281f !important; border-color: #2c2f36;
  box-shadow: inset 4px 0 0 #f2b21e !important;
}
/* side-catalog "marked/watched" cell: the engine paints it an off-theme
   highlight colour. Give it markedPost's treatment instead — the theme surface
   + the gold marker bar — for each Cream variant. (warmdark rule must stay LAST:
   it ties on specificity with the .theme_dark rule and wins by source order.) */
body.theme_cream .sideCatalogMarkedCell {
  background: #EFE8CF !important; border: 1px solid #CFCFC4 !important;
  box-shadow: inset 4px 0 0 #f2b21e !important;
}
body.theme_dark .sideCatalogMarkedCell {
  background: #2b281f !important; border: 1px solid #2c2f36 !important; color: #c9ccd1 !important;
  box-shadow: inset 4px 0 0 #f2b21e !important;
}
html.rchan-warmdark .sideCatalogMarkedCell {
  background: #2A2926 !important; border: 1px solid #454542 !important; color: #E8E6DF !important;
  box-shadow: inset 4px 0 0 #f2b21e !important;
}

/* ==========================================================================
   NEO-BRUTALIST THEME — rules live in theme-brutalist.css (split out of this
   file so the ~29KB only ships to visitors actually on the theme; loaded
   pre-paint by predark.js, on demand by ensureThemeCss on a live switch).
   Only the @font-face declarations stay here: they carry no selector to
   scope by, cost a few hundred bytes, and browsers download fonts lazily —
   only when a rendered element actually uses the family.
   ========================================================================== */
@font-face { font-family: "Helvetica Neue LT Std"; font-weight: 400; font-style: normal; font-display: swap; src: url("/.rchan/hn-roman.woff2") format("woff2"); }
@font-face { font-family: "Helvetica Neue LT Std"; font-weight: 700; font-style: normal; font-display: swap; src: url("/.rchan/hn-bold.woff2") format("woff2"); }
@font-face { font-family: "Helvetica Neue LT Std"; font-weight: 400; font-style: italic;  font-display: swap; src: url("/.rchan/hn-italic.woff2") format("woff2"); }

/* ==========================================================================
   ACADEMIA THEME — rules live in theme-academia.css (split out of this file,
   ~34KB, same loading scheme as Brutalist above). @font-face stays here for
   the same reason: selector-less, tiny, and fonts lazy-load on actual use.
   ========================================================================== */
/* Linux Libertine 5.3.0 (SIL OFL 1.1) — humanist old-style serif w/ true
   italics, real bold, and small-caps. Subset to latin+punctuation, TTF->woff2. */
/* New York (Apple optical serif, self-hosted) — Cream theme family.
   "New York Small" = body optical size; "New York Large" = display. */
@font-face { font-family: "New York Small"; font-weight: 400; font-style: normal; font-display: swap; src: url("/.rchan/ny-small-regular.woff2") format("woff2"); }
@font-face { font-family: "New York Small"; font-weight: 400; font-style: italic; font-display: swap; src: url("/.rchan/ny-small-italic.woff2") format("woff2"); }
@font-face { font-family: "New York Small"; font-weight: 500; font-style: normal; font-display: swap; src: url("/.rchan/ny-small-medium.woff2") format("woff2"); }
@font-face { font-family: "New York Small"; font-weight: 500; font-style: italic; font-display: swap; src: url("/.rchan/ny-small-mediumitalic.woff2") format("woff2"); }
@font-face { font-family: "New York Small"; font-weight: 600; font-style: normal; font-display: swap; src: url("/.rchan/ny-small-semibold.woff2") format("woff2"); }
@font-face { font-family: "New York Large"; font-weight: 600; font-style: normal; font-display: swap; src: url("/.rchan/ny-large-semibold.woff2") format("woff2"); }
@font-face { font-family: "New York Large"; font-weight: 700; font-style: normal; font-display: swap; src: url("/.rchan/ny-large-bold.woff2") format("woff2"); }
@font-face { font-family: "Linux Libertine"; font-weight: 400; font-style: normal; font-display: swap; src: url("/.rchan/ll-regular.woff2") format("woff2"); }
@font-face { font-family: "Linux Libertine"; font-weight: 400; font-style: italic;  font-display: swap; src: url("/.rchan/ll-italic.woff2") format("woff2"); }
@font-face { font-family: "Linux Libertine"; font-weight: 700; font-style: normal; font-display: swap; src: url("/.rchan/ll-bold.woff2") format("woff2"); }
@font-face { font-family: "Linux Libertine"; font-weight: 700; font-style: italic;  font-display: swap; src: url("/.rchan/ll-bolditalic.woff2") format("woff2"); }

/* ---------- File row controls: words -> SVG icons ----------
   posting.css paints these via ::after text ('Open file' / '(Hide file)' /
   '(Show file)'). Replace with currentColor mask icons — external-link,
   eye-off, eye — so they inherit the coloredIcon blue + red hover. */
body .nameLink::after, body .hideFileButton::after {
  content: '' !important;
  display: inline-block; width: 14px; height: 14px;
  background-color: currentColor;
  vertical-align: -2px;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-position: center; mask-position: center;
}
body .nameLink::after {   /* open file: external-link */
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 19H5V5h7V3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 19H5V5h7V3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z'/%3E%3C/svg%3E");
}
body .hideFileButton { margin-left: 4px; cursor: pointer; }
body .hideFileButton::after {   /* hide file: eye-off */
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 7a5 5 0 0 1 5 5c0 .65-.13 1.26-.36 1.83l2.92 2.92A11.8 11.8 0 0 0 23 12c-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2.71 3.16 1.29 4.57l2.53 2.53A11.8 11.8 0 0 0 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l3.4 3.4 1.41-1.41L2.71 3.16zM12 17a5 5 0 0 1-5-5c0-.77.18-1.5.49-2.14l1.57 1.57L9 12a3 3 0 0 0 3 3l.57-.06 1.57 1.57c-.64.31-1.37.49-2.14.49z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 7a5 5 0 0 1 5 5c0 .65-.13 1.26-.36 1.83l2.92 2.92A11.8 11.8 0 0 0 23 12c-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2.71 3.16 1.29 4.57l2.53 2.53A11.8 11.8 0 0 0 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l3.4 3.4 1.41-1.41L2.71 3.16zM12 17a5 5 0 0 1-5-5c0-.77.18-1.5.49-2.14l1.57 1.57L9 12a3 3 0 0 0 3 3l.57-.06 1.57 1.57c-.64.31-1.37.49-2.14.49z'/%3E%3C/svg%3E");
}
body .hideFileButton.hiddenFile::after {   /* file hidden: eye = show again */
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17a5 5 0 1 1 0-10 5 5 0 0 1 0 10zm0-8a3 3 0 1 0 0 6 3 3 0 0 0 0-6z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17a5 5 0 1 1 0-10 5 5 0 0 1 0 10zm0-8a3 3 0 1 0 0 6 3 3 0 0 0 0-6z'/%3E%3C/svg%3E");
}

/* ---------- "Filter this image" button (file rows) ---------- */
.rchan-fhash {
  border: 0; background: none; cursor: pointer; padding: 2px 4px;
  color: #274a6b; opacity: .55; vertical-align: middle;
}
.rchan-fhash:hover, .rchan-fhash:focus-visible { opacity: 1; color: #c8102e; }
.rchan-fhash svg { display: inline-block; vertical-align: middle; }
.theme_dark .rchan-fhash { color: #9fc4e8; }

/* ---------- Reverse image search links (file rows) ---------- */
.rchan-ris { font-size: x-small; margin-left: 6px; opacity: .85; white-space: nowrap; }
.rchan-ris:hover { opacity: 1; }
.rchan-ris a { text-decoration: none; }

/* ---------- Backlinks row ---------- */
.panelBacklinks a { margin-right: 4px; }

/* ---------- Floating menus: watcher, hide menu, posting extra menu ----------
   (body prefix: global.css paints .floatingMenu #D6DAF0 and loads after us) */
body .floatingMenu, body .hideMenu, body .extraMenu, body #watchedMenu {
  padding: 6px 8px;
  box-shadow: 4px 4px 0 rgba(0,0,0,.18);
  background: #E6E6DA; color: #393939; border: 1px solid #CFCFC4;
}
.hideMenu div, .extraMenu div, #watchedMenu .watchedCell { padding: 3px 6px; }
.hideMenu div:hover, .extraMenu div:hover { background: rgba(200,16,46,.12); }
.theme_dark .floatingMenu, .theme_dark .hideMenu, .theme_dark .extraMenu, .theme_dark #watchedMenu {
  background: #1f2126; color: #c9ccd1; border: 1px solid #2c2f36;
}
.watchedNotification::before { color: #e06c75 !important; }

/* ---------- Watched-threads menu: design-system pass ----------
   (structure: #watchedMenu > label(title) + #closeWatcherMenuButton + hr +
   wrappers > .watchedCell > .watchedCellLabel(a + notification) + close) */
body #watchedMenu {
  padding: 0; min-width: 260px; max-width: 340px; max-height: 60vh; overflow: auto;
  background: #EEEEE4; border: 1px solid #CFCFC4;
  box-shadow: 4px 4px 0 rgba(0,0,0,.18); font-size: .833rem;
}
body #watchedMenu > label {
  display: block; cursor: move; user-select: none;
  position: sticky; top: 0; z-index: 1;
  background: #DCDCCF; border-bottom: 1px solid #CFCFC4;
  padding: 3px 26px 3px 8px; font-weight: 700;
}
body #watchedMenu > hr { display: none; }
body #closeWatcherMenuButton {
  position: absolute; top: 4px; right: 6px; z-index: 2; cursor: pointer;
}
body #watchedMenu .watchedCell {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 4px 8px; border-bottom: 1px solid #CFCFC466;
}
body #watchedMenu .watchedCell:hover { background: rgba(200,16,46,.08); }
body #watchedMenu .watchedCellLabel {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
body #watchedMenu .watchedNotification { margin-left: 4px; font-weight: 700; }
body #watchedMenu .watchedCellCloseButton { flex: none; cursor: pointer; opacity: .6; }
body #watchedMenu .watchedCellCloseButton:hover { opacity: 1; color: #c8102e !important; }
.theme_dark body #watchedMenu, body.theme_dark #watchedMenu { background: #16171b; border-color: #2c2f36; }
.theme_dark #watchedMenu > label { background: #262a31 !important; border-color: #2c2f36; }
.theme_dark #watchedMenu .watchedCell { border-color: #2c2f3666; }
.theme_dark #watchedMenu .watchedCell:hover { background: rgba(224,108,117,.1); }

/* ---------- Quick Reply (qr.js #quick-reply) ----------
   The engine's threadPage.css pins width:300px and loads after this sheet,
   so sizing needs the body prefix. resize:both + overflow:auto = native
   resize handle; draggable by its header as before.
   Restyled to MATCH the floating new-thread box (#rchan-qr): flat cream
   panel, #DCDCCF sticky header with the close button on the right, 6-8px
   gutters, dashed dropzone, bordered Reply button. */
body #quick-reply {
  width: 400px; height: 680px;
  min-width: 340px; max-width: 96vw; max-height: 92vh;
  resize: both; overflow: auto;
  box-shadow: 4px 4px 0 rgba(0,0,0,.18);
  background: #E6E6DA; border: 1px solid #CFCFC4;
}
body #quick-reply #post-form-inner { min-width: 0; }
body #quick-reply table {
  width: 100%; background: #E6E6DA;
  border-collapse: separate; border-spacing: 0; padding: 0;
}
/* header row = #rchan-qr-header twin: sticky, draggable, close on the right */
body #quick-reply th {
  position: sticky; top: 0; z-index: 2;
  background: #DCDCCF; border: none; border-bottom: 1px solid #CFCFC4;
  padding: 3px 8px; text-align: left;
  font-size: .833rem; font-weight: 700; color: #393939;
}
body #quick-reply th .handle {
  float: none; width: auto;
  display: flex; align-items: center; justify-content: space-between;
  flex-direction: row-reverse;   /* close-btn is the FIRST child -> send it right */
  user-select: none;
}
body #quick-reply th .close-btn { float: none; padding: 0 3px; font-size: .8125rem; cursor: pointer; }
/* body cells get the #rchan-qr-body gutter */
body #quick-reply td { padding: 2px 8px; }
body #quick-reply tbody:last-child tr:last-child td { padding-bottom: 8px; }
/* compact default; ux.js auto-grows it to fit content (capped, then scrolls) */
#quick-reply textarea, #qrbody { width: 100%; box-sizing: border-box; min-height: 40px; resize: vertical; }
/* dropzone: dashed cream instead of the engine's grey slab */
body #quick-reply .dropzone {
  border: 1px dashed #CFCFC4; background: #EEEEE4; color: #393939;
  margin: 4px 0; padding: 10px 6px; text-align: center;
  font-size: x-small; font-weight: 700; opacity: .85; cursor: pointer;
}
body #quick-reply .dropzone:hover { border-color: #c8102e; opacity: 1; }
/* captcha: framed image + small reload button, like the rest of the system */
body #quick-reply .captchaImage {
  display: block; width: 100%; box-sizing: border-box;
  background: #fff; border: 1px solid #CFCFC4;
}
body #quick-reply .reloadCaptchaButton {
  border: 1px solid #CFCFC4; background: #E6E6DA; cursor: pointer;
  font: inherit; font-size: x-small; font-weight: 700; padding: 2px 8px;
}
body #quick-reply .reloadCaptchaButton:hover { background: #c8102e; color: #fff; border-color: #c8102e; }
/* captcha countdown (native, seconds until expiry+auto-reload): quiet meta text */
.captchaTimer { font-size: x-small; opacity: .85; margin-left: 6px; }
/* "Extra" / mobile "Files" / "Captcha" reveal rows read as links */
body #quick-reply td.small { color: #274a6b; cursor: pointer; font-weight: 700; }
body #quick-reply td.small:hover { color: #c8102e; }
/* Reply button: #rchan-formtoggle twin */
body #quick-reply #qrbutton {
  width: auto; margin: 4px auto 2px; padding: 3px 16px;
  border: 1px solid #CFCFC4; background: #E6E6DA; cursor: pointer;
  font: inherit; font-size: .833rem; font-weight: 700; color: #393939;
}
body #quick-reply #qrbutton:hover:not(:disabled) { background: #c8102e; color: #fff; border-color: #c8102e; }
body #quick-reply #qrbutton:disabled { opacity: .6; cursor: default; }
body #quick-reply .spoilerCheckbox { font-size: x-small; }
/* dark theme */
body.theme_dark #quick-reply, .theme_dark #quick-reply table { background: #1f2126 !important; border-color: #2c2f36; }
.theme_dark #quick-reply th { background: #262a31 !important; color: #c9ccd1; border-color: #2c2f36 !important; }
.theme_dark #quick-reply .dropzone { background: #16171b; color: #c9ccd1; border-color: #2c2f36; }
.theme_dark #quick-reply .reloadCaptchaButton, .theme_dark #quick-reply #qrbutton {
  background: #262a31; color: #c9ccd1; border-color: #333;
}
.theme_dark #quick-reply td.small { color: #7fb0e0; }

/* ---------- GET celebration (dubs get checked) ---------- */
.linkQuote.rchan-get-dubs { text-decoration: underline dotted #f2b21e 2px; text-underline-offset: 2px; }
.rchan-getbadge {
  display: inline-block; margin-left: 4px; padding: 0 5px;
  background: #f2b21e; color: #393939;
  font-size: x-small; font-weight: 700; vertical-align: middle;
  box-shadow: 1px 1px 0 rgba(0,0,0,.15);
}
.theme_dark .rchan-getbadge { background: #b8860b; color: #16171b; }

/* ---------- Report shortcut flag (hover-revealed per post) ---------- */
.rchan-reportbtn {
  border: 0; background: none; cursor: pointer; padding: 0 3px;
  margin-left: 6px; color: #274a6b; opacity: 0; transition: opacity .1s ease;
  vertical-align: -1px;
}
/* hover-reveal only on real hover-capable pointers — see .rchan-catwatch note
   above; this is THE cause of "image expand needs two taps" (the ancestor
   .innerPost/.innerOP wraps the thumbnail too). */
@media (hover: hover) and (pointer: fine) {
  .innerPost:hover .rchan-reportbtn, .innerOP:hover .rchan-reportbtn { opacity: .55; }
}
@media (hover: none), (pointer: coarse) {
  .rchan-reportbtn { opacity: .55; }
}
.rchan-reportbtn:focus-visible { opacity: 1; }
.rchan-reportbtn:hover { opacity: 1 !important; color: #c8102e; }
.rchan-reportbtn svg { display: inline-block; vertical-align: middle; }
.theme_dark .rchan-reportbtn { color: #9fc4e8; }

/* ---------- Native modal (report / ban / captcha): design-system pass ---------- */
.modalInnerPanel {
  background: #EEEEE4 !important; border: 1px solid #CFCFC4;
  box-shadow: 4px 4px 0 rgba(0,0,0,.18); border-radius: 0;
  font-size: .833rem; color: #393939;
}
.modalHeader {
  display: block; background: #DCDCCF; border-bottom: 1px solid #CFCFC4;
  padding: 3px 8px; font-weight: 700; text-align: left;
}
.modalTableBody th {
  background: transparent; border: none; text-align: right;
  font-size: .833rem; font-weight: 700; color: #393939; padding: 2px 8px;
}
.modalTableBody td { padding: 2px 8px 2px 0; }
.modalInnerPanel input[type=button] {
  cursor: pointer; margin: 6px 4px 8px 8px; padding: 3px 14px;
  border: 1px solid #CFCFC4; background: #E6E6DA; color: #393939;
  font: inherit; font-size: .833rem; font-weight: 700;
}
.modalInnerPanel input[type=button]:hover { background: #c8102e; color: #fff; border-color: #c8102e; }
.modalInnerPanel .captchaImage { background: #fff; border: 1px solid #CFCFC4; margin: 6px 8px 0; }
.theme_dark .modalInnerPanel { background: #1f2126 !important; border-color: #2c2f36; color: #c9ccd1; }
.theme_dark .modalHeader { background: #262a31; border-color: #2c2f36; }
.theme_dark .modalTableBody th { color: #c9ccd1; }
.theme_dark .modalInnerPanel input[type=button] { background: #262a31; color: #c9ccd1; border-color: #333; }

/* ---------- Gallery lightbox ---------- */
.modalPanel { backdrop-filter: blur(2px); }
.galleryImage { max-width: 92vw; max-height: 86vh; box-shadow: 4px 4px 0 rgba(0,0,0,.18); }

/* ---------- Gallery mode (g): fullscreen media overlay + filmstrip ---------- */
html.rchan-noscroll, html.rchan-noscroll body { overflow: hidden; }
#rchan-gallery {
  position: fixed; inset: 0; z-index: 10010; display: none;
  flex-direction: column; background: rgba(10, 10, 12, .94);
  color: #e8e8e8; -webkit-user-select: none; user-select: none;
}
.rchan-gal-main {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 8px;
}
.rchan-gal-main img, .rchan-gal-main video {
  max-width: 96vw; max-height: calc(100vh - 132px);
  object-fit: contain; box-shadow: 0 0 24px rgba(0,0,0,.6);
}
/* pinch/wheel zoom state: transform is set inline; grab cursor while zoomed */
#rchan-gallery.rchan-gal-zoomed .rchan-gal-main { overflow: hidden; }
#rchan-gallery.rchan-gal-zoomed .rchan-gal-main img { cursor: grab; }
#rchan-gallery.rchan-gal-zoomed .rchan-gal-main img:active { cursor: grabbing; }
.rchan-gal-meta {
  flex: none; display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 4px 56px; font-size: .833rem; min-height: 22px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rchan-gal-meta a { color: #9fc4e8; text-decoration: underline; cursor: pointer; }
.rchan-gal-strip {
  flex: none; display: flex; gap: 6px; align-items: center;
  padding: 8px 10px; overflow-x: auto; overflow-y: hidden;
  background: rgba(0,0,0,.5); scrollbar-width: thin;
}
.rchan-gal-thumb {
  flex: none; width: 64px; height: 64px; padding: 0; cursor: pointer;
  background: #1a1b1f; border: 2px solid transparent; color: #e8e8e8;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
  opacity: .7; transition: opacity .12s ease;
}
.rchan-gal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rchan-gal-thumb:hover { opacity: 1; }
.rchan-gal-thumb.rchan-gal-cur { border-color: #c8102e; opacity: 1; }
.rchan-gal-thumb.rchan-gal-vid { position: relative; }
.rchan-gal-thumb.rchan-gal-vid::after {
  content: "▶"; position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: #fff; font-size: 1rem;
  text-shadow: 0 0 6px rgba(0,0,0,.9); pointer-events: none;
}
#rchan-gallery .rchan-gal-x, #rchan-gallery .rchan-gal-prev, #rchan-gallery .rchan-gal-next {
  position: absolute; z-index: 2; border: 0; cursor: pointer;
  background: rgba(0,0,0,.55); color: #fff; font: inherit;
  width: 44px; height: 44px; line-height: 44px; text-align: center; padding: 0;
}
#rchan-gallery .rchan-gal-x { top: 10px; right: 10px; font-size: 1.1rem; }
.rchan-gal-prev, .rchan-gal-next {
  top: 50%; transform: translateY(-50%); font-size: 1.8rem;
}
.rchan-gal-prev { left: 10px; }
.rchan-gal-next { right: 10px; }
.rchan-gal-prev:disabled, .rchan-gal-next:disabled { opacity: .25; cursor: default; }
#rchan-gallery button:hover:not(:disabled) { background: #c8102e; }
@media (max-width: 640px) {
  .rchan-gal-thumb { width: 52px; height: 52px; }
  .rchan-gal-main img, .rchan-gal-main video { max-height: calc(100vh - 116px); }
  .rchan-gal-meta { padding: 4px 48px; }
}

/* ---------- j/k keyboard post navigation: current-post marker ---------- */
.rchan-kbcur > .innerPost, .rchan-kbcur > .innerOP, .rchan-kbcur > .markedPost {
  outline: 2px solid rgba(200,16,46,.45); outline-offset: 2px;
}
.catalogCell.rchan-kbcur { outline: 2px solid rgba(200,16,46,.6); outline-offset: 2px; }

/* ---------- New-since-last-visit + replies-to-you ---------- */
.postCell.rchan-new .innerPost { box-shadow: inset 3px 0 0 #2ea043, 2px 2px 0 rgba(0,0,0,.1) !important; }
#rchan-newline {
  text-align: center; margin: 12px auto; font-size: x-small; font-weight: 700;
  color: #2ea043; text-transform: uppercase;
  border-top: 1px dashed #2ea04366; padding-top: 6px; max-width: 90%;
}
.rchan-newbadge {
  display: inline-block; margin-left: 6px; padding: 0 7px;
  background: #2ea043; color: #fff; font-size: x-small; font-weight: 700; vertical-align: middle;
}
#rchan-youbtn {
  position: fixed; left: 12px; bottom: 12px; z-index: 9999;
  border: 0; cursor: pointer; padding: 8px 13px;
  font: inherit; font-size: .833rem; font-weight: 700;
  background: #c8102e; color: #fff; box-shadow: 2px 2px 0 rgba(0,0,0,.1);
  opacity: .9; transition: opacity .12s ease;
  display: inline-flex; align-items: center; gap: 6px;   /* svg icon + text */
}
#rchan-youbtn svg { display: block; flex: none; }
#rchan-youbtn:hover { opacity: 1; }
/* dismiss ✕ inside the pill: its own hit area, quiet until hovered */
#rchan-youbtn .rchan-yb-x {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 2px; padding: 3px; border-radius: 3px; opacity: .75; cursor: pointer;
}
#rchan-youbtn .rchan-yb-x:hover { opacity: 1; background: rgba(255,255,255,.18); }

/* ---------- Post form: collapse toggle + toolbar, char counter, drag-drop, previews ---------- */
#rchan-formtoggle {
  display: block; width: -moz-fit-content; width: fit-content; margin: 6px auto; /* centered */
  padding: 3px 11px; border-radius: 5px;
  border: 1px solid #CFCFC4; background: #E6E6DA; cursor: pointer; font: inherit;
  font-size: .833rem; font-weight: 700;
  box-shadow: 0 0 0 rgba(0,0,0,0);
  /* long, slow rollover — the lift eases in over ~0.6s */
  transition: box-shadow .6s cubic-bezier(.22,.61,.36,1), background-color .18s ease, color .18s ease, border-color .18s ease;
}
#rchan-formtoggle:hover { background: #c8102e; color: #fff; border-color: #c8102e; box-shadow: 0 6px 20px rgba(0,0,0,.28); }
.theme_dark #rchan-formtoggle { background: #262a31; color: #c9ccd1; border-color: #333; }

/* Floating new-thread box (board/catalog pages — the real #postingForm is moved
   into it; qr.js is thread-only). Same visual language as #quick-reply. */
#rchan-qr {
  position: fixed; top: 60px; right: 30px; z-index: 10005;
  width: 425px; min-width: 340px; max-width: 96vw; max-height: 92vh;
  resize: both; overflow: auto; display: none;
  background: #E6E6DA; border: 1px solid #CFCFC4;
  box-shadow: 4px 4px 0 rgba(0,0,0,.18);
}
#rchan-qr-header {
  cursor: move; user-select: none;
  position: sticky; top: 0; z-index: 1;    /* stays visible when the box body scrolls */
  background: #DCDCCF; border-bottom: 1px solid #CFCFC4;
  padding: 3px 8px; font-size: .833rem; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between;
}
#rchan-qr-close { border: 0; background: none; cursor: pointer; font-size: .8125rem; font-weight: 700; padding: 0 3px; }
#rchan-qr-close:hover { color: #c8102e; }
#rchan-qr-body { padding: 6px; }
#rchan-qr #postingForm input[type=text], #rchan-qr #postingForm textarea { max-width: 100%; box-sizing: border-box; }
.theme_dark #rchan-qr { background: #1f2126; border-color: #2c2f36; }
.theme_dark #rchan-qr-header { background: #262a31; border-color: #2c2f36; }
/* "Original Form" link under the toggle button (board/catalog pages) */
#rchan-origform {
  display: block; width: -moz-fit-content; width: fit-content;
  /* padding (not just margin) grows the actual tap target to Lighthouse's
     24px floor — it was a 14px-tall text-only hit box. Negative top margin
     offsets the added padding so the visible position/spacing is unchanged. */
  margin: -6px auto 0; padding: 6px 8px; font-size: x-small; text-decoration: underline; cursor: pointer;
  font-family: "Liberation Sans", "Arial", "sans-serif";
}

/* slide the posting form open/closed (grid-rows 1fr<->0fr animates true auto height) */
#postingForm.rchan-form {
  display: grid; grid-template-rows: 1fr; justify-items: center; /* center the form */
  transition: grid-template-rows .28s ease, opacity .28s ease;
}
#postingForm.rchan-form > * { min-height: 0; overflow: hidden; }
#postingForm.rchan-collapsed { grid-template-rows: 0fr; opacity: 0; }
/* "No location" checkbox is staff-only — hidden for everyone else in the main
   form AND the quick reply (the flagoverride addon strips noFlag server-side
   for non-staff; this is just the cosmetic half). ux.js adds .rchan-staff to
   <body> once /account.js confirms an authorized role. */
#noFlagDiv, #qrcheckboxNoFlag, label[for="qrcheckboxNoFlag"] { display: none; }
body.rchan-staff #noFlagDiv, body.rchan-staff #qrcheckboxNoFlag,
body.rchan-staff label[for="qrcheckboxNoFlag"] { display: revert; }

/* admin flag-override row (built only for authorized staff; server enforces)
   — .rchan-flagrow is the Quick Reply twin of the same control */
#rchan-flagrow, .rchan-flagrow { margin: 4px 0; font-size: .833rem; font-weight: 700; }
#rchan-flagrow select, .rchan-flagrow select { font: inherit; font-weight: 400; margin-left: 4px; max-width: 220px; }
/* char counter turns red within 10% of the board's message limit */
.rchan-charwarn { color: #c8102e; font-weight: 700; }
/* sage checkbox in the formatting bar */
.rchan-sagelab {
  display: inline-flex; align-items: center; gap: 3px; cursor: pointer;
  font-size: x-small; font-weight: 700; font-style: italic; opacity: .85;
}
.rchan-fmtbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 4px 0; }
/* scoped under #postingForm/#quick-reply to beat the engine's "#postingForm button
   {width:8em;font-size:125%}" (that rule is for the Post submit button). */
#postingForm .rchan-fmtbar button, #quick-reply .rchan-fmtbar button {
  width: auto !important; min-width: 26px !important; height: 24px !important;
  margin: 0 !important; padding: 0 8px !important; box-sizing: border-box;
  cursor: pointer;
  font-family: inherit; font-size: x-small !important; font-weight: 700; line-height: 1 !important;
  border: 1px solid #CFCFC4; background: #E6E6DA;
}
#postingForm .rchan-fmtbar button:hover, #quick-reply .rchan-fmtbar button:hover { background: #c8102e; color: #fff; border-color: #c8102e; }
.theme_dark #postingForm .rchan-fmtbar button, .theme_dark #quick-reply .rchan-fmtbar button { background: #262a31; color: #c9ccd1; border-color: #333; }
.rchan-charcount { margin-left: auto; font-size: x-small; opacity: .85; }
/* live post preview pane (under the textarea; toggled from the fmtbar) */
#postingForm .rchan-fmtbar button.rchan-pvon, #quick-reply .rchan-fmtbar button.rchan-pvon {
  background: #274a6b; color: #fff; border-color: #274a6b;
}
.rchan-preview {
  display: none; box-sizing: border-box; width: 100%;
  margin: 4px 0; padding: 6px 8px; text-align: left;
  font-size: .833rem; line-height: 1.35;
  background: #EEEEE4; border: 1px dashed #CFCFC4;
  max-height: 40vh; overflow: auto;
  word-break: break-word; overflow-wrap: anywhere;
}
.rchan-preview code { margin: 4px 0; }
.rchan-pv-empty { font-size: x-small; opacity: .7; }
.theme_dark .rchan-preview { background: #16171b; border-color: #2c2f36; }
#postingForm.rchan-dragover { outline: 2px dashed #c8102e; outline-offset: 3px; }
.rchan-filetray { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.rchan-filechip {
  display: flex; align-items: center; gap: 6px; max-width: 240px;
  padding: 3px 6px 3px 3px; font-size: x-small;
  background: #E6E6DA; border: 1px solid #CFCFC4;
}
.theme_dark .rchan-filechip { background: #1f2126; border-color: #2c2f36; }
.rchan-filechip img { width: 34px; height: 34px; object-fit: cover; display: block; }
.rchan-filemeta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.rchan-filebad { border-color: #c8102e; background: #c8102e1a; }
#postingForm .rchan-filex {
  width: auto !important; min-width: 0 !important; height: auto !important;
  margin: 0 !important; padding: 0 2px !important;
  border: 0; background: transparent; cursor: pointer;
  font-size: .833rem !important; line-height: 1; opacity: .6; font-weight: 700;
}
#postingForm .rchan-filex:hover { opacity: 1; color: #c8102e; }

/* ---------- Recently visited threads panel (🕘) + (You) inbox (✉) ---------- */
#rchan-hist, #rchan-youbox, #rchan-reports {
  position: fixed; right: 60px; bottom: 12px; z-index: 10004;
  width: 340px; max-width: 92vw; max-height: 60vh;
  display: none; overflow: auto;
  background: #EEEEE4; border: 1px solid #CFCFC4;
  box-shadow: 4px 4px 0 rgba(0,0,0,.18);
  font-size: .833rem;
}
/* inbox rows: unread gets weight + a green edge; head fits two buttons */
#rchan-youbox .rchan-hist-head { gap: 10px; }
#rchan-youbox .rchan-hist-head span { margin-right: auto; }
.rchan-yb-unread { font-weight: 700; box-shadow: inset 3px 0 0 #2ea043; }
/* unread count bubble on the nav envelope */
#rchan-youboxbtn { position: relative; }
#rchan-youboxbtn > span {
  position: absolute; top: -4px; right: -4px; pointer-events: none;
  min-width: 15px; height: 15px; line-height: 15px; padding: 0 2px;
  border-radius: 8px; background: #c8102e; color: #fff;
  font-size: 10px; font-weight: 700; text-align: center;
}
#rchan-youboxbtn > span:empty { display: none; }
/* staff: open-reports bubble on the global-management nav icon —
   clicking the bubble opens the inline queue (the link stays a link) */
#rchan-repbadge {
  position: absolute; top: -6px; right: -8px; cursor: pointer;
  min-width: 14px; height: 14px; line-height: 14px; padding: 0 2px;
  border-radius: 7px; background: #c8102e; color: #fff;
  font-size: 10px; font-weight: 700; text-align: center;
}
#rchan-repbadge:hover { background: #8f0c21; }
#rchan-repbadge:empty { display: none; }
.rchan-reports-foot {
  display: block; padding: 7px 8px; text-align: center;
  font-size: x-small; font-weight: 700; text-decoration: underline;
}
.rchan-hist-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  background: #DCDCCF; border-bottom: 1px solid #CFCFC4;
  padding: 3px 8px; font-weight: 700;
}
.rchan-hist-clear {
  border: 0; background: none; cursor: pointer; padding: 0 2px;
  font: inherit; font-size: x-small; font-weight: 700; color: #274a6b;
  text-decoration: underline;
}
.rchan-hist-clear:hover { color: #c8102e; }
.rchan-hist-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-bottom: 1px solid #CFCFC466;
}
.rchan-hist-row:hover { background: rgba(200,16,46,.08); }
.rchan-hist-title {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rchan-hist-meta { font-size: x-small; opacity: .85; flex: none; }
.rchan-hist-row .rchan-newbadge { margin-left: 0; flex: none; }
.rchan-hist-x {
  border: 0; background: none; cursor: pointer; padding: 0 2px; flex: none;
  font-size: .833rem; font-weight: 700; line-height: 1; opacity: .5;
}
.rchan-hist-x:hover, .rchan-hist-x:focus-visible { opacity: 1; color: #c8102e; }
.rchan-hist-empty { padding: 10px 8px; font-size: x-small; opacity: .85; text-align: center; }
/* pruned/archived threads: dimmed row + grey "gone" chip */
.rchan-hist-dead { opacity: .5; }
.rchan-deadbadge {
  display: inline-block; margin-left: 0; padding: 0 7px; flex: none;
  background: #8a8a82; color: #fff; font-size: x-small; font-weight: 700; vertical-align: middle;
}
.theme_dark .rchan-deadbadge { background: #4a4e57; }
.theme_dark #rchan-hist, .theme_dark #rchan-youbox, .theme_dark #rchan-reports { background: #16171b; border-color: #2c2f36; }
.theme_dark .rchan-hist-head { background: #262a31; border-color: #2c2f36; }
.theme_dark .rchan-hist-row { border-color: #2c2f3666; }
.theme_dark .rchan-hist-row:hover { background: rgba(224,108,117,.1); }
.theme_dark .rchan-hist-clear { color: #7fb0e0; }

/* ---------- Find-in-thread bar + ID funnels ---------- */
#rchan-find {
  position: fixed; top: 42px; left: 50%; transform: translateX(-50%);
  z-index: 10007; display: none; align-items: center; gap: 8px;
  background: #EEEEE4; border: 1px solid #CFCFC4;
  box-shadow: 4px 4px 0 rgba(0,0,0,.18);
  padding: 6px 8px; max-width: 94vw;
}
#rchan-find input { width: 300px; max-width: 60vw; padding: 3px 6px; font: inherit; }
.rchan-findcount { font-size: x-small; font-weight: 700; opacity: .85; white-space: nowrap; min-width: 54px; text-align: right; }
.rchan-findhide { display: none !important; }
.theme_dark #rchan-find { background: #16171b; border-color: #2c2f36; }
#rchan-findbtn, #rchan-expandbtn, #rchan-galbtn {
  border: 0; background: none; cursor: pointer; padding: 0 6px;
  color: #274a6b; display: inline-flex; align-items: center; align-self: center;
}
#rchan-findbtn:hover, #rchan-expandbtn:hover, #rchan-galbtn:hover { color: #c8102e; }
#rchan-expandbtn.rchan-on2 { color: #c8102e; }   /* expand-all active */
.theme_dark #rchan-findbtn, .theme_dark #rchan-expandbtn, .theme_dark #rchan-galbtn { color: #9fc4e8; }
.theme_dark #rchan-findbtn:hover, .theme_dark #rchan-expandbtn:hover, .theme_dark #rchan-galbtn:hover { color: #d6e8f8; }
.theme_dark #rchan-expandbtn.rchan-on2 { color: #e06c75; }
.rchan-idfunnel {
  border: 0; background: none; cursor: pointer; padding: 0 2px;
  margin-left: 2px; color: inherit; opacity: .45; vertical-align: -1px;
}
.rchan-idfunnel:hover, .rchan-idfunnel:focus-visible { opacity: 1; color: #c8102e; }
.rchan-idfunnel svg { display: inline-block; vertical-align: middle; }
/* ID petnames: local label + the ✎ that sets it */
.rchan-idnamebtn {
  border: 0; background: none; cursor: pointer; padding: 0 2px;
  margin-left: 1px; color: inherit; opacity: .45; vertical-align: -1px;
}
.rchan-idnamebtn:hover, .rchan-idnamebtn:focus-visible { opacity: 1; color: #c8102e; }
.rchan-idnamebtn svg { display: inline-block; vertical-align: middle; width: 11px; height: 11px; }
.rchan-idname {
  margin-left: 4px; padding: 0 5px; vertical-align: middle;
  background: #DCDCCF; color: #393939; border: 1px solid #CFCFC4;
  font-size: x-small; font-weight: 700; font-style: italic;
}
.theme_dark .rchan-idname { background: #262a31; color: #c9ccd1; border-color: #333; }

/* ---------- Staff quick-mod strip (hover-revealed, armed confirm) ---------- */
.rchan-qmod { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.rchan-qmod-btn {
  cursor: pointer; padding: 0 6px; line-height: 1.5;
  font-family: inherit; font-size: x-small; font-weight: 700;
  color: #c8102e; background: transparent; border: 1px solid #c8102e66;
  opacity: 0; transition: opacity .1s ease;
}
/* hover-reveal only on real hover-capable pointers — same ancestor-:hover
   quirk as .rchan-reportbtn above. */
@media (hover: hover) and (pointer: fine) {
  .innerPost:hover .rchan-qmod-btn, .innerOP:hover .rchan-qmod-btn { opacity: 1; }
}
@media (hover: none), (pointer: coarse) {
  .rchan-qmod-btn { opacity: 1; }
}
.rchan-qmod-btn:focus-visible, .rchan-qmod-btn.rchan-armed { opacity: 1; }
.rchan-qmod-btn:hover { background: #c8102e14; }
.rchan-qmod-btn.rchan-armed { background: #c8102e; color: #fff; border-color: #c8102e; }
.theme_dark .rchan-qmod-btn { color: #e06c75; border-color: #e06c7566; }
.theme_dark .rchan-qmod-btn.rchan-armed { background: #8f0c21; color: #fff; }

/* own-post delete strip: same armed-confirm buttons, user-side */
.rchan-owndel { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }

/* ---------- Conversation view (isolate a quote chain) ---------- */
#rchan-conv {
  position: fixed; top: 42px; left: 50%; transform: translateX(-50%);
  z-index: 10007; display: none; align-items: center; gap: 10px;
  background: #EEEEE4; border: 1px solid #CFCFC4;
  box-shadow: 4px 4px 0 rgba(0,0,0,.18);
  padding: 6px 10px; max-width: 94vw;
  font-size: .833rem; font-weight: 700;
}
.theme_dark #rchan-conv { background: #16171b; border-color: #2c2f36; }
.rchan-convhide { display: none !important; }
.rchan-convbtn {
  border: 0; background: none; cursor: pointer; padding: 0 3px;
  margin-left: 4px; color: #274a6b; opacity: .4; vertical-align: -1px;
}
.rchan-convbtn:hover, .rchan-convbtn:focus-visible { opacity: 1; color: #c8102e; }
.rchan-convbtn svg { display: inline-block; vertical-align: middle; }
.theme_dark .rchan-convbtn { color: #9fc4e8; }

/* ---------- Unified settings panel (gear in the nav column) ---------- */
#rchan-set {
  position: fixed; right: 60px; bottom: 12px; z-index: 10006;
  width: 360px; max-width: 92vw; max-height: 70vh;
  display: none; overflow: auto;
  background: #EEEEE4; border: 1px solid #CFCFC4;
  box-shadow: 4px 4px 0 rgba(0,0,0,.18);
  font-size: .833rem;
}
.rchan-set-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  background: #DCDCCF; border-bottom: 1px solid #CFCFC4;
  padding: 3px 8px; font-weight: 700;
}
.rchan-set-x {
  border: 0; background: none; cursor: pointer; padding: 0 3px;
  font-size: .8125rem; font-weight: 700; line-height: 1;
}
.rchan-set-x:hover { color: #c8102e; }
.rchan-set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 8px; border-bottom: 1px solid #CFCFC466; cursor: pointer;
}
.rchan-set-row:hover { background: rgba(200,16,46,.06); }
.rchan-set-row input[type=checkbox] { flex: none; margin: 0; cursor: pointer; }
.rchan-set-text { min-width: 0; }
.rchan-set-title { display: block; font-weight: 700; }
.rchan-set-desc { display: block; font-size: x-small; opacity: .8; }
.rchan-set-foot {
  display: flex; gap: 14px; flex-wrap: wrap;
  padding: 6px 8px; font-size: x-small; font-weight: 700;
}
/* auto-filter manager (inside the settings panel) */
.rchan-set-sub {
  padding: 5px 8px 3px; font-weight: 700;
  border-top: 1px solid #CFCFC4; margin-top: 2px;
}
.rchan-filter-none { padding: 2px 8px 6px; }
.rchan-filter-row {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 8px; border-bottom: 1px solid #CFCFC466;
}
.rchan-filter-type { flex: none; font-size: x-small; font-weight: 700; opacity: .8; min-width: 58px; }
.rchan-filter-pat {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: "Roboto Mono", ui-monospace, monospace; font-size: x-small;
}
.rchan-filter-form {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  padding: 6px 8px;
}
.rchan-filter-form select, .rchan-filter-form input[type=text], .rchan-filter-form button {
  font: inherit; font-size: x-small; padding: 3px 5px;
}
.rchan-filter-form input[type=text] { flex: 1; min-width: 90px; }
.rchan-filter-form button { cursor: pointer; border: 1px solid #CFCFC4; background: #E6E6DA; font-weight: 700; }
.rchan-filter-form button:hover { background: #c8102e; color: #fff; border-color: #c8102e; }
.rchan-filter-relab { display: inline-flex; align-items: center; gap: 3px; font-size: x-small; cursor: pointer; }
.theme_dark .rchan-set-sub { border-color: #2c2f36; }
.theme_dark .rchan-filter-row { border-color: #2c2f3666; }
.theme_dark .rchan-filter-form button { background: #262a31; color: #c9ccd1; border-color: #333; }
/* custom CSS box (inside the settings panel) */
.rchan-css-input {
  display: block; width: calc(100% - 16px); margin: 4px 8px; box-sizing: border-box;
  font-family: "Roboto Mono", ui-monospace, monospace; font-size: x-small;
  border: 1px solid #CFCFC4; background: #fff; color: #393939; padding: 4px 6px;
  resize: vertical;
}
.rchan-css-save {
  cursor: pointer; margin: 0 8px 8px; padding: 3px 12px;
  border: 1px solid #CFCFC4; background: #E6E6DA; color: #393939;
  font: inherit; font-size: x-small; font-weight: 700;
}
.rchan-css-save:hover { background: #c8102e; color: #fff; border-color: #c8102e; }
.theme_dark .rchan-css-input { background: #0f1013; color: #d7dae0; border-color: #2c2f36; }
.theme_dark .rchan-css-save { background: #262a31; color: #c9ccd1; border-color: #333; }
/* one-line stub left where a filtered post was */
.rchan-filterstub {
  margin: 4px 0; font-size: x-small; opacity: .75;
}
.rchan-filterstub a { text-decoration: underline; }
.rchan-set-foot a { text-decoration: underline; }
.theme_dark #rchan-set { background: #16171b; border-color: #2c2f36; }
.theme_dark .rchan-set-head { background: #262a31; border-color: #2c2f36; }
.theme_dark .rchan-set-row { border-color: #2c2f3666; }
.theme_dark .rchan-set-row:hover { background: rgba(224,108,117,.08); }

/* ---------- Command palette (Ctrl+K) ---------- */
#rchan-palette {
  position: fixed; inset: 0; z-index: 10016; display: none;
  align-items: flex-start; justify-content: center;
  background: rgba(0,0,0,.4); padding-top: 12vh;
}
.rchan-pal-box {
  width: 560px; max-width: 92vw; max-height: 70vh;
  display: flex; flex-direction: column;
  background: #EEEEE4; border: 1px solid #CFCFC4;
  box-shadow: 4px 4px 0 rgba(0,0,0,.18);
}
.rchan-pal-box input {
  border: 0; border-bottom: 1px solid #CFCFC4; background: #fff; color: #393939;
  font: inherit; font-size: .9rem; padding: 10px 12px; outline-offset: -2px;
}
.rchan-pal-list { overflow-y: auto; }
.rchan-pal-row {
  display: flex; align-items: baseline; gap: 8px; cursor: pointer;
  padding: 7px 10px; border-bottom: 1px solid #CFCFC466; font-size: .833rem;
}
.rchan-pal-row.rchan-pal-sel { background: #DCDCCF; box-shadow: inset 3px 0 0 #c8102e; }
.rchan-pal-kind {
  flex: none; min-width: 52px; text-align: center;
  font-size: x-small; font-weight: 700; text-transform: uppercase;
  padding: 1px 5px; background: #CFCFC4; color: #393939;
}
.rchan-pal-watched { background: #2ea043; color: #fff; }
.rchan-pal-action { background: #274a6b; color: #fff; }
.rchan-pal-setting { background: #5a5f6b; color: #fff; }
.rchan-pal-search { background: #c8102e; color: #fff; }
.rchan-pal-hit { background: #d29a2b; color: #fff; }
.rchan-pal-title { flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rchan-pal-sub { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .7; font-size: x-small; }
.rchan-pal-none { padding: 12px; text-align: center; opacity: .7; font-size: .833rem; }
.theme_dark .rchan-pal-box { background: #1f2126; border-color: #2c2f36; }
.theme_dark .rchan-pal-box input { background: #16171b; color: #c9ccd1; border-color: #2c2f36; }
.theme_dark .rchan-pal-row { border-color: #2c2f3666; }
.theme_dark .rchan-pal-row.rchan-pal-sel { background: #262a31; }
.theme_dark .rchan-pal-kind { background: #2c2f36; color: #c9ccd1; }
.theme_dark .rchan-pal-watched { background: #2ea043; color: #fff; }
.theme_dark .rchan-pal-action { background: #274a6b; color: #fff; }
.theme_dark .rchan-pal-setting { background: #454a55; color: #c9ccd1; }
@media (max-width: 640px) {
  #rchan-palette { padding-top: 4vh; }
  .rchan-pal-title { max-width: 48%; }
}

/* ---------- Feature guide overlay ---------- */
#rchan-guide {
  position: fixed; inset: 0; z-index: 10008; display: none;
  align-items: center; justify-content: center; background: rgba(0,0,0,.45);
}
.rchan-guide-box { width: 640px; max-width: 94vw; max-height: 82vh; display: flex; flex-direction: column; }
.rchan-guide-list { overflow-y: auto; padding: 4px 0 8px; }
.rchan-guide-h {
  padding: 7px 12px 4px; font-weight: 700; font-size: .9rem;
  border-bottom: 1px solid #CFCFC4; margin-bottom: 2px;
}
.rchan-guide-row { display: flex; gap: 10px; padding: 4px 12px; font-size: .833rem; align-items: baseline; }
.rchan-guide-term { flex: none; width: 132px; font-weight: 700; }
.rchan-guide-desc { flex: 1; min-width: 0; opacity: .9; }
.theme_dark .rchan-guide-h { border-color: #2c2f36; }
.rchan-keys-more { display: block; text-align: center; padding: 8px 0 2px; font-size: x-small; font-weight: 700; text-decoration: underline; }
@media (max-width: 640px) { .rchan-guide-term { width: 96px; }
}

/* ---------- "?" keyboard cheat-sheet overlay ---------- */
#rchan-keys {
  position: fixed; inset: 0; z-index: 10011; display: none;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,.35);
}
.rchan-keys-box {
  width: 340px; max-width: 92vw; max-height: 80vh; overflow: auto;
  background: #EEEEE4; border: 1px solid #CFCFC4;
  box-shadow: 4px 4px 0 rgba(0,0,0,.18); font-size: .833rem;
}
.rchan-keys-list { padding: 4px 0; }
.rchan-keys-row {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 10px;
}
.rchan-keys-row kbd {
  flex: none; min-width: 52px; text-align: center;
  background: #E6E6DA; border: 1px solid #CFCFC4; border-left: none; border-top: none;
  box-shadow: 1px 1px 0 rgba(0,0,0,.1);
  padding: 2px 6px; font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: x-small; font-weight: 700;
}
.theme_dark .rchan-keys-box { background: #16171b; border-color: #2c2f36; }
.theme_dark .rchan-keys-row kbd { background: #262a31; border-color: #2c2f36; color: #c9ccd1; }

/* ---------- Toast (styled alert() replacement) ---------- */
#rchan-toast {
  position: fixed; top: 48px; left: 50%; transform: translateX(-50%);
  z-index: 10010; display: none; cursor: pointer;
  max-width: min(560px, 92vw);
  background: #2e2e2e; color: #fdfdfb; font-size: .833rem; font-weight: 700;
  line-height: 1.35; padding: 8px 14px;
  border: 1px solid rgba(0,0,0,.15); box-shadow: 4px 4px 0 rgba(0,0,0,.18);
}
#rchan-toast.rchan-toast-err { background: #c8102e; color: #fff; }
#rchan-toast .rchan-toast-act { color: inherit !important; text-decoration: underline; font-weight: 700; }
#rchan-toast.rchan-toast-ok { background: #2ea043; color: #fff; }
.theme_dark #rchan-toast.rchan-toast-ok { background: #1f6f32; }
.theme_dark #rchan-toast { background: #0f1013; color: #e6e8ec; border-color: #2c2f36; }
.theme_dark #rchan-toast.rchan-toast-err { background: #8f0c21; }

/* ---------- Own-post flash after a successful reply ---------- */
@keyframes rchan-flashbg { 0% { background: #c8102e33; } 100% { background: transparent; } }
.rchan-flash { animation: rchan-flashbg 2.4s ease-out; }

/* ---------- "Resume reading" pill (per-thread scroll resume) ---------- */
#rchan-resume {
  position: fixed; bottom: 58px; left: 50%; transform: translateX(-50%);
  z-index: 9998; cursor: pointer;
  border: 0; padding: 7px 14px; font: inherit; font-size: .833rem; font-weight: 700;
  background: #274a6b; color: #fff; box-shadow: 2px 2px 0 rgba(0,0,0,.1);
  display: inline-flex; align-items: center; gap: 6px;
  opacity: .92;
}
#rchan-resume svg { display: block; flex: none; }
#rchan-resume:hover { opacity: 1; }

/* ---------- "▼ N new posts" pill ---------- */
#rchan-newpill {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: none; cursor: pointer;
  border: 0; padding: 7px 14px; font: inherit; font-size: .833rem; font-weight: 700;
  background: #2ea043; color: #fff; box-shadow: 2px 2px 0 rgba(0,0,0,.1);
  align-items: center; gap: 6px;   /* svg icon + text (shown as inline-flex) */
}
#rchan-newpill svg { display: block; flex: none; }
#rchan-newpill:hover { filter: brightness(1.08); }

/* ---------- Live-update health: status dot + "missed posts" pill ---------- */
.rchan-wsdot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  vertical-align: baseline; cursor: default;
}
.rchan-wsdot.rchan-ws-live { background: #2ea043; animation: rchan-pulse 2.2s ease-in-out infinite; }
.rchan-wsdot.rchan-ws-down { background: #d29a2b; animation: none; }
#rchan-wspill {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: none; cursor: pointer;
  border: 0; padding: 7px 14px; font: inherit; font-size: .833rem; font-weight: 700;
  background: #d29a2b; color: #fff; box-shadow: 2px 2px 0 rgba(0,0,0,.1);
  align-items: center; gap: 6px;
}
#rchan-wspill svg { display: block; flex: none; }
#rchan-wspill:hover { filter: brightness(1.08); }

/* ---------- Board liveness pill ("N new — refresh" on index/catalog) ---------- */
#rchan-boardpill {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: none; cursor: pointer;
  border: 0; padding: 7px 14px; font: inherit; font-size: .833rem; font-weight: 700;
  background: #2ea043; color: #fff; box-shadow: 2px 2px 0 rgba(0,0,0,.1);
  align-items: center; gap: 6px;
}
#rchan-boardpill svg { display: block; flex: none; }
#rchan-boardpill:hover { filter: brightness(1.08); }

/* ---------- Inline quote expansion ---------- */
.rchan-inline-quote { display: block; margin: 4px 0 4px 14px; }
.rchan-inline-quote .innerPost, .rchan-inline-quote .innerOP {
  display: table; background: #E6E6DA;
  border: 1px solid #CFCFC4; border-left: none; border-top: none;
  box-shadow: 2px 2px 0 rgba(0,0,0,.1); padding: 2px;
}
.theme_dark .rchan-inline-quote .innerPost, .theme_dark .rchan-inline-quote .innerOP {
  background: #1f2126; border-color: #2c2f36;
}
a.rchan-inlined { font-weight: 700; }
a.rchan-inlined::after { content: " ▲"; font-size: x-small; }

/* ---------- Relative timestamps ("(14 minutes ago)" next to the date) ---------- */
.relativeTime { font-size: x-small; opacity: .85; }

/* ---------- Long-thread rendering: skip offscreen posts ---------- */
@supports (content-visibility: auto) {
  #divThreads .postCell { content-visibility: auto; contain-intrinsic-size: auto 140px; }
}

/* ---------- Keyboard focus: visible rings for tab users ----------
   (mouse clicks don't match :focus-visible, so the Yotsuba look is
   untouched for pointer use) */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid #274a6b !important; outline-offset: 2px;
}
.theme_dark a:focus-visible, .theme_dark button:focus-visible, .theme_dark input:focus-visible,
.theme_dark select:focus-visible, .theme_dark textarea:focus-visible,
.theme_dark [tabindex]:focus-visible {
  outline-color: #9fc4e8 !important;
}

/* ---------- Reduced motion / spoilers / code ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}
.theme_dark span.spoiler:hover, .theme_dark span.spoiler:active { color: #c9ccd1 !important; }
span.spoiler:hover, span.spoiler:active { color: #2e2e2e; }
.divMessage code {
  display: block; margin: 6px 0; padding: 6px 8px;
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .833rem; line-height: 1.4; white-space: pre; overflow-x: auto;
  background: #E6E6DA; border: 1px solid #CFCFC4;
}
.theme_dark .divMessage code { background: #0f1013; border-color: #2c2f36; color: #d7dae0; }

/* ---------- Code block syntax highlighting (generic tokenizer, no language tag) ---------- */
.rchan-tok-kw { color: #7b2d8e; font-weight: 700; }
.rchan-tok-str { color: #b5341f; }
.rchan-tok-num { color: #0d5b73; }
.rchan-tok-cmt { color: #6b6b66; font-style: italic; }
.theme_dark .rchan-tok-kw { color: #c586c0; font-weight: 700; }
.theme_dark .rchan-tok-str { color: #ce9178; }
.theme_dark .rchan-tok-num { color: #79c0ff; }
.theme_dark .rchan-tok-cmt { color: #8b929e; font-style: italic; }
html.rchan-warmdark .rchan-tok-kw { color: #CE9BD9; font-weight: 700; }
html.rchan-warmdark .rchan-tok-str { color: #E3A67A; }
html.rchan-warmdark .rchan-tok-num { color: #8FBFDE; }
html.rchan-warmdark .rchan-tok-cmt { color: #9b9b94; font-style: italic; }

/* ---------- Thumbnail skeleton shimmer ---------- */
.rchan-skel {
  background-image: linear-gradient(90deg, #0000000d 25%, #0000001c 37%, #0000000d 63%);
  background-size: 400% 100%; animation: rchan-shimmer 1.4s ease infinite;
}
.theme_dark .rchan-skel { background-image: linear-gradient(90deg, #ffffff08 25%, #ffffff14 37%, #ffffff08 63%); }
@keyframes rchan-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------- Catalog preview as a bottom sheet on phones (tap-to-preview) ---------- */
#rchan-catprev.rchan-catprev-sheet {
  left: 8px !important; right: 8px; top: auto !important; bottom: 8px;
  width: auto; max-height: 45vh;
}

/* ---------- File privacy: chip edit button + rotate/crop editor ---------- */
.selectedCell { position: relative; }
.rchan-chipedit {
  border: 0; background: none; cursor: pointer; padding: 2px 4px;
  color: #274a6b; vertical-align: middle;
}
.rchan-chipedit:hover { color: #c8102e; }
.rchan-chipedit svg { display: inline-block; vertical-align: middle; width: 13px; height: 13px; }
.theme_dark .rchan-chipedit { color: #9fc4e8; }
#rchan-imgedit {
  position: fixed; inset: 0; z-index: 10014; display: none;
  align-items: center; justify-content: center; background: rgba(0,0,0,.55);
}
.rchan-ed-box {
  background: #EEEEE4; border: 1px solid #CFCFC4;
  box-shadow: 4px 4px 0 rgba(0,0,0,.18); max-width: 94vw;
}
.rchan-ed-stage { position: relative; padding: 10px; text-align: center; }
.rchan-ed-stage canvas { display: block; margin: 0 auto; cursor: crosshair; background: #fff; }
.rchan-ed-crop {
  position: absolute; display: none; pointer-events: none;
  border: 2px dashed #c8102e; background: rgba(200,16,46,.12);
}
.rchan-ed-hint { text-align: center; padding: 0 10px 4px; }
.rchan-ed-bar { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding: 6px 10px 10px; }
.rchan-ed-bar button {
  cursor: pointer; padding: 5px 12px; border: 1px solid #CFCFC4;
  background: #E6E6DA; color: #393939; font: inherit; font-size: .833rem; font-weight: 700;
}
.rchan-ed-bar button:hover { background: #c8102e; color: #fff; border-color: #c8102e; }
.rchan-ed-bar .rchan-ed-apply { background: #2ea043; color: #fff; border-color: #2ea043; }
.theme_dark .rchan-ed-box { background: #1f2126; border-color: #2c2f36; }
.theme_dark .rchan-ed-bar button { background: #262a31; color: #c9ccd1; border-color: #333; }
.theme_dark .rchan-ed-stage canvas { background: #0f1013; }

/* ---------- First-visit hint pill + settings "what's new" line ---------- */
#rchan-hint {
  position: fixed; top: 46px; left: 50%; transform: translateX(-50%);
  z-index: 9998; display: inline-flex; align-items: center; gap: 8px;
  max-width: 92vw; padding: 6px 12px;
  background: #E6E6DA; color: #393939; border: 1px solid #CFCFC4;
  box-shadow: 2px 2px 0 rgba(0,0,0,.12);
  font-size: .833rem; font-weight: 700; white-space: nowrap;
}
#rchan-hint .rchan-set-x { flex: none; }
.theme_dark #rchan-hint { background: #262a31; color: #c9ccd1; border-color: #333; }
@media (max-width: 640px) { #rchan-hint { white-space: normal; text-align: center; }
}
.rchan-set-news {
  padding: 5px 8px; font-size: x-small; opacity: .75; font-style: italic;
  border-bottom: 1px solid #CFCFC466;
}
.theme_dark .rchan-set-news { border-color: #2c2f3666; }
/* collapsible settings groups */
.rchan-set-group summary {
  cursor: pointer; padding: 6px 8px; font-weight: 700; font-size: .833rem;
  background: #DCDCCF; border-bottom: 1px solid #CFCFC4;
  list-style: none; display: flex; align-items: center; gap: 6px;
  -webkit-user-select: none; user-select: none;
}
.rchan-set-group summary::before { content: "▸"; font-size: x-small; opacity: .6; }
.rchan-set-group[open] summary::before { content: "▾"; }
.rchan-set-group summary::-webkit-details-marker { display: none; }
.rchan-set-grpcount {
  margin-left: auto; padding: 0 6px; font-size: x-small; font-weight: 700;
  background: #CFCFC4; color: #393939;
}
.theme_dark .rchan-set-group summary { background: #262a31; border-color: #2c2f36; }
.theme_dark .rchan-set-grpcount { background: #2c2f36; color: #c9ccd1; }
.rchan-set-select { font: inherit; font-size: x-small; align-self: center; flex: none; }

/* ---------- Sticky OP bar (thread context while scrolled deep) ---------- */
#rchan-stickyop {
  position: fixed; top: 40px; left: 50%; transform: translateX(-50%);
  z-index: 9997; display: none; align-items: center; gap: 8px;
  max-width: min(560px, 90vw); padding: 3px 10px; cursor: pointer;
  background: #E6E6DA; color: #393939; border: 1px solid #CFCFC4;
  box-shadow: 2px 2px 0 rgba(0,0,0,.12);
  font: inherit; font-size: .833rem; font-weight: 700;
}
#rchan-stickyop img { width: 26px; height: 26px; object-fit: cover; flex: none; }
#rchan-stickyop span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rchan-stickyop:hover { border-color: #c8102e; color: #c8102e; }
.theme_dark #rchan-stickyop { background: #262a31; color: #c9ccd1; border-color: #333; }
/* Mobile: the desktop centered pill (top:40px) collides with the fixed nav
   once it wraps, and the whole bottom zone is taken by #rchan-nav and the
   pills — so show a slim full-width strip pinned to the very top edge instead.
   It still only appears once the OP has scrolled off (JS-toggled), giving
   phone readers the thread's subject + a one-tap route back to the top while
   deep in a long thread — the one spot they lose orientation. z 9998 keeps it
   above the engine nav but below dialogs (10008+), which cover it when open. */
@media (max-width: 640px) {
  #rchan-stickyop {
    top: 0; left: 0; right: 0; transform: none;
    width: 100%; max-width: none; box-sizing: border-box;
    justify-content: flex-start; border-radius: 0;
    border-width: 0 0 1px 0; padding: 5px 12px; z-index: 9998;
  }
  #rchan-stickyop img { width: 22px; height: 22px; }
}

/* ---------- Thread minimap (right edge, desktop, long threads) ---------- */
#rchan-minimap {
  position: fixed; right: 2px; top: 44px; height: 54vh; width: 14px;
  z-index: 9990; opacity: .75; transition: opacity .12s ease;
}
#rchan-minimap:hover { opacity: 1; }
#rchan-minimap canvas { width: 100%; height: 100%; display: block; cursor: pointer; }
@media (max-width: 999px) { #rchan-minimap { display: none !important; }
}

/* ---------- Long-press action sheet (touch) ---------- */
#rchan-sheet {
  position: fixed; inset: 0; z-index: 10012; display: none;
  align-items: flex-end; justify-content: center;
  background: rgba(0,0,0,.45);
}
.rchan-sheet-box {
  width: 100%; max-width: 480px; padding: 6px 8px calc(10px + env(safe-area-inset-bottom));
  background: #EEEEE4; border-top: 1px solid #CFCFC4;
  box-shadow: 0 -4px 16px rgba(0,0,0,.25);
  display: flex; flex-direction: column; gap: 6px;
}
.rchan-sheet-head {
  text-align: center; font-size: .833rem; font-weight: 700; opacity: .7; padding: 4px 0 2px;
}
.rchan-sheet-box button {
  display: block; width: 100%; padding: 12px 10px; cursor: pointer;
  border: 1px solid #CFCFC4; background: #E6E6DA; color: #393939;
  font: inherit; font-size: .9rem; font-weight: 700; text-align: center;
}
.rchan-sheet-box button:active { background: #c8102e; color: #fff; border-color: #c8102e; }
.rchan-sheet-box .rchan-sheet-cancel { background: #DCDCCF; font-weight: 400; }
.theme_dark .rchan-sheet-box { background: #1f2126; border-color: #2c2f36; }
.theme_dark .rchan-sheet-box button { background: #262a31; color: #c9ccd1; border-color: #333; }
.theme_dark .rchan-sheet-box .rchan-sheet-cancel { background: #16171b; }

/* ---------- Pull-to-refresh (touch, board index/catalog) ---------- */
html.rchan-ptr, html.rchan-ptr body { overscroll-behavior-y: contain; }
#rchan-ptrind {
  position: fixed; top: 0; left: 50%; transform: translate(-50%, 0);
  z-index: 9999; pointer-events: none; opacity: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-size: .833rem; font-weight: 700;
  background: #E6E6DA; color: #393939; border: 1px solid #CFCFC4;
  box-shadow: 2px 2px 0 rgba(0,0,0,.1);
  transition: opacity .12s ease;
}
#rchan-ptrind.rchan-ptr-armed { background: #2ea043; color: #fff; border-color: #2ea043; }
#rchan-ptrind svg { display: block; flex: none; }
.theme_dark #rchan-ptrind { background: #262a31; color: #c9ccd1; border-color: #333; }
.theme_dark #rchan-ptrind.rchan-ptr-armed { background: #2ea043; color: #fff; border-color: #2ea043; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  /* 1rem (16px default) inputs: anything smaller makes iOS force-zoom on focus */
  body input, body select, body textarea, #quick-reply textarea, #qrbody { font-size: 1rem; }
  /* message text is unreadable at 10pt arial on a phone; nothing else changes */
  body .divMessage { font-size: .875rem; line-height: 1.45; }
  /* bigger, full-width Quick Reply so it's usable on phones */
  body #quick-reply { left: 2vw !important; right: 2vw !important; width: 96vw !important; max-width: 96vw !important; min-width: 0; height: auto; resize: none; }
  #quick-reply table, #quick-reply #post-form-inner { width: 100% !important; }
  #quick-reply textarea, #qrbody { width: 100% !important; box-sizing: border-box; min-height: 110px; }
  /* the floating new-thread box (board/catalog) gets the same treatment —
     its desktop 425px + right:30px overflows a 390px viewport */
  #rchan-qr { left: 2vw !important; right: 2vw !important; width: 96vw !important; max-width: 96vw !important; min-width: 0; top: 48px; resize: none; }
  body .innerPost, body .markedPost { display: block; }   /* shrink-wrap doesn't fit phones */
  body .divMessage { margin: 8px 10px; }
  .postCell { margin: 8px 4px; }
  /* thumbnails a touch smaller so text has room */
  .imgLink img { max-height: 40vh; width: auto; }
  /* bigger tap targets for the post links */
  .linkQuote, .linkReply, .linkName { padding: 3px 2px; display: inline-block; }
  /* header/nav wraps instead of overflowing */
  #dynamicHeader, nav { flex-wrap: wrap; }
  /* the sticky status line eats a whole nav row on a phone — drop it; its
     twin (#rchan-mstats) renders the same segments in-flow under the OP */
  #rchan-threadstat { display: none; }
  #rchan-mstats { display: flex; }
  #rchan-nav button { width: 44px; height: 44px; line-height: 44px; } /* thumb-friendly */
  /* reply = the primary action: promote the pen to a red FAB */
  #rchan-nav button#rchan-penbtn { background: #c8102e; opacity: 1; }
  /* posting form fields fill the width */
  #postingForm input[type=text], #postingForm textarea { max-width: 100%; box-sizing: border-box; }
  /* file-row controls: 14px mask icons are sub-44px tap targets — grow both
     the icon and the hit area */
  body .nameLink::after, body .hideFileButton::after { width: 20px; height: 20px; vertical-align: -5px; }
  body .nameLink, body .hideFileButton { padding: 6px 4px; display: inline-block; }
  .rchan-ris { white-space: normal; }
  .rchan-ris a { display: inline-block; padding: 4px 3px; }
  /* nav icon buttons (filter / expand-all / gallery) need finger room */
  #rchan-findbtn, #rchan-expandbtn, #rchan-galbtn { padding: 4px 10px; }
  #rchan-findbtn svg, #rchan-expandbtn svg, #rchan-galbtn svg { width: 18px; height: 18px; }
  .rchan-idfunnel { padding: 4px 6px; }
  .rchan-idfunnel svg { width: 14px; height: 14px; }
  /* floating panels: hug the small screen instead of the desktop offsets */
  #rchan-hist, #rchan-set, #rchan-youbox, #rchan-reports { right: 8px; left: 8px; width: auto; max-height: 62vh; }
  #rchan-find { left: 8px; right: 8px; transform: none; max-width: none; top: 46px; }
  #rchan-find input { flex: 1; width: auto; max-width: none; min-width: 0; }
  /* catalog toolbar dropdowns: finger-sized */
  #rchan-cattools select { padding: 7px 10px; margin-left: 3px; }
  #rchan-cattools label { margin: 0 2px; }
  /* form toggle buttons */
  #rchan-formtoggle { padding: 8px 16px; }
  /* fmtbar buttons: taller touch targets */
  #postingForm .rchan-fmtbar button, #quick-reply .rchan-fmtbar button { height: 32px !important; min-width: 34px !important; }
}

/* ---------- Print: archiving a thread should look like a document ----------
   Print-to-PDF is how threads get archived; without this it produced fixed
   navs over content, dark backgrounds and floating chrome. Black on white,
   chrome gone, every post rendered (content-visibility would skip some),
   spoilers revealed — an archive hides nothing. */
@media print {
  nav, #dynamicHeader, #rchan-nav, #rchan-minimap, #rchan-stickyop, #rchan-youbtn,
  #rchan-newpill, #rchan-boardpill, #rchan-wspill, #rchan-resume, #rchan-ptrind,
  #rchan-hint, #rchan-toast, #rchan-mstats, #quick-reply, #rchan-qr, #postingForm,
  #rchan-formtoggle, #rchan-origform, .rchan-fmtbar, #rchan-bannerwrap, #rchan-find,
  #rchan-conv, .rchan-qmod, .rchan-owndel, .rchan-reportbtn, .rchan-convbtn,
  .rchan-idfunnel, .rchan-idnamebtn, .rchan-fhash, .rchan-ris, .rchan-catwatch,
  #rchan-sitestat, #rchan-sitestat-nav, #rchan-cattools, .hideButton, .watchButton,
  .deletionCheckBox, .linkSelf, .extraMenuButton, #sideCatalogDiv, .coloredIcon,
  #rchan-expandbtn, #rchan-findbtn, #rchan-galbtn, footer, video, audio {
    display: none !important;
  }
  html, body {
    background: #fff !important; color: #000 !important;
    font-size: 11pt; margin: 0 !important;
  }
  body .innerPost, body .innerOP, body .markedPost {
    display: block !important;   /* override the flex media-object for print */
    background: #fff !important; color: #000 !important;
    border: 1px solid #bbb !important; box-shadow: none !important;
    page-break-inside: avoid;
  }
  a { color: #000 !important; text-decoration: underline; }
  span.spoiler { color: #000 !important; background: transparent !important; }
  .imgLink img { max-width: 2.6in; height: auto; }
  #divThreads .postCell { content-visibility: visible; contain-intrinsic-size: none; }
}

/* ==========================================================================
   CREAM (DARK)  — neutral dark variant (selectable: "Cream (Dark)")
   It rides on the native "dark" theme, so every dark-styled surface is
   inherited for free; html.rchan-warmdark (a marker on <html>, set by
   ux.js and safe from the native themeLoader's body.className rewrites)
   re-tints the cool grey dark palette to a neutral #1F1F1E ground, keeping
   a faint warm-cream ink + sage-green accent for the Cream identity.

   SHARED TOKEN CONTRACT (see also body.theme_cream, below): both Cream
   themes define the SAME custom-property names — every component (catalog
   cards, the signature editorial moves) is written ONCE against var(--x);
   only the values differ per theme. Don't add a one-off hex value to a
   component when a token already carries that meaning — add/adjust the
   token instead, so both themes move together.
   ========================================================================== */
html.rchan-warmdark {
  --ground: #1F1F1E; --well: #161615; --surface: #2A2A28; --surface-2: #363634;
  --line: #454542; --line-hover: #5A5A56; --ink: #E8E6DF; --ink-soft: #C7C4B8; --ink-faint: #9b9b94;
  --accent: #A6C185; --sage-text: #9CC96F; --wine: #E38A6E;
  --shadow-rest: 0 1px 3px rgba(0,0,0,.3);
  --shadow-hover: 0 6px 16px rgba(0,0,0,.35);
  --card-hover-bg: #363634;   /* = --surface-2: dark gets a visible fill-lift on hover */
}
html.rchan-warmdark body.theme_dark,
html.rchan-warmdark .theme_dark { background: var(--ground) !important; color: var(--ink) !important; }

/* Homepage landing (rchan.xyz / boards.rchan.xyz/): brand the front page with
   the Cream (Dark) ground (#1F1F1E) so its background matches the default theme
   for every dark visitor — the warm ground, not the cool grey #16171b a plain-
   "Dark" pick would otherwise show. Scoped to dark contexts only (html.predark
   or body.theme_dark) via :has(#indexWrapper), so light-theme visitors keep a
   readable light homepage (no dark-on-dark). */
html.predark body:has(#indexWrapper),
body.theme_dark:has(#indexWrapper) { background: #1F1F1E !important; }

/* deepest wells */
html.rchan-warmdark #rchan-tip, html.rchan-warmdark #rchan-toast,
html.rchan-warmdark .divMessage code, html.rchan-warmdark .rchan-css-input,
html.rchan-warmdark .rchan-ed-stage canvas, html.rchan-warmdark #rchan-catprev,
html.rchan-warmdark #watchedMenu, html.rchan-warmdark body #watchedMenu,
html.rchan-warmdark #quick-reply .dropzone, html.rchan-warmdark #rchan-hist,
html.rchan-warmdark #rchan-youbox, html.rchan-warmdark #rchan-reports,
html.rchan-warmdark #rchan-find, html.rchan-warmdark #rchan-conv,
html.rchan-warmdark #rchan-set, html.rchan-warmdark .rchan-keys-box,
html.rchan-warmdark .rchan-preview, html.rchan-warmdark .rchan-sheet-box .rchan-sheet-cancel {
  background: #161615 !important; border-color: var(--line) !important;
}

/* panels: cells, nav, forms, menus, popovers, inputs */
html.rchan-warmdark .innerPost, html.rchan-warmdark .catalogCell,
html.rchan-warmdark .sideCatalogCell, html.rchan-warmdark .markedPost,
html.rchan-warmdark #quick-reply table, html.rchan-warmdark #quick-reply,
html.rchan-warmdark #postingForm, html.rchan-warmdark #postingTable,
html.rchan-warmdark #postingForm td, html.rchan-warmdark .floatingMenu,
html.rchan-warmdark .hideMenu, html.rchan-warmdark .extraMenu,
html.rchan-warmdark #newPostFieldset, html.rchan-warmdark #divLatestPosts .latestPostCell,
html.rchan-warmdark .topBoards a, html.rchan-warmdark nav, html.rchan-warmdark #dynamicHeader,
html.rchan-warmdark #rchan-mstats, html.rchan-warmdark .pageLink, html.rchan-warmdark #divPages a,
html.rchan-warmdark .rchan-active-cell, html.rchan-warmdark .rchan-catprev-post,
html.rchan-warmdark #settingsFieldset, html.rchan-warmdark .rchan-ed-box,
html.rchan-warmdark .rchan-sheet-box, html.rchan-warmdark .rchan-pal-box,
html.rchan-warmdark #rchan-qr, html.rchan-warmdark .modalInnerPanel,
html.rchan-warmdark .quoteTooltip, html.rchan-warmdark .quoteTooltip .innerPost,
html.rchan-warmdark .quoteTooltip .innerOP, html.rchan-warmdark .rchan-filechip,
html.rchan-warmdark input, html.rchan-warmdark textarea, html.rchan-warmdark select {
  background: var(--surface) !important; color: var(--ink) !important; border-color: var(--line) !important;
}
html.rchan-warmdark .innerOP { background: transparent !important; }

/* panel-2: headers, legends, chips, buttons, kbd, summaries */
html.rchan-warmdark #postingForm th, html.rchan-warmdark .modalTableBody th,
html.rchan-warmdark #quick-reply th, html.rchan-warmdark #settingsFieldset legend,
html.rchan-warmdark #settingsFieldset button, html.rchan-warmdark #settingsFieldset input[type=submit],
html.rchan-warmdark .modalHeader, html.rchan-warmdark .modalInnerPanel input[type=button],
html.rchan-warmdark #rchan-formtoggle, html.rchan-warmdark #rchan-qr-header,
html.rchan-warmdark #postingForm .rchan-fmtbar button, html.rchan-warmdark #quick-reply .rchan-fmtbar button,
html.rchan-warmdark .rchan-hist-head, html.rchan-warmdark .rchan-idname,
html.rchan-warmdark .rchan-yours-chip, html.rchan-warmdark .rchan-keys-row kbd,
html.rchan-warmdark #rchan-hint, html.rchan-warmdark #rchan-stickyop,
html.rchan-warmdark .rchan-set-head, html.rchan-warmdark .rchan-set-group summary,
html.rchan-warmdark .rchan-filter-form button, html.rchan-warmdark .rchan-css-save,
html.rchan-warmdark .rchan-ed-bar button, html.rchan-warmdark .rchan-sheet-box button,
html.rchan-warmdark #rchan-ptrind, html.rchan-warmdark #watchedMenu > label {
  background: var(--surface-2) !important; color: var(--ink) !important; border-color: var(--line) !important;
}

/* borders */
html.rchan-warmdark #rchan-banner, html.rchan-warmdark #settingsFieldset form,
html.rchan-warmdark #settingsFieldset hr, html.rchan-warmdark .rchan-set-sub {
  border-color: var(--line) !important;
}
html.rchan-warmdark .rchan-hist-row, html.rchan-warmdark .rchan-set-row,
html.rchan-warmdark .rchan-filter-row, html.rchan-warmdark #watchedMenu .watchedCell,
html.rchan-warmdark .rchan-pal-row, html.rchan-warmdark .rchan-set-news {
  border-color: color-mix(in srgb, var(--line) 40%, transparent) !important;
}

/* text + accents */
html.rchan-warmdark a { color: var(--accent) !important; }
html.rchan-warmdark a:hover { color: #BED49F !important; }
html.rchan-warmdark .greenText { color: var(--sage-text) !important; }
html.rchan-warmdark .redText { color: var(--wine) !important; }
html.rchan-warmdark .labelSubject { color: #E6C88A !important; }
html.rchan-warmdark .linkName, html.rchan-warmdark .labelName { color: #C6BE9A !important; }
html.rchan-warmdark .linkQuote, html.rchan-warmdark .linkSelf { color: var(--ink) !important; }
html.rchan-warmdark .quoteLink, html.rchan-warmdark .panelBacklinks a { color: var(--accent) !important; }
html.rchan-warmdark .rchan-catprev-id { color: var(--ink) !important; }
/* controls that were blue in the cool-dark base → sage green */
html.rchan-warmdark .coloredIcon, html.rchan-warmdark .watchButton, html.rchan-warmdark #favouriteButton,
html.rchan-warmdark #sideCatalogRefreshButton, html.rchan-warmdark #rchan-findbtn,
html.rchan-warmdark #rchan-expandbtn, html.rchan-warmdark #rchan-galbtn, html.rchan-warmdark .rchan-convbtn,
html.rchan-warmdark .rchan-reportbtn, html.rchan-warmdark .rchan-fhash, html.rchan-warmdark .rchan-hist-clear,
html.rchan-warmdark .rchan-chipedit, html.rchan-warmdark #quick-reply td.small { color: var(--accent) !important; }
/* side nav: sage-green blocks with a dark glyph for contrast (was blue #274a6b) */
html.rchan-warmdark #rchan-nav button { background: var(--accent) !important; color: var(--ground) !important; }
html.rchan-warmdark #rchan-nav button.rchan-on { background: #BED49F !important; }

/* body copy: Arial 10pt (titles stay serif; body reads as plain sans). */
html.rchan-warmdark .divMessage {
  font-family: "Liberation Sans", "Arial", "sans-serif";
  font-size: 10pt; line-height: 1.5; color: var(--ink) !important;
}
/* greentext/quotes read as quoted PROSE, not code: EXACTLY the body register,
   differing in COLOUR only. The engine sets a font on .greenText that beat the
   inherited serif — pull family/size/weight/style/tracking back from .divMessage. */
html.rchan-warmdark .divMessage .greenText,
html.rchan-warmdark .divMessage .redText {
  font-family: inherit !important; font-size: inherit !important; font-weight: inherit !important;
  font-style: normal !important; letter-spacing: normal !important; line-height: inherit !important;
}
/* post/thread separators: the base cream hr (#CFCFC4) is far too bright here */
html.rchan-warmdark hr { border-top-color: #3C3C38 !important; }
/* board/catalog title: DISPLAY optical serif (New York Large, Semibold), with the
   embossed-on-dark shadow (dark crisp catch below — sibling of Cream's letterpress). */
html.rchan-warmdark .boardHeader p#labelName, html.rchan-warmdark #catalogId,
html.rchan-warmdark #catalogId .title, html.rchan-warmdark #labelBoard {
  font-family: "New York Large", Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: -.5px;
  color: #EFEDE6 !important; text-shadow: 0 1px 1px rgba(0,0,0,.5);
}
/* thread subjects in Arial (bold), keeping their hue */
html.rchan-warmdark .labelSubject { font-family: "Liberation Sans", "Arial", "sans-serif" !important; font-weight: 700; }
html.rchan-warmdark .boardHeader p#labelDescription, html.rchan-warmdark .rchan-empty-title { color: var(--ink) !important; }

/* ==========================================================================
   SHARED CATALOG CARD SYSTEM — Cream + Cream (Dark)
   Fills over strokes, full-bleed thumbs, hover life. ONE component, written
   once against the token contract (both themes' :root-equivalent blocks
   define the same custom-property names, above) — only token VALUES differ
   per theme, never the rule structure. Light still gets a real --line stroke
   (fills alone don't separate on a light ground); dark's --line is close
   enough to --surface to read as "barely-there" — same declaration, themed
   values doing the work.
   ========================================================================== */

/* 1. Card surface: definition from the fill sitting one step above --ground.
   Hover lifts (both themes); background shift on hover is dark-only —
   --card-hover-bg literally equals --surface on light, a no-op. */
:is(body.theme_cream, html.rchan-warmdark) .catalogCell {
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow-rest);
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
:is(body.theme_cream, html.rchan-warmdark) .catalogCell:hover {
  background: var(--card-hover-bg) !important;
  border-color: var(--line-hover) !important;
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* 2. Full-bleed thumb: edge-to-edge at the card top, radius matches the card's
   top corners, fixed-height band, cover-cropped. The image edge IS the divider —
   no hairline between thumb and body. */
:is(body.theme_cream, html.rchan-warmdark) .catalogCell > a.linkThumb {
  height: 160px; overflow: hidden;
}
:is(body.theme_cream, html.rchan-warmdark).rchan-cat-s .catalogCell > a.linkThumb,
html.rchan-warmdark.rchan-cat-s .catalogCell > a.linkThumb { height: 120px; }

/* 3. Stat line: plain text at the card bottom, no border, a faint --ground
   wash for grounding. Compact "R 1 · I 0 · P 1" format (set in JS —
   decorateCreamDarkCatalog, runs for both themes). color-mix so the wash
   itself needs no extra per-theme alpha token. */
:is(body.theme_cream, html.rchan-warmdark) .catalogCell > p.threadStats {
  border-top: none !important;
  background: color-mix(in srgb, var(--ground) 40%, transparent);
  font-size: 10px !important; color: var(--ink-faint) !important;
  padding: 12px !important; letter-spacing: .04em;
}
:is(body.theme_cream, html.rchan-warmdark) .rchan-nofile-open {
  float: right; color: var(--accent); text-decoration: none; font-weight: 700;
}
:is(body.theme_cream, html.rchan-warmdark) .rchan-nofile-open:hover { text-decoration: underline; }

/* 4. Teaser clamp: clean line-boundary cut instead of scroll-in-place. Cream
   (Dark) only for now — light Cream keeps the scroll-in-place teaser it
   already shipped; not part of this pass's light-parity scope. */
html.rchan-warmdark .catalogCell > .divMessage {
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;
  overflow: hidden; overflow-y: hidden;
}

/* 5. Color diet: ink text, faint metadata, accent interactive — nothing else.
   Subjects go ink (not the legacy gold/blue); the whole card is the hover
   target, so the subject picks up --accent when the CARD is hovered, not
   just itself. */
:is(body.theme_cream, html.rchan-warmdark) .catalogCell .labelSubject { color: var(--ink) !important; font-weight: 600; }
:is(body.theme_cream, html.rchan-warmdark) .catalogCell:hover .labelSubject { color: var(--accent) !important; }
:is(body.theme_cream, html.rchan-warmdark) .catalogCell .greenText { color: var(--ink-faint) !important; }
/* the ★ next to the board/catalog title: never the legacy gold — quiet
   outline (--ink-faint) unfavorited, --accent once favorited (a state cue,
   not decoration). */
:is(body.theme_cream, html.rchan-warmdark) #favouriteButton { color: var(--ink-faint) !important; }
:is(body.theme_cream, html.rchan-warmdark) .checkedFavouriteButton { color: var(--accent) !important; }

/* 6. No-image cells: --surface-2 band where the thumb would be (same fixed
   height), a centered muted glyph instead of raw "Open" text (folded into the
   stat line instead — see .rchan-nofile-open above and decorateCreamDarkCatalog). */
:is(body.theme_cream, html.rchan-warmdark) .catalogCell.rchan-nofile > a.linkThumb {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2) !important;
}
:is(body.theme_cream, html.rchan-warmdark) .rchan-nofile-glyph {
  /* was var(--ink-faint) (#9b9b94) — 4.33:1 against this badge's background,
     just under WCAG AA's 4.5:1 (Lighthouse color-contrast). --ink-soft is
     lighter and clears it with room to spare. */
  color: var(--ink-soft); font-size: 11px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
}

/* ==========================================================================
   SIGNATURE EDITORIAL MOVES — Cream + Cream (Dark), shared, token-driven.
   Restraint rule: these five plus the serif/eyebrow pairing carry the WHOLE
   register. No other ornament gets added beyond what's specified here.
   ========================================================================== */

/* (a) Small-caps eyebrows: metadata reads as quiet marginalia, never
   competes with the serif headline (poster name) or body copy. */
:is(body.theme_cream, html.rchan-warmdark) .labelCreated,
:is(body.theme_cream, html.rchan-warmdark) .relativeTime,
:is(body.theme_cream, html.rchan-warmdark) .spanId,
:is(body.theme_cream, html.rchan-warmdark) .labelId,
:is(body.theme_cream, html.rchan-warmdark) .sizeLabel,
:is(body.theme_cream, html.rchan-warmdark) .dimensionLabel,
:is(body.theme_cream, html.rchan-warmdark) .originalNameLink {
  font-family: "Liberation Sans", "Arial", "sans-serif" !important;
  font-size: 10.5px !important; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-faint) !important;
}

/* (b) Post numbers: plain "No. 72" in the sans metadata register — reverted
   from an earlier serif/superscript "№" footnote treatment (clashed with the
   metadata eyebrow register). .linkSelf ("No.") stays as-is (inherits the
   normal ink/ metadata styling already set elsewhere); the adjacent
   .linkQuote (the clickable number) gets --accent as its link color, normal
   baseline, same size as the rest of the header line — no font-family or
   font-size override at all. */
:is(body.theme_cream, html.rchan-warmdark) .linkSelf + .linkQuote {
  color: var(--accent) !important;
}
/* quote backlinks ("replied to by >>61…"): stay mono-ish, recolor to --accent */
:is(body.theme_cream, html.rchan-warmdark) .quoteLink,
:is(body.theme_cream, html.rchan-warmdark) .panelBacklinks a { color: var(--accent) !important; }

/* (c) Drop rule on OPs: a double hairline under the OP's header block — the
   "chapter opening" cue, replacing a generic border. Reply headers stay
   plain (the rule marks where a THREAD begins, not every post). */
:is(body.theme_cream, html.rchan-warmdark) .innerOP .opHead {
  border-bottom: 3px double var(--line);
  padding-bottom: 6px; margin-bottom: 8px; display: block;
}

/* (d) Marginalia reply count: catalog stat line is already eyebrow-styled
   (font-size/letter-spacing set in the shared card system above); on hover,
   append last-bump relative time (set as a data attribute by
   decorateCatalogLastBump — degrades to an empty, invisible ::after when no
   data was available). */
:is(body.theme_cream, html.rchan-warmdark) .catalogCell > p.threadStats {
  font-family: "Liberation Sans", "Arial", "sans-serif" !important;
  letter-spacing: .08em; text-transform: uppercase;
}
:is(body.theme_cream, html.rchan-warmdark) .catalogCell > p.threadStats[data-lastbump]::after {
  content: " \00b7 " attr(data-lastbump) " \00b7 ";
  opacity: 0; transition: opacity 150ms ease;
}
:is(body.theme_cream, html.rchan-warmdark) .catalogCell:hover > p.threadStats[data-lastbump]::after {
  opacity: 1;
}

/* (e) Ornamented terminators: one glyph (⁂, the printer's asterism for a
   section break), used consistently everywhere a plain "the end" marker
   used to sit — infinite-scroll's fin mark and page dividers (text set in
   27-infinite-scroll.js). Larger + quieter than body text; IS the mark. */
:is(body.theme_cream, html.rchan-warmdark) .rchan-scroll-end {
  font-size: 18px !important; letter-spacing: 0 !important; text-transform: none !important;
  color: var(--ink-faint) !important; font-weight: 400 !important;
}
:is(body.theme_cream, html.rchan-warmdark) .rchan-pagedivider span {
  color: var(--ink-faint) !important; font-size: 15px;
}

/* 7. Floating button bar: one compact pill (not the full-width sticky footer
   the base theme uses), docked bottom-right. 32px square buttons, faint icons,
   sage on hover/active. */
html.rchan-warmdark #rchan-nav {
  left: auto !important; right: 16px !important; bottom: 16px !important;
  width: auto !important; gap: 4px !important; padding: 4px !important;
  background: var(--surface) !important; border: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 6px 16px rgba(0,0,0,.35);
}
html.rchan-warmdark #rchan-nav button {
  width: 32px !important; height: 32px !important;
  background: transparent !important; color: var(--ink-faint) !important;
  border-radius: 4px; box-shadow: none !important;
}
html.rchan-warmdark #rchan-nav button:hover { background: var(--surface-2) !important; color: var(--accent) !important; }
html.rchan-warmdark #rchan-nav button.rchan-on { background: var(--accent) !important; color: var(--ground) !important; }
/* the pill is small + corner-docked now, not a full-width bar — the generic
   60px body clearance is more than it needs, but the catalog grid gets a
   little extra so the pill never sits over the last row's bottom-right card */
html.rchan-warmdark #divThreads:has(.catalogCell) { padding-bottom: 90px !important; }

/* 8. Page header rhythm: title, 12px, create-thread, 8px, original-form,
   24px, controls row, 16px, grid (each gap owned by ONE element's
   margin-bottom, margin-top:0 on the follower avoids collapse ambiguity). */
html.rchan-warmdark #catalogId { margin-bottom: 12px !important; }
html.rchan-warmdark #rchan-formtoggle { margin-top: 0 !important; margin-bottom: 8px !important; }
html.rchan-warmdark #rchan-origform { margin-top: 0 !important; margin-bottom: 24px !important; }
/* #postingForm (collapsed) and #divTools (hidden but still in flow) sit between
   origform and the controls row — zero their margins so origform's
   margin-bottom is the ONLY thing setting that gap. */
html.rchan-warmdark #postingForm, html.rchan-warmdark #divTools { margin: 0 !important; }
html.rchan-warmdark #rchan-cattools { margin-top: 0 !important; margin-bottom: 16px !important; }

/* ---------- Forced colors (Windows High Contrast) ----------
   Nearly every control we ship is an SVG on a transparent background —
   in forced-colors mode most vanished entirely, and the meaning carried
   by state colors (watched-green, live-green, armed-red) was erased.
   Give controls real borders/faces from the system palette, keep the
   few semantic dots opted out so their color survives, and let focus
   fall back to the system Highlight. */
@media (forced-colors: active) {
  #rchan-nav button, #rchan-findbtn, #rchan-expandbtn, #rchan-galbtn,
  .rchan-catwatch, .rchan-fhash, .rchan-reportbtn, .rchan-convbtn,
  .rchan-idfunnel, .rchan-idnamebtn, .rchan-chipedit, .rchan-qmod-btn,
  .rchan-hist-x, .rchan-set-x, .rchan-gal-x, .rchan-gal-prev, .rchan-gal-next {
    opacity: 1 !important;
    border: 1px solid ButtonText !important;
    background: ButtonFace !important;
    color: ButtonText !important;
  }
  .rchan-wsdot, .rchan-sitedot, .rchan-newbadge, .rchan-deadbadge,
  #rchan-youboxbtn > span, #rchan-repbadge {
    forced-color-adjust: none;                   /* these colors ARE the information */
  }
  .rchan-kbcur > .innerPost, .rchan-kbcur > .innerOP, .catalogCell.rchan-kbcur {
    outline: 3px solid Highlight !important;
  }
  .rchan-yb-unread { box-shadow: none; border-left: 4px solid Highlight; }
  .rchan-pal-row.rchan-pal-sel { background: Highlight !important; color: HighlightText !important; box-shadow: none; }
  body.rchan-ws .imgLink img, body.rchan-ws .linkThumb img { filter: blur(12px); } /* WS blur still applies */

}

/* ==========================================================================
   OPTIMISTIC PENDING POST (15-media-hover.js patchReplyCallback)
   Your just-submitted reply, rendered client-side while the confirmed render
   is fetched. Dimmed + gently pulsing = "in flight"; swaps for the real post
   without moving (same position, same size), so the flash-scroll that follows
   lands exactly where the eye already is.
   ========================================================================== */
.rchan-pending { opacity: .62; animation: rchan-pendingpulse 1.6s ease-in-out infinite; }
@keyframes rchan-pendingpulse { 50% { opacity: .82; } }
@media (prefers-reduced-motion: reduce) { .rchan-pending { animation: none; }
}
.rchan-pending-files {
  display: inline-flex; align-items: center; gap: 3px; margin-left: 8px;
  opacity: .7; vertical-align: middle;
}
.rchan-pending-files span { font-size: x-small; }

/* ==========================================================================
   CROSS-DOCUMENT VIEW TRANSITIONS (progressive enhancement, Chromium 126+)
   Same-origin navigations (catalog <-> thread, index -> thread, pagination)
   crossfade instead of flashing white/dark between documents. Browsers
   without support ignore the at-rule entirely; reduced-motion users get an
   instant swap (animation disabled below, matching every other motion rule).
   Kept deliberately fast (140ms) so it reads as "solid", not "animated".
   ========================================================================== */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 140ms; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-image-pair(*),
  ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}