/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --surface: #f6f6f7;
  --border: #e8e8ea;
  --text: #17181c;
  --muted: #6b6e76;
  --faint: #9a9ca3;
  --accent: #5b3df5;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f12;
    --surface: #17181d;
    --border: #25272e;
    --text: #ececef;
    --muted: #9396a0;
    --faint: #686b75;
    --accent: #a08cff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0f12;
  --surface: #17181d;
  --border: #25272e;
  --text: #ececef;
  --muted: #9396a0;
  --faint: #686b75;
  --accent: #a08cff;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
svg { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 22px; height: 22px; fill: var(--accent); stroke: var(--accent); }
.brand-name { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.topbar-actions { display: flex; align-items: center; gap: 2px; }
.status { font-size: 13px; color: var(--faint); margin-right: 10px; white-space: nowrap; }
.icon-btn, .home-link {
  width: 36px; height: 36px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 8px; color: var(--muted); transition: color .15s, background .15s;
}
.icon-btn:hover, .home-link:hover { color: var(--text); background: var(--surface); }
.icon-btn svg, .home-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.spinning svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
@media (max-width: 640px) { .status { display: none; } }

/* ---------- Tabs ---------- */
.tabs-bar { border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 24px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: none; border: 0; padding: 0 0 12px; margin-bottom: -1px; font-size: 14px; color: var(--muted);
  border-bottom: 1px solid transparent; white-space: nowrap; transition: color .15s;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); font-weight: 500; border-bottom-color: var(--text); }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 20px 0 0; }
.filters[hidden] { display: none; }
.search { display: flex; align-items: center; gap: 8px; flex: 0 1 180px; height: 32px; }
.search svg { width: 15px; height: 15px; fill: none; stroke: var(--faint); stroke-width: 2; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 14px; }
.search input::-webkit-search-cancel-button { display: none; }
.search input::placeholder { color: var(--faint); }
.chips { order: -1; flex: 1 1 auto; display: flex; gap: 16px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .chips { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .chips::-webkit-scrollbar { display: none; }
  .search { flex: 1 1 100%; }
}
.chip { border: 0; background: none; padding: 0; font-size: 13px; color: var(--muted); transition: color .15s; white-space: nowrap; }
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { color: var(--text); font-weight: 500; }
.active-filter { font-size: 13px; color: var(--muted); width: 100%; }
.active-filter[hidden] { display: none; }
.active-filter button { border: 0; background: var(--surface); color: var(--text); border-radius: 6px; padding: 2px 8px; font-size: 13px; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 64px; padding: 16px 0 72px; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; gap: 40px; } }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 48px 0 8px; }
.section-head:first-child { margin-top: 12px; }
.section-head h2 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 0; }
.section-head .count { font-size: 13px; color: var(--faint); }

/* ---------- Top story ---------- */
.lead { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 32px; align-items: start; padding: 8px 0 28px; border-bottom: 1px solid var(--border); }
.lead h2 { font-size: clamp(24px, 3vw, 30px); font-weight: 600; line-height: 1.2; letter-spacing: -0.025em; margin: 0 0 10px; text-wrap: balance; }
.lead p { margin: 0 0 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lead-media { aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--surface); }
.lead-media img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 640px) { .lead { grid-template-columns: 1fr; gap: 16px; } .lead-media { order: -1; aspect-ratio: 5 / 2; } }

.secondary { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; }
.sec-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.sec-item h3 { font-size: 15px; line-height: 1.35; margin: 0 0 6px; font-weight: 500; letter-spacing: -0.01em; text-wrap: pretty; }
.sec-item h3 a:hover, .story h3 a:hover, .lead h2 a:hover, .paper h3 a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
@media (max-width: 640px) { .secondary { grid-template-columns: 1fr; } }

/* ---------- Story list ---------- */
.stories { display: flex; flex-direction: column; }
.story { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; padding: 20px 0; border-bottom: 1px solid var(--border); }
.story:first-child { padding-top: 8px; }
.story h3 { font-size: 16px; line-height: 1.35; margin: 0 0 4px; font-weight: 500; letter-spacing: -0.01em; text-wrap: pretty; }
.story p { margin: 0 0 8px; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thumb { display: block; width: 96px; height: 72px; border-radius: 6px; overflow: hidden; background: var(--surface); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 640px) { .story { gap: 16px; } .story p { display: none; } .story h3 { margin-bottom: 6px; } .thumb { width: 72px; height: 54px; } }

.meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12.5px; color: var(--faint); }
.src { color: var(--muted); }

.more { display: flex; justify-content: center; margin-top: 28px; }
.btn { border: 1px solid var(--border); background: none; border-radius: 8px; padding: 8px 16px; font-size: 13.5px; color: var(--muted); transition: border-color .15s, color .15s; }
.btn:hover { border-color: var(--faint); color: var(--text); }
.text-link { border: 0; background: none; padding: 0; align-self: flex-start; margin-top: auto; font-size: 13px; color: var(--muted); }
.text-link:hover { color: var(--text); }

