/* Newsdesk: dark, quiet, mono-accented. Tokens follow SPEC §13, with the §19 contrast values. */
:root,
[data-theme="dark"] {
  --bg: #09090b;
  --surface: #111113;
  --surface-2: #18181b;
  --border: rgba(63, 63, 70, 0.53);
  --border-strong: #27272a;
  --text: #fafafa;
  --muted: #a1a1aa;
  --faint: #8a8a93; /* §19.8: ≥ 4.5:1 on the page and on raised rows */
  --accent: #f845fa;
  --primary-bg: #fafafa;
  --primary-fg: #09090b;
  --backdrop: rgba(0, 0, 0, 0.6);
  --sk: #111113;
  --icon-bg: #27272a;
  --icon-border: #3f3f46;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #fafafa;
  --surface: #f4f4f5;
  --surface-2: #e4e4e7;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #09090b;
  --muted: #52525b;
  --faint: #5f5f68; /* §19.8 */
  --accent: #c026d3; /* §19.8: the light theme's accent */
  --primary-bg: #09090b;
  --primary-fg: #fafafa;
  --backdrop: rgba(9, 9, 11, 0.35);
  --sk: #f0f0f2;
  --icon-bg: #ffffff;
  --icon-border: #e4e4e7;
  color-scheme: light;
}

:root {
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --pixel: "Geist Pixel", "Silkscreen", var(--mono);
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --r: 4px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t: 150ms;
  --header: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/24px var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
.btn:disabled { color: var(--faint); border-color: var(--border); }
a { color: inherit; text-decoration: none; }
img { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.grow { flex: 1 1 auto; min-width: 0; }
.rel { position: relative; }
.mono { font-family: var(--mono); }
.small { font-size: 12px; line-height: 18px; }
.muted { color: var(--muted); }
.pad { padding: 12px; margin: 0; }
.pad-x { padding: 0 4px; margin: 4px 0 8px; }
.pixel { font-family: var(--pixel); font-weight: 400; letter-spacing: 0.02em; }
.ico { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; flex: none; }

#app { display: flex; flex-direction: column; height: 100dvh; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r);
  font: 500 12px/1 var(--mono); color: var(--text); background: transparent; white-space: nowrap;
  transition: background var(--t) var(--ease), color var(--t) var(--ease), border-color var(--t) var(--ease);
}
.btn:hover:not(:disabled) { background: var(--surface); }
.btn.primary { background: var(--primary-bg); color: var(--primary-fg); border-color: var(--primary-bg); }
.btn.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #09090b; }
[data-theme="light"] .btn.primary:hover:not(:disabled) { color: #ffffff; } /* §19.11: 5:1 on the light accent */
.btn.wide { width: 100%; }
.btn:active:not(:disabled), .icon-btn:active:not(:disabled), .seg-btn:active { transform: translateY(1px); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none;
  border: 1px solid transparent; border-radius: var(--r); color: var(--muted);
  transition: color var(--t) var(--ease), border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.link-btn { font: 500 12px/18px var(--mono); color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { text-decoration-thickness: 2px; }
.input {
  width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--bg); font: 13px/1 var(--mono); color: var(--text);
}
.input::placeholder { color: var(--faint); }
.input.big { height: 40px; font-size: 14px; }
.input:focus { outline: none; border-color: var(--accent); }
.select {
  height: 32px; padding: 0 26px 0 8px; border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M1 1l4 4 4-4' fill='none' stroke='%2371717a' stroke-width='1.5'/></svg>") no-repeat right 8px center;
  appearance: none; font: 12px/1 var(--mono); color: var(--text); max-width: 130px;
}
.seg { display: inline-flex; height: 32px; padding: 2px; gap: 2px; border: 1px solid var(--border-strong); border-radius: var(--r); flex: none; }
.seg-btn { padding: 0 9px; border-radius: 2px; font: 500 12px/1 var(--mono); color: var(--faint); transition: color var(--t) var(--ease), background var(--t) var(--ease); }
.seg-btn:hover { color: var(--text); }
.seg-btn.is-on { background: var(--surface-2); color: var(--text); }
.sort-label { font: 500 12px/32px var(--mono); color: var(--faint); padding: 0 6px; cursor: default; }
.badge { font: 500 11px/18px var(--mono); color: var(--muted); border: 1px solid var(--border-strong); border-radius: var(--r); padding: 0 6px; flex: none; }
.switch { width: 34px; height: 20px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-strong); position: relative; flex: none; transition: background var(--t) var(--ease); }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--faint); transition: transform var(--t) var(--ease), background var(--t) var(--ease); }
.switch[aria-checked="true"] { background: var(--primary-bg); border-color: var(--primary-bg); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(14px); background: var(--primary-fg); }

