:root {
  --bg: #0d1117;
  --bg-soft: #11161d;
  --panel: #161b22;
  --panel-2: #1c2128;
  --panel-3: #21262d;
  --border: #30363d;
  --border-soft: #242a31;
  --text: #e6edf3;
  --muted: #9aa5b1;
  --muted-2: #8b949e;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.12);
  --link-hover: #79c0ff;
  --green: #3fb950;
  --green-soft: rgba(63, 185, 80, 0.12);
  --yellow: #d29922;
  --yellow-soft: rgba(210, 153, 34, 0.14);
  --red: #f85149;
  --red-soft: rgba(248, 81, 73, 0.12);
  --purple: #bc8cff;
  --brand-1: #79c0ff;
  --brand-2: #58a6ff;
  --brand-3: #bc8cff;
  --btn-primary: #238636;
  --btn-primary-hover: #1f883d;
  --chart: #58a6ff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  --font: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(88, 166, 255, 0.10), transparent 60%),
    radial-gradient(700px 360px at 95% 0%, rgba(188, 140, 255, 0.07), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.drawer-open { overflow: hidden; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:where(a, button, input, select, [tabindex]):focus {
  scroll-margin-top: 80px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: -64px;
  z-index: 100;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--panel-3);
  color: var(--text);
  font-weight: 600;
  transition: top 0.15s;
}
.skip-link:focus { top: 12px; text-decoration: none; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 16px; height: 16px; flex: 0 0 auto; vertical-align: -2px; }

.hidden { display: none !important; }

.app { min-height: 100vh; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 22px;
  background: rgba(13, 17, 23, 0.82);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #0d1117;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2) 55%, var(--brand-3));
  box-shadow: 0 6px 18px rgba(88, 166, 255, 0.25);
}

.brand-text h1 { margin: 0; font-size: 16px; letter-spacing: 0.2px; }
.brand-text p { margin: 1px 0 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap .icon { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.search-wrap input {
  width: 250px;
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-soft);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-wrap input::placeholder { color: var(--muted-2); }

.switch { position: relative; display: flex; align-items: center; gap: 8px; min-height: 32px; color: var(--muted); font-size: 12px; user-select: none; cursor: pointer; }
.switch input {
  position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0;
}
.switch-track {
  width: 34px; height: 19px; border-radius: 99px; background: var(--panel-3);
  border: 1px solid var(--border); position: relative; transition: background 0.15s, border-color 0.15s;
}
.switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--muted); transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .switch-track { background: var(--accent-soft); border-color: rgba(88, 166, 255, 0.55); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(15px); background: var(--accent); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel-2); color: var(--text);
  padding: 8px 13px; font-size: 13px; font-weight: 600;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { background: var(--panel-3); border-color: #3d444d; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--btn-primary); border-color: #2ea043; color: #fff; }
.btn.primary:hover { background: var(--btn-primary-hover); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 28px; padding: 4px 9px; font-size: 12px; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.btn .icon.spinning { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- banner ---------- */

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 10px 22px 0; padding: 9px 14px;
  border: 1px solid rgba(210, 153, 34, 0.4);
  background: var(--yellow-soft);
  color: #e3b341;
  border-radius: 10px;
  font-size: 13px;
}
.banner.info { border-color: rgba(88, 166, 255, 0.4); background: var(--accent-soft); color: var(--link-hover); }
.banner.error { border-color: rgba(248, 81, 73, 0.4); background: var(--red-soft); color: #ff7b72; }

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

.layout { display: flex; gap: 0; max-width: 1500px; margin: 0 auto; }

.sidebar {
  position: sticky; top: 63px; align-self: flex-start;
  width: 214px; flex: 0 0 214px;
  height: calc(100vh - 63px);
  padding: 20px 14px;
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; justify-content: space-between;
}

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 40px; padding: 9px 11px;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--muted);
  font-size: 13.5px; font-weight: 600; text-align: left;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); }
.nav-item.active .nav-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.sidebar-foot { color: var(--muted-2); font-size: 12px; line-height: 1.7; }
.sidebar-foot p { margin: 0; }
.sidebar-foot .muted { color: var(--muted-2); }

.content { flex: 1; min-width: 0; padding: 24px 28px calc(60px + env(safe-area-inset-bottom)); }

.view { display: none; animation: fadeIn 0.22s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- hero ---------- */

.hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  padding: 22px 24px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(88, 166, 255, 0.10), transparent 45%),
    linear-gradient(315deg, rgba(188, 140, 255, 0.08), transparent 40%),
    var(--panel);
  margin-bottom: 18px;
}
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: 2.2px; }
.hero h2 { margin: 0; font-size: 26px; letter-spacing: -0.4px; }
.hero-sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.stat-pill {
  min-width: 92px; padding: 9px 13px;
  background: rgba(13, 17, 23, 0.55); border: 1px solid var(--border);
  border-radius: 10px; text-align: right;
}
.stat-pill strong { display: block; font-size: 18px; line-height: 1.2; }
.stat-pill span { color: var(--muted); font-size: 12px; }

/* ---------- panels ---------- */

.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.overview-card { padding: 16px 16px 12px; min-height: 260px; }

.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.card-title .icon { color: var(--accent); }
.card-more { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 3px; min-height: 24px; padding: 3px 5px; background: none; border: 0; border-radius: 5px; }
.card-more:hover { color: var(--accent); }

.source-status { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.dot.ok { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.dot.partial { background: var(--yellow); box-shadow: 0 0 0 3px var(--yellow-soft); }
.dot.error { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

.card-list { display: flex; flex-direction: column; }
.card-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 2px; border-top: 1px solid var(--border-soft);
  min-width: 0;
}
.card-row:first-child { border-top: 0; }
.card-rank { width: 18px; color: var(--muted-2); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; flex: 0 0 18px; }
.card-main { flex: 1; min-width: 0; }
.card-name { display: block; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.card-name:hover { color: var(--accent); text-decoration: none; }
.card-meta { display: block; color: var(--muted-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-side { color: var(--green); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.card-side.muted { color: var(--muted); font-weight: 500; }

/* ---------- view head / toolbar ---------- */

.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.view-head h2 { margin: 0; font-size: 24px; letter-spacing: -0.3px; }
.view-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.segmented { display: inline-flex; background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.segmented button {
  border: 0; background: transparent; color: var(--muted);
  min-height: 32px; padding: 6px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--panel-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }

.select-wrap { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; }
.select-wrap select {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; color: var(--text); outline: none; cursor: pointer;
}
.select-wrap select:focus { border-color: var(--accent); }

.notice {
  margin: 0 0 12px; padding: 8px 12px;
  border-left: 3px solid rgba(88, 166, 255, 0.5);
  background: rgba(88, 166, 255, 0.06);
  border-radius: 0 8px 8px 0;
  color: var(--muted); font-size: 12.5px;
}

.table-hint { display: none; margin: 0 0 8px; color: var(--muted-2); font-size: 12px; }
.muted-note { color: var(--muted-2); font-size: 12px; }

/* ---------- tables ---------- */

.table-panel { padding: 0; }
.table-panel.is-loading { min-height: 420px; }
.table-scroll { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.repo-table { width: 100%; border-collapse: collapse; min-width: 820px; }
.repo-table th {
  position: sticky; top: 0; z-index: 2;
  padding: 10px 12px; text-align: left;
  background: var(--panel-2); color: var(--muted);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.repo-table td { padding: 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.repo-table tbody tr { cursor: pointer; transition: background 0.12s; }
.repo-table tbody tr:hover { background: rgba(88, 166, 255, 0.05); }
.repo-table tbody tr:focus-visible { outline-offset: -2px; background: rgba(88, 166, 255, 0.08); }
.repo-table tbody tr:last-child td { border-bottom: 0; }
.col-rank { width: 42px; }
.col-lang { width: 100px; }
.col-num { width: 96px; text-align: right !important; }
.col-date { width: 104px; white-space: nowrap; }
.col-action { width: 78px; text-align: right !important; }
.repo-table td.col-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.repo-table td.col-date { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.row-detail {
  min-height: 28px; padding: 4px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  background: transparent; color: var(--accent);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.row-detail:hover { background: var(--accent-soft); border-color: rgba(88, 166, 255, 0.55); }

.rank-badge {
  display: inline-grid; place-items: center;
  width: 25px; height: 25px; border-radius: 7px;
  background: var(--panel-3); color: var(--muted);
  font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.rank-badge.top1 { background: rgba(210, 153, 34, 0.16); color: #e3b341; }
.rank-badge.top2 { background: rgba(139, 148, 158, 0.16); color: #c9d1d9; }
.rank-badge.top3 { background: rgba(188, 120, 60, 0.16); color: #d18a4a; }

.repo-cell { min-width: 280px; }
.repo-name { font-weight: 700; font-size: 14px; color: var(--text); }
.repo-name .owner { color: var(--muted); font-weight: 500; }
.repo-name:hover { color: var(--accent); text-decoration: none; }
.repo-desc { margin-top: 2px; color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

.lang { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.lang-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted-2); }
.delta { color: var(--green); font-weight: 700; }
.delta.neutral { color: var(--muted); font-weight: 500; }
.delta .unit { color: var(--muted-2); font-size: 11px; font-weight: 500; }
.stars { color: var(--text); font-weight: 600; }

/* ---------- security / gitee ---------- */

.hg-volume { background: rgba(88, 166, 255, 0.04); }
.hg-volume .rank-title { color: var(--accent); }

.empty { padding: 36px 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- section / black horses ---------- */

.section { margin-top: 24px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 7px; }
.section-head h3 .icon { color: var(--yellow); }
.section-head span { color: var(--muted-2); font-size: 12px; }

.mini-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.mini-card {
  padding: 12px; border: 1px solid var(--border-soft); border-radius: 10px;
  background: var(--panel); transition: border-color 0.15s, transform 0.15s;
}
.mini-card:hover { border-color: var(--border); transform: translateY(-1px); }
.mini-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mini-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-delta { color: var(--green); font-size: 12px; font-weight: 800; }
.mini-stats { margin-top: 8px; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.arrow { color: var(--muted-2); }

/* ---------- two column ---------- */

.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.two-col .panel { min-width: 0; }

/* Two explicit columns keep the short V2EX panels from leaving a tall blank area. */
.china-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.china-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1100px) {
  .china-columns { grid-template-columns: 1fr; }
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.panel-head h3 { margin: 0; font-size: 14px; }
.link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.link:hover { color: var(--accent); text-decoration: none; }

/* ---------- rank list ---------- */

.rank-list { display: flex; flex-direction: column; }
.rank-list.wide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rank-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-top: 1px solid var(--border-soft);
  min-width: 0;
}
.rank-item:first-child { border-top: 0; }
.rank-item:hover { background: rgba(88, 166, 255, 0.04); }
.rank-num { width: 20px; flex: 0 0 20px; color: var(--muted-2); font-size: 12px; font-weight: 700; text-align: right; padding-top: 1px; }
.rank-main { flex: 1; min-width: 0; }
.rank-title { display: block; color: var(--text); font-size: 13.5px; font-weight: 600; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.rank-title:hover { color: var(--accent); text-decoration: none; }
.rank-desc { margin-top: 2px; color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rank-meta { margin-top: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted-2); font-size: 12px; }
.rank-meta .tag { color: var(--muted); background: var(--panel-3); border-radius: 4px; padding: 1px 5px; }
.rank-side { flex: 0 0 auto; text-align: right; color: var(--muted); font-size: 12px; line-height: 1.5; }
.rank-side strong { display: block; color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.rank-side .green { color: var(--green); }

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

.link-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.link-card {
  display: block; padding: 16px; border: 1px solid var(--border-soft); border-radius: 10px;
  background: var(--panel); transition: border-color 0.15s, background 0.15s;
}
.link-card:hover { border-color: var(--accent); background: var(--panel-2); text-decoration: none; }
.link-card h4 { margin: 0 0 4px; font-size: 14px; color: var(--text); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.link-card p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.link-card .icon { color: var(--muted-2); }

/* ---------- drawer ---------- */

.drawer-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(1, 4, 9, 0.66);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.15s ease;
}
.drawer {
  position: fixed; top: 0; right: 0; z-index: 51;
  width: min(520px, 92vw); height: 100vh;
  background: var(--bg-soft);
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 50px rgba(0, 0, 0, 0.45);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: slideIn 0.2s ease;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--muted);
}
.drawer-close:hover { color: var(--text); background: var(--panel-3); }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 26px 22px 40px; }

.drawer-repo h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.3px; padding-right: 44px; }
.drawer-repo h2 .owner { color: var(--muted); font-weight: 500; }
.drawer-desc { color: var(--muted); font-size: 13.5px; margin: 8px 0 16px; }
.drawer-desc.original { margin-top: -8px; padding-left: 10px; border-left: 2px solid var(--border); color: var(--muted-2); font-size: 12.5px; }
.desc-label { display: inline-block; margin-right: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.stat-box { padding: 12px; background: var(--panel); border: 1px solid var(--border-soft); border-radius: 9px; }
.stat-box span { display: block; color: var(--muted-2); font-size: 12px; }
.stat-box strong { display: block; margin-top: 2px; font-size: 17px; font-variant-numeric: tabular-nums; }
.meta-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; color: var(--muted); font-size: 12.5px; }
.meta-list div { display: flex; justify-content: space-between; gap: 12px; }
.meta-list span { flex: 0 0 auto; white-space: nowrap; }
.meta-list strong { color: var(--text); font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 16px; }
.tag-chip { padding: 2px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--link-hover); font-size: 12px; }
.spark-wrap { margin: 16px 0; padding: 16px; background: var(--panel); border: 1px solid var(--border-soft); border-radius: 10px; }
.spark-wrap h4 { margin: 0 0 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.sparkline { width: 100%; height: 76px; display: block; }
.spark-empty { color: var(--muted-2); font-size: 12px; padding: 12px 0; }
.drawer-actions { display: flex; gap: 8px; margin-top: 16px; }

.loading-block { padding: 28px 0; color: var(--muted); font-size: 13px; }
.skeleton-line { height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; margin-bottom: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.skeleton-row td { padding: 14px 12px; }
.skeleton-card { padding: 16px; }
.skeleton-card .skeleton-line:last-child { margin-bottom: 0; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 70; padding: 9px 16px; border-radius: 9px;
  background: var(--panel-3); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; box-shadow: var(--shadow);
}

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .overview-grid { grid-template-columns: 1fr; }
  .mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .link-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rank-list.wide { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero-stats { justify-content: flex-start; }
}

@media (max-width: 880px) {
  .topbar { position: static; flex-wrap: wrap; padding: 10px 14px; }
  .topbar-actions { width: 100%; flex-wrap: wrap; row-gap: 8px; }
  .search-wrap { flex: 1 1 100%; min-width: 0; }
  .search-wrap input { width: 100%; min-width: 0; min-height: 40px; }
  .muted-note { flex: 1 1 100%; }
  .layout { display: block; }
  .sidebar {
    position: sticky; top: 0; z-index: 20; width: auto; height: auto;
    border-right: 0; border-bottom: 1px solid var(--border-soft);
    padding: 8px 12px; background: rgba(13, 17, 23, 0.94); backdrop-filter: blur(12px);
  }
  .switch { min-height: 44px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
  .nav::-webkit-scrollbar { height: 4px; }
  .nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
  .nav::-webkit-scrollbar-track { background: transparent; }
  .nav-item { width: auto; min-height: 44px; white-space: nowrap; padding: 8px 12px; }
  .sidebar-foot { display: none; }
  .content { padding: 18px 14px calc(50px + env(safe-area-inset-bottom)); }
  .two-col { grid-template-columns: 1fr; }
  .mini-grid { grid-template-columns: 1fr; }
  .link-grid { grid-template-columns: 1fr; }
  .hero h2 { font-size: 21px; }
  .table-hint { display: block; }
  .btn { min-height: 40px; }
  .btn.small { min-height: 40px; }
  .segmented button { min-height: 40px; }
  .select-wrap select { min-height: 40px; }
  .row-detail { min-height: 40px; }
  .card-more { min-height: 32px; padding: 6px 6px; }
  .drawer-close { width: 44px; height: 44px; }
}

@media (max-width: 560px) {
  .switch-label { display: none; }
  .btn.primary span { display: none; }
  .hero { padding: 18px 16px; }
  .hero > div:first-child { min-width: 0; width: 100%; }
  .hero-sub { overflow-wrap: anywhere; }
  .hero-stats {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%; gap: 8px;
  }
  .stat-pill { min-width: 0; text-align: left; }
  .section-head { flex-direction: column; gap: 3px; }
  .repo-table { table-layout: fixed; min-width: 760px; }
  .repo-table th.col-rank,
  .repo-table td.col-rank { display: none; }
  .repo-table th:nth-child(2),
  .repo-table td:nth-child(2) {
    position: sticky; left: 0; z-index: 1;
    width: 200px; min-width: 200px; max-width: 200px;
    background: var(--panel);
    box-shadow: 1px 0 0 var(--border-soft);
  }
  .repo-table th:nth-child(2) { background: var(--panel-2); z-index: 3; }
  .repo-table tbody tr:hover td:nth-child(2) { background: #1a2129; }
  .repo-cell { min-width: 200px; max-width: 200px; }
  .card-row { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .btn .icon.spinning { animation: none; }
}
