/* ============================================================
   MiraiStore — visual system v4
   Structure inspired by npmjs.com (card registry, red brand
   mark, README-style detail page) with a socket.dev-grade dark
   theme, score/insight panels, and a real analytics dashboard.
   Dark is the default surface; light is an explicit opt-in via
   the header toggle (persisted in localStorage).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

:root {
  /* ---- dark (default) ---- */
  --bg: #0a0d12;
  --bg-alt: #0a0d12;
  --surface: #10141b;
  --surface-raised: #141922;
  --surface-sunken: #0c0f15;
  --border: #232a35;
  --border-soft: #1a1f28;

  --text: #e8ebf0;
  --text-dim: #9aa4b2;
  --text-faint: #626d7c;

  --accent: #ff6b5e;
  --accent-strong: #ff8578;
  --accent-text-on: #1a0503;
  --accent-soft: rgba(255, 107, 94, 0.12);
  --accent-line: rgba(255, 107, 94, 0.35);

  --goat: #3ddc84;
  --mirai: #f0a840;
  --discord: #8ea1ff;
  --telegram: #4fc3f7;
  --other: #9aa4b2;

  --good: #3ddc84;
  --good-soft: rgba(61, 220, 132, 0.12);
  --warn: #f0a840;
  --warn-soft: rgba(240, 168, 64, 0.12);
  --bad: #ff6259;
  --bad-soft: rgba(255, 98, 89, 0.12);

  --dev-badge-bg: rgba(94, 160, 255, 0.12);
  --dev-badge-text: #7fb3ff;
  --dev-badge-border: rgba(94, 160, 255, 0.3);

  --code-bg: #0d1017;
  --code-text: #e4e4e6;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);

  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', Menlo, Consolas, monospace;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #fafafa;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-sunken: #f6f6f7;
  --border: #e3e3e5;
  --border-soft: #ececed;

  --text: #1b1b1d;
  --text-dim: #63666a;
  --text-faint: #93969b;

  --accent: #cb3837;
  --accent-strong: #a82d2c;
  --accent-text-on: #ffffff;
  --accent-soft: rgba(203, 56, 55, 0.08);
  --accent-line: rgba(203, 56, 55, 0.28);

  --goat: #1a8754;
  --mirai: #b26a00;
  --discord: #5865f2;
  --telegram: #0288d1;
  --other: #6b6f76;

  --good: #1a8754;
  --good-soft: rgba(26, 135, 84, 0.1);
  --warn: #b26a00;
  --warn-soft: rgba(178, 106, 0, 0.1);
  --bad: #d32f2f;
  --bad-soft: rgba(211, 47, 47, 0.1);

  --dev-badge-bg: #eef6ff;
  --dev-badge-text: #0969da;
  --dev-badge-border: #b6d9ff;

  --code-bg: #17181b;
  --code-text: #e4e4e6;

  --shadow-sm: 0 1px 2px rgba(20, 20, 22, 0.06);
  --shadow: 0 4px 16px rgba(20, 20, 22, 0.08);

  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  /* Belt-and-suspenders against any element pushing past the viewport —
     this is what forced people to pinch-zoom out to see the whole page. */
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg-alt);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 0.15s ease, color 0.15s ease;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; margin: 0; }
code, pre { font-family: var(--font-mono); }
img, svg { max-width: 100%; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ---------------------------------------------------------------
   Header
   --------------------------------------------------------------- */

.site-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 17px;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text-on);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.brand span { color: var(--accent); }

.main-nav { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.main-nav a:hover { background: var(--surface-sunken); color: var(--text); }
.main-nav a.active { color: var(--accent); background: var(--accent-soft); }

.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  width: 220px;
  min-width: 0;
  flex-shrink: 1;
  color: var(--text-faint);
  font-size: 13px;
  cursor: pointer;
}
.header-search svg { flex-shrink: 0; width: 14px; height: 14px; }
.header-search span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.theme-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-sunken);
  color: var(--text-dim);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-faint); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }

main { max-width: 1120px; margin: 0 auto; padding: 40px 24px 80px; min-width: 0; }

.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 26px; margin-bottom: 6px; }
.page-head p { color: var(--text-dim); margin: 0; font-size: 15px; }

/* ---------------------------------------------------------------
   Hero
   --------------------------------------------------------------- */