/* ---------- source icon: favicon on a 20 px bordered tile (lighter than the page in dark mode).
   §19.1: the only place a source's own colour appears. ---------- */
.src-icon {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 20px; height: 20px; border: 1px solid var(--icon-border); border-radius: var(--r);
  background: var(--icon-bg); overflow: hidden;
}
.src-letter {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--c); color: var(--ink); font: 600 11px/1 var(--mono);
}
.src-icon img { position: relative; width: 14px; height: 14px; object-fit: contain; opacity: 0; }
.src-icon.has-img .src-letter { display: none; }
.src-icon.has-img img { opacity: 1; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 30; flex: none; height: var(--header);
  display: flex; align-items: center; gap: 20px; padding: 0 16px;
  border-bottom: 1px solid var(--border); background: var(--bg);
}
.brand { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.logo-mark { display: inline-flex; }
.brand-name { font-size: 16px; line-height: 1; }
.nav { display: flex; gap: 4px; }
.nav-btn { height: 32px; padding: 0 10px; border-radius: var(--r); font: 500 12px/1 var(--mono); color: var(--muted); transition: color var(--t) var(--ease), background var(--t) var(--ease); }
.nav-btn:hover { color: var(--text); background: var(--surface); }
.nav-btn[aria-expanded="true"] { color: var(--text); }
.kbd-hint { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 6px; border: 1px solid var(--border-strong); border-radius: var(--r); font: 12px/1 var(--mono); color: var(--faint); }
.kbd-hint:hover { color: var(--text); }
.kbd-hint kbd { font: 500 11px/1 var(--mono); padding: 4px 5px; border-radius: 3px; background: var(--surface-2); color: var(--muted); }

/* ---------- layout picker ---------- */
.layout-bar {
  flex: none; display: flex; gap: 4px; padding: 6px 16px; border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.layout-bar::-webkit-scrollbar { display: none; }
.layout-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: var(--r); flex: none;
  font: 500 12px/1 var(--mono); color: var(--faint); transition: color var(--t) var(--ease), background var(--t) var(--ease);
}
.layout-btn:hover { color: var(--text); background: var(--surface); }
.layout-btn.is-on { color: var(--text); background: var(--surface); box-shadow: inset 0 -2px 0 var(--accent); }
.layout-key { font-size: 11px; color: var(--faint); }
.diagram rect { fill: currentColor; opacity: 0.45; }
.diagram rect.dim { opacity: 0.22; }
.diagram rect.dash { fill: none; stroke: currentColor; stroke-dasharray: 2 1.5; opacity: 0.45; }
.layout-btn.is-on .diagram rect { opacity: 0.85; }
.layout-btn.is-on .diagram rect.dim { opacity: 0.4; }

/* ---------- main + columns ---------- */
.main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.main.boot { align-items: center; justify-content: center; }
.columns { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 16px; padding: 16px; overflow: auto; }
.col-row { flex: 1 1 0; min-height: 0; display: flex; gap: 16px; }
.col { display: flex; flex-direction: column; min-height: 0; min-width: 0; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); overflow: hidden; container-type: inline-size; }
.col-narrow { flex: 0 1 420px; min-width: 260px; }
.col-wide { flex: 1 1 480px; min-width: 400px; }
.col-deck { flex: 1 0 400px; max-width: 560px; }
.layout-cockpit .col-row { min-height: 300px; }
.deck-bar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px 0; }

