/* The Q Drops: static archive viewer. System fonts only; no external requests. */

:root {
  --bg: #050814;
  --bg-soft: #0a0f20;
  --bg-softer: #111725;
  --surface: #0b1122;
  --line: #1c2438;
  --line-strong: #2b3652;
  --ink: #e8ebf2;
  --ink-2: #b0b8c9;
  --ink-3: #7d879c;
  --accent: #ff6a3d;
  --accent-ink: #050814;
  --accent-soft: rgba(255, 106, 61, 0.14);
  --chart: #ee5c2c;              /* validated: dark band, >=3:1 on --bg */
  --link: #7fe0ff;
  --green: #a9d86d;
  --mark: rgba(255, 196, 61, 0.32);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 10px;
  --gutter: 24px;
  --bar-h: 64px;                 /* sticky search bar height, for scroll offsets */
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7f5f0;
  --bg-soft: #efece4;
  --bg-softer: #e5e1d6;
  --surface: #fffdf8;
  --line: #dcd6c9;
  --line-strong: #c6bfaf;
  --ink: #16181d;
  --ink-2: #3d424d;
  --ink-3: #5f6573;
  --accent: #c4421a;
  --accent-ink: #ffffff;
  --accent-soft: rgba(196, 66, 26, 0.11);
  --chart: #c4421a;              /* validated: light band, >=3:1 on --bg */
  --link: #0a6585;
  --green: #4a7417;
  --mark: rgba(255, 190, 40, 0.45);
  --shadow: 0 10px 30px rgba(40, 30, 10, 0.18);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  overflow-x: hidden;
}
a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }
button, input, select { font: inherit; color: inherit; }
img { max-width: 100%; }
svg { width: 18px; height: 18px; flex: none; }
h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
code, kbd { font-family: var(--mono); font-size: 0.88em; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px; text-align: center;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px;
  background: var(--bg-soft); color: var(--ink-2);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 6px; }
.skip:focus { top: 8px; }
.muted { color: var(--ink-3); font-weight: 400; }
.small { font-size: 13px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--bg-soft); color: var(--ink);
  font-size: 14px; line-height: 1; text-decoration: none; white-space: nowrap;
  cursor: pointer;
}
.btn:hover { background: var(--bg-softer); text-decoration: none; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--bg-softer); color: var(--ink); }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.icon-only { width: 34px; padding: 0; }
.btn[aria-disabled="true"] { opacity: 0.35; pointer-events: none; }
.toggle {
  height: 34px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: transparent; color: var(--ink-2); font-size: 13px; cursor: pointer; white-space: nowrap;
}
.toggle.small { height: 26px; padding: 0 9px; font-size: 12px; }
.toggle:hover { color: var(--ink); background: var(--bg-soft); }
.toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700;
}

