/* WannaSub — utilitarian, no framework, no build step. */

:root {
  color-scheme: light dark;

  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #f0f2f5;
  --ink: #16191d;
  --ink-2: #545c66;
  --ink-3: #858e99;
  --line: #dde1e6;
  --line-2: #eaedf1;
  --accent: #2f6feb;
  --accent-ink: #ffffff;
  --shadow: 0 1px 2px rgba(16, 20, 26, .06), 0 1px 8px rgba(16, 20, 26, .04);

  --site-patreon: #e0503c;
  --site-subscribestar: #128a6f;
  --site-fanbox: #1f7ee0;

  --f-language: #2f6feb;
  --f-format: #7c4ddc;
  --f-theme: #c2670a;
  --f-franchise: #0f8a5f;

  --radius: 8px;
  --card-w: 154px;

  /* Shared thumbnail placeholder, drawn in CSS so no card carries inline SVG. */
  --ph-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg fill='%239aa4b0'%3E%3Ccircle cx='24' cy='24' r='6'/%3E%3Cpath d='M8 54l16-18 11 12 9-9 12 15z'/%3E%3C/g%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b;
    --panel: #1b1f24;
    --panel-2: #22272e;
    --ink: #e6e9ee;
    --ink-2: #a8b1bc;
    --ink-3: #78828e;
    --line: #2c333b;
    --line-2: #242a31;
    --accent: #5b9bff;
    --accent-ink: #0d1117;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);

    --site-patreon: #ff7a66;
    --site-subscribestar: #35c3a2;
    --site-fanbox: #58aaff;

    --f-language: #7fb0ff;
    --f-format: #b596f7;
    --f-theme: #f0a952;
    --f-franchise: #4ecb96;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", "Segoe UI Variable Text",
        Roboto, "Helvetica Neue", Arial, "Noto Sans JP", "Yu Gothic UI", "Meiryo",
        "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }

h1 { font-size: 20px; margin: 0 0 10px; letter-spacing: -.01em; }
h2 { font-size: 13px; margin: 0 0 8px; }
h3 { font-size: 14px; margin: 0; }

.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 0 16px; height: 48px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -.02em; font-size: 15px; }
.brand img { display: block; border-radius: 6px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); font: inherit; cursor: pointer;
}
.btn:hover { background: var(--panel-2); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }

html[data-blur="1"] .on-when-clear,
html:not([data-blur="1"]) .on-when-blurred { display: none; }

/* ---------------------------------------------------------------- add account */

.addbar {
  display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap;
  padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.addlabel { font-weight: 650; white-space: nowrap; }
.addlabel .muted { font-weight: 400; }
.addrow { display: flex; gap: 6px; flex: 0 1 520px; min-width: 0; }
.addrow input[type="url"] {
  flex: 1 1 auto; min-width: 0; padding: 5px 9px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit;
}
.addrow input[type="url"]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.addrow .btn { white-space: nowrap; }
.addrow .btn:disabled { opacity: .6; cursor: default; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.addnote { color: var(--ink-3); }
.addnote.ok { color: var(--f-franchise); }
.addnote.err { color: var(--site-patreon); }

/* ---------------------------------------------------------------- age gate */

#agegate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 12, 15, .82);
  backdrop-filter: blur(3px);
  padding: 20px;
}
html[data-gate="ok"] #agegate { display: none; }
.gate-card {
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 24px; max-width: 460px; box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}
.gate-card h1 { font-size: 28px; margin-bottom: 12px; }
.gate-card p { margin: 0 0 10px; }
.gate-actions { display: flex; gap: 10px; margin-top: 18px; }

/* ---------------------------------------------------------------- layout */

main { padding: 16px; }
main.browse {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  max-width: 1800px;
  margin: 0 auto;
}
main.detail, main.stats, main.errorpage { max-width: 1100px; margin: 0 auto; }

.foot {
  display: flex; flex-direction: column; gap: 2px;
  padding: 18px 16px 28px; border-top: 1px solid var(--line-2);
  margin-top: 24px; color: var(--ink-2); font-size: 12px;
}

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  position: sticky; top: 64px;
  max-height: calc(100vh - 80px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px;
}
.sidebar .search { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.sidebar .search input[type="search"] {
  flex: 1 1 100%; min-width: 0;
  padding: 7px 9px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  font: inherit;
}
.sidebar .search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.facet { padding: 10px 0; border-top: 1px solid var(--line-2); }
.facet:first-of-type { border-top: 0; }
.facet h2 {
  display: flex; align-items: baseline; gap: 8px;
  text-transform: uppercase; letter-spacing: .06em;
  font-size: 11px; color: var(--ink-3);
}
.clear { font-size: 11px; color: var(--accent); text-transform: none; letter-spacing: 0; }
.clear:hover { text-decoration: underline; }

.mode { display: flex; gap: 4px; margin: 0 0 8px; }
.mode a {
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-2);
}
.mode a.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.opts { list-style: none; margin: 0; padding: 0; }
.opt {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 6px; border-radius: 5px; color: var(--ink-2);
}
.opt:hover { background: var(--panel-2); color: var(--ink); }
.opt.on { color: var(--ink); font-weight: 600; }
.opt .tick { width: 11px; color: var(--accent); font-size: 11px; }
.opt .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt .n { color: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }

.more summary { font-size: 11px; color: var(--accent); cursor: pointer; padding: 4px 6px; }
.minsubs { margin-top: 8px; font-size: 11px; color: var(--ink-3); }
.minsubs-opts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.minsubs-opts a {
  padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2);
}
.minsubs-opts a.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.dot.s-patreon { background: var(--site-patreon); }
.dot.s-subscribestar { background: var(--site-subscribestar); }
.dot.s-fanbox { background: var(--site-fanbox); }