.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 44px;
  margin-bottom: 32px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
  box-shadow: var(--shadow-sm);
}
.hero-copy, .hero-console { min-width: 0; }
.hero-copy h1 { font-size: 32px; line-height: 1.2; margin-bottom: 14px; max-width: 460px; }
.hero-copy p { color: var(--text-dim); font-size: 15.5px; max-width: 440px; margin-bottom: 24px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.hero-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 12px 18px;
  max-width: 460px;
  box-shadow: var(--shadow-sm);
}
.hero-search-box input {
  border: none; outline: none; flex: 1; min-width: 0;
  font-size: 14.5px; font-family: var(--font-display);
  background: transparent; color: var(--text);
}
.hero-search-box svg { width: 16px; height: 16px; color: var(--text-faint); flex-shrink: 0; }

.hero-console { background: #0d1017; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border-soft); }
.console-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: #171b23; }
.console-bar .dot { width: 10px; height: 10px; border-radius: 50%; background: #363c47; }
.console-title { margin-left: 8px; color: #7d8695; font-family: var(--font-mono); font-size: 12px; }
.console-body { padding: 18px 16px; font-family: var(--font-mono); font-size: 13px; overflow-x: auto; }
.console-line { color: #e4e4e6; margin-bottom: 6px; white-space: nowrap; }
.console-line .prompt { color: #6fd97f; margin-right: 8px; }
.console-out { color: #7d8695; margin: 0 0 14px 20px; white-space: nowrap; }
.console-out.ok { color: #6fd97f; }
.cursor { animation: blink 1s step-start infinite; }
@keyframes blink { 50% { opacity: 0; } }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 999px;
  font-weight: 600; font-size: 14px;
  border: 1.5px solid transparent; cursor: pointer;
  transition: transform 0.1s, background 0.12s, border-color 0.12s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--accent-text-on); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--text-faint); }

/* ---------------------------------------------------------------
   Composition / score bars (shared by home + analytics)
   --------------------------------------------------------------- */

.composition {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px; margin-bottom: 24px;
}
.composition-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.composition-head h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.composition-head a { font-size: 13px; font-weight: 600; color: var(--accent); }
.composition-bar {
  display: flex; height: 8px; border-radius: 999px; overflow: hidden;
  background: var(--surface-sunken); margin-bottom: 14px;
}
.composition-bar span { transition: width 0.3s ease; }
.composition-legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; color: var(--text-dim); }
.composition-legend .item { display: flex; align-items: center; gap: 6px; }
.composition-legend .swatch { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.composition-legend b { color: var(--text); font-family: var(--font-mono); }

.section-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); font-weight: 700; margin: 36px 0 14px;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.section-title strong { color: var(--text); font-size: 14px; }
.section-title .count { text-transform: none; font-weight: 500; letter-spacing: 0; color: var(--text-faint); }

/* ---------------------------------------------------------------
   Command cards / grid
   --------------------------------------------------------------- */

.cmd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cmd-card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 8px;
  min-width: 0;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.cmd-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.cmd-card .rank { position: absolute; top: 14px; right: 16px; font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }
.cmd-name { font-weight: 700; font-size: 15.5px; padding-right: 30px; overflow-wrap: anywhere; }
.cmd-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12.5px; color: var(--text-faint); font-family: var(--font-mono); align-items: center; }
.cmd-meta a.author-link, .cmd-meta span.author-link { color: var(--text-dim); font-family: var(--font-display); font-weight: 600; cursor: pointer; }
.cmd-meta a.author-link:hover, .cmd-meta span.author-link:hover { color: var(--accent); }
.cmd-desc {
  color: var(--text-dim); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.badge {
  display: inline-flex; align-items: center; width: fit-content;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.03em; border: 1px solid transparent;
}
.badge.goat     { background: rgba(61,220,132,0.12);  color: var(--goat); }
.badge.mirai    { background: rgba(240,168,64,0.12);  color: var(--mirai); }
.badge.discord  { background: rgba(142,161,255,0.14); color: var(--discord); }
.badge.telegram { background: rgba(79,195,247,0.14);  color: var(--telegram); }
.badge.other    { background: rgba(154,164,178,0.14); color: var(--other); }

.dev-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px 1px 6px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  background: var(--dev-badge-bg); color: var(--dev-badge-text);
  border: 1px solid var(--dev-badge-border); vertical-align: middle; white-space: nowrap;
}
.dev-badge svg { width: 10px; height: 10px; }

.empty-state {
  padding: 60px 20px; text-align: center; color: var(--text-faint);
  border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface);
}

.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.filter-tabs button, .filter-tabs a {
  padding: 7px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  color: var(--text-dim); background: var(--surface); border: 1px solid var(--border); cursor: pointer;
}
.filter-tabs button.active, .filter-tabs a.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.search-bar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.search-bar input {
  flex: 1; min-width: 160px; padding: 11px 16px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 14.5px; font-family: var(--font-display); background: var(--surface); color: var(--text);
}
.search-bar input:focus { outline: none; border-color: var(--accent-line); }
.search-bar select {
  padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 14px; font-family: var(--font-display);
}

.pagination { display: flex; align-items: center; gap: 14px; justify-content: center; margin-top: 28px; }
.pagination button { padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-weight: 600; font-size: 13.5px; }
.pagination button:disabled { opacity: 0.4; cursor: default; }
.page-info { font-size: 13px; color: var(--text-faint); font-family: var(--font-mono); }
.loader { padding: 60px 0; text-align: center; color: var(--text-faint); }

/* ---------------------------------------------------------------
   Package detail page — the min-width:0 rules below are the fix
   for the "must zoom out" bug: without them, a long unbroken line
   inside <pre> forced this grid column past the viewport width.
   --------------------------------------------------------------- */

.pkg-layout { display: grid; grid-template-columns: 1fr 300px; gap: 32px; align-items: start; }
.pkg-main, .pkg-sidebar { min-width: 0; }
.back-link { display: inline-block; margin-bottom: 18px; color: var(--text-dim); font-size: 13.5px; font-weight: 600; }
.back-link:hover { color: var(--accent); }

.pkg-main .badges { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.pkg-main h1 { font-size: 26px; margin-bottom: 8px; overflow-wrap: anywhere; }
.byline { color: var(--text-dim); font-size: 14px; margin: 0 0 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.byline a { font-weight: 700; color: var(--text); }
.byline a:hover { color: var(--accent); }
.desc { color: var(--text-dim); font-size: 15px; margin: 10px 0 22px; overflow-wrap: anywhere; }

.stat-row { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-chip { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 18px; text-align: center; min-width: 84px; }
.stat-chip .num { font-weight: 800; font-size: 19px; font-family: var(--font-mono); }
.stat-chip .label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }

.aliases-line { font-size: 13.5px; color: var(--text-dim); overflow-wrap: anywhere; }

.pkg-main pre {
  background: var(--code-bg); color: var(--code-text); border-radius: var(--radius);
  padding: 18px; overflow-x: auto; font-size: 13px; line-height: 1.6; margin: 0;
  max-width: 100%;
}

.pkg-sidebar { display: flex; flex-direction: column; gap: 16px; }
.side-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; min-width: 0; }
.side-card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin-bottom: 12px; }
.side-card .install-cmd { background: var(--surface-sunken); border-radius: var(--radius-sm); padding: 10px 12px; font-family: var(--font-mono); font-size: 12.5px; word-break: break-all; color: var(--text); }
.side-card .kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 6px 0; border-bottom: 1px solid var(--border-soft); }
.side-card .kv:last-child { border-bottom: none; }
.side-card .kv span:first-child { color: var(--text-faint); }
.side-card .kv span:last-child { text-align: right; overflow-wrap: anywhere; }
.side-card .dev-profile-link { display: flex; align-items: center; gap: 10px; padding: 4px 0; min-width: 0; }
.side-card .dev-profile-link span:last-child { min-width: 0; overflow: hidden; }
.dev-name-line { overflow-wrap: anywhere; }

