/* ---------- design tokens ---------- */
:root {
  --bg-0: #0b0d12;
  --bg-1: #11141c;
  --bg-2: #161a25;
  --bg-3: #1d2130;
  --bg-4: #262b3d;
  --rule: #262b3d;
  --rule-2: #303650;

  --fg-0: #f2f4fa;
  --fg-1: #d3d7e3;
  --fg-2: #9aa0b3;
  --fg-3: #6b7185;

  --brand: #7cc4ff;
  --brand-2: #5aa9f0;
  --accent: #ffb86b;
  --good: #66d39c;
  --warn: #f06292;
  --code: #fde68a;
  --mb: #aad4ff;
  --rpc: #d6a4ff;
  --umsg: #b8e6c8;

  --mono: ui-monospace, "JetBrains Mono", "Fira Code", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-pill: 999px;
  --shadow: 0 1px 0 rgba(0,0,0,.4), 0 8px 24px -8px rgba(0,0,0,.5);
  --shadow-soft: 0 1px 2px rgba(0,0,0,.25), 0 4px 16px -6px rgba(0,0,0,.35);
  --shadow-lift: 0 2px 4px rgba(0,0,0,.3), 0 12px 28px -10px rgba(0,0,0,.5);

  /* Spacing scale: use these instead of arbitrary px values for new components. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  /* Motion: short for input feedback, medium for entrances, long for ambient. */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.4, 0, .2, 1);
  --dur-fast: 120ms;
  --dur-med: 200ms;
  --dur-slow: 320ms;

  --transition: var(--dur-fast) var(--ease-out);
}

/* ---------- motion vocabulary (used by dashboard-style pages only) ---------- */
@keyframes uiFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes uiFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes uiSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes uiSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* Loading spinner: used in place of "loading..." text where appropriate. */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--rule);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: uiSpin .8s linear infinite;
  vertical-align: -3px;
  margin-right: 6px;
}

/* Reusable button vocabulary. Modifiers compose on the .btn base. Existing pages
   that use class names like .support-analyze-btn keep working via aliases below. */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font: inherit;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--bg-3);
  color: var(--fg-1);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.btn:hover:not(:disabled) { background: var(--bg-4); color: var(--fg-0); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary {
  background: var(--brand); color: var(--bg-0);
  border-color: var(--brand);
  font-weight: 600;
}
.btn--primary:hover:not(:disabled) { background: var(--brand-2); border-color: var(--brand-2); color: var(--bg-0); box-shadow: 0 4px 14px -4px rgba(124,196,255,.45); }
.btn--secondary {
  background: transparent;
  color: var(--fg-1);
  border-color: var(--rule);
}
.btn--secondary:hover:not(:disabled) { background: var(--bg-3); color: var(--fg-0); border-color: var(--rule-2); }
.btn--quiet {
  background: transparent;
  color: var(--fg-2);
  border-color: transparent;
  padding: 3px 8px;
  font-size: 11.5px;
}
.btn--quiet:hover:not(:disabled) { color: var(--fg-0); background: var(--bg-3); }

/* Alias the older button class names to the new vocabulary so existing markup
   inherits the consistent style without us hand-editing every call site. */
.support-analyze-btn, .theft-scan-btn, .compare-bar button:not(:disabled) {
  display: inline-flex; align-items: center; gap: var(--space-2);
  background: var(--brand); color: var(--bg-0);
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: 6px 14px; font: inherit; font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.support-analyze-btn:hover:not(:disabled),
.theft-scan-btn:hover:not(:disabled),
.compare-bar button:hover:not(:disabled) {
  background: var(--brand-2); border-color: var(--brand-2);
  box-shadow: 0 4px 14px -4px rgba(124,196,255,.45);
}
.support-analyze-btn:active:not(:disabled),
.theft-scan-btn:active:not(:disabled),
.compare-bar button:active:not(:disabled) { transform: translateY(1px); }
.support-secondary-btn, .btn-tiny {
  background: transparent; color: var(--fg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 4px 10px; font: inherit; font-size: 11.5px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.support-secondary-btn:hover:not(:disabled),
.btn-tiny:hover:not(:disabled) {
  background: var(--bg-3); color: var(--fg-0); border-color: var(--rule-2);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(124,196,255,.05), transparent 60%),
    radial-gradient(800px 500px at -10% 110%, rgba(255,184,107,.04), transparent 60%),
    var(--bg-0);
  color: var(--fg-1);
  font: 14px/1.55 var(--sans);
  letter-spacing: .01em;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-2); text-decoration: underline; text-underline-offset: 3px; }
code, .mono { font-family: var(--mono); font-size: .9em; }
::selection { background: rgba(124,196,255,.3); color: var(--fg-0); }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow: hidden;
}
.sidebar-head {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: baseline; gap: 8px; margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.brand a { color: var(--fg-0); }
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); display: inline-block; box-shadow: 0 0 8px rgba(124,196,255,.5); }
.brand-sub { color: var(--fg-3); font-size: 11px; font-weight: 400; letter-spacing: .02em; text-transform: uppercase; margin-top: 4px; }
.meta {
  color: var(--fg-2);
  font-size: 11.5px;
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.meta .chip {
  background: var(--bg-3);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule-2);
}
.meta .chip strong { color: var(--fg-1); }

.toolbar {
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-1);
}
.search {
  width: 100%;
  padding: 9px 12px 9px 32px;
  background: var(--bg-3);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius-sm);
  color: var(--fg-0);
  font: 13px var(--sans);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(124,196,255,.18);
}
.search-wrap { position: relative; }
.search-wrap::before {
  content: '⌕';
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--fg-3); font-size: 14px; pointer-events: none;
}

nav { overflow-y: auto; padding: 8px 8px 24px; flex: 1; }
nav::-webkit-scrollbar { width: 8px; }
nav::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }
nav::-webkit-scrollbar-track { background: transparent; }

.cat { margin: 6px 0; }
.cat-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--fg-3);
  padding: 6px 10px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  user-select: none;
  background: transparent;
  border: 0;
  font-family: inherit;
  text-align: left;
}
.cat-h:hover { color: var(--fg-1); background: var(--bg-2); }
.cat-h:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.cat-h .count { background: var(--bg-3); color: var(--fg-2); padding: 1px 7px; border-radius: 10px; font-size: 10px; font-weight: 600; }
.cat-h .arrow { color: var(--fg-3); transition: transform var(--transition); font-size: 10px; margin-right: 4px; }
.cat.collapsed .arrow { transform: rotate(-90deg); }
.cat.collapsed ul { display: none; }
.cat ul { list-style: none; padding: 0; margin: 2px 0 0; }
.cat li { position: relative; }
.cat li a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 22px;
  color: var(--fg-1);
  font-size: 13px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12.5px;
  transition: background var(--transition), color var(--transition);
}
.cat li a:hover { background: var(--bg-2); color: var(--fg-0); text-decoration: none; }
.cat li.active a {
  background: linear-gradient(90deg, rgba(124,196,255,.18), rgba(124,196,255,.04));
  color: var(--fg-0);
  font-weight: 600;
  border-left: 2px solid var(--brand);
  padding-left: 20px;
}
.cat li.asset a::after {
  content: '●';
  margin-left: auto;
  color: var(--accent);
  font-size: 8px;
  flex-shrink: 0;
}
.cat li.mb a::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--mb); opacity: .6;
  flex-shrink: 0;
}
.cat li:not(.mb) a::before {
  content: '';
  width: 6px; height: 6px; border-radius: 1px;
  background: var(--fg-3); opacity: .4;
  flex-shrink: 0;
}

/* ---------- main ---------- */
.main {
  padding: 28px 36px 56px;
  max-width: 1100px;
  min-width: 0;
}
.crumbs {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--fg-3);
  margin-bottom: 10px;
  font-family: var(--mono);
}
.crumbs a { color: var(--fg-3); }
.crumbs a:hover { color: var(--brand); }
.crumbs .sep { opacity: .5; }