.col-head { flex: none; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 8px 0 6px; border-bottom: 1px solid var(--border); }
.col-title-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.col-title { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; height: 34px; padding: 0 6px; border-radius: var(--r); transition: background var(--t) var(--ease); }
.col-title:hover { background: var(--surface); }
.col-icons { display: inline-flex; gap: 2px; }
.col-name { font: 600 14px/20px var(--sans); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-title .ico { color: var(--faint); }
.col-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.col-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.col-foot { padding: 0 0 8px; }
.foot-text { margin: 0; padding: 20px 12px; text-align: center; font: 12px/18px var(--mono); color: var(--faint); }
.foot-error { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 32px 16px; text-align: center; font: 13px/20px var(--mono); color: var(--muted); }
.foot-error p { margin: 0; }

/* narrow columns: the title gets its own line, controls go below it */
@container (max-width: 360px) {
  .col-head { flex-wrap: wrap; height: auto; padding: 6px 6px 8px; row-gap: 4px; }
  .col-title-wrap { flex: 1 1 100%; }
  .col-tools { flex: 1 1 100%; justify-content: flex-start; padding-left: 4px; }
  .col-tools .icon-btn { margin-left: auto; }
}

/* rows */
.row {
  position: relative; display: grid; grid-template-columns: 28px 1fr 32px; gap: 12px; align-items: start;
  padding: 14px 8px 14px 12px; border-bottom: 1px solid var(--border); transition: background var(--t) var(--ease);
}
.row:hover { background: var(--surface); }
.row.is-tight { padding-top: 8px; padding-bottom: 8px; }
.row.is-active { background: var(--surface); box-shadow: inset 2px 0 0 var(--accent); }
.layout-reader .row { cursor: pointer; }
/* §19.1: the row number is plain faint mono text ("01"); multi-source rows show the source icon */
.row-mark {
  display: inline-flex; align-items: flex-start; justify-content: flex-start; width: 28px; min-height: 22px; padding-top: 1px;
  color: var(--faint); font: 500 12px/22px var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0;
}
.row-mark.is-icon { padding-top: 1px; }
.row-body { min-width: 0; }
.row-title {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  font: 500 15px/22px var(--sans); color: var(--text); overflow-wrap: anywhere;
}
.row-title:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); }
.row-summary { margin: 4px 0 0; font-size: 14px; line-height: 21px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.row-details { margin: 6px 0 0; font: 12px/18px var(--mono); color: var(--faint); overflow-wrap: anywhere; }
.row-details a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.save-btn { width: 32px; height: 28px; display: inline-flex; align-items: center; justify-content: center; color: var(--faint); border-radius: var(--r); opacity: 0; transition: opacity var(--t) var(--ease), color var(--t) var(--ease); }
.row:hover .save-btn, .row:focus-within .save-btn, .save-btn.is-saved { opacity: 1; }
.save-btn:hover { color: var(--text); }
.save-btn.is-saved { color: var(--text); }
@media (hover: none) { .save-btn { opacity: 1; } }

/* image grid */
.masonry { display: flex; gap: 16px; padding: 16px; align-items: flex-start; }
.masonry-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.tile { display: block; color: var(--text); }
.tile-img { aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface); }
.tile-img img { width: 100%; height: 100%; object-fit: cover; transition: opacity var(--t) var(--ease); }
.tile:hover .tile-img img { opacity: 0.88; }
/* §19.1: no source colour here; the block is a neutral surface with the source icon */
.tile-fallback { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; padding: 14px; background: var(--surface-2); }
.tile-fallback span:last-child { font: 500 15px/21px var(--sans); color: var(--text); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
/* §19.4: one caption line, 13/20 mono, a 16 px external-link icon */
.tile-cap { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; font: 500 13px/20px var(--mono); }
.tile-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-arrow { color: var(--faint); transition: color var(--t) var(--ease); flex: none; width: 16px; height: 16px; }
.tile:hover .tile-arrow { color: var(--text); }
.tile-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; font: 11px/16px var(--mono); color: var(--faint); }
.tile-counts { margin-left: auto; }

/* skeletons */
.skeletons { display: flex; flex-direction: column; }
.is-grid .skeletons { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; padding: 16px; }
.sk { background: var(--sk); border-radius: var(--r); }
.sk-row { display: flex; gap: 12px; padding: 14px 12px; border-bottom: 1px solid var(--border); }
.sk-sq { width: 28px; height: 28px; flex: none; }
.sk-line { height: 12px; margin: 6px 0; }
.sk-img { aspect-ratio: 4 / 3; border-radius: 0; }
.h-title { height: 28px; margin: 10px 0; }
.w100 { width: 100%; } .w90 { width: 90%; } .w70 { width: 70%; } .w60 { width: 60%; } .w50 { width: 50%; } .w40 { width: 40%; }