/* Copy-to-clipboard code panel wrapper (public/js/code-tools.js) */
.code-panel { position: relative; max-width: 100%; }
.code-panel pre { padding-right: 60px; }
.code-panel .copy-btn {
  position: absolute; top: 10px; right: 10px;
  padding: 5px 10px; font-size: 11.5px; font-weight: 600; font-family: var(--font-mono);
  color: var(--text-dim); background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
}
.code-panel .copy-btn:hover { color: var(--text); border-color: var(--text-faint); }
.code-panel .copy-btn:disabled { color: var(--good); border-color: var(--good); opacity: 1; cursor: default; }

.dev-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-text-on);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.dev-name-line { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dev-sub { font-size: 12px; color: var(--text-faint); }

.profile-header {
  display: flex; align-items: center; gap: 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px 32px; margin-bottom: 28px;
  flex-wrap: wrap;
}
.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: var(--accent-text-on);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 28px; flex-shrink: 0;
}
.profile-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-name-row h1 { font-size: 22px; overflow-wrap: anywhere; }
.profile-stats { display: flex; gap: 22px; margin-top: 10px; font-size: 13.5px; color: var(--text-dim); flex-wrap: wrap; }
.profile-stats b { color: var(--text); font-family: var(--font-mono); }

.endpoint { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 16px; min-width: 0; }
.endpoint-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.endpoint-path { font-family: var(--font-mono); font-size: 14.5px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.endpoint-body p { margin: 0 0 10px; color: var(--text-dim); font-size: 14px; overflow-wrap: anywhere; }
.endpoint-body p:last-child { margin-bottom: 0; }
.endpoint-body ul { margin: 0 0 10px; padding-left: 20px; color: var(--text-dim); font-size: 14px; }
.endpoint-body li { margin-bottom: 6px; overflow-wrap: anywhere; }
.endpoint-body code, .endpoint-body pre { background: var(--surface-sunken); border-radius: var(--radius-sm); }
.endpoint-body pre { padding: 12px 14px; overflow-x: auto; font-size: 13px; margin: 0 0 10px; max-width: 100%; }
.endpoint-body pre code { background: none; padding: 0; }
code.inline { padding: 2px 6px; font-size: 13px; overflow-wrap: anywhere; }
.method {
  display: inline-block; font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: var(--radius-sm); letter-spacing: 0.03em;
}
.method.get  { background: rgba(79,195,247,0.14); color: var(--telegram); }
.method.post { background: rgba(61,220,132,0.14); color: var(--goat); }

.site-footer { border-top: 1px solid var(--border); padding: 28px 24px; text-align: center; color: var(--text-faint); font-size: 13px; background: var(--surface); }
.site-footer a { color: var(--text-dim); font-weight: 600; }
.site-footer a:hover { color: var(--accent); }

::selection { background: var(--accent-soft); color: var(--accent-strong); }

/* Abnormal-activity / DDoS suspension banner (public/js/ratelimit-guard.js) */
.ddos-block-banner {
  position: sticky; top: 60px; z-index: 39;
  background: var(--bad-soft); color: var(--bad);
  border-bottom: 1px solid var(--bad);
  padding: 10px 24px; text-align: center;
  font-size: 13.5px; font-weight: 600;
}
.ddos-block-banner strong { font-family: var(--font-mono); }
body.ddos-blocked .header-search,
body.ddos-blocked .hero-search-box { pointer-events: none; opacity: 0.5; }

/* ---------------------------------------------------------------
   Analytics dashboard
   --------------------------------------------------------------- */

.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; min-width: 0;
}
.stat-card .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin-bottom: 8px; }
.stat-card .value { font-family: var(--font-mono); font-size: 26px; font-weight: 700; color: var(--text); }
.stat-card .sub { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; }