.title-row { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.title-row h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--fg-0);
}
.title-row .kind {
  color: var(--fg-3);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
}
.sub {
  color: var(--fg-3);
  font-family: var(--mono);
  font-size: 12.5px;
  margin: 4px 0 12px;
}
.sub .src-link { color: var(--fg-2); }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag {
  display: inline-block;
  background: var(--bg-3);
  color: var(--fg-2);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-family: var(--mono);
  border: 1px solid var(--rule-2);
}
.tag.mb { background: rgba(170,212,255,.12); color: var(--mb); border-color: rgba(170,212,255,.25); }
.tag.rpc { background: rgba(214,164,255,.12); color: var(--rpc); border-color: rgba(214,164,255,.25); }
.tag.umsg { background: rgba(184,230,200,.12); color: var(--umsg); border-color: rgba(184,230,200,.25); }
.tag.serial { background: rgba(255,210,154,.12); color: var(--accent); border-color: rgba(255,210,154,.25); }
.tag.attr { background: var(--bg-3); color: var(--fg-2); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 18px 0 4px;
}
.stat {
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.stat .v { font-size: 20px; font-weight: 700; color: var(--fg-0); line-height: 1; }
.stat .k { font-size: 11px; color: var(--fg-3); text-transform: uppercase; letter-spacing: .08em; margin-top: 4px; }
.stat.has-asset .v { color: var(--accent); }

.section { margin-top: 28px; }
.section > h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--fg-3);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section > h3::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* ---------- hierarchy ---------- */
.kv {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 6px 18px;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.kv .k { color: var(--fg-3); font-size: 12px; padding-top: 2px; }
.kv .v {
  color: var(--fg-1);
  font-family: var(--mono);
  font-size: 13px;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.kv .chain {
  color: var(--fg-2);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 4px;
}
.kv .chain a, .kv .chain > span:not(.arrow) { white-space: nowrap; }
.kv .chain .arrow { color: var(--fg-3); margin: 0 6px; font-size: 11px; }

/* ---------- asset box ---------- */
.asset-grid { display: grid; gap: 12px; }
.asset-box {
  background: linear-gradient(160deg, rgba(255,184,107,.06), rgba(255,184,107,.01));
  border: 1px solid rgba(255,184,107,.2);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.asset-box h4 {
  margin: 0 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: .12em;
}
.asset-box .pair-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 4px 16px;
}
.asset-box .pair {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px dotted rgba(255,255,255,.04);
  font-family: var(--mono);
  font-size: 12.5px;
  align-items: baseline;
}
.asset-box .pair .ak { color: var(--fg-3); }
.asset-box .pair .av { color: var(--good); font-weight: 500; text-align: right; }
.asset-box .pair .av.num { color: var(--code); }
.asset-box .pair .av.bool { color: var(--mb); }
.asset-box .pair .av.str { color: var(--good); }
.asset-box .pair .av.obj { color: var(--fg-2); font-size: 11px; }

/* ---------- members ---------- */
.members { display: grid; gap: 8px; }
.mem {
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--rule-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 9px 12px;
  transition: border-color var(--transition);
}
.mem:hover { border-left-color: var(--brand); }
.mem .head { font-family: var(--mono); font-size: 13px; line-height: 1.6; word-break: break-word; }
.mem .head .mod { color: var(--fg-3); margin-right: 4px; }
.mem .head .type { color: var(--accent); }
.mem .head .name { color: var(--brand); font-weight: 600; }
.mem .head .punc { color: var(--fg-3); }
.mem .head .init { color: var(--code); }
.mem .head .init.lit { background: rgba(253,230,138,.08); padding: 0 4px; border-radius: 3px; }
.mem.method .head .name { color: var(--good); }
.mem.field .head .name { color: var(--brand); }
.mem.prop .head .name { color: var(--mb); }

.mem .tag-row { margin-top: 4px; }
.mem details { margin-top: 6px; }
.mem details summary { color: var(--fg-3); font-size: 11.5px; cursor: pointer; padding: 2px 0; user-select: none; }
.mem details summary:hover { color: var(--fg-1); }
.mem details summary::marker { color: var(--fg-3); }
.mem .magic-list { margin-top: 4px; }
.mem .magic-line {
  padding: 4px 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--fg-2);
  border-radius: 3px;
}
.mem .magic-line:hover { background: var(--bg-3); }
.mem .magic-line .magic {
  color: var(--code);
  font-weight: 700;
  background: rgba(253,230,138,.08);
  padding: 0 4px;
  border-radius: 3px;
}
.mem .magic-line .line { color: var(--fg-3); font-size: 10.5px; }
.mem .calls {
  columns: 2 220px;
  column-gap: 18px;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 11.5px;
}
.mem .calls div { break-inside: avoid; padding: 1px 0; color: var(--fg-2); }

/* ---------- cross-refs ---------- */
.refs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .refs-grid { grid-template-columns: 1fr; } }
.refs-panel {
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.refs-panel h4 { margin: 0 0 10px; font-size: 12px; color: var(--fg-2); font-weight: 600; }
.refs-panel h4 .count { color: var(--fg-3); font-weight: 400; margin-left: 4px; }
.refs-panel ul { list-style: none; padding: 0; margin: 0; columns: 2 140px; column-gap: 12px; }
.refs-panel li { break-inside: avoid; padding: 1px 0; font-family: var(--mono); font-size: 12px; }
.refs-panel.empty p { color: var(--fg-3); font-style: italic; margin: 0; font-size: 12px; }

/* ---------- welcome ---------- */
.hero {
  background: linear-gradient(160deg, rgba(124,196,255,.06), rgba(124,196,255,.01));
  border: 1px solid rgba(124,196,255,.2);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 22px;
}
.hero h2 { margin: 0 0 6px; font-size: 24px; color: var(--fg-0); }
.hero p { margin: 0; color: var(--fg-2); font-size: 14px; max-width: 760px; }
.feature-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 18px; }
.feature {
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.feature h4 { margin: 0 0 4px; font-size: 13px; color: var(--fg-0); }
.feature p { margin: 0; color: var(--fg-2); font-size: 12px; line-height: 1.5; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.cat-card {
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition);
}
.cat-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.cat-card .n { font-size: 22px; font-weight: 700; color: var(--brand); line-height: 1; }
.cat-card .name { font-size: 13px; color: var(--fg-1); margin-top: 4px; }
.cat-card .sub { font-size: 10.5px; color: var(--fg-3); margin: 0; }

/* ---------- footer ---------- */
.foot {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  color: var(--fg-3);
  font-size: 11.5px;
  font-family: var(--mono);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.foot a { color: var(--fg-2); }

/* ---------- misc ---------- */
.linkext::after { content: '↗'; font-size: 10px; margin-left: 2px; opacity: .6; }
.empty { color: var(--fg-3); font-style: italic; }
.pill { background: var(--bg-3); color: var(--fg-2); border-radius: 4px; padding: 1px 6px; font-size: 10.5px; margin-left: 4px; font-family: var(--mono); }
.pill.ext { background: rgba(240,98,146,.12); color: var(--warn); }
.pill.proj { background: rgba(102,211,156,.12); color: var(--good); }

/* ---------- branch picker / filter chips ---------- */
.branch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: 10px;
  font-size: 11.5px;
}
.branch-row .br-label { color: var(--fg-3); margin-right: 4px; }
.branch-pill {
  background: var(--bg-3);
  border: 1px solid var(--rule-2);
  color: var(--fg-2);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-family: var(--mono);
  cursor: pointer;
  transition: var(--transition);
}
.branch-pill:hover { background: var(--bg-4); color: var(--fg-0); border-color: var(--brand); }
.branch-pill.primary {
  background: linear-gradient(135deg, rgba(124,196,255,.18), rgba(124,196,255,.04));
  border-color: var(--brand);
  color: var(--fg-0);
  font-weight: 600;
}
.branch-pill.missing {
  opacity: .35;
  cursor: not-allowed;
  text-decoration: line-through;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.filter-chip {
  background: var(--bg-3);
  border: 1px solid var(--rule-2);
  color: var(--fg-2);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--mono);
  cursor: pointer;
  transition: var(--transition);
}
.filter-chip:hover { background: var(--bg-4); color: var(--fg-0); }
.filter-chip.active {
  background: var(--brand);
  color: #0a0e15;
  border-color: var(--brand);
  font-weight: 600;
}
.filter-chip.busy::after { content: ' ...'; opacity: .6; }

.cat li.rpc a::before {
  background: var(--rpc);
  opacity: .7;
  border-radius: 50%;
}
.cls-label { color: var(--accent); font-size: 11px; opacity: .85; }
.cat li.active .cls-label { color: var(--accent-2); }
.cat.src-search .cat-h { color: var(--good); }
.cat.src-search li a { color: var(--fg-1); }

/* ---------- deprecation badge ---------- */
.deprecated-badge {
  display: inline-block;
  background: rgba(240,98,146,.16);
  color: var(--warn);
  border: 1px solid rgba(240,98,146,.4);
  border-radius: 4px;
  padding: 0 5px;
  margin-left: 4px;
  font-size: 10.5px;
  font-family: var(--mono);
  cursor: default;
}

/* ---------- patch badge in class detail ---------- */
.patch-badge {
  margin: 10px 0;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(255,184,107,.12), rgba(255,184,107,.04));
  border: 1px solid rgba(255,184,107,.4);
  border-radius: var(--radius);
  color: var(--fg-1);
  font-size: 12.5px;
  font-family: var(--mono);
}
.patch-badge a { color: var(--accent); }