/* ---------- popovers ---------- */
.popover {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; min-width: 260px; max-width: min(340px, calc(100vw - 32px));
  padding: 8px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r);
}
.popover-right { left: auto; right: 0; }
.picker { display: flex; flex-direction: column; gap: 8px; }
.picker-list { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; }
.picker-head { margin: 8px 6px 4px; font: 500 11px/16px var(--mono); color: var(--faint); }
.picker-item { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px; border-radius: var(--r); font-size: 13px; text-align: left; }
.picker-item:hover, .picker-item:focus-visible { background: var(--surface-2); }
.picker-item.is-on .ico { color: var(--text); }
.settings { display: flex; flex-direction: column; gap: 4px; min-width: 280px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 6px; font-size: 13px; line-height: 20px; cursor: pointer; }
.set-row.col { flex-direction: column; align-items: flex-start; cursor: default; }
.aa-panel { display: flex; flex-direction: column; gap: 6px; min-width: 240px; }
.opt-label { margin: 6px 2px 0; font: 500 11px/16px var(--mono); color: var(--faint); }
.size-row { display: flex; align-items: center; gap: 8px; }
.size-out { font: 12px/1 var(--mono); color: var(--muted); min-width: 40px; text-align: center; }

/* ---------- Reader layout ---------- */
.reader-grid { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 240px 420px minmax(0, 1fr); }
.reader-grid.is-inspiration { grid-template-columns: 240px minmax(0, 1fr); }
.reader-grid.is-inspiration .article { display: none; }
.reader-grid .col { border: 0; border-right: 1px solid var(--border); border-radius: 0; min-width: 0; }
.is-collapsed .reader-grid { grid-template-columns: minmax(0, 1fr); }
.is-collapsed .reader-grid .col { border-right: 0; }

.sidebar { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); }
.side-top { padding: 12px; border-bottom: 1px solid var(--border); }
.side-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-bottom: 8px; }
.side-head { margin: 0; padding: 14px 14px 8px; font-size: 11px; line-height: 16px; color: var(--faint); }
.side-list { list-style: none; margin: 0; padding: 0 6px; }
.side-item { position: relative; display: flex; align-items: center; height: 34px; border-radius: var(--r); transition: background var(--t) var(--ease); }
.side-item:hover { background: var(--surface); }
.side-item.is-active { background: var(--surface); box-shadow: inset 2px 0 0 var(--accent); }
.side-item.is-over { box-shadow: inset 0 2px 0 var(--text); }
.side-item.is-dragging { opacity: 0.4; }
.grip { width: 14px; display: inline-flex; justify-content: center; color: var(--faint); opacity: 0; cursor: grab; flex: none; }
.side-item:hover .grip { opacity: 1; }
.side-item[draggable="false"] .grip { visibility: hidden; }
.side-pick { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 4px; text-align: left; font-size: 13px; line-height: 18px; }
.side-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.side-item.is-active .side-title { font-weight: 600; }
.side-remove { width: 28px; height: 28px; opacity: 0; }
.side-item:hover .side-remove, .side-remove:focus-visible { opacity: 1; }
.side-foot { padding: 12px; border-top: 1px solid var(--border); }

