:root {
  --bg: #f8f8f6;
  --surface: #ffffff;
  --surface-2: #f1f2ef;
  --border: #dcddd8;
  --text: #1d2925;
  --muted: #676d69;
  --accent: #165e4e;
  --accent-ink: #ffffff;
  --accent-soft: #e3efe9;
  --lost: #8a5300;
  --lost-soft: #fbefd9;
  --tl-red: #d1342b;
  --shadow: 0 1px 2px rgb(20 30 25 / 6%), 0 8px 24px rgb(20 30 25 / 8%);
  --radius: 10px;
  --series-bar: #1baf7a;
  --series-line: #eb6834;
  --grid: #e7e8e4;
  --gutter: 32px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

/* Dark theme: default since theme.js sets data-theme; this block covers a system-dark fallback. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111513;
    --surface: #1a1f1d;
    --surface-2: #222826;
    --border: #2f3633;
    --text: #e8ece9;
    --muted: #9aa39e;
    --accent: #3fae8f;
    --accent-ink: #08130f;
    --accent-soft: #1d3a31;
    --lost: #f0b85a;
    --lost-soft: #3a2c14;
    --tl-red: #ff5d52;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 35%);
    --series-bar: #199e70;
    --series-line: #d95926;
    --grid: #2a312e;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #111513;
  --surface: #1a1f1d;
  --surface-2: #222826;
  --border: #2f3633;
  --text: #e8ece9;
  --muted: #9aa39e;
  --accent: #3fae8f;
  --accent-ink: #08130f;
  --accent-soft: #1d3a31;
  --lost: #f0b85a;
  --lost-soft: #3a2c14;
  --tl-red: #ff5d52;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 35%);
  --series-bar: #199e70;
  --series-line: #d95926;
  --grid: #2a312e;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

button, input, select { font: inherit; color: inherit; }

[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  text-decoration: none;
  font-size: 17px;
  white-space: nowrap;
}
.brand-group { display: flex; align-items: center; gap: 12px; flex: none; }
.brand-icon { position: relative; display: inline-flex; flex: none; }
.brand-mark { width: 28px; height: 28px; flex: none; border-radius: 7px; }
.brand-tip {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  z-index: 30;
  /* Hugs short quotes; longer ones wrap at 260px. */
  width: max-content;
  max-width: min(260px, calc(100vw - 32px));
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px 10px 10px 3px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgb(0 0 0 / 18%);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  /* Grows out of the tail; after the pointer leaves it lingers 2s, then fades a little faster than it arrived. */
  transform: translateY(-4px) scale(0.97);
  transform-origin: 20px -6px;
  transition: opacity 0.12s ease-in 2s, transform 0.12s ease-in 2s;
}
.brand-tip::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 16px;
  width: 8px;
  height: 8px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  background: var(--surface);
  transform: rotate(45deg);
}
/* Bridges the gap under the icon, so the pointer can travel into the bubble without it closing. */
.brand-tip::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: 14px;
}
.brand-icon:hover .brand-tip,
.brand-icon:has(:focus-visible) .brand-tip,
.brand-tip.is-greeting {
  opacity: 1;
  pointer-events: auto;
  transform: none;
  transition: opacity 0.18s cubic-bezier(0.2, 0, 0, 1), transform 0.22s cubic-bezier(0.2, 0, 0, 1);
}
@media (prefers-reduced-motion: reduce) {
  .brand-tip { transform: none; }
}
.brand-goon {
  display: block;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.brand-goon:hover { text-decoration: underline; text-underline-offset: 3px; }
.brand-out {
  display: none;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.brand-out:hover { border-color: var(--accent); color: var(--accent); }
/* The owner's switch between the admin view and the visitor view; only tools/serve.py shows it. */
.admin-toggle {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.admin-toggle[hidden] { display: none; }
.admin-toggle:hover { border-color: var(--accent); color: var(--accent); }
.admin-toggle[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.admin-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.admin-toggle[aria-pressed="true"] .eye-off,
.admin-toggle[aria-pressed="false"] .eye { display: none; }

/* The second site: a way back out, none of the parts marked data-main-only, and its own data-adult-only parts. */
:root[data-site="h"] .brand-out { display: inline-flex; }
:root[data-site="h"] .brand-tip,
:root[data-site="h"] .brand-tip::before { border-color: var(--tl-red); }
:root[data-site="h"] [data-main-only] { display: none !important; }
:root:not([data-site="h"]) [data-adult-only] { display: none !important; }
:root[data-site="h"] .hero { padding-bottom: 8px; }
.nav {
  display: flex;
  gap: 4px;
  min-width: 0;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav.more-right { mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent); }
.nav.more-left { mask-image: linear-gradient(to left, #000 calc(100% - 16px), transparent); }
.nav.more-left.more-right { mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 16px), transparent); }
.nav a {
  padding: 7px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 15px;
  white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.theme-toggle {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}

/* Hero */
main { max-width: 1600px; margin: 0 auto; padding: 0 var(--gutter); }
.hero { padding: 40px 0 24px; }
.eyebrow {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero h1 {
  margin: 0;
  font-size: clamp(32px, 4.4vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.hero-meta { margin: 10px 0 0; color: var(--muted); }
.hero-meta .nowrap { white-space: nowrap; } /* the date and the "i" wrap together */
/* The circled "i" after the stats line opens the coverage notes below it. */
.info-toggle {
  display: inline-grid;
  vertical-align: middle;
  margin: -4px 0 -2px 2px;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s;
}
.info-toggle span {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font: italic 800 11px/1 Georgia, serif;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
@media (hover: hover) { .info-toggle:hover { color: var(--accent); } }
.info-toggle[aria-expanded="true"] { color: var(--accent); }
.info-toggle[aria-expanded="true"] span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.hero-notes {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows 0.2s ease, visibility 0s 0.2s;
}
.hero-notes.open { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows 0.2s ease; }
.hero-notes-inner { min-height: 0; overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .hero-notes, .hero-notes.open { transition: none; }
}
.hero-coverage {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.hero-coverage a { color: inherit; }
.hero-coverage a:hover { color: var(--accent); }
/* Description under the type buttons, for the selected Videos, My Personal Pick or Lost tweets filter */
.kind-note {
  display: none;
  width: 0;
  min-width: 100%; /* exactly as wide as the type buttons above, without widening their row */
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}
.kind-note strong { color: var(--lost); }
#toolbar:has(#kind [data-kind="pick"][aria-checked="true"]) .kind-note[data-kind="pick"],
#toolbar:has(#kind [data-kind="video"][aria-checked="true"]) .kind-note[data-kind="video"],
#toolbar:has(#kind [data-kind="lost"][aria-checked="true"]) .kind-note[data-kind="lost"]:not(:empty) { display: block; }

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
  padding: 16px 0;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-inline { flex-direction: row; align-items: center; gap: 12px; }
.field-label { color: var(--muted); font-size: 15px; white-space: nowrap; }
.field-search { flex: 1 1 280px; max-width: 420px; }
.field-inline .field-label { display: inline-flex; align-items: center; gap: 7px; }
.label-icon {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* The magnifier sits inside the search box, on the left. */
.field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  transition: stroke 0.15s;
}
.search-box { position: relative; display: block; }
.search-box:focus-within .field-icon { stroke: var(--accent); }
.field-search input {
  height: 46px;
  padding: 0 16px 0 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  width: 100%;
}
/* The Gallery search has a row to itself; the filters sit on the row below. */
#toolbar .field-search { flex-basis: 100%; max-width: none; }
#toolbar .search-box { max-width: 420px; }
/* The type buttons always get their own line, however few there are; their note matches the row's width. */
.kind-group { flex-basis: 100%; display: grid; grid-template-columns: fit-content(100%); gap: 12px; }
.field-search input::placeholder { color: var(--muted); opacity: 0.8; }
.field-search input:focus { background: var(--surface); border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.select { position: relative; display: inline-flex; }
.select::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
  color: var(--text);
}
.select select {
  appearance: none;
  -webkit-appearance: none;
  height: 46px;
  min-width: 170px;
  padding: 0 44px 0 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.select select:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }

.segmented { display: flex; flex-wrap: wrap; gap: 10px; }
.segmented button[role="radio"] {
  height: 46px;
  padding: 0 20px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.kind-icon {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.segmented button[role="radio"]:hover { border-color: var(--accent); }
.segmented button[role="radio"][aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* Status */
.status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  min-height: 40px;
  margin-bottom: 12px;
}
.status p, .status-line { margin: 0; color: var(--muted); font-size: 15px; }
.status-line { margin-bottom: 16px; }
.chip-row { display: flex; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 6px 0 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}
.chip button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 12px;
}
.chip button:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.chip-label { padding: 0 12px; }

/* Virtualized grid */
.grid { position: relative; contain: strict; }
.card {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  contain: strict;
}
/* The whole card opens the viewer; the heart sits beside it, so it is not a nested button. */
.card-hit {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: none;
  color: inherit;
  font: inherit;
  cursor: zoom-in;
}
.card-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  transition: transform 0.35s ease, opacity 0.25s;
  opacity: 0;
}
.card img.ready { opacity: 1; }
.card:hover img { transform: scale(1.03); }
.card-meta {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  padding: 28px 10px 9px;
  background: linear-gradient(to top, rgb(0 0 0 / 62%), transparent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  opacity: 0;
  transition: opacity 0.2s;
}
.card:hover .card-meta, .card:focus-within .card-meta { opacity: 1; }
.card-handle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.card-likes { flex: none; font-variant-numeric: tabular-nums; opacity: 0.92; }
.badges {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  gap: 5px;
  pointer-events: none;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  background: rgb(0 0 0 / 58%);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.badge-lost { background: #b86e00; margin-left: auto; }
/* Works by hidden artists, which only the owner's local server shows. */
.badge-hidden { background: #a3324b; margin-left: auto; }
.badge-lost + .badge-hidden { margin-left: 0; }
.has-pick .badges { right: 46px; }

/* My Personal Pick hearts */
.pick-btn, .pick-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgb(0 0 0 / 50%);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.pick-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s, background 0.15s;
}
.pick-badge { width: 26px; height: 26px; pointer-events: none; }
.pick-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.pick-badge svg { width: 14px; height: 14px; fill: #ff5c7a; }
.pick-btn[aria-pressed="true"] svg { fill: #ff5c7a; stroke: #ff5c7a; }
.card:hover .pick-btn, .shelf-card:hover .pick-btn, .pick-btn:focus-visible, .pick-btn[aria-pressed="true"] { opacity: 1; }
.pick-btn:hover { background: rgb(0 0 0 / 70%); transform: scale(1.06); }
.pick-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (hover: none) {
  .pick-btn { opacity: 1; }
}

/* Artist link (ARTIST_LINKS in app.js): a small pill under the handle, beside the open button so it is not nested */
.card-link {
  position: absolute;
  left: 10px;
  bottom: 9px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgb(0 0 0 / 55%);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s, background 0.15s;
}
.card-link:hover { background: rgb(219 39 119 / 88%); }
.card-link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.card:hover .card-link, .card:focus-within .card-link, .shelf-card .card-link { opacity: 1; visibility: visible; }
.has-link .card-handle { margin-bottom: 27px; } /* lifts only the handle above the pill */
.has-link .card-likes { line-height: 22px; } /* same box as the pill, so the hearts line up with it */
.btn-pick { gap: 8px; }
.btn-pick svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.btn-pick[aria-pressed="true"] svg { fill: #ff5c7a; stroke: #ff5c7a; }
.badge svg { width: 9px; height: 9px; fill: currentColor; }

/* Page size */
#per-page { min-width: 96px; }

/* Pager */
.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 32px 0 8px;
}
.pager-pages { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pager button {
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.pager button:hover:not(:disabled) { border-color: var(--accent); }
.pager button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pager button:disabled { opacity: 0.35; cursor: default; }
.pager .pager-step { color: var(--accent); font-weight: 600; }
.pager-gap { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 42px; color: var(--muted); }

.empty {
  padding: 80px 0;
  text-align: center;
  color: var(--muted);
}

/* Artists */
.artists {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.artist {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}
.artist:hover { border-color: var(--accent); }
.artist img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 20%;
  background: var(--surface-2);
  transition: transform 0.35s ease;
}
.artist:hover img { transform: scale(1.03); }
.artist-text { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; padding: 10px 12px 12px; }
.artist-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 700; }
.artist-followers { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.artist-count {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgb(0 0 0 / 68%);
  color: #fff;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.footer {
  max-width: 1600px;
  margin: 48px auto 0;
  padding: 24px var(--gutter) 40px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.footer p { max-width: 72ch; margin: 0 auto; text-wrap: pretty; }
.footer p + p { margin-top: 6px; }
.footer a { color: inherit; white-space: nowrap; }

/* Viewer */
.viewer {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #0b0d0c;
  color: #e8ece9;
  overflow: hidden;
}
.viewer[open] { display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.viewer::backdrop { background: rgb(0 0 0 / 85%); }
.viewer-stage { position: relative; min-height: 0; }
.viewer-media {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 72px;
}
.viewer-media img, .viewer-media video {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
}
.viewer-nav {
  position: absolute;
  top: 50%;
  width: 48px;
  height: 72px;
  margin-top: -36px;
  border: 0;
  border-radius: 8px;
  background: rgb(255 255 255 / 8%);
  color: #fff;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}
/* A click near an arrow counts as the arrow: the hit area fills its side margin and reaches 64px above and below. */
.viewer-nav::before { content: ""; position: absolute; inset: -64px -12px; }
.viewer-nav:disabled::before { content: none; }
.viewer-nav:hover { background: rgb(255 255 255 / 16%); }
.viewer-nav:disabled { opacity: 0.25; cursor: default; }
.viewer-nav.prev { left: 12px; }
.viewer-nav.next { right: 12px; }
.viewer-info {
  position: relative;
  padding: 56px 24px 24px;
  background: #151917;
  border-left: 1px solid #262c29;
  overflow-y: auto;
}
.viewer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c9d0cc;
  font-size: 16px;
  cursor: pointer;
}
.viewer-close:hover { background: rgb(255 255 255 / 10%); color: #fff; }
.viewer-pos { margin: 0 0 4px; color: #8e9893; font-size: 13px; font-variant-numeric: tabular-nums; }
.viewer-artist {
  display: block;
  font-size: 22px;
  font-weight: 700;
  text-decoration: none;
  word-break: break-all;
}
.viewer-artist:hover { text-decoration: underline; }
.viewer-link {
  display: inline-flex;
  align-items: center;
  height: 28px;
  margin-top: 10px;
  padding: 0 12px;
  border-radius: 999px;
  background: #262c29;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}
.viewer-link:hover { background: rgb(219 39 119 / 88%); }
.viewer-link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.viewer-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.viewer-tags .badge { backdrop-filter: none; background: #262c29; }
.viewer-tags .badge-lost { background: #b86e00; margin-left: 0; }
.viewer-tags .badge-hidden { background: #a3324b; margin-left: 0; }
/* The owner's Comic toggle (local server only): outlined when off, filled when on. */
.viewer-tags .badge-toggle { border: 1px dashed #4a524e; background: transparent; color: #8e9893; font: inherit; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; cursor: pointer; }
.viewer-tags .badge-toggle:hover { border-color: #8e9893; color: #e8ece9; }
.viewer-tags .badge-toggle[aria-pressed="true"] { border-style: solid; border-color: transparent; background: #262c29; color: #fff; }
.viewer-tags .badge-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.viewer-lost {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #3a2c14;
  color: #f3cf8f;
  font-size: 14px;
}
.viewer-post { margin: 16px 0 0; }
.viewer-text { margin: 0; color: #e8ece9; font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.viewer-text.clamped { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 8; line-clamp: 8; overflow: hidden; }
.viewer-text a { color: #3fae8f; text-decoration: none; }
.viewer-text a:hover { text-decoration: underline; }
.viewer-text a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 2px; }
.viewer-text-more { margin: 6px 0 0; padding: 0; border: 0; background: none; color: #8e9893; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.viewer-text-more:hover { color: #e8ece9; }
.viewer-text-more:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.viewer-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin: 20px 0;
  font-size: 14px;
}
.viewer-meta dt { color: #8e9893; }
.viewer-meta dd { margin: 0; overflow-wrap: anywhere; }
.viewer-actions { display: flex; flex-direction: column; gap: 8px; }
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 16px;
  border: 1px solid #343b38;
  border-radius: 6px;
  background: transparent;
  color: #e8ece9;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: rgb(255 255 255 / 6%); }
.btn-primary { background: #3fae8f; border-color: #3fae8f; color: #08130f; }
.btn-primary:hover { background: #4cc4a2; }
.viewer-note { margin: 16px 0 0; color: #8e9893; font-size: 13px; }

/* Responsive */
@media (max-width: 900px) {
  :root { --gutter: 16px; }
  .viewer[open] { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .viewer-media { padding: 8px; }
  .viewer-nav { width: 36px; height: 56px; margin-top: -28px; font-size: 26px; background: rgb(0 0 0 / 45%); }
  .viewer-nav:disabled { opacity: 0; }
  .viewer-nav::before { content: none; } /* the arrows sit over the picture here, where swipes need the room */
  .viewer-nav.prev { left: 6px; }
  .viewer-nav.next { right: 6px; }
  .viewer-info { max-height: 42dvh; padding: 18px 16px 16px; border-left: 0; border-top: 1px solid #262c29; }
  .viewer-close { position: fixed; top: 10px; right: 10px; background: rgb(0 0 0 / 55%); z-index: 2; }
  .viewer-actions { flex-direction: row; flex-wrap: wrap; }
  .viewer-actions .btn { flex: 1 1 auto; }
  .viewer-meta { margin: 14px 0; }
  .viewer-post { margin-top: 14px; }
  .viewer-text.clamped { -webkit-line-clamp: 4; line-clamp: 4; }
}

@media (max-width: 640px) {
  .topbar-inner { gap: 12px; height: 56px; }
  .nav { gap: 2px; }
  .theme-toggle { width: 32px; height: 32px; }
  .nav a { padding: 6px 9px; font-size: 14px; }
  .hero { padding: 20px 0 4px; }
  .hero h1 { font-size: 30px; }
  .hero-meta { font-size: 14px; margin-top: 6px; }
  .toolbar { gap: 10px; padding: 12px 0; }
  .field-label { font-size: 13px; }
  .field-search { flex-basis: 100%; max-width: none; }
  #toolbar .search-box { max-width: none; }
  .field-search .field-label { display: none; }
  .field-search input, .select select { height: 42px; }
  .field-inline { flex: 1 1 calc(50% - 5px); flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; }
  .select select { min-width: 0; width: 100%; padding-left: 12px; padding-right: 36px; }
  .field-icon { left: 12px; width: 16px; height: 16px; }
  .label-icon { width: 14px; height: 14px; }
  .field-search input { padding-left: 38px; }
  .select::after { right: 14px; }
  /* The type buttons shrink to icons on one row; the names stay for screen readers. */
  .segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; width: 100%; }
  .kind-group { grid-template-columns: 100%; gap: 10px; }
  .segmented button[role="radio"] { height: 40px; padding: 0; }
  .kind-icon { width: 20px; height: 20px; }
  .kind-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .card-meta { opacity: 1; font-size: 12px; padding: 22px 8px 7px; }
  .card-link { opacity: 1; visibility: visible; left: 8px; bottom: 7px; }
  #per-page { min-width: 0; }
  .pager { gap: 8px 6px; margin-top: 24px; }
  .pager-pages { order: -1; width: 100%; }
  .pager .pager-step { flex: 1 1 0; }
}

@media (max-width: 440px) {
  .brand-text { display: none; }
}

@media (hover: none) {
  .card-meta { opacity: 1; }
  .card-link { opacity: 1; visibility: visible; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 0.01ms !important; }
}

/* Home: shelves */
.shelf { margin: 12px 0 44px; }
.shelf-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.shelf-head h2 { margin: 0; font-size: 26px; line-height: 1.2; letter-spacing: -0.01em; }
.shelf-head h2 a { color: inherit; text-decoration: none; }
.shelf-head h2 a::after { content: " →"; color: var(--accent); font-weight: 600; transition: margin 0.15s; }
.shelf-head h2 a:hover { color: var(--accent); }
.shelf-head h2 a:hover::after { margin-left: 4px; }
.shelf-sub { margin: 4px 0 0; color: var(--muted); font-size: 15px; }

/* My ideas: two request/result pairs, four images across in one line on wide screens. */
.my-ideas { margin: 12px 0 44px; }
.ideas-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 24px;
  margin-top: 16px;
}
.ideas-note { margin: 28px 0 0; color: var(--muted); font-size: 15px; text-align: center; }
.idea-pair { display: flex; align-items: center; justify-content: center; gap: 16px; min-width: 0; }
.idea-pair figure { margin: 0; }
.idea-pair figcaption { margin-top: 10px; color: var(--muted); font-size: 14px; }
.idea-pair figcaption a { color: var(--accent); font-weight: 600; text-decoration: none; white-space: nowrap; }
.idea-pair figcaption a:hover { text-decoration: underline; }
/* The tweet and the art shrink together, in their 300:240 desktop proportion, so both pairs share one row. */
.idea-tweet { flex: 5 1 0; min-width: 0; max-width: 300px; }
.idea-tweet blockquote {
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.idea-tweet-author { margin: 0 0 8px; }
.idea-tweet-author span { margin-left: 4px; color: var(--muted); }
.idea-tweet-text { margin: 0; font-size: 16px; line-height: 1.5; }
.idea-tweet-media {
  display: block;
  width: 100%;
  max-width: 240px;
  height: auto;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.idea-arrow { flex: none; color: var(--accent); font-size: 26px; font-weight: 600; line-height: 1; }
.idea-art { flex: 4 1 0; min-width: 0; max-width: 240px; }
.idea-art-open, .idea-art-link {
  display: block;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}
.idea-art-open { padding: 0; border: 0; cursor: pointer; }
.idea-art-link { border: 1px solid var(--border); }
.idea-art-open img, .idea-art-link img { display: block; width: 100%; height: auto; transition: transform 0.2s; }
.idea-art-open img { aspect-ratio: 1; object-fit: cover; }
.idea-art-open:hover img, .idea-art-link:hover img { transform: scale(1.03); }
@media (max-width: 1200px) { /* tablets: both pairs still share a row, with tighter spacing and text */
  .idea-pair { gap: 10px; }
  .idea-tweet blockquote { padding: 12px 14px; }
  .idea-tweet-text { font-size: 14px; }
  .idea-pair figcaption { font-size: 13px; }
  .idea-arrow { font-size: 20px; }
}
@media (max-width: 900px) { /* stack the two pairs when they no longer fit side by side */
  .ideas-grid { grid-template-columns: 1fr; gap: 32px; }
  .idea-pair { gap: 16px; justify-content: flex-start; }
  .idea-tweet-text { font-size: 16px; }
  .idea-pair figcaption { font-size: 14px; }
}
@media (max-width: 700px) { /* phone: idea -> result per line, with smaller images to fit */
  .ideas-grid { gap: 24px; }
  .idea-pair { gap: 10px; justify-content: space-between; }
  .idea-tweet { max-width: none; }
  .idea-tweet-media { max-width: 140px; }
  .idea-art { flex: 0 0 140px; width: 140px; max-width: none; }
  .idea-arrow { font-size: 20px; }
}
.shelf-controls { display: flex; align-items: center; gap: 8px; flex: none; }
.shelf-btn, .shelf-shuffle {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.shelf-btn { width: 40px; font-size: 22px; line-height: 1; }
.shelf-shuffle { padding: 0 14px; color: var(--accent); font-weight: 600; font-size: 14px; }
.shelf-btn:hover, .shelf-shuffle:hover { border-color: var(--accent); }
.shelf-btn:disabled { opacity: 0.35; cursor: default; border-color: var(--border); }
.shelf-link { color: var(--accent); font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; }
.shelf-link:hover { text-decoration: underline; }
.shelf-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.shelf-empty { margin: 0; padding: 32px 0; color: var(--muted); }
.shelf-card {
  position: relative;
  flex: 0 0 270px;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  scroll-snap-align: start;
}
#fame-track .shelf-card { flex-basis: 340px; }
.shelf-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  transition: transform 0.35s ease;
}
.shelf-card:hover img { transform: scale(1.03); }
.shelf-card .card-meta { opacity: 1; padding: 36px 10px 9px; }
.rank {
  position: absolute;
  top: 8px;
  left: 8px;
  min-width: 30px;
  height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  background: rgb(0 0 0 / 62%);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 26px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Home: Archive Activity */
.timeline { margin: 8px 0 0; padding-top: 32px; border-top: 1px solid var(--border); }
.timeline-take { max-width: 760px; margin: 6px 0 0; color: var(--muted); font-size: 16px; }
.timeline-take b { color: var(--text); font-variant-numeric: tabular-nums; }
.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 16px;
}
.tile, .panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.tile { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; }
.tile-label { color: var(--muted); font-size: 14px; font-weight: 600; }
.tile-num { font-size: 30px; font-weight: 750; line-height: 1.2; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.tile-unit { font-size: 16px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.tile-sub { color: var(--muted); font-size: 14px; }
.panel { padding: 18px 20px; margin-bottom: 16px; }
.panel-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-bar h3 { margin: 0; font-size: 17px; }
.seg-small { display: inline-flex; padding: 3px; border-radius: 8px; background: var(--surface-2); }
.seg-small button {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.seg-small button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 12%); }
.legend { display: flex; gap: 18px; margin: 12px 0 4px; color: var(--muted); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw-bar { width: 10px; height: 10px; border-radius: 2px; background: var(--series-bar); }
.sw-line { width: 16px; height: 2px; border-radius: 1px; background: var(--series-line); }
.chart { position: relative; height: 300px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--series-bar); }
.chart .peak-label { fill: var(--text); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .bar.dim { opacity: 0.45; }
.chart .avg { fill: none; stroke: var(--series-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot { fill: var(--series-line); stroke: var(--surface); stroke-width: 2; }
.tooltip {
  position: absolute;
  z-index: 2;
  min-width: 160px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13px;
  pointer-events: none;
}
.tooltip strong { display: block; margin-bottom: 4px; }
.tooltip div { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); }
.tooltip div span:last-child { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.tooltip i { display: inline-block; margin-right: 6px; vertical-align: middle; }
.note { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.tablewrap { overflow-x: auto; margin-top: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 9px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
.table th:first-child, .table td:first-child { text-align: left; }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.table tbody tr:hover { background: var(--surface-2); }

@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .shelf { margin-bottom: 32px; }
  .shelf-head h2 { font-size: 21px; }
  .shelf-sub { font-size: 14px; }
  .shelf-btn { display: none; }
  .shelf-card { flex-basis: 200px; }
  #fame-track .shelf-card { flex-basis: 255px; }
  .shelf-track { gap: 8px; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter) 10px; scroll-padding: 0 var(--gutter); }
  .tile { padding: 12px 14px; }
  .tile-num { font-size: 24px; }
  .panel { padding: 14px; }
  .chart { height: 220px; }
  .timeline .shelf-head { flex-direction: column; align-items: flex-start; }
}

/* Timeline view: a rail down the left with a red line that follows the scroll */
.tl-intro { padding: 8px 0 4px; }
.tl-intro h2 { margin: 0; font-size: 26px; letter-spacing: -0.01em; }
.tl-intro p { max-width: 760px; margin: 6px 0 0; color: var(--muted); }
.tl { position: relative; margin-top: 20px; padding-left: 40px; }
.tl-rail { position: absolute; top: 0; bottom: 0; left: 11px; width: 2px; border-radius: 2px; background: var(--border); }
.tl-progress { width: 100%; height: 0; border-radius: inherit; background: var(--tl-red); }
.tl-list { margin: 0; padding: 0; list-style: none; }
.tl-entry { position: relative; padding-bottom: 36px; }
.tl-entry:last-child { padding-bottom: 8px; }
.tl-dot {
  position: absolute;
  top: 7px;
  left: -34px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  transition: background 0.15s, border-color 0.15s;
}
.tl-entry.reached .tl-dot { border-color: var(--tl-red); background: var(--tl-red); }
.tl-date { margin: 0 0 12px; font-size: 18px; line-height: 26px; letter-spacing: -0.005em; }
.tl-marker { padding-bottom: 20px; }
.tl-marker .tl-date, .tl-year .tl-date { font-size: 28px; line-height: 26px; letter-spacing: -0.02em; }
.tl-marker .tl-dot, .tl-year .tl-dot { top: 5px; left: -36px; width: 16px; height: 16px; }
.tl-works { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tl-card { position: relative; aspect-ratio: 4 / 5; contain: layout paint; }
.tl-year .tl-works { grid-template-columns: repeat(auto-fill, minmax(200px, 260px)); align-items: start; }
/* Early art: natural shape (aspect-ratio set from its size), uncropped, with tall screenshots capped and letterboxed */
.tl-card-early { max-height: 480px; }
.tl-card-early img { object-fit: contain; object-position: center; }

@media (max-width: 640px) {
  .tl-intro h2 { font-size: 22px; }
  .tl { padding-left: 30px; }
  .tl-rail { left: 7px; }
  .tl-dot { left: -28px; }
  .tl-marker .tl-dot, .tl-year .tl-dot { left: -30px; }
  .tl-marker .tl-date, .tl-year .tl-date { font-size: 24px; }
  .tl-date { font-size: 16px; }
  .tl-works, .tl-year .tl-works { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tl-card-early { max-height: 340px; }
}