/* ---------- masthead ---------- */
.masthead { border-bottom: 1px solid var(--line); background: var(--bg); }
.masthead-inner {
  max-width: 1280px; margin: 0 auto; padding: 14px var(--gutter);
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.mark { width: 40px; height: 40px; }
:root[data-theme="dark"] .mark-light, :root[data-theme="light"] .mark-dark { display: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.kicker { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.span-line { margin: 0; color: var(--ink-3); font-size: 13px; font-family: var(--mono); }
.top-actions { margin-left: auto; display: flex; gap: 2px; }
:root[data-theme="dark"] .i-moon, :root[data-theme="light"] .i-sun { display: none; }

/* ---------- search bar (sticky) ---------- */
.searchbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 10px max(var(--gutter), calc((100% - 1280px) / 2 + var(--gutter)));
  display: flex; gap: 10px; align-items: center;
}
.search { position: relative; flex: 1; min-width: 0; }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input {
  width: 100%; height: 44px; padding: 0 40px 0 40px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg-soft); font-size: 16px; color: var(--ink);
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.slash-hint { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search input:focus ~ .slash-hint, .search input:not(:placeholder-shown) ~ .slash-hint { display: none; }
.search-opts { display: flex; gap: 6px; align-items: center; }
.filters-btn { display: none; }

/* ---------- timeline / histogram ---------- */
.timeline { max-width: 1280px; margin: 0 auto; padding: 18px var(--gutter) 8px; }
.timeline-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.timeline-head h2 { font-size: 14px; color: var(--ink-2); }
.timeline-tools { display: flex; align-items: center; gap: 12px; }
.hist { position: relative; padding-top: 18px; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.hist-peak {
  position: absolute; left: 0; right: 0; top: 18px; height: 0;
  border-top: 1px dashed var(--line); pointer-events: none;
}
.hist-peak span { position: absolute; left: 0; bottom: 2px; font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.hist-bars {
  display: grid; column-gap: 2px; align-items: end;
  height: 96px; border-bottom: 1px solid var(--line-strong);
}
.bar {
  height: 100%; padding: 0; border: 0; background: transparent; cursor: pointer;
  display: flex; align-items: flex-end; justify-content: center; min-width: 0;
}
.bar .fill {
  display: block; width: 100%; max-width: 24px;
  background: var(--chart); border-radius: 4px 4px 0 0;
  transition: opacity 120ms;
}
.bar.zero .fill { height: 0 !important; }
.bar.dim .fill { opacity: 0.25; }
.bar:hover .fill, .bar.hot .fill { opacity: 1; filter: brightness(1.18); }
.bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 3px; }
.hist-axis { display: grid; column-gap: 2px; height: 18px; }
.hist-axis span { font-size: 11px; color: var(--ink-3); font-family: var(--mono); white-space: nowrap; padding-top: 3px; overflow: visible; }
.tip {
  position: absolute; z-index: 5; pointer-events: none;
  transform: translate(-50%, calc(-100% - 8px));
  background: var(--bg-softer); border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 6px 9px; font-size: 12px; line-height: 1.35; white-space: nowrap; box-shadow: var(--shadow);
}
.tip strong { display: block; font-size: 13px; color: var(--ink); }
.tip span { color: var(--ink-3); }
.hist-table-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; }
.hist-table-wrap table { border-collapse: collapse; width: 100%; font-size: 13px; }
.hist-table-wrap th, .hist-table-wrap td { padding: 5px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.hist-table-wrap td:last-child, .hist-table-wrap th:last-child { text-align: right; font-family: var(--mono); }
.hist-table-wrap tr.muted td { color: var(--ink-3); }
.hist-table-wrap thead th { position: sticky; top: 0; background: var(--bg-soft); color: var(--ink-2); font-weight: 600; }

/* ---------- layout ---------- */
.layout {
  max-width: 1280px; margin: 0 auto; padding: 12px var(--gutter) 40px;
  display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 32px; align-items: start;
}
.filters {
  position: sticky; top: calc(var(--bar-h) + 12px);
  max-height: calc(100vh - var(--bar-h) - 24px); overflow: auto;
  padding: 4px 4px 16px 0;
  scrollbar-width: thin;
}
.filters-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.filters-head h2 { font-size: 15px; }
.drawer-close { display: none; }
.fgroup { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 12px 0 14px; }
.fgroup legend { padding: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); float: left; width: 100%; }
.fgroup legend + * { clear: both; }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dates label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-3); }
.dates input, .goto input, .sort select {
  height: 32px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 7px;
  background: var(--bg-soft); color: var(--ink); min-width: 0; width: 100%;
}
.dates input { font-size: 13px; }
.facet { display: flex; flex-direction: column; gap: 1px; }
.check {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 14px;
}
.check:hover { background: var(--bg-soft); }
.check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.check .label { min-width: 0; }
.check .sub { display: block; font-size: 11.5px; color: var(--ink-3); }
.check .mono { font-family: var(--mono); font-size: 13px; }
.count { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.check.none .label, .check.none .count { opacity: 0.45; }
.goto { display: flex; align-items: center; gap: 6px; }
.goto .hash { color: var(--ink-3); font-family: var(--mono); }
.goto input { width: 90px; flex: none; }
.export { display: flex; gap: 6px; margin: 6px 0 10px; }
.export-note, #export-note { margin: 0; }
.dl-all { display: inline-block; }
.scrim { display: none; }

/* ---------- results ---------- */
.results { min-width: 0; outline: none; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 8px; flex-wrap: wrap; }
.result-count { margin: 0; color: var(--ink-2); font-size: 14px; }
.result-count strong { color: var(--ink); }
.sort { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); }
.sort select { width: auto; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.active-filters:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 10px;
  border: 1px solid var(--line-strong); border-radius: 14px; background: var(--bg-soft);
  font-size: 13px; color: var(--ink-2); cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip .x { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 9px; background: var(--bg-softer); font-size: 13px; line-height: 1; }
.cards { display: flex; flex-direction: column; gap: 14px; max-width: 820px; }
.sentinel { height: 1px; }
.empty, .loading { padding: 48px 0; color: var(--ink-2); max-width: 820px; }
.empty p { margin: 0 0 12px; font-size: 16px; }

/* ---------- cards ---------- */
.card {
  position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px 16px; scroll-margin-top: calc(var(--bar-h) + 14px);
}
.card:focus { outline: none; }
.card.current { border-color: var(--line-strong); box-shadow: inset 3px 0 0 var(--accent); }
.card:focus-visible { box-shadow: inset 3px 0 0 var(--accent); }
#single .card:focus-visible { box-shadow: none; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.num {
  font-family: var(--mono); font-weight: 700; font-size: 14px; text-decoration: none;
  color: var(--accent); background: var(--accent-soft); padding: 3px 8px; border-radius: 6px;
}
.num:hover { background: var(--accent); color: var(--accent-ink); }
.when { color: var(--ink); font-size: 14px; font-weight: 550; }
.when .tz { color: var(--ink-3); font-weight: 400; }
.card-actions { margin-left: auto; display: flex; gap: 2px; }
.card-actions .btn { height: 28px; width: 28px; color: var(--ink-3); }
.card-actions svg { width: 16px; height: 16px; }
.meta {
  display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0 10px;
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-3);
}
.meta .nm { color: var(--ink); font-weight: 700; font-family: var(--sans); font-size: 13.5px; }
.meta .tr { color: var(--ink-2); }
.meta a { color: var(--ink-3); }
.meta a:hover { color: var(--link); }
.body {
  margin: 0; white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: 16px; line-height: 1.55; color: var(--ink);
}
.body.no-text { color: var(--ink-3); font-style: italic; font-size: 14px; }
.gt { color: var(--green); }
.qlink {
  color: var(--link); text-decoration: underline dotted; text-underline-offset: 3px;
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
}
.qlink:hover { text-decoration-style: solid; }
.qlink.to-drop::after { content: " ↗"; font-size: 0.8em; }
.deadref { color: var(--ink-3); }
.body a.url { color: var(--link); }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }

.refs { display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; }
.ref {
  border-left: 3px solid var(--line-strong); background: var(--bg-soft);
  border-radius: 0 7px 7px 0; padding: 6px 12px 8px;
}
.ref > summary {
  cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; gap: 3px 10px; align-items: baseline;
  font-family: var(--mono); font-size: 12px; color: var(--ink-3); padding: 2px 0;
}
.ref > summary::-webkit-details-marker { display: none; }
.ref > summary::before { content: "▸"; color: var(--ink-3); width: 10px; transition: transform 120ms; }
.ref[open] > summary::before { transform: rotate(90deg); }
.ref > summary .nm { color: var(--ink-2); font-weight: 700; font-family: var(--sans); font-size: 12.5px; }
.ref > summary .is-q { color: var(--accent); }
.ref > summary .tr { color: var(--ink-2); }
.ref > summary .snip {
  flex-basis: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--sans); font-size: 13.5px; color: var(--ink-3);
}
.ref[open] > summary .snip { display: none; }
.ref .body { font-size: 14.5px; line-height: 1.5; color: var(--ink-2); margin-top: 4px; }
.ref .refs { margin: 8px 0 4px; }
.ref.q { border-left-color: var(--accent); }
.ref.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); } 100% { background: var(--bg-soft); box-shadow: none; } }

.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 12px 0 2px; }
.imgs.one { grid-template-columns: minmax(0, 520px); }
.ref .imgs { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.thumb {
  position: relative; display: block; padding: 0; border: 1px solid var(--line); border-radius: 7px;
  overflow: hidden; background: var(--bg-softer); cursor: zoom-in; aspect-ratio: 1 / 1;
}
.imgs.one .thumb { aspect-ratio: auto; max-height: 460px; }
.thumb img, .thumb video { display: block; width: 100%; height: 100%; object-fit: cover; }
.imgs.one .thumb img, .imgs.one .thumb video { height: auto; max-height: 460px; object-fit: contain; }
.thumb.vid:not(.missing)::after {
  content: "▶"; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  display: grid; place-items: center; border-radius: 50%; background: rgba(3, 5, 12, 0.7); color: #fff;
  font-size: 18px; line-height: 1; padding-left: 3px; box-sizing: border-box; pointer-events: none;
}
.thumb.missing {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-style: dashed; cursor: zoom-in; padding: 10px; text-align: center;
  font-family: var(--mono); font-size: 11px; color: var(--ink-3); overflow-wrap: anywhere;
}
.imgs.one .thumb.missing { min-height: 160px; max-height: 260px; }
.thumb.missing svg { width: 22px; height: 22px; opacity: 0.6; }
.thumb .fname { max-width: 100%; }

.backlinks { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.backlinks a { font-family: var(--mono); }

/* single view */
.single-nav { display: flex; align-items: center; gap: 8px; margin: 2px 0 14px; max-width: 820px; }
.single-nav .spacer { flex: 1; }
.single-nav .btn span { font-family: var(--mono); }
#single .card { padding: 20px 24px 22px; }
#single .card .body { font-size: 17.5px; line-height: 1.6; }
#single .imgs { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
#single .imgs.one { grid-template-columns: minmax(0, 720px); }
.single-extra { max-width: 820px; margin-top: 18px; }
.single-extra h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); margin-bottom: 8px; }
.mini-list { display: flex; flex-direction: column; gap: 6px; }
.mini {
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: baseline;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  color: var(--ink-2); text-decoration: none; font-size: 14px;
}
.mini:hover { border-color: var(--line-strong); background: var(--bg-soft); }
.mini .num { padding: 1px 6px; font-size: 12.5px; }
.mini .snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini .d { color: var(--ink-3); font-size: 12px; font-family: var(--mono); margin-right: 8px; }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--line); text-align: center; padding: 28px var(--gutter) 40px; }
.site-foot p { margin: 4px 0; }
.site-foot a { color: var(--ink-2); }
.motto { font-weight: 700; letter-spacing: 0.02em; color: var(--ink); font-size: 15px; }