/* article */
.article { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.art-bar { flex: none; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 12px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.art-bar::-webkit-scrollbar { display: none; }
.art-bar.is-disabled > :not(.seg):not(.back-btn) { opacity: 0.5; pointer-events: none; }
.art-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; background: var(--rbg); color: var(--rtext); }
.article { --rbg: var(--bg); --rtext: var(--text); --rmuted: var(--muted); --rline: var(--border); }
.article[data-reader-theme="dark"] { --rbg: #09090b; --rtext: #e4e4e7; --rmuted: #a1a1aa; --rline: #27272a; }
.article[data-reader-theme="light"] { --rbg: #fcfcfc; --rtext: #18181b; --rmuted: #52525b; --rline: #e4e4e7; }
.article[data-reader-theme="sepia"] { --rbg: #f3ead7; --rtext: #3b2f1e; --rmuted: #6b5a40; --rline: #e0d3b6; }
.art-empty { height: 100%; min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center; font: 13px/20px var(--mono); color: var(--rmuted); }
.art-empty p { margin: 0; }
.art-frame { width: 100%; height: 100%; border: 0; background: #fff; display: block; }
.story { max-width: 680px; margin: 0 auto; padding: 48px 28px 96px; }
.story-title { margin: 0 0 16px; font: 500 36px/1.15 var(--serif); letter-spacing: -0.01em; text-wrap: balance; color: var(--rtext); }
.article[data-face="sans"] .story-title { font-family: var(--sans); font-weight: 600; letter-spacing: -0.02em; }
.story-meta { display: flex; align-items: center; gap: 8px; margin: 0; font: 12px/18px var(--mono); color: var(--rmuted); }
.story-icon { width: 16px; height: 16px; border-radius: 3px; object-fit: contain; }
.story-date { margin: 4px 0 32px; font: 12px/18px var(--mono); color: var(--rmuted); }
.story-body { font: 400 var(--rsize, 19px) / 1.7 var(--serif); color: var(--rtext); overflow-wrap: break-word; }
.article[data-face="sans"] .story-body { font-family: var(--sans); line-height: 1.6; }
.story-body p { margin: 0 0 1.1em; }
.story-body h1, .story-body h2, .story-body h3, .story-body h4 { font-family: var(--sans); font-weight: 600; line-height: 1.3; margin: 1.6em 0 0.6em; }
.story-body h2 { font-size: 1.25em; } .story-body h3 { font-size: 1.1em; }
.story-body a { color: inherit; text-decoration: underline; text-decoration-color: var(--rmuted); text-underline-offset: 3px; }
.story-body img { max-width: 100%; height: auto; margin: 1.2em auto; }
.story-body figure { margin: 1.5em 0; }
.story-body figcaption { font: 12px/18px var(--mono); color: var(--rmuted); }
.story-body blockquote { margin: 1.2em 0; padding-left: 1em; border-left: 2px solid var(--rline); color: var(--rmuted); }
.story-body pre { overflow-x: auto; padding: 12px; border: 1px solid var(--rline); border-radius: var(--r); font: 13px/1.5 var(--mono); }
.story-body code { font-family: var(--mono); font-size: 0.85em; }
.story-body table { display: block; overflow-x: auto; border-collapse: collapse; font-size: 0.85em; }
.story-body td, .story-body th { border: 1px solid var(--rline); padding: 4px 8px; }
.story-body ul, .story-body ol { padding-left: 1.3em; }
.story-skeleton .sk { background: color-mix(in srgb, var(--rtext) 8%, transparent); }
.article-full { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; }
.article-full .article { flex: 1 1 auto; }
body.no-scroll { overflow: hidden; }

/* ---------- modals ---------- */
.backdrop { position: fixed; inset: 0; z-index: 60; background: var(--backdrop); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; }
.modal { width: 100%; max-width: 560px; max-height: 84vh; overflow-y: auto; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--r); padding: 20px; }
.modal-wide { max-width: 980px; }
.modal-side { position: fixed; top: 0; right: 0; bottom: 0; max-width: 440px; max-height: none; border-width: 0 0 0 1px; border-radius: 0; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 18px; line-height: 24px; }
.catalog { display: flex; flex-direction: column; gap: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 30px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--r); font: 500 12px/1 var(--mono); color: var(--muted); transition: color var(--t) var(--ease), background var(--t) var(--ease); }
.chip:hover { color: var(--text); }
.chip.is-on { background: var(--primary-bg); color: var(--primary-fg); border-color: var(--primary-bg); }
.child-row { display: flex; flex-direction: column; gap: 8px; }
.child-row:empty { display: none; }
.child-label { margin: 0; font: 500 12px/16px var(--mono); color: var(--faint); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row-between p { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); transition: background var(--t) var(--ease); }
.card:hover { background: var(--surface); }
.card-top { display: flex; align-items: flex-start; gap: 12px; }
.card-title { margin: 0; font: 600 14px/20px var(--sans); }
.card-domain { margin: 0; font: 12px/18px var(--mono); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-reason { margin: 0; font: 12px/18px var(--mono); color: var(--muted); }
.card-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: auto; }
.card.is-off .card-title { color: var(--muted); }
.card-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.badge-inactive { color: var(--faint); border-style: dashed; }
.card-last-post { margin: 0; font: 12px/18px var(--mono); color: var(--muted); }
.card.is-inactive .card-title { color: var(--muted); }
.empty-text { margin: 0; padding: 24px 4px; font: 13px/20px var(--mono); color: var(--muted); }
.preview-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.preview-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.preview-item img { width: 72px; height: 54px; object-fit: cover; flex: none; background: var(--surface); }
.preview-item a { font-weight: 500; font-size: 14px; line-height: 20px; }
.preview-item a:hover { text-decoration: underline; }
.preview-item p { margin: 2px 0 0; }
.saved-list { display: flex; flex-direction: column; }
.saved-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.saved-item .src-icon { margin-top: 3px; }
.saved-read { height: 28px; padding: 0 10px; flex: none; }
.saved-title { font: 500 14px/20px var(--sans); }
.saved-title:hover { text-decoration: underline; }
.saved-item p { margin: 2px 0 0; }
.switcher { display: flex; flex-direction: column; gap: 10px; }
.switch-list { display: flex; flex-direction: column; max-height: 52vh; overflow-y: auto; }
/* §19.5: rows keep 38 px; the kind is plain faint text */
.switch-item { display: flex; flex: none; align-items: center; gap: 10px; height: 38px; min-height: 38px; padding: 0 10px; border-radius: var(--r); text-align: left; font-size: 14px; }
.switch-item .grow { color: var(--text); }
.switch-kind { font: 12px/1 var(--mono); color: var(--faint); flex: none; }
.switch-item.is-on, .switch-item:hover { background: var(--surface); }
.boot-error { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 16px; font: 13px/20px var(--mono); color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 899px) {
  .top { gap: 6px; padding: 0 10px; }
  .nav { gap: 0; }
  .nav-btn { padding: 0 6px; white-space: nowrap; }
  .kbd-hint span { display: none; }
  .layout-bar { padding: 6px 12px; }
  .columns { padding: 0; gap: 0; }
  .col-row { gap: 0; }
  .col, .col-wide, .col-narrow, .col-deck { flex: 1 1 auto; min-width: 0; max-width: none; border: 0; border-radius: 0; }
  .deck-bar { padding: 8px 12px; border-bottom: 1px solid var(--border); }
  .layout-name { display: inline; }
  .story { padding: 28px 16px 72px; }
  .story-title { font-size: 28px; }
  .hide-sm { display: none; }
  .art-bar { padding: 0 8px; gap: 6px; }
  .masonry { padding: 12px; gap: 12px; }
  .masonry-col { gap: 16px; }
  .modal { padding: 16px; max-height: 88vh; }
  .backdrop { padding: 16px 12px; }
}
@media (max-width: 520px) {
  .kbd-hint { display: none; }
  /* §19.6: logo only; 40 px tall nav buttons with 12 px text; dialogs fill the screen */
  .top .brand-name { display: none; }
  .top .nav-btn { height: 40px; padding: 0 10px; font-size: 12px; }
  .backdrop { padding: 0; }
  .modal, .modal-wide, .modal-side { position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; border: 0; border-radius: 0; }
  .back-btn .back-text { display: none; }
  .back-btn { padding: 0 8px; }
  .art-bar .btn.ghost { padding: 0 8px; }
  .layout-key { display: none; }
  .col-head { padding: 0 4px; gap: 4px; }
  .col-tools { gap: 4px; }
  .select { max-width: 104px; }
  .modal-side { max-width: none; border: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

/* §19.13 / §19.10: hidden heading, skip link, list focus */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -48px; z-index: 100; padding: 8px 12px; border-radius: var(--r); background: var(--primary-bg); color: var(--primary-fg); font: 500 13px/1 var(--mono); }
.skip-link:focus { top: 8px; }
.row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.side-pick:focus-visible { outline-offset: -2px; }
.unavailable-toggle { margin-top: 4px; }

/* §20 search mode in a column header */
.col-head.is-search { height: auto; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px; }
.col-search-row { display: flex; align-items: center; gap: 6px; }
.col-search-row > .ico { color: var(--faint); margin-left: 4px; }
.col-search-input { flex: 1 1 auto; min-width: 0; }
.col-search-opts { display: flex; gap: 6px; flex-wrap: wrap; }
.col-search-opts .select { max-width: none; flex: 1 1 140px; }

/* §20.7 share menu */
.share-menu { display: flex; flex-direction: column; min-width: 220px; }
.menu-item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 8px; border-radius: var(--r); font-size: 13px; color: var(--text); text-align: left; text-decoration: none; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); }
.menu-item .ico { color: var(--faint); }
.saved-item .rel { flex: none; }
.saved-item .share-btn { height: 28px; padding: 0 8px; }
@media (max-width: 520px) { .art-bar .copy-btn { display: none; } }

/* §21.5 keyboard highlight in the Reader story list (separate from the open story) */
.row.is-highlight:not(.is-active) { background: var(--surface); }