/* ---------- Research list ---------- */
.papers { display: flex; flex-direction: column; }
.paper { padding: 20px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 40px 1fr; gap: 8px; }
.paper .num { font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; line-height: 1.6; }
.paper h3 { margin: 4px 0 6px; font-size: 16px; line-height: 1.35; font-weight: 500; letter-spacing: -0.01em; }
.paper p { margin: 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.paper .authors { font-size: 13px; color: var(--faint); margin-top: 6px; }
@media (max-width: 640px) { .paper { grid-template-columns: 1fr; gap: 0; } .paper .num { display: none; } }

/* ---------- Sidebar ---------- */
.sidebar { padding-top: 12px; }
@media (min-width: 901px) { .sidebar { position: sticky; top: 80px; align-self: start; } }
.sidebar h4 { margin: 0 0 10px; font-size: 13px; font-weight: 500; color: var(--muted); }
.rank-list { display: flex; flex-direction: column; }
.rank-list button { display: flex; justify-content: space-between; gap: 12px; border: 0; background: none; padding: 5px 0; font-size: 14px; text-align: left; }
.rank-list button span:last-child { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.rank-list button:hover span:first-child { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.rank-list button[aria-pressed="true"] span:first-child { font-weight: 600; }
.source-note { margin: 20px 0 0; font-size: 12.5px; color: var(--faint); }

/* ---------- Models view ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin: 36px 0 8px; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 32px; font-weight: 600; line-height: 1.25; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.labs, .releases { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 40px; }
.lab, .release { padding: 20px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.lab-head { display: flex; align-items: baseline; gap: 12px; }
.lab-head > div:first-child { min-width: 0; }
.lab-head h3 { margin: 0; font-size: 16px; font-weight: 500; letter-spacing: -0.01em; }
.lab-head .fam { font-size: 13px; color: var(--faint); }
.lab-head .buzz { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.lab-head .buzz b { font-weight: 500; color: var(--text); }
.lab-head .buzz small { font-size: 13px; color: var(--faint); margin-left: 4px; }
.lab ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.lab li { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; padding: 3px 0; }
.lab li a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lab li a:hover, .lab .headline a:hover, .release h3 a:hover, td .mname:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.lab li span { color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lab .headline { font-size: 13.5px; color: var(--muted); }
.release .top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--faint); }
.release h3 { margin: 0; font-size: 16px; font-weight: 500; letter-spacing: -0.01em; }
.release p { margin: 0; font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.specs { display: flex; flex-wrap: wrap; gap: 12px; margin-top: auto; }
.spec { font-size: 12.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.spec small { color: var(--faint); font-size: 12.5px; margin-right: 4px; }

.table-tools { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; align-items: center; }
.select { height: 32px; border: 1px solid var(--border); background: none; color: var(--muted); border-radius: 8px; padding: 0 8px; font: inherit; font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12.5px; font-weight: 400; color: var(--faint); padding: 10px 16px 10px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 16px 10px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .mname { font-weight: 500; }
td .mid { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.mods { display: inline-flex; gap: 8px; }
.mod { font-size: 12.5px; color: var(--muted); }

.hf { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 40px; }
.hf a { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--border); }
.hf a:hover b { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.hf .rank { font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; }
.hf .nm { min-width: 0; }
.hf .nm b { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hf .nm small { font-size: 12.5px; color: var(--faint); }
.hf .likes { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- States ---------- */
.loading, .empty { text-align: center; padding: 100px 20px; color: var(--muted); }
.spinner { width: 24px; height: 24px; margin: 0 auto 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--muted); animation: spin 0.8s linear infinite; }
.empty h3 { font-weight: 500; font-size: 16px; color: var(--text); margin: 0 0 6px; }

.footer { padding: 24px 0 40px; font-size: 12.5px; color: var(--faint); }
.footer p { margin: 0; }
.footer a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Bold look: layered over the base styles above ---------- */
:root { --bg: #f6f6fc; --surface: rgba(255, 255, 255, .8); --solid: #fff; --border: rgba(30, 20, 80, .11); --text: #100e24; --muted: #57546f; --faint: #7f7c98; --accent: #6a3df5; --grad: linear-gradient(100deg, #6a3df5, #c026d3 50%, #06b6d4); --blob-a: rgba(124, 77, 255, .24); --blob-b: rgba(6, 182, 212, .19); --blob-c: rgba(217, 70, 239, .13); --glow: rgba(106, 61, 245, .75); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #06060f; --surface: rgba(20, 19, 36, .72); --solid: #13122a; --border: rgba(255, 255, 255, .09); --text: #f3f2fb; --muted: #a9a6c4; --faint: #807d9b; --accent: #b39dff; --grad: linear-gradient(100deg, #b39dff, #f0abfc 50%, #5eead4); --blob-a: rgba(124, 77, 255, .32); --blob-b: rgba(6, 182, 212, .2); --blob-c: rgba(217, 70, 239, .16); }
}
:root[data-theme="dark"] { --bg: #06060f; --surface: rgba(20, 19, 36, .72); --solid: #13122a; --border: rgba(255, 255, 255, .09); --text: #f3f2fb; --muted: #a9a6c4; --faint: #807d9b; --accent: #b39dff; --grad: linear-gradient(100deg, #b39dff, #f0abfc 50%, #5eead4); --blob-a: rgba(124, 77, 255, .32); --blob-b: rgba(6, 182, 212, .2); --blob-c: rgba(217, 70, 239, .16); }
body { overflow-x: clip; }
body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(60vmax 42vmax at 6% -8%, var(--blob-a), transparent 70%), radial-gradient(54vmax 36vmax at 98% -6%, var(--blob-b), transparent 70%), radial-gradient(40vmax 30vmax at 55% 110%, var(--blob-c), transparent 70%); }
.wrap { max-width: 1240px; }
.topbar { background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); }
.brand-mark { width: 28px; height: 28px; filter: drop-shadow(0 0 10px var(--accent)); }
.brand-name { font-size: 20px; font-weight: 800; letter-spacing: -.035em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.icon-btn, .home-link { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text); }
.icon-btn:hover, .home-link:hover { background: var(--surface); border-color: var(--accent); transform: translateY(-1px); }
.tabs-bar { border-bottom: 0; }
.tabs { gap: 4px; padding-top: 6px; padding-bottom: 4px; }
.tabs button { padding: 7px 14px; margin: 0; border: 0; border-radius: 12px; font-weight: 600; transition: background .15s, color .15s; }
.tabs button:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tabs button[aria-selected="true"] { color: #fff; background: linear-gradient(100deg, #6a3df5, #c026d3); box-shadow: 0 8px 18px -9px var(--glow); }
.chips { gap: 5px; }
.chip { padding: 4px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-weight: 550; }
.chip[aria-pressed="true"] { color: #fff; background: var(--accent); border-color: var(--accent); }
:root[data-theme="dark"] .chip[aria-pressed="true"] { color: #120b2e; }
.search { flex: 0 1 240px; height: 40px; padding: 0 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.search:focus-within { border-color: var(--accent); }
.active-filter button { background: var(--accent); color: #fff; }
.layout { grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; }
.section-head h2 { font-size: clamp(26px, 3.4vw, 40px); font-weight: 800; letter-spacing: -.04em; color: var(--text); }
.section-head:first-child h2 { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead:has(.lead-media) { position: relative; isolation: isolate; display: flex; align-items: flex-end; min-height: clamp(340px, 38vw, 460px); padding: 0; overflow: hidden; border: 0; border-radius: 24px; color: #fff; box-shadow: 0 28px 54px -34px var(--glow); }
.lead:has(.lead-media) .lead-media { position: absolute; inset: 0; z-index: -2; aspect-ratio: auto; border-radius: 0; }
.lead:has(.lead-media) .lead-media img { transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.lead:has(.lead-media):hover .lead-media img { transform: scale(1.04); }
.lead:has(.lead-media)::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(180deg, rgba(6, 5, 18, .05) 20%, rgba(6, 5, 18, .92) 92%); }
.lead:has(.lead-media) > div { padding: 24px; }
.lead:has(.lead-media) h2 { font-size: clamp(25px, 3.4vw, 42px); line-height: 1.07; letter-spacing: -.035em; font-weight: 800; }
.lead:has(.lead-media) p { color: rgba(255, 255, 255, .86); }
.lead:has(.lead-media) .meta, .lead:has(.lead-media) .src { color: rgba(255, 255, 255, .85); }
.secondary { gap: 10px; margin-top: 10px; }
.sec-item, .story, .paper, .lab, .release { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: transform .2s, border-color .2s, box-shadow .2s; }
.sec-item { padding: 14px; }
.sec-item:hover, .story:hover, .paper:hover, .lab:hover, .release:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); box-shadow: 0 18px 34px -24px var(--glow); }
.stories { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.story, .story:first-child { padding: 14px; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
.story h3, .sec-item h3 { font-weight: 650; }
.thumb { width: 104px; height: 88px; border-radius: 12px; }
.papers { gap: 10px; }
.paper { padding: 16px; }
.paper .num { font-size: 22px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sidebar { padding: 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.stat { padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.stat .value { font-size: 38px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stats { gap: 10px; }
.labs, .releases { gap: 10px; }
.lab, .release { padding: 16px; }
.table-wrap { padding: 4px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.hf { gap: 8px; }
.hf a { padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.hf a:hover { border-color: var(--accent); }
@media (max-width: 1040px) { .stories { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .lead:has(.lead-media) { min-height: 330px; }
  .lead:has(.lead-media) .lead-media { aspect-ratio: auto; }
  .lead:has(.lead-media) > div { padding: 16px; }
  .story, .story:first-child { padding: 12px; }
  .thumb { width: 76px; height: 64px; }
  .search { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) { .sec-item, .story, .paper, .lab, .release, .lead-media img { transition: none; } }