/* ---------------------------------------------------------------- toolbar */

.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 0 2px 12px;
}
.hits { color: var(--ink-2); }
.hits strong { color: var(--ink); font-size: 15px; }
.sorts { display: flex; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.sorts a { font-size: 12px; padding: 4px 10px; border-radius: 999px; color: var(--ink-2); }
.sorts a:hover { background: var(--panel-2); }
.sorts a.on { background: var(--accent); color: var(--accent-ink); }
.shows { display: flex; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.shows a { font-size: 12px; padding: 4px 10px; border-radius: 999px; color: var(--ink-2); white-space: nowrap; }
.shows a:hover { background: var(--panel-2); color: var(--ink); }
.shows a.on { background: var(--ink-2); color: var(--panel); }
.perpage { display: flex; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.perpage a { font-size: 12px; padding: 4px 9px; border-radius: 999px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.perpage a:hover { background: var(--panel-2); color: var(--ink); }
.perpage a.on { background: var(--panel-2); color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------------- grid */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr));
  gap: 8px;
}
.card {
  display: block;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; overflow: hidden;
  box-shadow: var(--shadow);
  padding-bottom: 6px;
  transition: border-color .1s ease;
  content-visibility: auto;
  contain-intrinsic-size: 154px 350px;
}
.card:hover { border-color: var(--accent); }

/* Square thumbnail: <img class="th"> or an empty <span class="th ph">. */
.th {
  display: block; width: 100%; aspect-ratio: 1; object-fit: cover;
  background: var(--panel-2); border-bottom: 1px solid var(--line-2);
}
.th.ph {
  background-image: var(--ph-image);
  background-repeat: no-repeat; background-position: center;
  background-size: 38% 38%;
  opacity: .55;
}
html[data-blur="1"] img.th { filter: blur(14px); }
html[data-blur="1"] .card:hover img.th { filter: blur(2px); }

.card .cr { display: flex; align-items: center; gap: 4px; padding: 5px 6px 0; }
/* Name row: the name takes the width, the latest-post age sits at the right.
   The subscriber count is deliberately not on the card (user decision
   2026-09-19): the space goes to labels instead. */
.card .name {
  display: flex; align-items: baseline; gap: 6px; padding: 2px 6px 0;
  font-size: 12.5px; font-weight: 620; line-height: 1.25;
}
.card .name .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .name .when {
  flex: 0 0 auto; font-size: 10.5px; font-weight: 400; font-style: normal;
  color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.card .name .when.pub { color: var(--f-franchise); }
/* Six rows of chips (the card budget went 3 -> 8 -> 12 labels on 2026-09-19). */
.card .chips { padding: 4px 6px 0; gap: 3px; max-height: 126px; overflow: hidden; align-content: flex-start; }
.card .chip { font-size: 10px; padding: 0 4px; }
.card .badge { font-size: 9px; padding: 1px 4px; font-style: normal; }
.card .revenue { margin-left: auto; font-size: 11.5px; }
.card .pill {
  font-size: 9px; font-style: normal; text-transform: uppercase; letter-spacing: .03em;
  padding: 1px 4px; border-radius: 3px; white-space: nowrap;
  background: var(--panel-2); color: var(--ink-3); border: 1px solid var(--line);
}
/* Not yet tagged by the local-LLM system: a dashed outline, so a provisional
   card is recognisable at a glance without shouting. */
.card .pill.untag {
  border-style: dashed; background: transparent; color: var(--ink-3);
  letter-spacing: .02em;
}
.src-heading {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-3); margin: 0 0 4px; font-weight: 600;
}
.src-heading .muted { text-transform: none; letter-spacing: 0; margin-left: 6px; }
.untag-notice { border-left-style: dashed; }

.notice {
  margin: 8px 0 12px; padding: 8px 10px; max-width: 70ch;
  border-left: 3px solid var(--ink-3); background: var(--panel-2);
  border-radius: 0 4px 4px 0; color: var(--ink-2); font-size: 12.5px;
}
.notice strong { color: var(--ink); }

.card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Detail-page thumbnail (a single large image; inline SVG is fine here). */
.thumb { background: var(--panel-2); overflow: hidden; border-radius: 6px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.thumb-ph .ph { width: 42%; height: 42%; opacity: .28; }
.thumb-ph .ph rect { fill: none; stroke: currentColor; stroke-width: 3; }
.thumb-ph .ph circle, .thumb-ph .ph path { fill: currentColor; }
html[data-blur="1"] .thumb img { filter: blur(16px); }
html[data-blur="1"] .thumb:hover img { filter: blur(2px); }
.badge {
  font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px; color: #fff; white-space: nowrap;
}
.badge.s-patreon { background: var(--site-patreon); }
.badge.s-subscribestar { background: var(--site-subscribestar); }
.badge.s-fanbox { background: var(--site-fanbox); }
.badge.adult { background: #b3352c; }
.badge[class*="st-"] { background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line); }
.badge.st-active { background: transparent; color: var(--f-franchise); border-color: currentColor; }
.badge.st-pending { background: transparent; color: var(--f-theme); border-color: currentColor; }

.revenue {
  font-size: 12px; font-weight: 650; color: var(--ink);
  font-variant-numeric: tabular-nums; margin-left: auto; white-space: nowrap;
}
.subs { font-size: 11.5px; font-variant-numeric: tabular-nums; margin-top: -2px; }
.updated { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.tiers th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 4px 8px 6px 0; border-bottom: 1px solid var(--line); }
.tiers td { padding: 5px 8px 5px 0; border-bottom: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.method { margin: 0 0 12px; max-width: 60ch; }
.empty-title { font-size: 15px; color: var(--ink); font-weight: 600; }
.name {
  font-size: 13.5px; font-weight: 620; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.latest { display: flex; gap: 5px; align-items: baseline; font-size: 11.5px; color: var(--ink-3); min-width: 0; }
.latest .lock { color: var(--ink-3); }
.latest .ptitle { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.latest .pdate { white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font-size: 10.5px; line-height: 1.6; padding: 0 6px; border-radius: 4px;
  border: 1px solid; background: transparent; white-space: nowrap;
}
.chip .conf { margin-left: 4px; opacity: .6; font-variant-numeric: tabular-nums; }
.chip.f-language { color: var(--f-language); border-color: color-mix(in srgb, var(--f-language) 35%, transparent); background: color-mix(in srgb, var(--f-language) 9%, transparent); }
.chip.f-format { color: var(--f-format); border-color: color-mix(in srgb, var(--f-format) 35%, transparent); background: color-mix(in srgb, var(--f-format) 9%, transparent); }
.chip.f-theme { color: var(--f-theme); border-color: color-mix(in srgb, var(--f-theme) 35%, transparent); background: color-mix(in srgb, var(--f-theme) 9%, transparent); }
.chip.f-franchise { color: var(--f-franchise); border-color: color-mix(in srgb, var(--f-franchise) 35%, transparent); background: color-mix(in srgb, var(--f-franchise) 9%, transparent); }
.chip.raw { color: var(--ink-2); border-color: var(--line); background: var(--panel-2); }
a.chip:hover { filter: brightness(1.1); text-decoration: underline; }

.empty { padding: 40px; text-align: center; color: var(--ink-3); }

.pager { display: flex; align-items: center; gap: 6px; padding: 18px 2px; flex-wrap: wrap; }
.pager a {
  min-width: 30px; text-align: center; padding: 5px 9px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink-2);
}
.pager a:hover { background: var(--panel-2); color: var(--ink); }
.pager a.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pager .gap { color: var(--ink-3); }

/* ---------------------------------------------------------------- detail */

.crumbs { margin: 0 0 12px; color: var(--accent); font-size: 12px; }
.profile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.profile-head { display: flex; gap: 18px; padding: 18px; border-bottom: 1px solid var(--line-2); }
.thumb.big { width: 200px; flex: 0 0 200px; aspect-ratio: 1; border-radius: var(--radius); }
.profile-meta { min-width: 0; }
.profile-meta h1 { margin: 8px 0 2px; font-size: 22px; }
.handle { margin: 0 0 8px; color: var(--ink-3); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.headline { margin: 0 0 12px; }
.actions { margin: 0; }

.block { padding: 16px 18px; border-top: 1px solid var(--line-2); }
.block:first-of-type { border-top: 0; }
.block h2 {
  text-transform: uppercase; letter-spacing: .06em; font-size: 11px; color: var(--ink-3);
  margin-bottom: 10px;
}
.block.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.block.cols h2 { margin-top: 18px; }
.block.cols > div > h2:first-child { margin-top: 0; }
.desc { margin: 0; white-space: pre-wrap; color: var(--ink-2); max-width: 80ch; }

.labelrow { display: flex; gap: 10px; align-items: baseline; padding: 3px 0; }
.facet-name { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; width: 84px; flex: 0 0 84px; }
.facet-name.f-language { color: var(--f-language); }
.facet-name.f-format { color: var(--f-format); }
.facet-name.f-theme { color: var(--f-theme); }
.facet-name.f-franchise { color: var(--f-franchise); }

/* What the tagger saw (observations), then why it labelled it (reason). */
.obs { margin: 10px 0 2px; color: var(--ink-2); max-width: 80ch; }
.why { margin: 2px 0 0; max-width: 80ch; }

table { border-collapse: collapse; width: 100%; font-size: 13px; }
.facts th { text-align: left; font-weight: 500; color: var(--ink-3); width: 140px; padding: 4px 8px 4px 0; vertical-align: top; }
.facts td { padding: 4px 0; word-break: break-word; }
.facts a { color: var(--accent); }

.posts th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 4px 8px 6px 0; border-bottom: 1px solid var(--line); }
.posts td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.posts a { color: var(--accent); }
.posts .pub { color: var(--f-franchise); }
.posts .locked { color: var(--f-theme); }
.tagcell { display: flex; flex-wrap: wrap; gap: 3px; }

.links { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.links li { padding: 3px 0; display: flex; gap: 8px; }
.links a { color: var(--accent); overflow: hidden; text-overflow: ellipsis; }
.links .kind {
  flex: 0 0 84px; color: var(--ink-3); text-transform: uppercase; font-size: 10px;
  letter-spacing: .05em; padding-top: 2px;
}

.spark { display: block; max-width: 360px; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: color-mix(in srgb, var(--accent) 14%, transparent); stroke: none; }

/* ---------------------------------------------------------------- stats */

.tiles { display: flex; flex-wrap: wrap; gap: 10px; }
.tile {
  display: flex; flex-direction: column; gap: 2px; min-width: 120px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px;
}
.tile-n { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile-l { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }

main.stats .block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }
.matrix th { text-align: left; padding: 5px 10px 5px 0; }
.matrix thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.matrix td { padding: 5px 10px 5px 0; border-bottom: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.matrix td.zero { color: var(--ink-3); }
.matrix tr.totals td, .matrix tr.totals th { border-bottom: 0; font-weight: 650; }

.statcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.statcol h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.bars { list-style: none; margin: 0; padding: 0; }
.bars a { display: grid; grid-template-columns: minmax(0, 1fr) 70px 46px; gap: 8px; align-items: center; padding: 2px 0; font-size: 12px; }
.bars a:hover .bar-l { color: var(--accent); }
.bar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bar-track { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 3px; background: var(--ink-3); }
.bar-fill.f-language { background: var(--f-language); }
.bar-fill.f-format { background: var(--f-format); }
.bar-fill.f-theme { background: var(--f-theme); }
.bar-fill.f-franchise { background: var(--f-franchise); }
.bar-n { text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- error */

.errbox {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; margin-top: 40px;
}
.detail { background: var(--panel-2); padding: 10px; border-radius: 6px; overflow-x: auto; font-size: 12px; color: var(--ink-2); }

/* --- Claude's confidence threshold (taxonomy v3) -------------------------- */

/* Sidebar, under Site: the minimum confidence a label needs to filter, count
   and appear on a card.  Buttons reuse .minsubs-opts. */
.confbox .minsubs-opts a { font-variant-numeric: tabular-nums; }


/* Card chips carry the number, small and quiet: a 0.4 guess must look like one. */
.card .chip .conf { margin-left: 3px; opacity: .55; font-weight: 400; }

/* Detail page: labels below the threshold stay visible, faded. */
.chip.below { opacity: .42; }
.chip.below:hover { opacity: .75; }
.conf-note { margin-top: 6px; }
.checked { margin-top: 4px; display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.checked .chip { opacity: .85; }
.checked .ck-page_blocked { color: var(--site-patreon); }


/* ---------------------------------------------------------------- responsive
   Desktop is the layout above.  Below 900px the sidebar becomes a drawer
   (opened from the toolbar's Filters button; app.js), toolbars scroll
   sideways instead of wrapping into a wall of pills, and wide tables scroll
   inside their own box.  Without JS the sidebar simply stacks above the
   results, as it always did. */

.filters-btn, .drawer-head, .scrim, .topbar .narrow { display: none; }
/* Funnel-ish "three lines" icon, drawn in CSS (no inline SVG in the page). */
.filters-btn::before {
  content: ""; width: 14px; height: 10px;
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 14px 2px no-repeat,
    linear-gradient(currentColor, currentColor) 3px 4px / 8px 2px no-repeat,
    linear-gradient(currentColor, currentColor) 5px 8px / 4px 2px no-repeat;
}
.filters-btn .count {
  min-width: 18px; padding: 0 5px; border-radius: 999px; text-align: center;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 650;
}
/* Desktop: the pill groups sit in the toolbar as before. */
.toolgroups { display: contents; }
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tablewrap > table { min-width: 100%; }

.topbar {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
.foot { padding-bottom: max(28px, env(safe-area-inset-bottom)); }

/* Very wide screens: more room, slightly larger cards. */
@media (min-width: 2000px) {
  main.browse { max-width: 2400px; grid-template-columns: 280px minmax(0, 1fr); }
  :root { --card-w: 172px; }
  .card { contain-intrinsic-size: 172px 370px; }
  main.detail, main.stats, main.errorpage { max-width: 1300px; }
}

@media (max-width: 900px) {
  main.browse { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; max-height: none; }
  .block.cols { grid-template-columns: minmax(0, 1fr); }

  html[data-js] .filters-btn { display: inline-flex; }
  html[data-js] .sidebar {
    position: fixed; z-index: 60; top: 0; bottom: 0; left: 0;
    width: min(340px, 88vw); max-height: none;
    border-radius: 0; border-width: 0 1px 0 0;
    padding: 0 14px max(16px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    overscroll-behavior: contain;
    transform: translateX(-102%); visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
    box-shadow: 8px 0 32px rgba(0, 0, 0, .25);
  }
  html[data-filters="open"] .sidebar {
    transform: none; visibility: visible;
    transition: transform .2s ease, visibility 0s;
  }
  html[data-js] .drawer-head {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 1;
    margin: 0 -14px 10px; padding: 10px 14px;
    background: var(--panel); border-bottom: 1px solid var(--line-2);
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .scrim:not([hidden]) {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(10, 12, 15, .5);
  }
  html[data-filters="open"] body { overflow: hidden; }

  .toolbar { gap: 8px; }
  .toolbar .spacer { display: none; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  main { padding: 10px; }
  .topbar { gap: 10px; }
  .topbar .wide { display: none; }
  .topbar .narrow { display: inline; }
  .updated { font-size: 11px; }

  /* All pill groups share one swipeable row, sort order first. */
  .toolbar { gap: 8px; }
  .toolbar .hits { flex: 1 1 auto; }
  .toolgroups {
    display: flex; gap: 6px; flex: 1 1 100%; min-width: 0;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin: 0 -10px; padding: 0 10px 2px;
    -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent);
            mask-image: linear-gradient(90deg, #000 92%, transparent);
  }
  .toolgroups::-webkit-scrollbar { display: none; }
  .toolgroups > * { flex: 0 0 auto; }
  .toolgroups .sorts { order: -1; }
  .toolgroups .spacer { display: none; }
  .sorts a { white-space: nowrap; }

  .sidebar .search input[type="search"] { flex: 1 1 0; }

  /* Two cards across even on a 320px screen. */
  :root { --card-w: 136px; }
  .grid { gap: 6px; }
  .card { contain-intrinsic-size: 136px 330px; }
  .card .cr { flex-wrap: wrap; row-gap: 2px; }
  .card .revenue { font-size: 11px; }

  .addbar { padding-top: 7px; padding-bottom: 7px; gap: 4px 8px; }
  .addlabel { font-size: 12px; white-space: normal; }
  .addrow { flex: 1 1 100%; order: 2; }
  .addnote { font-size: 11.5px; }
  .addrow input[type="url"] { font-size: 16px; padding: 6px 9px; }

  /* iOS zooms into inputs under 16px. */
  .sidebar .search input[type="search"] { font-size: 16px; }

  .pager { justify-content: center; }
  .pager .muted { flex-basis: 100%; text-align: center; }

  .gate-card { padding: 20px; }
  .gate-card h1 { font-size: 24px; }
  .gate-actions { flex-direction: column; }
  .gate-actions .btn { justify-content: center; padding: 10px 12px; }

  /* Detail page */
  .crumbs { margin-bottom: 8px; }
  .profile-head { flex-direction: row; gap: 12px; padding: 12px; flex-wrap: wrap; }
  .thumb.big { width: 96px; flex: 0 0 96px; }
  .profile-meta { flex: 1 1 180px; }
  .profile-meta h1 { font-size: 19px; margin-top: 6px; }
  .actions .btn { width: 100%; justify-content: center; padding: 10px 12px; }
  .block { padding: 12px; }
  .labelrow { flex-direction: column; gap: 3px; padding: 5px 0; }
  .facet-name { width: auto; flex: none; }
  .facts th { width: 108px; }
  .links li { flex-direction: column; gap: 0; padding: 4px 0; }
  .links .kind { flex: none; }
  .links a { word-break: break-all; }
  .posts { font-size: 12.5px; }
  .posts .tagcell { min-width: 140px; }
  .spark { max-width: 100%; }

  /* Stats page */
  .tile { flex: 1 1 calc(50% - 10px); min-width: 0; }
  .bars a { grid-template-columns: minmax(0, 1fr) 56px 42px; }
}

@media (max-width: 380px) {
  .updated { display: none; }
}

@media (max-width: 900px) and (min-width: 641px) {
  .profile-head { flex-direction: column; }
  .thumb.big { width: 140px; flex-basis: 140px; }
}

/* Touch screens: bigger hit areas for the small links. */
@media (pointer: coarse) {
  .opt { padding: 7px 6px; }
  .mode a, .minsubs-opts a { padding: 5px 10px; font-size: 12px; }
  .shows a, .sorts a, .perpage a { padding: 7px 11px; }
  .pager a { padding: 8px 12px; min-width: 38px; }
  .more summary { padding: 8px 6px; }
  .btn.small { padding: 6px 10px; }
  .clear { padding: 4px 0; }
}

/* ---------------------------------------------------------------- tag corrections
   Detail page "Suggest a correction": the × after each chip appears only in
   edit mode (.labels-block.editing); a struck-through chip is a pending
   removal.  web/feedback.py stores what is sent; nothing changes live. */

.chipx { display: inline-flex; align-items: center; gap: 1px; }
.chip-rm {
  display: none; border: 0; background: transparent; color: var(--ink-3);
  font: inherit; font-size: 13px; line-height: 1; padding: 0 3px; cursor: pointer; border-radius: 3px;
}
.chip-rm:hover { color: var(--site-patreon); background: var(--panel-2); }
.labels-block.editing .chipx > .chip-rm { display: inline-block; }
.chipx.rm > .chip { text-decoration: line-through; opacity: .45; }
.chipx.rm > .chip-rm { color: var(--site-patreon); }

.tagfb-open { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.tagfb {
  margin-top: 10px; padding: 12px; max-width: 620px;
  border: 1px dashed var(--line); border-radius: var(--radius); background: var(--panel-2);
}
.tagfb p { margin: 0 0 10px; }
.tagfb-add { display: flex; gap: 6px; flex-wrap: wrap; }
.tagfb select, .tagfb input:not(.hp), .tagfb textarea {
  padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font: inherit;
}
.tagfb-add input { flex: 1 1 180px; min-width: 0; }
.tagfb textarea { display: block; width: 100%; margin-top: 8px; resize: vertical; }
.tagfb-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12.5px; }
.tagfb-list li { display: flex; align-items: center; gap: 4px; padding: 2px 0; }
.tagfb-list li.add span { color: var(--f-franchise); }
.tagfb-list li.rm span { color: var(--site-patreon); }
.tagfb-list .chip-rm { display: inline-block; }
.tagfb-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.tagfb .ok { color: var(--f-franchise); }
.tagfb .err { color: var(--site-patreon); }
@media (pointer: coarse) {
  .chip-rm { font-size: 16px; padding: 2px 6px; }
}
@media (max-width: 640px) {
  .tagfb select, .tagfb input:not(.hp), .tagfb textarea { font-size: 16px; }
}

/* ---------------------------------------------------------------- comments board
   Detail page, bottom: numbered posts with a daily per-thread ID, board style. */

.board-list { list-style: none; margin: 0 0 14px; padding: 0; max-width: 820px; }
.board-list > li { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.board-list > li:target { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.board-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.board-num { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.board-name { font-weight: 650; color: var(--f-franchise); }
.board-meta { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.board-report {
  margin-left: auto; border: 0; background: none; color: var(--ink-3); font: inherit; font-size: 11px;
  cursor: pointer; padding: 2px 4px; border-radius: 4px;
}
.board-report:hover { color: var(--site-patreon); background: var(--panel-2); }
.board-report:disabled { cursor: default; opacity: .7; }
.board-text { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.board-ref { color: var(--accent); }
.board-empty { padding: 6px 0; border: 0 !important; }
.board-form { max-width: 820px; }
.board-form input:not(.hp), .board-form textarea {
  padding: 6px 9px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font: inherit;
}
.board-row { display: flex; gap: 8px; margin-bottom: 6px; }
.board-row input { width: 220px; max-width: 100%; }
.board-form textarea { display: block; width: 100%; resize: vertical; }
.board-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.board .ok { color: var(--f-franchise); }
.board .err { color: var(--site-patreon); }
@media (max-width: 640px) {
  .board-form input:not(.hp), .board-form textarea { font-size: 16px; }
  .board-row input { width: 100%; }
}
@media (pointer: coarse) {
  .board-report { padding: 6px 8px; }
}

/* ---------------------------------------------------------------- tag landing pages & share */
.landing { margin: 0 2px 14px; }
.landing h1 { font-size: 24px; margin: 0 0 6px; }
.landing p { margin: 0; max-width: 75ch; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.share { background: var(--ink); border-color: var(--ink); color: var(--panel); }
.btn.share:hover { filter: brightness(1.15); background: var(--ink); }