/* ---------- dialogs ---------- */
.modal {
  width: min(640px, calc(100% - 32px)); max-height: 86vh; padding: 0;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(2, 4, 10, 0.66); }
.modal-inner { position: relative; padding: 26px 28px 22px; overflow: auto; max-height: 86vh; }
.modal h2 { font-size: 20px; margin-bottom: 10px; padding-right: 40px; }
.modal h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); margin: 20px 0 6px; }
.modal p { margin: 0 0 10px; color: var(--ink-2); }
.modal p strong { color: var(--ink); }
.modal .motto { margin-top: 20px; text-align: center; }
.modal-close { position: absolute; right: 14px; top: 14px; }
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 18px; margin: 0; }
.keys div { display: flex; gap: 10px; align-items: baseline; }
.keys dt { min-width: 92px; }
.keys dd { margin: 0; color: var(--ink-2); font-size: 14px; }

.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(3, 5, 12, 0.95); color: #e8ebf2;
}
.lightbox[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.lightbox::backdrop { background: rgba(3, 5, 12, 0.8); }
.lb-stage { display: flex; align-items: center; justify-content: center; padding: 16px; min-height: 0; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-missing { white-space: pre-line; font-family: var(--mono); color: #9aa3b5; text-align: center; padding: 40px; border: 1px dashed #3a4560; border-radius: 10px; }
.lb-bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid #1c2438; }
.lb-bar .btn.ghost { color: #c9d0dd; }
.lb-bar .btn.ghost:hover { background: #1a2236; color: #fff; }
.lb-cap { flex: 1; margin: 0; font-size: 13px; color: #aab3c5; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }

.preview {
  position: fixed; z-index: 60; width: min(520px, calc(100vw - 24px)); max-height: 60vh; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: var(--shadow); padding: 12px 14px; pointer-events: none;
}
.preview .card { border: 0; padding: 0; background: transparent; }
.preview .body { font-size: 14px; }
.preview .ref { margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity 160ms, transform 160ms;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .filters-btn { display: inline-flex; }
  .filters {
    position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; max-height: none;
    width: min(340px, 88vw); padding: 16px 18px 24px;
    background: var(--surface); border-right: 1px solid var(--line-strong); box-shadow: var(--shadow);
    transform: translateX(-105%); transition: transform 200ms ease; visibility: hidden;
  }
  .filters.open { transform: none; visibility: visible; }
  .drawer-close { display: inline-flex; }
  .filters-head { gap: 6px; }
  .filters-head h2 { margin-right: auto; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(2, 4, 10, 0.55); }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; --bar-h: 108px; }
  .masthead-inner { gap: 8px 12px; padding-top: 12px; padding-bottom: 12px; }
  .title { font-size: 21px; }
  .mark { width: 34px; height: 34px; }
  .top-actions .btn span { display: none; }
  .top-actions .btn { width: 34px; padding: 0; }
  .span-line { order: 3; width: 100%; font-size: 12px; }
  .searchbar { flex-wrap: wrap; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .search { flex-basis: 100%; }
  .search-opts { width: 100%; }
  .search-opts .filters-btn { margin-left: auto; }
  .hint-drag { display: none; }
  .card { padding: 12px 14px 14px; }
  .card-head { flex-wrap: nowrap; gap: 8px; }
  .when { font-size: 13.5px; min-width: 0; }
  .when .wd { display: none; }
  .body { font-size: 15.5px; }
  #single .card { padding: 14px 16px 16px; }
  #single .card .body { font-size: 16.5px; }
  .imgs { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .single-nav #btn-back span { display: none; }
  .lb-cap { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (forced-colors: active) {
  .bar .fill { background: CanvasText; }
  .bar.dim .fill { background: GrayText; }
}