/* ---------- mods page ---------- */
.mods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.show-more-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 4px;
}
.show-more-row:empty { margin: 0; }
.version-history.collapsed .version-row-extra { display: none; }
.ver-toggle { margin-top: 8px; }
.stored-theft-alert {
  border: 1px solid rgba(240, 98, 146, 0.45);
  background: rgba(240, 98, 146, 0.08);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 8px 0 12px;
}
.flag-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: rgba(240, 98, 146, 0.2);
  color: #f06292;
  border: 1px solid rgba(240, 98, 146, 0.5);
}
.method-compare-host { margin: 6px 0 4px; }
.method-compare-list { display: flex; flex-direction: column; gap: 10px; }
.method-pair { border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.method-pair.trivial { opacity: 0.6; }
.direction-verdict { background: var(--bg-2); border: 1px solid var(--rule); border-left: 3px solid var(--accent, #6fd19a); border-radius: var(--radius); padding: 8px 12px; margin: 8px 0; font-size: 13px; }
.theft-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 8px; }
.dismiss-bar { background: var(--bg-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 8px 12px; margin: 10px 0; font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Metadata/asset side-by-side (icons, descriptions, deps). */
.meta-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.meta-side { background: var(--bg-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.meta-side-head { font-size: 12px; margin-bottom: 8px; word-break: break-all; }
.meta-icon { width: 128px; height: 128px; border-radius: 12px; object-fit: cover; background: var(--bg-4); image-rendering: pixelated; }
.meta-icon.empty { display: flex; align-items: center; justify-content: center; font-size: 12px; }
.meta-desc { margin-top: 8px; font-size: 12.5px; color: var(--fg-2); white-space: pre-wrap; text-align: left; width: 100%; }
@media (max-width: 720px) { .meta-sides { grid-template-columns: 1fr; } }
/* Per-method origin pills: green = this side wrote it first, red = the other side
   (i.e. this side copied), grey = a third mod originated it. */
.flag-pill.origin-this     { background: rgba(110,209,154,.16); color: #6fd19a; }
.flag-pill.origin-other    { background: rgba(220,90,90,.18);  color: #e88; }
.flag-pill.origin-elsewhere{ background: var(--bg-4); color: var(--fg-2); }
.method-pair-title { display: flex; align-items: center; gap: 4px; }

/* Full-screen reader for code that doesn't fit inline (theft pairs, source diff). */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.62); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { width: 92vw; height: 88vh; background: var(--bg-2); border: 1px solid var(--rule); border-radius: var(--radius); display: flex; flex-direction: column; box-shadow: 0 16px 56px rgba(0,0,0,0.55); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--rule); flex-shrink: 0; }
.modal-title { font-size: 13px; word-break: break-all; }
.modal-body { flex: 1; min-height: 0; padding: 10px; display: flex; }
.modal-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; min-height: 0; }
.modal-sides.single { grid-template-columns: 1fr; }
.modal-side { display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.modal-side-head { padding: 6px 10px; font-size: 11px; color: var(--fg-2); border-bottom: 1px solid var(--rule); background: var(--bg-3); flex-shrink: 0; display: flex; align-items: center; gap: 6px; }
.modal-code { margin: 0; padding: 10px; overflow: auto; flex: 1; min-height: 0; font-size: 12px; line-height: 1.5; background: var(--bg-1); white-space: pre; tab-size: 4; }
@media (max-width: 720px) { .modal { width: 96vw; height: 92vh; } .modal-sides { grid-template-columns: 1fr; } }
.method-pair-title { padding: 5px 8px; background: var(--bg-3); font-size: 12px; border-bottom: 1px solid var(--rule); }
.method-snippet { margin: 0; padding: 8px; font-size: 11px; line-height: 1.45; overflow-x: auto; max-height: 240px; background: var(--bg-1); white-space: pre; }

/* Side-by-side matched-method diff. The body is ONE two-column grid so left line N
   and right line N share a grid row and stay aligned even when a long line wraps -
   that's what lets both sides show in full at any width with no horizontal scroll. */
.method-diff { background: var(--bg-1); }
.diff-head, .diff-grid { display: grid; grid-template-columns: 1fr 1fr; }
.method-diff.single .diff-head { grid-template-columns: 1fr; }
.diff-head-cell { padding: 4px 10px; font-size: 11px; color: var(--fg-2); background: var(--bg-3); border-bottom: 1px solid var(--rule); }
.diff-head-cell + .diff-head-cell { border-left: 1px solid var(--rule); }
.diff-scroll { max-height: 360px; overflow: auto; }
.diff-grid { font-family: var(--mono, ui-monospace, monospace); font-size: 11px; line-height: 1.5; }
.diff-cell { display: flex; min-width: 0; align-items: stretch; }
.diff-col-r { border-left: 1px solid var(--rule); }
.diff-cell .code-ln { user-select: none; flex-shrink: 0; min-width: 40px; padding: 0 8px; text-align: right; color: var(--fg-3); border-right: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.diff-cell .code-src { flex: 1; min-width: 0; padding: 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Per-line tints sit under the syntax highlight so tokens stay readable. */
.diff-cell.diff-del    { background: rgba(220,90,90,.16);  box-shadow: inset 2px 0 0 #e0564b; }
.diff-cell.diff-add    { background: rgba(110,209,154,.16); box-shadow: inset 2px 0 0 #5bbf86; }
.diff-cell.diff-change { background: rgba(255,190,90,.14);  box-shadow: inset 2px 0 0 #e0a84b; }
.diff-cell.diff-gap    { background: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(127,127,127,.05) 5px, rgba(127,127,127,.05) 10px); }
.diff-cell.diff-gap .code-ln { color: transparent; }
/* In the expand modal the grid fills the available height instead of a fixed cap. */
.modal-diff { display: flex; flex-direction: column; width: 100%; min-height: 0; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.modal-diff .diff-scroll { max-height: none; flex: 1; min-height: 0; }
.modal-diff .diff-grid { font-size: 12px; line-height: 1.55; }
/* Header pills summarising how different the two bodies are. */
.flag-pill.diff-pill-same    { background: rgba(220,90,90,.18);  color: #e88; }
.flag-pill.diff-pill-changed { background: var(--bg-4); color: var(--fg-2); }

/* Shared-class-name callout - the size-independent theft tell, shown loudly. */
.shared-types-banner { margin: 8px 0; padding: 8px 10px; background: rgba(220,90,90,.08); border: 1px solid rgba(220,90,90,.25); border-radius: var(--radius); }
.shared-types-banner.signature-hit { background: rgba(220,90,90,.14); border-color: rgba(220,90,90,.5); }
.shared-types-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.shared-type-chip { padding: 2px 7px; background: rgba(220,90,90,.14); border: 1px solid rgba(220,90,90,.3); border-radius: 4px; font-size: 12px; color: #f3a0a0; }
.shared-type-chip.signature-chip { background: rgba(255,80,80,.28); border-color: #e0564b; color: #ffd0cc; font-weight: 600; }
.signature-note { margin: 8px 0 0; font-size: 12px; color: #f0b3ad; }
.source-view-code { margin-top: 8px; padding: 10px; font-size: 12.5px; line-height: 1.55; background: var(--bg-1); border: 1px solid var(--rule); border-radius: var(--radius); height: 70vh; min-height: 360px; overflow: auto; white-space: pre; tab-size: 4; }
.div-row.clickable { cursor: pointer; }
.div-row.clickable:hover { background: var(--bg-3); }
.div-detail-row > td { background: var(--bg-1); padding: 10px 12px; }
.gh-div-tally { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.gh-div-chip { padding: 2px 10px; border-radius: 999px; font-size: 12px; border: 1px solid var(--rule); }
.gh-div-chip.ok   { background: rgba(70, 180, 110, 0.14); color: #6fd19a; }
.gh-div-chip.warn { background: rgba(220, 180, 70, 0.14); color: #e0c46a; }
.gh-div-chip.bad  { background: rgba(220, 90, 90, 0.16);  color: #e88; }
.gh-div-worst-row { padding: 3px 0; border-bottom: 1px solid var(--rule); font-size: 13px; }
.gh-div-worst-row:last-child { border-bottom: none; }
/* The authors leaderboard reuses .eval-table's borders but is a text table, not a
   numeric one: left-align everything and let the count columns be narrow, so the
   "theft signal" / "source disclosure" headers actually sit over their values. */
.authors-table { width: 100%; }
/* `table.authors-table` beats `.eval-table td`'s right-align (which is defined
   later in the file and would otherwise win at equal specificity). */
table.authors-table th, table.authors-table td { text-align: left; vertical-align: middle; white-space: nowrap; }
table.authors-table td.num, table.authors-table th.num { text-align: right; }
/* One non-reflowing row of [bar] [pct] [low?]: the badge no longer bumps the
   percentage onto a second line and shoves the rest of the row out of alignment. */
.disc-cell { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.disc-bar { display: inline-block; width: 70px; height: 8px; border-radius: 4px; background: var(--bg-4); overflow: hidden; flex-shrink: 0; }
.disc-fill { height: 100%; background: #6fd19a; }
.theft-verdict { padding: 1px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.tv-clean      { background: var(--bg-4); color: var(--fg-2); }
.tv-minor      { background: rgba(220, 180, 70, 0.14); color: #e0c46a; }
.tv-concerning { background: rgba(230, 140, 60, 0.16); color: #f0a868; }
.tv-high-theft { background: rgba(220, 90, 90, 0.18); color: #e88; }
.team-groups { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.team-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--radius); }
.team-chip { background: rgba(110, 160, 220, 0.14); }
.team-add { display: inline-flex; gap: 4px; align-items: center; margin-left: auto; }
.theft-alert-head { font-size: 14px; margin-bottom: 2px; }
.theft-thief { font-weight: 600; color: #e88; }
.theft-victim { color: #6fa0dc; }
.theft-alert-hit { font-size: 13px; padding: 1px 0 1px 4px; }
.theft-alert-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.scroll-grid {
  max-height: 720px;
  overflow-y: auto;
  padding-right: 6px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(0,0,0,.1);
}
.scroll-grid::-webkit-scrollbar { width: 8px; }
.scroll-grid::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }

/* version history table on the mod detail page */
.version-history {
  display: grid;
  gap: 4px;
  font-family: var(--mono);
  font-size: 12.5px;
  margin-top: 6px;
}
.version-row {
  display: grid;
  grid-template-columns: 22px 90px 100px 1fr auto;
  gap: 10px;
  padding: 4px 12px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  align-items: center;
  min-height: 0;
}
.version-row.current {
  border-color: var(--brand);
  background: linear-gradient(160deg, rgba(124,196,255,.06), var(--bg-2));
}
.version-num { color: var(--fg-0); font-weight: 600; }
.version-date { color: var(--fg-3); font-size: 11px; }
.inline-row { padding: 0; }

/* upload progress + result panel */
.upload-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-top: 14px;
}
.upload-step {
  padding: 6px 10px;
  border-radius: 4px;
  color: var(--fg-3);
  font-family: var(--mono);
  font-size: 12px;
  background: transparent;
  transition: all .25s;
  border-left: 3px solid var(--rule);
}
.upload-step.active { color: var(--brand); border-left-color: var(--brand); background: rgba(124,196,255,.06); }
.upload-step.done   { color: var(--good); border-left-color: var(--good); }

.upload-result { background: var(--bg-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; }
.upload-result .crumbs { color: var(--fg-3); margin-bottom: 4px; }
.upload-verdict {
  font-size: 16px;
  font-weight: 700;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin: 12px 0;
}
.upload-verdict.ok   { background: rgba(102,211,156,.08); border: 1px solid rgba(102,211,156,.4); color: var(--good); }
.upload-verdict.bad  { background: rgba(240,98,146,.10); border: 1px solid rgba(240,98,146,.5); color: var(--warn); }
.upload-verdict.warn { background: rgba(255,184,107,.10); border: 1px solid rgba(255,184,107,.5); color: var(--accent); }
.upload-verdict.neutral { background: var(--bg-3); border: 1px solid var(--rule-2); color: var(--fg-1); }

/* author profile score banner */
.author-score {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--bg-2);
  margin: 14px 0;
}
.author-score.score-very-high { border-color: rgba(102,211,156,.5); background: linear-gradient(135deg, rgba(102,211,156,.10), var(--bg-2)); }
.author-score.score-high      { border-color: rgba(102,211,156,.35); background: linear-gradient(135deg, rgba(102,211,156,.06), var(--bg-2)); }
.author-score.score-mid       { border-color: var(--rule-2); }
.author-score.score-low       { border-color: rgba(255,184,107,.4); background: linear-gradient(135deg, rgba(255,184,107,.06), var(--bg-2)); }
.author-score.score-very-low  { border-color: rgba(240,98,146,.4); background: linear-gradient(135deg, rgba(240,98,146,.10), var(--bg-2)); }
.author-score .as-score {
  font-size: 52px;
  font-weight: 800;
  font-family: var(--mono);
  line-height: 1;
  min-width: 80px;
  text-align: center;
  color: var(--fg-0);
}
.author-score.score-very-high .as-score { color: var(--good); }
.author-score.score-high      .as-score { color: var(--good); }
.author-score.score-low       .as-score { color: var(--accent); }
.author-score.score-very-low  .as-score { color: var(--warn); }
.author-score .as-meta { flex: 1; }
.author-score .as-verdict { font-size: 18px; font-weight: 700; color: var(--fg-0); }
.author-score .as-sub { color: var(--fg-2); font-size: 12px; font-family: var(--mono); margin-top: 4px; }

.score-breakdown { background: var(--bg-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 16px; margin: 10px 0; }
.score-breakdown summary { color: var(--fg-2); font-size: 13px; cursor: pointer; }
.score-plus { color: var(--good); font-weight: 700; min-width: 32px; display: inline-block; }
.score-minus { color: var(--warn); font-weight: 700; min-width: 32px; display: inline-block; }
.mod-card {
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  display: grid;
  /* Fixed row layout: icon | name | owner | description | meta | compat | action.
     Description gets 1fr (flex space); everything else stays fixed-height. Buttons land
     in the same spot on every card regardless of how long the description is. */
  grid-template-rows:
    [icon] auto
    [name] auto
    [owner] auto
    [desc] 1fr
    [meta] auto
    [compat] auto
    [status] auto
    [action] auto;
  gap: 6px;
  min-height: 240px;
  position: relative;
}
.mod-card .mod-desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 4.5em;
}
.mod-card .mod-action {
  align-self: end;
  justify-self: start;
}
.mod-card .theft-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(240, 98, 146, 0.16);
  color: #f06292;
  border: 1px solid rgba(240, 98, 146, 0.4);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease;
}
.mod-card a.theft-badge-link:hover {
  background: rgba(240, 98, 146, 0.32);
  color: #fff;
}
/* AI badge: appears inline inside the status strip, color-coded by verdict severity. */
.ai-flag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10.5px;
  font-family: var(--mono);
  border: 1px solid;
  cursor: default;
  white-space: nowrap;
}
.ai-flag.clean      { background: rgba(102,211,156,.08); border-color: rgba(102,211,156,.3); color: var(--good); }
.ai-flag.weak       { background: rgba(255,184,107,.08); border-color: rgba(255,184,107,.3); color: var(--accent); }
.ai-flag.likely     { background: rgba(255,184,107,.16); border-color: rgba(255,184,107,.5); color: var(--accent); font-weight: 600; }
.ai-flag.verylikely { background: rgba(240,98,146,.14);  border-color: rgba(240,98,146,.5);  color: var(--warn); font-weight: 700; }
.ai-flag.declared   { background: rgba(124,196,255,.10); border-color: rgba(124,196,255,.4); color: var(--brand); }
.ai-flag.neutral    { background: var(--bg-3); border-color: var(--rule-2); color: var(--fg-3); }

/* Status strip: fixed-height row above the action button so verdict is always at the same y-position. */
.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid var(--rule);
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 10.5px;
}
.status-cell {
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--rule-2);
  white-space: nowrap;
}
.status-cell.ok      { background: rgba(102,211,156,.08); border-color: rgba(102,211,156,.3); color: var(--good); }
.status-cell.bad     { background: rgba(240,98,146,.14); border-color: rgba(240,98,146,.5); color: var(--warn); font-weight: 700; }
.status-cell.watched { background: rgba(240,98,146,.10); border-color: rgba(240,98,146,.4); color: var(--warn); }
.status-cell.trusted { background: rgba(102,211,156,.10); border-color: rgba(102,211,156,.4); color: var(--good); }
.status-cell.neutral { color: var(--fg-3); }

/* Card-verdict borders. Most severe wins via the cardVerdict() ranking. */
.mod-card { transition: border-color .2s; }
.mod-card.card-verdict-theft         { border-color: rgba(240,98,146,.6); box-shadow: 0 0 0 1px rgba(240,98,146,.2); }
.mod-card.card-verdict-ai-suspicious { border-color: rgba(240,98,146,.4); }
.mod-card.card-verdict-watched       { border-color: rgba(240,98,146,.3); }
.mod-card.card-verdict-ai-weak       { border-color: rgba(255,184,107,.35); }
.mod-card.card-verdict-declared      { border-color: rgba(124,196,255,.3); }
.mod-card.card-verdict-clean         { border-color: var(--rule); }
.mod-icon { width: 56px; height: 56px; border-radius: 8px; align-self: flex-start; image-rendering: -webkit-optimize-contrast; }
.mod-name { font-size: 14px; font-weight: 700; color: var(--fg-0); font-family: var(--mono); }
.mod-card.trusted { border-color: rgba(102,211,156,.35); background: linear-gradient(160deg, rgba(102,211,156,.06), var(--bg-2)); }
.trusted-mark { color: var(--good); font-size: 13px; }

.trusted-section { background: var(--bg-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; }
.trusted-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.trusted-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 10px;
  border-radius: 999px;
  background: rgba(102,211,156,.10);
  border: 1px solid rgba(102,211,156,.35);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--good);
}
.trusted-chip .inline-toggle { padding: 0 6px; font-size: 11px; margin: 0; }

.cmp-picker { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.cmp-picker label { width: 16px; color: var(--fg-3); font-family: var(--mono); }
.cmp-result { margin-top: 10px; }
.cmp-summary { font-family: var(--mono); font-size: 13px; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--rule); border-radius: var(--radius); }
.cmp-pct, .cmp-verdict { font-weight: 700; }
.cmp-pct.ok, .cmp-verdict.ok { color: var(--good); }
.cmp-pct.warn, .cmp-verdict.warn { color: var(--accent); }
.cmp-pct.bad, .cmp-verdict.bad { color: var(--warn); }

.theft-alert {
  background: rgba(240,98,146,.06);
  border-left: 3px solid var(--warn);
  padding: 10px 12px;
  margin: 6px 0;
  border-radius: 4px;
}
.theft-alert strong { color: var(--warn); }

/* watchlist (subset of trusted-section styling, inverted color) */
.watchlist-section { border-color: rgba(240,98,146,.3); background: rgba(240,98,146,.03); }
.watch-chip {
  background: rgba(240,98,146,.10) !important;
  border-color: rgba(240,98,146,.4) !important;
  color: var(--warn) !important;
}
.mod-card.watched { box-shadow: inset 3px 0 0 var(--warn); }
.mod-icon-placeholder { background: var(--bg-3); border-radius: 8px; }

/* AI section styling on detail page */
.ai-section { background: var(--bg-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 16px; margin-top: 18px; }
.ai-section.suspicious { border-color: rgba(240,98,146,.4); background: rgba(240,98,146,.04); }
.ai-section.declared   { border-color: rgba(124,196,255,.3); background: rgba(124,196,255,.04); }
.ai-section.weak       { border-color: rgba(255,184,107,.3); }

.ai-reasons li { margin-bottom: 4px; }
.btn-tiny {
  font: inherit;
  font-size: 11px;
  padding: 1px 6px;
  margin-left: 6px;
  border: 1px solid var(--rule);
  background: var(--bg-3);
  color: var(--fg-2);
  border-radius: 4px;
  cursor: pointer;
}
.btn-tiny:hover { background: var(--bg-1); color: var(--fg-1); }
.evidence-list {
  margin: 6px 0 10px 18px;
  padding: 6px 10px;
  background: var(--bg-1);
  border-left: 2px solid var(--rule);
  font-size: 11.5px;
}
.ev-item { margin: 6px 0 10px; }
.ev-item:last-child { margin-bottom: 0; }
.ev-loc { color: var(--fg-3); font-size: 11px; margin-bottom: 2px; }
.ev-snip { color: var(--fg-2); white-space: pre-wrap; word-break: break-all; }
.ev-block {
  margin: 2px 0 0;
  padding: 4px 0;
  background: var(--bg-0);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font: 11px/1.45 var(--mono);
  overflow-x: auto;
  white-space: pre;
  color: var(--fg-2);
}
.ev-line { display: flex; padding: 0 8px; }
.ev-line.ev-match { background: rgba(255,184,107,.18); color: var(--fg-1); }
.ev-ln {
  display: inline-block;
  min-width: 42px;
  margin-right: 10px;
  text-align: right;
  color: var(--fg-3);
  user-select: none;
  border-right: 1px solid var(--rule);
  padding-right: 6px;
}
.ev-line.ev-match .ev-ln { color: var(--warn); }
.ev-tx { flex: 1; white-space: pre; }

/* Version-compare picker on mod detail page */
.version-row.compare-pick { background: rgba(124,196,255,.08); }
.version-row .ver-compare-cb { margin: 0; width: 14px; height: 14px; }
.compare-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; margin-bottom: 8px;
  background: var(--bg-2); border: 1px solid var(--rule); border-radius: var(--radius);
  font-size: 12.5px;
}
.compare-bar button {
  font: inherit; font-weight: 600;
  padding: 4px 14px; border-radius: 4px; cursor: pointer;
  background: var(--brand); color: var(--bg-0);
  border: 1px solid var(--brand);
}
.compare-bar button:hover:not(:disabled) { filter: brightness(1.1); }
.compare-bar button:disabled {
  background: var(--bg-3); color: var(--fg-2);
  border-color: var(--rule);
  cursor: not-allowed; font-weight: 500;
  opacity: 1;
}

/* Tabbed diff viewer (per-mod version compare) */
.diff-tabs-wrap { outline: none; margin-top: 8px; }
.diff-tabs-wrap:focus { box-shadow: 0 0 0 1px var(--brand); border-radius: var(--radius-sm); }
.diff-tabs-hint { margin: 0 0 6px; }
.diff-tab-strip {
  display: flex; gap: 2px;
  overflow-x: auto;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0;
  margin-bottom: 0;
  scrollbar-width: thin;
}
.diff-tab {
  flex: 0 0 auto;
  font: inherit; font-family: var(--mono); font-size: 12px;
  padding: 5px 12px;
  background: var(--bg-2);
  color: var(--fg-2);
  border: 1px solid var(--rule);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
}
.diff-tab:hover { background: var(--bg-3); color: var(--fg-1); }
.diff-tab.active {
  background: var(--bg-0);
  color: var(--fg-0);
  border-color: var(--rule) var(--rule) var(--bg-0);
  font-weight: 600;
}
.diff-tab .tab-counts { color: var(--fg-3); font-size: 11px; font-weight: normal; margin-left: 4px; }
.diff-tab.active .tab-counts { color: var(--fg-2); }
.diff-pane > .patch-file { margin-top: 0; }
.diff-pane > .patch-file > summary { padding-top: 10px; }

/* Theft-scan section on mod detail page */
.theft-scan {
  background: var(--bg-2); border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-soft);
}
.theft-controls {
  display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center;
  margin: var(--space-3) 0 var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-1); border-radius: var(--radius-sm);
}
.theft-controls label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--fg-2); cursor: pointer;
}
.theft-controls input[type="checkbox"] { margin: 0; }
.theft-scan-btn {
  font: inherit; font-weight: 600;
  padding: 5px 16px; border-radius: 4px; cursor: pointer;
  background: var(--brand); color: var(--bg-0);
  border: 1px solid var(--brand);
}
.theft-scan-btn:hover:not(:disabled) { filter: brightness(1.1); }
.theft-scan-btn:disabled {
  background: var(--bg-3); color: var(--fg-3);
  border-color: var(--rule);
  cursor: wait;
}
.theft-status { margin: 8px 0; font-size: 12px; }

/* Theft-scan in-progress strip: spinner, label, and a determinate bar. The
   bar goes indeterminate (pulsing sweep) when the server hasn't reported any
   "done/total" yet, then locks to a real percentage once progress comes in. */
.scan-progress {
  margin: 6px 0 10px;
  padding: 8px 10px;
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule);
}
.scan-progress-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--fg-2);
}
.scan-spinner {
  display: inline-block; width: 12px; height: 12px;
  border: 2px solid var(--rule); border-top-color: var(--brand);
  border-radius: 50%;
  animation: uiSpin .8s linear infinite;
}
.scan-progress-bar {
  position: relative; height: 6px; margin-top: 6px;
  background: var(--bg-3);
  border-radius: 999px; overflow: hidden;
}
.scan-progress-fill {
  height: 100%; width: 0;
  background: var(--brand);
  border-radius: inherit;
  transition: width 240ms ease-out;
}
.scan-progress-fill.indeterminate {
  width: 35% !important;
  animation: scanSweep 1.2s ease-in-out infinite;
}
@keyframes scanSweep {
  0%   { margin-left: -35%; }
  100% { margin-left: 100%; }
}

/* Skeleton placeholders: pulsing shimmer to convey "loading" without committing
   to a specific layout the data might not actually match. */
@keyframes skelPulse {
  0%, 100% { opacity: .55; }
  50%      { opacity: .85; }
}
.skel-line {
  height: 10px;
  margin: 6px 0;
  background: var(--bg-3);
  border-radius: 4px;
  animation: skelPulse 1.4s ease-in-out infinite;
}
.skel-w-40 { width: 40%; }
.skel-w-55 { width: 55%; }
.skel-w-60 { width: 60%; }
.skel-w-70 { width: 70%; }
.skel-w-90 { width: 90%; }
.skel-card {
  pointer-events: none;
  opacity: .9;
}
.skel-card .skel-icon {
  width: 64px; height: 64px;
  background: var(--bg-3); border-radius: var(--radius-sm);
  animation: skelPulse 1.4s ease-in-out infinite;
}
.theft-skel-card {
  margin: 8px 0;
  padding: 10px 12px;
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--rule);
}

.theft-results { margin-top: 8px; }
.theft-group {
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  border-left: 3px solid var(--rule);
  animation: uiFadeUp var(--dur-med) var(--ease-out) both;
}
.theft-group-victim  { border-left-color: var(--warn, #f06292); background: linear-gradient(90deg, rgba(240,98,146,.04), transparent 40%); }
.theft-group-suspect { border-left-color: var(--accent, #ffb86b); background: linear-gradient(90deg, rgba(255,184,107,.04), transparent 40%); }
.theft-group-ambig   { border-left-color: var(--rule-2); }
.theft-group h4 {
  margin: 0 0 4px; font-size: 13px;
  display: flex; align-items: baseline; gap: 6px;
}
.theft-arrow { font-size: 16px; opacity: 0.7; }
.theft-group-victim  .theft-arrow { color: var(--crit, #f06292); opacity: 1; }
.theft-group-suspect .theft-arrow { color: var(--warn, #ffb86b); opacity: 1; }
.theft-count { color: var(--fg-3); font-weight: normal; font-size: 12px; }

.theft-card {
  margin: var(--space-2) 0;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
  animation: uiFadeUp var(--dur-med) var(--ease-out) both;
}
.theft-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.theft-card.twin-very-strong { border-left: 3px solid var(--warn, #f06292); }
.theft-card.twin-strong      { border-left: 3px solid var(--accent, #ffb86b); }
.theft-card.twin-moderate    { border-left: 3px solid var(--rule-2); }
.theft-card-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.theft-mod-link { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--fg-0); text-decoration: none; }
.theft-mod-link:hover { text-decoration: underline; color: var(--brand); }
.theft-mod-link .sub { font-weight: normal; font-size: 11px; margin-left: 6px; }
.theft-date { font-size: 11px; }

.theft-meter {
  height: 4px; width: 100%;
  background: var(--bg-1);
  border-radius: 2px;
  overflow: hidden;
  margin: 4px 0 6px;
}
.theft-meter-bar { height: 100%; background: var(--fg-3); transition: width 0.2s; }
.theft-meter.weak       .theft-meter-bar { background: var(--fg-3); }
.theft-meter.moderate   .theft-meter-bar { background: var(--warn, #ffb86b); }
.theft-meter.strong     .theft-meter-bar { background: rgba(240,98,146,.8); }
.theft-meter.very-strong .theft-meter-bar { background: var(--crit, #f06292); }

.theft-verdict {
  font-size: 13px;
  margin: var(--space-2) 0 var(--space-1);
  color: var(--fg-1);
}
.theft-verdict.weak       { color: var(--fg-2); font-weight: 500; }
.theft-verdict.moderate   { color: var(--accent, #ffb86b); font-weight: 600; }
.theft-verdict.strong     { color: rgba(240,98,146,.9); font-weight: 600; }
.theft-verdict.very-strong { color: var(--warn, #f06292); font-weight: 700; }

.theft-stats {
  display: flex; flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  font-size: 11.5px;
  margin-top: var(--space-2);
}
.theft-stat { display: inline-flex; flex-direction: column; gap: 2px; }
.theft-stat .k { color: var(--fg-3); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.theft-stat .v {
  font: 600 14px var(--mono);
  color: var(--fg-1);
  font-variant-numeric: tabular-nums;
}
.theft-stat .v.identical-strong      { color: var(--accent, #ffb86b); }
.theft-stat .v.identical-very-strong { color: var(--warn, #f06292); }

.theft-types { margin-top: 4px; line-height: 1.8; }
.theft-type-chip {
  display: inline-block;
  font-family: var(--mono); font-size: 11px;
  padding: 1px 6px; margin: 0 4px 2px 0;
  background: var(--bg-0); border: 1px solid var(--rule); border-radius: 3px;
  color: var(--fg-2);
}
.theft-type-chip.signature-chip { background: rgba(255,80,80,.28); border-color: #e0564b; color: #ffd0cc; font-weight: 600; }

/* Thief flag + full-corpus scan results on the author page. */
.trusted-chip.thief-chip { background: rgba(220,60,60,.22); color: #ff9b94; border: 1px solid rgba(220,60,60,.5); }
.inline-toggle.danger { color: #e88; border-color: rgba(220,90,90,.4); }
.inline-toggle.danger:hover { background: rgba(220,90,90,.12); }
.thief-scan-section { margin-top: 14px; }
.thief-mod-card { border: 1px solid var(--rule); border-radius: var(--radius); margin: 8px 0; overflow: hidden; }
.thief-mod-head { padding: 6px 10px; background: var(--bg-3); border-bottom: 1px solid var(--rule); font-size: 12.5px; }
.thief-source-row { padding: 6px 10px; border-top: 1px solid var(--rule); }
.thief-source-row:first-child { border-top: none; }
.thief-source-row.signature-hit { background: rgba(220,90,90,.07); }
.thief-source-line { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.thief-source-line .inline-toggle { margin-left: auto; }

/* Removed-from-store annotations */
.banner.removed-banner {
  margin: 6px 0 14px;
  padding: 10px 14px;
  border-left: 3px solid var(--crit, #f06292);
  background: rgba(240,98,146,.06);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--fg-1);
}
.version-row.removed {
  opacity: 0.6;
  background: rgba(240,98,146,.04);
}
.version-row.removed .version-num { text-decoration: line-through; }
/* Theft preview chips on mod cards */
.theft-preview-row {
  display: flex; flex-wrap: wrap; gap: var(--space-1);
  margin-top: var(--space-1);
}
.theft-chip {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: default;
  line-height: 1.5;
  transition: transform var(--dur-fast) var(--ease-out),
              filter var(--dur-fast) var(--ease-out);
}
.theft-chip:hover { transform: translateY(-1px); filter: brightness(1.15); }

/* Whole mod card is clickable → navigate to detail page on click. Inner links and
   buttons opt out via their own click handlers. */
.mod-card.clickable {
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.mod-card.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.mod-card.clickable:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* In-signature type links (renderTypeWithLinks): subtle by default, brand on hover. */
.type .type-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted var(--rule-2);
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.type .type-link:hover { color: var(--brand); border-bottom-color: var(--brand); }
.theft-chip.victim {
  background: rgba(240,98,146,.15);
  color: var(--crit, #f06292);
  border-color: rgba(240,98,146,.35);
}
.theft-chip.thief {
  background: rgba(255,184,107,.12);
  color: var(--warn, #ffb86b);
  border-color: rgba(255,184,107,.30);
}
.theft-chip.thief.s60, .theft-chip.thief.s80, .theft-chip.thief.s100 {
  background: rgba(240,98,146,.18);
  color: var(--crit, #f06292);
  border-color: rgba(240,98,146,.40);
}
.theft-chip.bundle-container, .theft-chip.bundle-embedded {
  background: var(--bg-3);
  color: var(--fg-2);
  border-color: var(--rule);
}
.theft-chip.fork {
  background: rgba(124,196,255,.10);
  color: var(--brand);
  border-color: rgba(124,196,255,.30);
}
/* Metadata-twin chips: distinct color since these often catch the most blatant
   re-uploads (same icon, find-and-replace description). Pink/red shouts. */
.theft-chip.metadata-victim {
  background: rgba(240,98,146,.18);
  color: var(--warn, #f06292);
  border-color: rgba(240,98,146,.42);
}
.theft-chip.metadata-thief {
  background: rgba(240,98,146,.22);
  color: #fff;
  border-color: var(--warn, #f06292);
}

/* Page hero: used on dashboard-style pages (support, theft) so they don't look like
   they're just another stack of sections. Soft elevation instead of harsh border. */
.page-hero {
  position: relative;
  margin: 0 0 var(--space-5);
  padding: var(--space-5) var(--space-5) var(--space-5);
  background:
    radial-gradient(800px 240px at -10% -40%, rgba(124,196,255,.07), transparent 60%),
    linear-gradient(160deg, var(--bg-2), var(--bg-1));
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  animation: uiFadeUp var(--dur-med) var(--ease-out) both;
}
.page-hero::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124,196,255,.20), transparent);
}
.page-hero .crumbs { margin-bottom: var(--space-2); }
.page-hero h2 { margin: 0 0 var(--space-2); font-size: 24px; letter-spacing: -.01em; }
.page-hero-sub { margin: 0; color: var(--fg-2); font-size: 13.5px; line-height: 1.55; max-width: 760px; }

/* Support / triage page: soft-elevated panels, no heavy borders. */
.support-step {
  margin: 0 0 var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  animation: uiFadeUp var(--dur-med) var(--ease-out) both;
}
.support-step + .support-step { animation-delay: 60ms; }
.support-step + .support-step + .support-step { animation-delay: 120ms; }
.support-step h3 {
  margin: 0 0 var(--space-1); font-size: 15px;
  display: flex; align-items: baseline; gap: var(--space-2);
}
.support-step h3 .support-step-tag {
  font: 600 10.5px var(--mono);
  color: var(--brand); letter-spacing: .08em;
  text-transform: uppercase;
  margin-right: var(--space-2);
}
.support-step > p.sub { margin: 0 0 var(--space-3); }

.support-code-row {
  display: flex; gap: var(--space-2); align-items: center;
  margin: var(--space-1) 0 var(--space-3);
}
.support-text-input {
  flex: 1; min-width: 0;
  background: var(--bg-1); color: var(--fg-1);
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  padding: 7px 12px;
  font: 12px/1.5 var(--mono);
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.support-text-input:focus,
.support-input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--bg-0);
}

.support-input {
  width: 100%; box-sizing: border-box;
  background: var(--bg-1); color: var(--fg-1);
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  padding: 12px 14px;
  font: 12px/1.55 var(--mono);
  resize: vertical;
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.support-controls {
  display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap;
}
.support-controls label { font-size: 12.5px; color: var(--fg-2); }
.support-controls select {
  font: inherit; padding: 4px 8px;
  background: var(--bg-1); color: var(--fg-1);
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
}

.support-result-section { margin-top: var(--space-5); }
.support-results .support-step:first-child { margin-top: var(--space-3); }
.support-session-banner {
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: rgba(124,196,255,.06);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.support-session-banner code {
  font-size: 11px; color: var(--fg-2);
  background: transparent; padding: 0;
}

.support-summary-list {
  list-style: none; padding: 0; margin: var(--space-3) 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: var(--space-2);
}
.support-summary-list li {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  display: flex; flex-direction: column;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.support-summary-list li:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.support-summary-list .k {
  font-size: 10px; color: var(--fg-3);
  text-transform: uppercase; letter-spacing: .06em;
}
.support-summary-list .v {
  font: 600 18px var(--mono); color: var(--fg-0); margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.support-pill-code {
  display: inline-block; margin: 0 var(--space-1) 2px 0;
  padding: 2px var(--space-2);
  background: var(--bg-1); border: 1px solid var(--rule); border-radius: 3px;
  font-size: 11px; color: var(--fg-2);
}

.suspect-card {
  margin: var(--space-3) 0;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-2);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent, #ffb86b);
  box-shadow: var(--shadow-soft);
  animation: uiFadeUp var(--dur-med) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 40ms);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.suspect-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.suspect-card:first-of-type {
  border-left-color: var(--warn, #f06292);
  background: linear-gradient(120deg, rgba(240,98,146,.06), var(--bg-2) 40%);
}
.suspect-head { display: flex; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-2); }
.suspect-mod { font-family: var(--mono); font-weight: 600; color: var(--fg-0); text-decoration: none; }
.suspect-mod:hover { color: var(--brand); }
.suspect-score {
  margin-left: auto;
  font: 600 11px var(--mono);
  color: var(--fg-3);
  background: var(--bg-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
}
.suspect-card:first-of-type .suspect-score { color: var(--warn, #f06292); background: rgba(240,98,146,.10); }
.suspect-meter {
  height: 4px; width: 100%;
  background: var(--bg-1); border-radius: 2px; overflow: hidden;
  margin-bottom: var(--space-3);
}
.suspect-meter-bar {
  height: 100%; background: var(--accent, #ffb86b);
  transform-origin: left center;
  animation: meterFill var(--dur-slow) var(--ease-out) both;
}
@keyframes meterFill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.suspect-card:first-of-type .suspect-meter-bar { background: var(--warn, #f06292); }
.suspect-reasons { margin: 0; padding-left: var(--space-5); font-size: 12.5px; }
.suspect-reasons li { margin: var(--space-1) 0; color: var(--fg-2); line-height: 1.5; }

/* Theft leaderboard table: lightweight, no internal borders */
.theft-board {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-top: var(--space-2);
}
.theft-board th {
  text-align: left;
  font-weight: 600;
  color: var(--fg-3);
  border-bottom: 1px solid var(--rule);
  padding: var(--space-2) var(--space-3);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.theft-board td {
  padding: var(--space-2) var(--space-3);
  vertical-align: top;
  transition: background var(--dur-fast) var(--ease-out);
}
.theft-board tr {
  animation: uiFadeIn var(--dur-med) var(--ease-out) both;
}
.theft-board tr:hover td { background: var(--bg-2); }
.theft-board tr:hover td:first-child { border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm); }
.theft-board tr:hover td:last-child { border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
.theft-board td.rank { color: var(--fg-3); font-family: var(--mono); width: 32px; }
.theft-board a { color: var(--fg-0); text-decoration: none; font-family: var(--mono); transition: color var(--dur-fast) var(--ease-out); }
.theft-board a:hover { color: var(--brand); }

.pill.removed-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(240,98,146,.18);
  color: var(--crit, #f06292);
  border: 1px solid rgba(240,98,146,.35);
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* bulk-analyze progress */
.bulk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 14px;
}
.bulk-pill {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bulk-pill.running { border-color: var(--brand); }
.bulk-pill.done { border-color: rgba(102,211,156,.4); }
.bulk-pill.idle { padding: 8px 12px; align-items: center; flex-direction: row; gap: 6px; font-size: 12px; color: var(--fg-2); }
.bulk-bar { height: 5px; background: var(--bg-3); border-radius: 3px; overflow: hidden; }
.bulk-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--good)); transition: width 1s ease; }
.bulk-text { font-size: 11.5px; font-family: var(--mono); color: var(--fg-2); }

/* notification log panel */
.notif-entry {
  padding: 8px 12px;
  margin: 4px 0;
  background: var(--bg-3);
  border-left: 3px solid var(--rule-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.notif-entry.notif-theft { border-left-color: var(--warn); background: rgba(240,98,146,.04); }
.notif-entry.notif-ai-suspicious { border-left-color: var(--brand); }
.notif-entry.notif-watchlist-flag { border-left-color: var(--warn); }
.notif-title { font-weight: 600; color: var(--fg-0); }
.notif-body { color: var(--fg-1); font-size: 12px; margin-top: 2px; }
.notif-meta { color: var(--fg-3); font-size: 10.5px; font-family: var(--mono); margin-top: 4px; }
.notif-entry { position: relative; }
.notif-delete {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-3);
  font-size: 16px;
  line-height: 1;
  padding: 0 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}
.notif-delete:hover { background: rgba(240,98,146,.15); color: var(--warn); border-color: rgba(240,98,146,.3); }
.mod-owner { font-size: 11.5px; color: var(--fg-2); font-family: var(--mono); }
.mod-desc { font-size: 12px; color: var(--fg-1); margin: 4px 0; }
.mod-meta { font-size: 11px; color: var(--fg-3); font-family: var(--mono); }

.compat-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.compat-chip {
  padding: 2px 10px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11.5px;
  border: 1px solid;
  white-space: nowrap;
}
.compat-chip.ok { background: rgba(102,211,156,.12); color: var(--good); border-color: rgba(102,211,156,.35); }
.compat-chip.bad { background: rgba(240,98,146,.10); color: var(--warn); border-color: rgba(240,98,146,.35); }
.compat-chip.unknown { background: var(--bg-3); color: var(--fg-3); border-color: var(--rule-2); }

.chip .badge {
  background: var(--accent);
  color: #0a0e15;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  padding: 0 6px;
  margin-left: 6px;
}

.raw-link { font-size: 10.5px; color: var(--fg-3); font-family: var(--mono); }

/* ---------- rendered patch page ---------- */
.diff-add { color: var(--good); }
.diff-del { color: var(--warn); }
.patch-file {
  margin: 14px 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-2);
  overflow: hidden;
}
.patch-file > summary {
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg-3);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.patch-file > summary::-webkit-details-marker { display: none; }
.patch-file-path { font-weight: 600; color: var(--fg-0); flex: 1; min-width: 0; overflow-wrap: anywhere; }
.patch-counts { font-size: 12px; }
.patch-hunk {
  background: #0d1018;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  border-top: 1px solid var(--rule);
}
.patch-hunk-head {
  padding: 4px 14px;
  color: var(--fg-3);
  background: rgba(124,196,255,.04);
  font-size: 11px;
}
.patch-hunk-context { color: var(--fg-2); margin-left: 12px; }
.patch-line {
  display: grid;
  grid-template-columns: 50px 50px 18px 1fr;
  align-items: baseline;
  padding: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.patch-line.patch-add { background: rgba(102,211,156,.08); }
.patch-line.patch-del { background: rgba(240,98,146,.08); }
.patch-line.patch-ctx { background: transparent; }
.patch-ln { color: var(--fg-3); padding: 0 8px 0 0; text-align: right; font-variant-numeric: tabular-nums; user-select: none; }
.patch-sign { padding: 0 4px; user-select: none; font-weight: 600; }
.patch-line.patch-add .patch-sign { color: var(--good); }
.patch-line.patch-del .patch-sign { color: var(--warn); }
.patch-text { color: var(--fg-1); padding-right: 12px; }
.patch-line.patch-add .patch-text { color: #aef0c4; }
.patch-line.patch-del .patch-text { color: #f8b6cd; }

/* ---------- in-class branch row ---------- */
.class-branches {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin: 10px 0 4px;
}
.class-branches .cb-label {
  color: var(--fg-3);
  font-size: 11.5px;
  font-family: var(--mono);
  margin-right: 4px;
}

/* ---------- asset compare table ---------- */
.asset-box.compare .compare-row {
  display: grid;
  grid-template-columns: 200px repeat(var(--cols, 3), minmax(120px, 1fr));
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px dotted rgba(255,255,255,.04);
  font-family: var(--mono);
  font-size: 12.5px;
  align-items: baseline;
}
.asset-box.compare .compare-row.header {
  border-bottom: 1px solid var(--rule-2);
  margin-bottom: 4px;
  padding-bottom: 6px;
}
.asset-box.compare .compare-k { color: var(--fg-3); }
.asset-box.compare .compare-row.header .compare-k { color: var(--fg-2); font-weight: 600; }
.asset-box.compare .compare-v {
  color: var(--good);
  font-weight: 500;
  word-break: break-word;
}
.asset-box.compare .compare-row.header .compare-v {
  color: var(--fg-1);
  font-weight: 600;
  font-size: 11px;
  display: flex;
  flex-direction: column;
}
.asset-box.compare .compare-row.header .col-b { font-size: 12px; }
.asset-box.compare .compare-row.header .col-v { color: var(--fg-3); font-size: 10.5px; font-weight: 400; }
.asset-box.compare .compare-v.num { color: var(--code); }
.asset-box.compare .compare-v.bool { color: var(--mb); }
.asset-box.compare .compare-v.obj { color: var(--fg-2); font-size: 11px; }
.asset-box.compare .compare-v.diff-changed {
  background: rgba(255,184,107,.08);
  border-left: 2px solid var(--accent);
  padding-left: 6px;
  margin-left: -6px;
}
.asset-box.compare .compare-row.changed .compare-k::after {
  content: ' Δ';
  color: var(--accent);
  font-weight: 700;
}
.asset-box.compare .compare-row.changed {
  background: rgba(255,184,107,.04);
}
/* Auto-set --cols based on number of compare-v columns. Done via JS would be cleaner;
   for now use flex fallback when grid gets crowded. */
@media (max-width: 1200px) {
  .asset-box.compare .compare-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .asset-box.compare .compare-row.header { display: none; }
  .asset-box.compare .compare-v::before {
    content: attr(data-b) ': ';
    color: var(--fg-3);
    margin-right: 4px;
  }
}

/* ---------- branch cards on home ---------- */
.branch-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.section > h3 .hint { color: var(--fg-3); text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 11px; margin-left: 8px; }
.branch-card {
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.branch-card.primary { border-color: var(--brand); background: linear-gradient(160deg, rgba(124,196,255,.06), var(--bg-2)); }
.branch-card.clickable { cursor: pointer; transition: var(--transition); }
.branch-card.clickable:not(.primary):hover { border-color: var(--brand); transform: translateY(-1px); }
.branch-card.steam-active { box-shadow: inset 3px 0 0 var(--good); }
.branch-card .badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  vertical-align: middle;
}
.branch-card .active-badge { background: rgba(102,211,156,.18); color: var(--good); border: 1px solid rgba(102,211,156,.4); }
.branch-card .primary-badge { background: rgba(124,196,255,.18); color: var(--brand); border: 1px solid rgba(124,196,255,.4); }
.branch-pill.steam-active { box-shadow: inset 0 -2px 0 var(--good); }
.branch-pill .dot-active { color: var(--good); margin-left: 4px; font-size: 8px; vertical-align: middle; }
.br-warning {
  color: var(--accent);
  font-size: 11px;
  font-style: italic;
  margin-left: 6px;
  font-family: var(--mono);
}
.branch-card .bname { font-size: 14px; font-weight: 700; color: var(--fg-0); font-family: var(--mono); }
.branch-card .bv { font-size: 18px; color: var(--brand); font-family: var(--mono); margin: 4px 0 2px; }
.branch-card .bs { font-size: 11.5px; color: var(--fg-2); font-family: var(--mono); }
.branch-card .bd { font-size: 10.5px; color: var(--fg-3); margin-top: 6px; }

/* ---------- diff inline (used in welcome hero) ---------- */
.diff-inline { font-family: var(--mono); }
.diff-old { color: var(--fg-3); text-decoration: line-through; }
.diff-new { color: var(--accent); font-weight: 600; }

/* ---------- main page layout (detail + TOC) ---------- */
.main .page { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 28px; align-items: start; }
.class-detail { min-width: 0; }
.toc {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  font-size: 12px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.toc h4 {
  margin: 0 0 8px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--fg-3);
}
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { padding: 3px 0; }
.toc a { color: var(--fg-2); }
.toc a:hover { color: var(--brand); }
@media (max-width: 1100px) {
  .main .page { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; }
}

/* ---------- inline toggle button (show code, copy, etc.) ---------- */
.inline-toggle {
  background: var(--bg-3);
  border: 1px solid var(--rule-2);
  color: var(--fg-2);
  padding: 2px 8px;
  font-size: 11px;
  font-family: var(--mono);
  border-radius: 4px;
  cursor: pointer;
  margin-left: 4px;
  transition: var(--transition);
}
.inline-toggle:hover { background: var(--bg-4); color: var(--fg-0); border-color: var(--brand); }

/* ---------- code block ---------- */
.code-block {
  margin-top: 10px;
  background: #0d1018;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
.code-block .code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--bg-3);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-3);
  border-bottom: 1px solid var(--rule);
}
.code-block .code-head .inline-toggle { margin-left: 8px; }
.code-block pre {
  margin: 0;
  padding: 8px 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  background: transparent;
  color: var(--fg-1);
}
.code-block code { display: block; padding: 0; background: transparent; font: inherit; color: inherit; }
/* Highlighter output (highlightSlice → <code class="hl">) is reused in the
   code-block, the source viewer, and theft method snippets: scope the line
   layout + token palette to .hl so it styles everywhere, not just code-block. */
/* width:max-content lets the highlighted block grow to its longest line so the
   scroll container (.method-snippet / .modal-code / .source-view-code, all
   overflow-x:auto) actually scrolls horizontally instead of clipping. */
.hl { display: block; padding: 0; background: transparent; font: inherit; color: inherit; width: max-content; min-width: 100%; }
.hl .code-line { display: flex; }
.hl .code-ln {
  user-select: none;
  flex-shrink: 0;
  width: 56px;
  padding: 0 12px 0 12px;
  color: var(--fg-3);
  text-align: right;
  border-right: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
}
.hl .code-src {
  flex: 1;
  padding: 0 12px;
  white-space: pre;
}
/* Syntax highlight palette: tuned to the site theme. */
.hl .tk-kw  { color: #d693e7; }            /* keyword (purple) */
.hl .tk-ty  { color: #8be9fd; }            /* type / PascalCase */
.hl .tk-fn  { color: #66d39c; }            /* method call */
.hl .tk-st  { color: #f1fa8c; }            /* string / char */
.hl .tk-cm  { color: #6c7592; font-style: italic; }  /* comment */
.hl .tk-num { color: #ffb86c; }            /* numeric literal */
.hl .tk-id  { color: var(--fg-1); }        /* plain identifier */
.hl .tk-pn  { color: var(--fg-2); }        /* punctuation */

/* ---------- asset compare: baseline-relative ---------- */
.asset-box .asset-box-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.asset-box .asset-box-head h4 { margin: 0; }
.asset-box .oc-toggle {
  font-size: 11px;
  color: var(--fg-3);
  font-family: var(--mono);
  cursor: pointer;
  user-select: none;
}
.asset-box .oc-toggle input { vertical-align: middle; margin-right: 4px; accent-color: var(--brand); }

.asset-box.compare .compare-row {
  display: grid;
  grid-template-columns: 200px repeat(var(--cols, 3), minmax(100px, 1fr));
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px dotted rgba(255,255,255,.04);
  font-family: var(--mono);
  font-size: 12.5px;
  align-items: baseline;
}
.asset-box.compare .compare-row.header {
  border-bottom: 1px solid var(--rule-2);
  margin-bottom: 4px;
  padding-bottom: 6px;
}
.asset-box.compare .compare-k { color: var(--fg-3); }
.asset-box.compare .compare-row.header .compare-k { color: var(--fg-2); font-weight: 600; }
.asset-box.compare .compare-v {
  word-break: break-word;
  font-weight: 500;
  color: var(--good);
}
.asset-box.compare .compare-v.num { color: var(--code); }
.asset-box.compare .compare-v.bool { color: var(--mb); }
.asset-box.compare .compare-v.obj { color: var(--fg-2); font-size: 11px; }
.asset-box.compare .compare-v.baseline {
  /* baseline column gets a subtle left tick to anchor the eye */
  border-left: 2px solid var(--rule-2);
  padding-left: 6px;
  margin-left: -6px;
}
.asset-box.compare .compare-v.same {
  color: var(--fg-3);
  opacity: .55;
  font-weight: 400;
  text-align: left;
  /* show `=` visibly but don't shout */
}
.asset-box.compare .compare-v.missing {
  color: var(--fg-3);
  opacity: .35;
  font-style: italic;
}
.asset-box.compare .compare-v.diff-changed {
  background: rgba(255,184,107,.10);
  border-left: 2px solid var(--accent);
  padding-left: 6px;
  margin-left: -6px;
  font-weight: 600;
  color: var(--accent);
}
.asset-box.compare .compare-row.header .compare-v {
  color: var(--fg-1);
  font-weight: 600;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  border-left: none !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
  background: transparent !important;
}
.asset-box.compare .compare-row.header .col-b { font-size: 12px; }
.asset-box.compare .compare-row.header .col-v { color: var(--fg-3); font-size: 10.5px; font-weight: 400; }
.asset-box.compare .compare-row.changed .compare-k::after {
  content: ' Δ';
  color: var(--accent);
  font-weight: 700;
}
.asset-box.compare .compare-row.changed { background: rgba(255,184,107,.03); }
@media (max-width: 1200px) {
  .asset-box.compare .compare-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .asset-box.compare .compare-row.header { display: none; }
  .asset-box.compare .compare-v::before {
    content: attr(data-b) ': ';
    color: var(--fg-3);
    margin-right: 4px;
  }
  .asset-box.compare .compare-v.baseline { border-left: none; padding-left: 0; margin-left: 0; }
  .asset-box.compare .compare-v.diff-changed { border-left: none; padding-left: 0; margin-left: 0; }
}

/* ---------- recents / magic / linkhash ---------- */
.cat.recents .cat-h, .cat.magic .cat-h { color: var(--brand); }
.recents-toggle {
  padding: 4px 22px;
  font-size: 11px;
  color: var(--fg-3);
  cursor: pointer;
  font-family: var(--mono);
  user-select: none;
  background: transparent;
  border: 0;
  display: block;
  width: 100%;
  text-align: left;
}
.recents-toggle:hover { color: var(--brand); }
.recents-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: var(--radius-sm); }
.filter-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.cat.magic .magic-where { color: var(--code); font-family: var(--mono); font-size: 10.5px; }
.chip.linkhash {
  background: rgba(124,196,255,.08);
  border: 1px solid rgba(124,196,255,.25);
  color: var(--brand);
  text-decoration: none;
}
.chip.linkhash:hover { background: rgba(124,196,255,.15); }

/* ---------- stale flag ---------- */
.branch-card.stale { border-color: var(--warn); }
.stale-flag { color: var(--warn); }

/* ---------- #__learn page ----------
   Guided reading path for someone who knows programming foundations but not
   yet patterns/algorithms. Lesson ladder, auto-curated lists, exercises. */
.learn-banner {
  display: flex; gap: 14px; align-items: center;
  padding: 14px 16px; margin: 0 0 18px;
  background: linear-gradient(135deg, rgba(124, 196, 255, .08), rgba(124, 196, 255, .02));
  border: 1px solid rgba(124, 196, 255, .35);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  color: var(--fg-1);
  text-decoration: none;
  transition: background var(--transition);
}
.learn-banner:hover { background: rgba(124, 196, 255, .14); }
.learn-banner .lb-icon { font-size: 28px; }
.learn-banner .lb-title { font-weight: 600; font-size: 15px; }
.learn-banner .lb-sub { font-size: 12.5px; color: var(--fg-2); margin-top: 2px; }

.learn-ladder { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.learn-lesson {
  display: flex; gap: 14px;
  padding: 14px 16px;
  background: var(--bg-1);
  border: 1px solid var(--bg-3);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
}
.learn-num {
  font-size: 22px; font-weight: 600; color: var(--brand);
  font-family: var(--mono);
  min-width: 28px; text-align: center;
}
.learn-lbody { flex: 1; min-width: 0; }
.learn-ltitle { font-size: 15px; margin: 0 0 6px; }
.learn-llinks { margin: 8px 0 4px; font-size: 13px; }
.learn-link { font-weight: 500; }
.learn-look {
  font-size: 12.5px; color: var(--fg-2); margin: 6px 0 0;
  font-style: italic;
}

.learn-concept-grid, .learn-system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px; margin-top: 10px;
}
.learn-auto, .learn-system {
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius);
}
.learn-auto h4, .learn-system h4 { margin: 0 0 6px; font-size: 13px; }
.learn-auto-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 3px;
  font-size: 12.5px;
}
.learn-auto-list a { color: var(--fg-1); text-decoration: none; }
.learn-auto-list a:hover { color: var(--brand); }

.learn-exercises {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 10px; margin-top: 10px;
}
.learn-exercise {
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius);
}
.learn-exercise.lvl1 { border-left: 3px solid var(--good); }
.learn-exercise.lvl2 { border-left: 3px solid var(--warn); }
.learn-exercise.lvl3 { border-left: 3px solid var(--bad); }
.learn-ex-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.learn-ex-level {
  font-family: var(--mono); font-weight: 700; font-size: 11px;
  padding: 1px 6px; border-radius: 3px;
  background: var(--bg-3); color: var(--fg-1);
}
.learn-ex-lesson { font-size: 11px; color: var(--fg-3); }
.learn-ex-task { font-size: 13px; margin: 4px 0; }

/* ---------- author theft grade panel ----------
   Sibling of the AI-score banner. Two-column header (score + meta),
   collapsible breakdown, and named-victim/copier lists. */
.theft-grade {
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid var(--bg-3);
  border-left: 3px solid var(--bg-3);
  border-radius: var(--radius);
  background: var(--bg-1);
}
.theft-grade.clean       { border-left-color: var(--good); }
.theft-grade.low         { border-left-color: var(--brand); }
.theft-grade.mid         { border-left-color: var(--warn); }
.theft-grade.high        { border-left-color: var(--bad); background: rgba(255, 90, 90, .04); }
.theft-grade .tg-head    { display: flex; gap: 14px; align-items: center; }
.theft-grade .tg-score   { font-size: 30px; font-weight: 600; font-family: var(--mono); min-width: 60px; text-align: right; }
.theft-grade.high .tg-score { color: var(--bad); }
.theft-grade.mid .tg-score  { color: var(--warn); }
.theft-grade.low .tg-score  { color: var(--brand); }
.theft-grade.clean .tg-score { color: var(--good); }
.theft-grade .tg-verdict { font-size: 14px; font-weight: 500; }
.theft-grade .tg-sub     { font-size: 12px; color: var(--fg-2); margin-top: 2px; }
.theft-grade .tg-breakdown { margin-top: 12px; }
.theft-grade .tg-list    { margin-top: 12px; }
.theft-grade .tg-list-title { font-size: 12.5px; color: var(--fg-2); margin-bottom: 4px; }

/* ---------- mod-detail signal summary ----------
   Sits between the page header and the version-history strip so the user
   sees the headline cross-corpus signal immediately. */
.detail-signal-summary {
  margin: 6px 0 14px;
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--bg-3);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
}
.detail-signal-headline {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 8px;
  color: var(--fg-1);
}
.detail-signal-targets { display: flex; flex-direction: column; gap: 4px; }
.detail-signal-targets > span { font-size: 12.5px; }

/* ---------- AI-declaration regression banner ----------
   Loud because this is an explicit bad-faith signal: author declared AI use,
   then dropped the tag in a later version without rewriting. */
.ai-regression-banner {
  background: rgba(255, 90, 90, .08);
  border: 1px solid rgba(255, 90, 90, .35);
  border-left: 3px solid var(--bad);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 8px 0;
  color: var(--fg-1);
  font-size: 13.5px;
}
.ai-regression-banner strong { color: var(--bad); }

/* ---------- removed-from-Thunderstore ---------- */
/* Mods that were uploaded, cached by us, then deleted from Thunderstore stay
   visible with this treatment so we don't lose theft suspects who delete
   after getting caught. */
.mod-card.removed {
  opacity: 0.85;
  background: repeating-linear-gradient(
    -45deg,
    var(--bg-1),
    var(--bg-1) 12px,
    rgba(255, 255, 255, .02) 12px,
    rgba(255, 255, 255, .02) 22px
  );
  border-style: dashed;
}
.removed-icon {
  position: absolute;
  top: 6px; right: 6px;
  z-index: 2;
  background: rgba(255, 90, 90, .12);
  border: 1px solid rgba(255, 90, 90, .35);
  color: var(--bad);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: .03em;
}

/* visually hidden but reachable to screen readers */
.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;
}

.src-search-more {
  padding: 6px 12px 8px; font-size: 11px; color: var(--fg-3);
  font-style: italic;
}

/* ---------- theft page ----------
   Headline strip + trusted callout + author-grouped cards. Same tab bar
   pattern as the mods page (.mods-tabs class is shared). */
.theft-headline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}
.theft-headline-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 14px 8px;
  border: 1px solid var(--bg-3);
  border-radius: var(--radius);
  background: var(--bg-1);
  color: var(--fg-1);
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition);
}
.theft-headline-card:hover { background: var(--bg-2); border-color: var(--fg-3); }
.theft-headline-card .thc-num   { font-size: 22px; font-weight: 600; font-family: var(--mono); }
.theft-headline-card .thc-label { font-size: 11px; color: var(--fg-2); margin-top: 4px; text-align: center; }
.theft-headline-card.tone-critical { border-left: 3px solid var(--bad); }
.theft-headline-card.tone-critical .thc-num { color: var(--bad); }
.theft-headline-card.tone-warn     { border-left: 3px solid var(--warn); }
.theft-headline-card.tone-warn .thc-num { color: var(--warn); }
.theft-headline-card.tone-info     { border-left: 3px solid var(--brand); }

.theft-trusted-callout {
  background: rgba(255, 200, 80, .06);
  border: 1px solid rgba(255, 200, 80, .35);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 0 0 14px;
}
.theft-trusted-callout .ttc-head { font-weight: 600; margin-bottom: 8px; color: var(--fg-1); }
.theft-trusted-callout .ttc-items { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.theft-trusted-callout .ttc-item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.theft-trusted-callout .ttc-chip {
  font-size: 11px; padding: 1px 8px; border-radius: 10px;
  background: rgba(255, 200, 80, .15); color: var(--fg-1);
}

.theft-alerts-banner {
  display: block;
  padding: 10px 14px;
  margin: 0 0 14px;
  background: rgba(255, 90, 90, .07);
  border: 1px solid rgba(255, 90, 90, .35);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  color: var(--fg-1);
  text-decoration: none;
  font-size: 13px;
}
.theft-alerts-banner:hover { background: rgba(255, 90, 90, .12); }

.theft-priority-section {
  background: rgba(124, 196, 255, .04);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.theft-filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.theft-mode-toggle {
  display: inline-flex;
  border: 1px solid var(--bg-3);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 6px 0 0;
}
.theft-mode-btn {
  background: var(--bg-1); color: var(--fg-2);
  border: 0;
  padding: 6px 14px;
  font-size: 12.5px;
  cursor: pointer;
  border-right: 1px solid var(--bg-3);
}
.theft-mode-btn:last-child { border-right: 0; }
.theft-mode-btn:hover { color: var(--fg-1); background: var(--bg-2); }
.theft-mode-btn.active { background: var(--brand); color: var(--bg-0); }
.theft-mode-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.ttc-dismiss {
  background: transparent; border: 0;
  color: var(--fg-3); cursor: pointer;
  font-size: 14px; padding: 2px 6px;
  margin-left: auto;
}
.ttc-dismiss:hover { color: var(--bad); }

.theft-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 10px;
}
.theft-card {
  background: var(--bg-1);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.theft-card.trusted { border-left: 3px solid var(--warn); }
.theft-card-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.theft-card-title { font-weight: 600; color: var(--fg-1); text-decoration: none; }
.theft-card-title:hover { color: var(--brand); }
.theft-card-trusted { font-size: 10.5px; color: var(--warn); }
.theft-card-meta { font-size: 11px; color: var(--fg-3); margin-left: auto; font-family: var(--mono); }
.theft-card-target { font-size: 12px; }
.theft-card-bar {
  position: relative;
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
}
.theft-card-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bad); }
.theft-card-score {
  position: absolute; right: 4px; top: -16px;
  font-size: 10px; color: var(--fg-3); font-family: var(--mono);
}
.theft-card-others {
  font-size: 11.5px; color: var(--fg-2); margin-top: 2px;
}

.theft-author-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 10px;
}
.theft-author-card {
  background: var(--bg-1);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.theft-author-card .tac-head {
  display: flex; align-items: baseline; gap: 10px;
  border-bottom: 1px solid var(--bg-3);
  padding-bottom: 6px; margin-bottom: 8px;
}
.theft-author-card .tac-author { font-weight: 600; color: var(--fg-1); text-decoration: none; font-size: 14px; }
.theft-author-card .tac-author:hover { color: var(--brand); }
.theft-author-card .tac-count { font-size: 11px; color: var(--fg-2); margin-left: auto; font-family: var(--mono); }
.theft-author-card .tac-mods { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.theft-author-card .tac-mods li { display: flex; align-items: baseline; gap: 6px; }
.theft-author-card .tac-mods a { color: var(--fg-1); text-decoration: none; }
.theft-author-card .tac-mods a:hover { color: var(--brand); }
.theft-author-card .tac-score {
  margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--bad);
}

/* ---------- mods page tabs ----------
   Slim tab bar sits between the h2 and the page content for #__mods*. Replaces
   the previous one-giant-stacked-page layout. */
.mods-tabs {
  display: flex;
  gap: 2px;
  margin: 8px 0 14px;
  border-bottom: 1px solid var(--bg-3);
  padding-bottom: 0;
  flex-wrap: wrap;
}
.mods-tab {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--fg-2);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.mods-tab:hover { color: var(--fg-1); background: var(--bg-2); }
.mods-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  background: var(--bg-2);
}
.mods-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- active-theft strip ----------
   Slim red banner pinned above whichever mods tab the user is on so unresolved
   theft alerts are always visible without leaving the catalog. */
.active-theft-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 0 0 14px;
  background: rgba(255, 90, 90, .07);
  border: 1px solid rgba(255, 90, 90, .35);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  color: var(--fg-1);
  font-size: 13px;
  text-decoration: none;
  transition: background var(--transition);
}
.active-theft-strip:hover { background: rgba(255, 90, 90, .12); }
.active-theft-strip .ats-icon { font-size: 16px; }
.active-theft-strip .ats-text strong { color: var(--bad); }
.active-theft-strip .ats-pkg { color: var(--fg-1); text-decoration: underline; text-underline-offset: 2px; }
.active-theft-strip .ats-pkg:hover { color: var(--bad); }
.active-theft-strip .ats-all { color: var(--bad); text-decoration: none; white-space: nowrap; }
.active-theft-strip .ats-all:hover { text-decoration: underline; }

/* ---------- toast ----------
   non-blocking alternative to alert(). Stacks bottom-right; auto-dismisses. */
#toast-host {
  position: fixed; right: 18px; bottom: 18px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  background: var(--bg-2); color: var(--fg-1);
  border: 1px solid var(--bg-3); border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 12.5px; max-width: 420px;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  pointer-events: auto;
  animation: toast-in .18s ease-out;
}
.toast-ok   { border-left-color: var(--good); }
.toast-warn { border-left-color: var(--warn); }
.toast-err  { border-left-color: var(--bad); }
.toast-out  { opacity: 0; transform: translateY(4px); transition: opacity .18s, transform .18s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .toast-out { transition: none; }
}

/* ---------- mobile hamburger + off-canvas sidebar ----------
   Hidden on desktop; reveal at the tablet breakpoint. */
.sidebar-toggle {
  display: none;
  position: fixed; top: 10px; left: 10px; z-index: 60;
  width: 40px; height: 40px;
  background: var(--bg-2); color: var(--fg-1);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius-sm);
  font-size: 18px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.sidebar-toggle:hover { background: var(--bg-3); }
.sidebar-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 40;
  animation: backdrop-in .15s ease-out;
}
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- tablet (≤1100px): sidebar stays inline, content tightens ---------- */
@media (max-width: 1100px) {
  .main { padding: 22px 18px; }
  .mods-grid, .theft-cards, .theft-author-grid { gap: 8px; }
  .theft-headline { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
}

/* ---------- phone (≤720px): off-canvas sidebar + single-column grids ---------- */
@media (max-width: 720px) {
  /* Layout becomes single-column; sidebar slides in from the left when toggled. */
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: min(86vw, 340px);
    max-height: 100vh;
    transform: translateX(-100%);
    transition: transform .2s ease-out;
    z-index: 50;
    box-shadow: 2px 0 16px rgba(0,0,0,.4);
    overflow-y: auto;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-toggle { display: block; }

  /* Main content: full width, room at the top for the toggle button. */
  .main { padding: 60px 14px 24px; }
  .main .page { grid-template-columns: 1fr; }

  /* Tabs scroll horizontally instead of wrapping on a narrow viewport. */
  .mods-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .mods-tab { white-space: nowrap; padding: 8px 12px; font-size: 12.5px; }

  /* Grids collapse to single column on phone. */
  .mods-grid { grid-template-columns: 1fr; }
  .theft-cards, .theft-author-grid { grid-template-columns: 1fr; }
  .theft-headline { grid-template-columns: repeat(2, 1fr); }
  .feature-list, .branch-cards, .cat-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  /* Filter chip rows wrap nicely and stay touch-targets. */
  .filter-row { gap: 6px; }
  .filter-chip { padding: 8px 12px; font-size: 12.5px; min-height: 36px; }

  /* Author score header: stack score above meta on narrow screens. */
  .author-score { flex-direction: column; align-items: flex-start; gap: 8px; }
  .author-score .as-score { font-size: 38px; }
  .theft-grade .tg-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .theft-grade .tg-score { min-width: 0; font-size: 32px; text-align: left; }

  /* Heading sizes nudged down for thumb-readable measure. */
  h2 { font-size: 20px; }
  h3 { font-size: 16px; }

  /* Active theft strip wraps onto two rows if needed. */
  .active-theft-strip { flex-wrap: wrap; }

  /* Support page textareas: full width, no horizontal scroll. */
  .support-input { width: 100%; box-sizing: border-box; }

  /* Toast: pin to bottom-center on phone instead of bottom-right. */
  #toast-host { right: 8px; left: 8px; align-items: stretch; }
  .toast { max-width: none; }

  /* Theft headline cards: shrink padding so 2-up fits cleanly on a 375px phone. */
  .theft-headline-card { padding: 10px 6px; }
  .theft-headline-card .thc-num { font-size: 18px; }
}

/* ---------- very small phones (≤380px): nudge even tighter ---------- */
@media (max-width: 380px) {
  .main { padding: 56px 10px 20px; }
  .theft-headline { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
}

/* Labeling panel on mod detail page: user's ground-truth verdict gets fed
   into the eval endpoint that scores AI/theft heuristics. */
.label-panel {
  background: var(--bg-2); border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-soft);
}
.label-row {
  display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center;
  margin-top: var(--space-2);
}
.label-row label { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-2); font-size: 13px; }
.label-row select, .label-row input[type="text"], .label-row textarea {
  font: inherit; padding: 4px 8px; border-radius: 4px;
  border: 1px solid var(--bg-3); background: var(--bg-1); color: var(--fg);
}
.label-status { color: var(--fg-3); }

/* Labeled-corpus eval page */
.label-eval-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3); margin: var(--space-3) 0;
}
.label-eval-summary > div {
  padding: var(--space-3); background: var(--bg-1);
  border-radius: var(--radius-sm);
}
.label-eval-summary strong { font-size: 22px; display: block; color: var(--brand); }
.eval-table {
  border-collapse: collapse; margin-top: var(--space-3); font-size: 13px;
}
.eval-table th, .eval-table td {
  padding: 4px 12px; border-bottom: 1px solid var(--bg-3); text-align: right;
}
.eval-table th:first-child, .eval-table td:first-child { text-align: left; }
.eval-table tr:hover td { background: var(--bg-1); }

/* GitHub source-vs-DLL panel on mod detail page */
.github-panel {
  background: var(--bg-2); border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-soft);
}
.github-stats {
  display: flex; gap: var(--space-4); flex-wrap: wrap;
  margin-top: var(--space-2);
}
.github-stats span { color: var(--fg-2); font-size: 13px; }
.github-stats strong { color: var(--brand); }
.github-verdict { font-weight: 600; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.github-verdict.ok   { background: rgba(0, 200, 0, 0.15); color: var(--ok, #4caf50); }
.github-verdict.warn { background: rgba(255, 180, 0, 0.15); color: var(--warn, #ffb400); }
.github-verdict.bad  { background: rgba(255, 80, 80, 0.18); color: var(--err, #ff5050); }
.github-type-list { font-size: 12px; color: var(--fg-3); margin: 8px 0 4px; }

/* AI-declared-by-author badge: distinct from the code-shape likelihood pill
   right next to it so the eye can separate "what the heuristic measured" from
   "what the author admitted to". */
.pill.ai-declared-pill {
  background: rgba(124,196,255,.18);
  color: var(--brand);
  border: 1px solid rgba(124,196,255,.3);
}

/* ---------- #__graph: game knowledge graph ---------- */
.gg-branches { display: flex; gap: 6px; margin: 14px 0 4px; }
.gg-branches .chip.active { background: var(--brand-2); border-color: var(--brand-2); color: var(--bg-0); }
.gg-timeline { width: 100%; border-collapse: collapse; font-size: 13px; }
.gg-timeline th, .gg-timeline td { text-align: left; padding: 5px 10px; border-bottom: 1px solid var(--rule-1); }
.gg-timeline th.r, .gg-timeline td.r { text-align: right; font-family: var(--mono); }
.gg-timeline th { color: var(--fg-3); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.gg-timeline tbody tr, .gg-timeline tr { cursor: pointer; }
.gg-timeline tr:hover td { background: var(--bg-3); }
.gg-timeline tr.sel td { background: rgba(124,196,255,.12); }
.gg-timeline td.r.up { color: var(--good); }
.gg-timeline td.r.down { color: var(--warn); }
.gg-qrow { display: flex; gap: 8px; margin: 8px 0; }
.gg-q { flex: 1; padding: 7px 10px; background: var(--bg-2); border: 1px solid var(--rule-2); border-radius: 6px; color: var(--fg-0); font-size: 13px; }
.gg-q:focus { outline: none; border-color: var(--brand); }
.gg-out { background: var(--bg-1); border: 1px solid var(--rule-1); border-radius: 6px; padding: 12px; margin-top: 8px;
  font-family: var(--mono); font-size: 12px; line-height: 1.5; white-space: pre-wrap; max-height: 460px; overflow: auto; }
.gg-gods { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 22px; margin-top: 10px; }
.gg-god { display: flex; align-items: center; gap: 9px; padding: 3px 0; border-bottom: 1px solid var(--rule-1); }
.gg-deg { font-family: var(--mono); font-size: 11px; color: var(--fg-3); min-width: 34px; text-align: right; }
.gg-loc { color: var(--fg-3); font-size: 11px; margin-left: auto; }
.gg-ask { background: none; border: 1px solid var(--rule-2); color: var(--fg-3); border-radius: 4px;
  cursor: pointer; font-size: 11px; padding: 0 6px; line-height: 1.6; }
.gg-ask:hover { color: var(--brand); border-color: var(--brand); }
@media (max-width: 720px) { .gg-gods { grid-template-columns: 1fr; } }

/* #__reports: exporter controls, run log, and the rendered document.
   The documents are fixed-width by design (side-by-side code columns), so the
   viewer must not wrap or the two columns stop lining up. */
.report-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 10px; }
.report-log {
  background: var(--bg-1); border: 1px solid var(--rule-1); border-radius: 6px;
  padding: 10px 12px; margin: 0 0 16px; white-space: pre-wrap;
  font-size: 12px; color: var(--fg-1); min-height: 2.2em;
}
.report-files { list-style: none; padding: 0; margin: 0 0 18px; }
.report-files li {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--rule-1);
}
.report-body {
  background: var(--bg-1); border: 1px solid var(--rule-1); border-radius: 6px;
  padding: 14px; overflow-x: auto; white-space: pre;
  font-size: 12px; line-height: 1.45; tab-size: 4;
}