.analytics-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; margin-bottom: 8px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; min-width: 0; }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin-bottom: 4px; }
.panel .panel-sub { font-size: 12.5px; color: var(--text-faint); margin-bottom: 18px; }

/* daily publishing activity — real bar chart from uploadDate counts */
.activity-chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; margin-bottom: 10px; }
.activity-chart .bar-col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.activity-chart .bar { background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; opacity: 0.85; transition: opacity 0.12s; }
.activity-chart .bar-col:hover .bar { opacity: 1; }
.activity-chart-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }

.leaderboard { display: flex; flex-direction: column; }
.leaderboard-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border-soft); min-width: 0;
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-rank { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); width: 18px; flex-shrink: 0; }
.leaderboard-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.leaderboard-bar-track { flex-shrink: 0; width: 60px; height: 5px; border-radius: 999px; background: var(--surface-sunken); overflow: hidden; }
.leaderboard-bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.leaderboard-value { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); width: 56px; text-align: right; flex-shrink: 0; }

.score-note { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.score-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.score-dot.good { background: var(--good); }
.score-dot.warn { background: var(--warn); }
.score-dot.bad { background: var(--bad); }

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */

@media (max-width: 1080px) {
  .analytics-grid { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 32px 24px; }
  .pkg-layout { grid-template-columns: 1fr; }
  .main-nav { display: none; }
  .header-search { width: auto; flex: 1; }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr 1fr; }
  main { padding: 28px 16px 60px; }
  .site-header { padding: 0 14px; gap: 12px; }
  .hero { padding: 24px 18px; }
  .stat-row { gap: 8px; }
  .stat-chip { padding: 10px 12px; min-width: 72px; }
}
