/* 6529 Network State — Minimalist Modern tokens, app shell, components */

/* ---------- Tokens ---------- */

:root {
  --background: #FAFAFA;
  --foreground: #0F172A;
  --muted: #F1F5F9;
  --muted-foreground: #64748B;
  --accent: #0052FF;
  --accent-secondary: #4D7CFF;
  --accent-foreground: #FFFFFF;
  --border: #E2E8F0;
  --card: #FFFFFF;
  --ring: #0052FF;
  --inverted-bg: #0F172A;
  --inverted-fg: #FFFFFF;
  --inverted-muted: rgba(255, 255, 255, 0.62);
  --dot-color: rgba(255, 255, 255, 1);

  --gradient: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  --accent-5: rgba(0, 82, 255, 0.05);
  --accent-8: rgba(0, 82, 255, 0.08);
  --accent-30: rgba(0, 82, 255, 0.30);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.10);
  --shadow-accent: 0 4px 14px rgba(0, 82, 255, 0.25);
  --shadow-accent-lg: 0 8px 24px rgba(0, 82, 255, 0.35);

  --font-display: 'Montserrat', system-ui, -apple-system, sans-serif;
  --font-ui: 'Montserrat', system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-w: 248px;
  --gap: 20px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: #09090B;
    --foreground: #FAFAFA;
    --muted: #18181B;
    --muted-foreground: #A1A1AA;
    --accent: #4D7CFF;
    --accent-secondary: #7C9CFF;
    --border: #27272A;
    --card: #111113;
    --ring: #4D7CFF;
    --inverted-bg: #FFFFFF;
    --inverted-fg: #0F172A;
    --inverted-muted: rgba(15, 23, 42, 0.62);
    --dot-color: rgba(15, 23, 42, 1);
    --accent-5: rgba(77, 124, 255, 0.07);
    --accent-8: rgba(77, 124, 255, 0.12);
    --accent-30: rgba(77, 124, 255, 0.35);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --background: #09090B;
  --foreground: #FAFAFA;
  --muted: #18181B;
  --muted-foreground: #A1A1AA;
  --accent: #4D7CFF;
  --accent-secondary: #7C9CFF;
  --border: #27272A;
  --card: #111113;
  --ring: #4D7CFF;
  --inverted-bg: #FFFFFF;
  --inverted-fg: #0F172A;
  --inverted-muted: rgba(15, 23, 42, 0.62);
  --dot-color: rgba(15, 23, 42, 1);
  --accent-5: rgba(77, 124, 255, 0.07);
  --accent-8: rgba(77, 124, 255, 0.12);
  --accent-30: rgba(77, 124, 255, 0.35);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 6px; }

.mono { font-family: var(--font-mono); }
.dim { color: var(--muted-foreground); }
.hidden { display: none !important; }

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- App shell ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100dvh;
  position: relative;
}

/* Ambient radial glow, top-right */
.app::before {
  content: '';
  position: absolute;
  top: -240px;
  right: -240px;
  width: 640px;
  height: 640px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.05;
  filter: blur(150px);
  pointer-events: none;
}

/* Sidebar */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px 16px;
  border-right: 1px solid var(--border);
  background: var(--card);
  position: relative;
  z-index: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 22px;
  color: var(--foreground);
}
.brand:hover { color: var(--foreground); }

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--gradient);
  box-shadow: var(--shadow-accent);
  flex-shrink: 0;
  position: relative;
}
.brand-mark::after {
  content: '';
  position: absolute;
  inset: 5px;
  background: url(assets/6529-mark.png) center / contain no-repeat;
}

.brand-text {
  display: flex;
  flex-direction: column;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  line-height: 1;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-top: 5px;
}

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted-foreground);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease-out;
}
.nav-item:hover { background: var(--muted); color: var(--foreground); }
.nav-item[aria-current="page"] { background: var(--accent-8); color: var(--accent); }

.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--muted);
  color: var(--muted-foreground);
  transition: all 0.2s ease-out;
  flex-shrink: 0;
}
.nav-icon svg { width: 16px; height: 16px; }
.nav-item:hover .nav-icon { transform: scale(1.06); }
.nav-item[aria-current="page"] .nav-icon {
  background: var(--gradient);
  color: var(--accent-foreground);
  box-shadow: var(--shadow-accent);
}

.nav-caret { width: 14px; height: 14px; margin-left: auto; color: var(--muted-foreground); transition: transform 0.25s var(--ease-out); }
.nav-item[aria-current="page"] .nav-caret { transform: rotate(180deg); color: var(--accent); }
.nav-sub { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 6px 28px; position: relative; overflow: hidden; animation: dropdown 0.3s var(--ease-out) both; }
@keyframes dropdown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.nav-sub[hidden] { display: none; }
.nav-sub::before { content: ''; position: absolute; left: 25px; top: 4px; bottom: 6px; width: 2px; border-radius: 2px; background: var(--border); }
.nav-subitem {
  display: flex; align-items: center;
  height: 36px; padding: 0 12px;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--muted-foreground); font-size: 13px; font-weight: 500;
  cursor: pointer; text-align: left; transition: all 0.2s ease-out;
}
.nav-subitem:hover { background: var(--muted); color: var(--foreground); }
.nav-subitem[aria-current="true"] { color: var(--accent); background: var(--accent-5); }
.subnav.mobile-only { display: none; }
.stat-link { color: inherit; cursor: pointer; }
.stat-link:hover { color: inherit; border-color: var(--accent-30); }

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 4px;
}

.status {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--muted);
  border: 1px solid var(--border);
}
.status-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-width: 0; }
.status-k { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted-foreground); white-space: nowrap; }
.status-k .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.status-v { font-size: 11px; color: var(--foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-mobile { display: none; }
.sidebar .status-row { flex-direction: column; align-items: flex-start; gap: 2px; }
.sidebar .status-row + .status-row { padding-top: 6px; border-top: 1px solid var(--border); }
.sidebar .status-v { font-size: 12px; }

/* Badge (section label) */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--accent-30);
  background: var(--accent-5);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  width: fit-content;
  white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

/* Main */

.main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  padding: 24px 28px 28px;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.topbar-title { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(24px, 2.3vw, 32px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.topbar-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--muted-foreground);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease-out;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--foreground); border-color: var(--accent-30); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.icon-btn:active { transform: scale(0.98); }
.icon-btn .icon-moon { display: none; }
:root[data-theme="dark"] .icon-btn .icon-sun { display: none; }
:root[data-theme="dark"] .icon-btn .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-btn .icon-moon { display: block; }
}

/* ---------- Views ---------- */

.view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: var(--gap);
  min-height: 0;
}

/* Staggered entrance */
.view > * > *, .view > .toolbar, .view > .scroll-area {
  animation: fadeInUp 0.7s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 70ms + 40ms);
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s ease-out, transform 0.3s ease-out;
}
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-5), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease-out;
  pointer-events: none;
}
.card:hover { box-shadow: var(--shadow-xl); transform: translateY(-2px); }
.card:hover::after { opacity: 1; }

/* Stats */

.stats { display: grid; gap: var(--gap); }
.stats-3 { grid-template-columns: 1.3fr 1fr 1fr; }
.stats-4 { grid-template-columns: 1.3fr 1fr 1fr 1fr; }

.stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 24px;
  min-width: 0;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.stat-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 2.4vw, 36px);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-foot { display: flex; align-items: center; gap: 10px; min-height: 22px; }
.stat-sub { font-size: 12px; color: var(--muted-foreground); }

/* Inverted hero stat with dot texture and rotating ring */

.stat-hero {
  background: var(--inverted-bg);
  color: var(--inverted-fg);
  border-color: transparent;
}
.stat-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--dot-color) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.05;
  pointer-events: none;
}
.stat-hero::after { background: radial-gradient(circle at 100% 0%, var(--accent-30), transparent 55%); opacity: 0.6; }
.stat-hero .stat-label { color: var(--inverted-muted); }
.stat-hero .stat-sub { color: var(--inverted-muted); }
.stat-hero .stat-value { font-size: clamp(34px, 3vw, 48px); }
.stat-hero > * { position: relative; z-index: 1; }

.stat-hero .ring {
  position: absolute;
  right: -44px;
  bottom: -44px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 1.5px dashed var(--accent-secondary);
  opacity: 0.55;
  animation: spin 60s linear infinite;
  z-index: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Trend badge */

.trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  background: var(--gradient);
  color: var(--accent-foreground);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  box-shadow: var(--shadow-accent);
}
.trend:empty { display: none; }
.trend svg { width: 12px; height: 12px; }
.trend.down { background: var(--muted); color: var(--muted-foreground); box-shadow: none; }
.stat-hero .trend.down { background: rgba(127, 127, 127, 0.2); color: var(--inverted-fg); }

/* Panels */

.panels { display: grid; gap: var(--gap); min-height: 0; }
.panels-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panels-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panels-overview { grid-template-columns: 1.1fr 1fr 0.75fr; }
.panels-economy { grid-template-columns: 1.2fr 1fr 0.7fr; }

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 22px;
  margin: 0;
  min-height: 0;
  min-width: 0;
}

.panel figcaption, .panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.panel-title { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.panel figcaption .mono, .panel-head .mono { font-size: 11px; }

.chart-plot { flex: 1 1 auto; min-height: 0; position: relative; }
.chart-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-plot .grid { stroke: var(--border); stroke-width: 1; }
.chart-plot .axis-label { font-family: var(--font-mono); font-size: 11px; fill: var(--muted-foreground); }
.chart-plot .value-label { font-family: var(--font-mono); font-size: 11px; fill: var(--foreground); }
.chart-plot .series-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-plot .series-area { fill: url(#areaFill); }
.chart-plot .series-end { fill: var(--accent); stroke: var(--card); stroke-width: 2; }
.chart-plot .bar { fill: url(#barFill); }
.chart-plot .bar.ytd { opacity: 0.45; }
.chart-plot .crosshair { stroke: var(--muted-foreground); stroke-width: 1; stroke-dasharray: 2 3; pointer-events: none; }
.chart-plot .hover-dot { fill: var(--accent); stroke: var(--card); stroke-width: 2; pointer-events: none; }
.chart-plot .hit { fill: transparent; cursor: crosshair; }
.chart-plot .skeleton { fill: var(--muted); }

.tooltip {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--foreground);
  color: var(--background);
  font-size: 12px;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 12px));
  box-shadow: var(--shadow-lg);
}

/* Side panel key/value lists */

.side { gap: 14px; overflow: auto; }
.side .panel-head:not(:first-child) { margin-top: 6px; }

.kv-list { display: flex; flex-direction: column; gap: 6px; }
.kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--muted);
}
.kv .k { font-size: 12px; color: var(--muted-foreground); }
.kv .v { font-family: var(--font-display); font-weight: 700; font-size: 18px; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; flex-shrink: 0; }

/* ---------- Economy sub-views ---------- */

.view-economy { grid-template-rows: minmax(0, 1fr); }
.subview { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: var(--gap); min-height: 0; }
.kv-link { cursor: pointer; transition: all 0.2s ease-out; color: inherit; }
a.kv-link:hover { color: inherit; }
.kv-link:hover { background: var(--accent-8); }
.kv .k.who { display: inline-flex; align-items: center; gap: 8px; color: var(--foreground); font-weight: 500; min-width: 0; }
.kv .k.who img { width: 22px; height: 22px; border-radius: 6px; object-fit: cover; background: var(--border); flex-shrink: 0; }
.kv .k.who span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Artists (inside Economy) ---------- */

.toolbar.toolbar-row { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; }
.toolbar.toolbar-row .toolbar-note { margin-left: auto; font-size: 11px; }

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 14px;
  min-width: 260px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--muted-foreground);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease-out;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-8); }
.search svg { width: 16px; height: 16px; flex-shrink: 0; }
.search input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--foreground); font: inherit; min-width: 0; }
.search input::placeholder { color: var(--muted-foreground); opacity: 0.6; }

.artist-list { display: flex; flex-direction: column; gap: 8px; }

.artist-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease-out;
}
.artist-row:hover { border-color: var(--accent-30); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.artist-avatar { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--muted); }
.artist-name { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artist-handles { font-family: var(--font-mono); font-size: 11px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artist-metric { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 72px; }
.artist-metric .v { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.artist-metric .k { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-foreground); }
.artist-row .chev { width: 16px; height: 16px; color: var(--muted-foreground); }

.detail { display: flex; flex-direction: column; gap: 20px; }
.back {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px 0 8px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--card);
  color: var(--muted-foreground); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all 0.2s ease-out; width: fit-content;
}
.back:hover { color: var(--foreground); border-color: var(--accent-30); }
.back svg { width: 16px; height: 16px; }

.detail-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.detail-avatar { width: 84px; height: 84px; border-radius: 20px; object-fit: cover; background: var(--muted); box-shadow: var(--shadow-lg); }
.detail-title { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.detail-title h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 28px; letter-spacing: -0.03em; line-height: 1.1; }
.handle-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.handle-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--accent-30); background: var(--accent-5);
  font-family: var(--font-mono); font-size: 11px; color: var(--accent);
  transition: all 0.2s ease-out;
}
.handle-chip:hover { background: var(--gradient); color: var(--accent-foreground); border-color: transparent; box-shadow: var(--shadow-accent); }
.handle-chip svg { width: 12px; height: 12px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.meme-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 10px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--border);
  color: inherit; transition: all 0.2s ease-out;
}
.meme-card:hover { color: inherit; border-color: var(--accent-30); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.meme-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--muted); }
.meme-card .t { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meme-card .m { display: flex; justify-content: space-between; gap: 8px; font-family: var(--font-mono); font-size: 10px; color: var(--muted-foreground); }
.meme-card .m b { color: var(--foreground); font-weight: 500; }

/* ---------- Split bars (grants per card) ---------- */

.chips-era .chip[aria-selected="true"] { background: var(--foreground); color: var(--background); box-shadow: none; }

.split { display: flex; gap: 2px; height: 10px; width: 100%; min-width: 0; }
.split-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.split-track { width: 100%; }
.split .seg { height: 100%; border-radius: 3px; background: var(--accent); min-width: 2px; cursor: default; transition: opacity 0.15s ease-out; }
.split .seg:nth-child(even) { opacity: 0.45; }
.split .seg:hover { opacity: 1; outline: 2px solid var(--accent-30); }
.split-lg { height: 22px; gap: 3px; }
.split-lg .seg { border-radius: 6px; }
.split-note { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-foreground); }

.artist-row.with-bar { grid-template-columns: 44px minmax(0, 1.2fr) minmax(0, 1fr) auto auto auto; }
.artist-row .split-wrap { padding-right: 8px; }

.card-row .artist-avatar { border-radius: 8px; }
.era-tag { display: inline-block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--muted); color: var(--muted-foreground); margin-left: 8px; vertical-align: middle; }
.era-tag.voted { background: var(--accent-8); color: var(--accent); }

.card-hero { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 24px; align-items: start; }
.card-hero img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 16px; background: var(--muted); box-shadow: var(--shadow-xl); }
.card-hero .detail-title h2 { font-size: 30px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted-foreground); }
.card-meta b { color: var(--foreground); font-weight: 600; }

/* ---------- Collectors ---------- */

.view-artists, .view-collectors { grid-template-rows: auto minmax(0, 1fr); }
.collector-row { grid-template-columns: 44px 44px minmax(0, 1fr) auto auto auto auto; color: inherit; }
.collector-row:hover { color: inherit; }
.collector-row .rank { font-family: var(--font-mono); font-size: 12px; color: var(--muted-foreground); text-align: right; }
.collector-row .artist-avatar { border-radius: 50%; }
.load-more-wrap { display: flex; justify-content: center; padding: 16px 0 4px; }
.load-more { height: 44px; padding: 0 22px; }

/* ---------- Builders view ---------- */

.view-builders { grid-template-rows: auto minmax(0, 1fr); }
.builder-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 0.9fr) minmax(0, 1.6fr) 110px 108px;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  transition: all 0.2s ease-out;
}
.builder-row:hover { border-color: var(--accent-30); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.builder-row .artist-avatar { border-radius: 10px; }
.builder-row .artist-name a { color: inherit; }
.builder-row .artist-name a:hover { color: var(--accent); }
.builder-row .artist-handles a { color: inherit; }
.builder-row .artist-handles a:hover { color: var(--accent); }
.builder-tagline {
  font-size: 13px; line-height: 1.5; color: var(--muted-foreground);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.builder-row .entry-cat { justify-self: start; }
.builder-row .entry-links { display: grid; grid-template-columns: repeat(3, 32px); gap: 4px; justify-content: end; }
.builder-row .slot { display: grid; place-items: center; width: 32px; height: 32px; }

.toolbar { display: flex; flex-direction: column; gap: 10px; }
.toolbar-note { margin: 0; font-size: 13px; color: var(--muted-foreground); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease-out;
}
.chip:hover { color: var(--foreground); border-color: var(--accent-30); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.chip[aria-selected="true"] { background: var(--gradient); color: var(--accent-foreground); border-color: transparent; box-shadow: var(--shadow-accent); }

.scroll-area { min-height: 0; overflow: auto; padding: 2px; margin: -2px; }

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }

.card.entry {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  min-height: 190px;
}
.card.entry.placeholder { border-style: dashed; box-shadow: none; }

.entry-head { display: flex; align-items: center; gap: 12px; }

.entry-pfp {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--gradient);
  flex-shrink: 0;
  object-fit: cover;
  box-shadow: var(--shadow-accent);
  transition: transform 0.3s ease-out;
}
.placeholder .entry-pfp { background: var(--muted); box-shadow: none; }
.card.entry:hover .entry-pfp { transform: scale(1.08); }

.entry-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.entry-handle { font-family: var(--font-mono); font-size: 11px; color: var(--muted-foreground); }
.entry-handle a { color: inherit; }
.entry-handle a:hover { color: var(--accent); }

.entry-tagline { font-size: 13px; color: var(--muted-foreground); flex-grow: 1; line-height: 1.6; text-wrap: pretty; }

.entry-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.entry-cat {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 5px 10px;
  border: 1px solid var(--accent-30);
  background: var(--accent-5);
  border-radius: 999px;
}

.entry-links { display: flex; gap: 4px; }
.entry-links a {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--muted-foreground);
  transition: all 0.2s ease-out;
}
.entry-links a:hover { color: var(--accent); background: var(--accent-8); }
.entry-links svg { width: 16px; height: 16px; }
.mark-sm { display: block; width: 18px; height: 18px; border-radius: 5px; background: var(--gradient); position: relative; box-shadow: var(--shadow-accent); }
.mark-sm::after { content: ''; position: absolute; inset: 3px; background: url(assets/6529-mark.png) center / contain no-repeat; }
.entry-links a:hover .mark-sm { transform: scale(1.08); }

.empty { margin: 0; color: var(--muted-foreground); font-size: 13px; }

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

@media (max-width: 1180px) {
  .panels-economy { grid-template-columns: 1fr 1fr; }
  .panels-economy .side { grid-column: 1 / -1; }
  .subview { overflow: auto; grid-template-rows: auto auto; }
  .stats-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-hero { grid-column: 1 / -1; }
  .panels-overview { grid-template-columns: 1fr 1fr; }
  .panels-overview .side { grid-column: 1 / -1; }
  .panels-3 { grid-template-columns: 1fr 1fr; }
  .panels-3 > :last-child { grid-column: 1 / -1; }
  .view { overflow: auto; grid-template-rows: auto auto; }
  .panels .chart { min-height: 240px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; height: auto; min-height: 100dvh; }
  .app::before { display: none; }

  .sidebar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    flex-direction: row;
    align-items: center;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
  }
  .brand, .sidebar-foot { display: none; }
  .nav {
    flex-direction: row; width: 100%; gap: 2px;
    overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent);
            mask-image: linear-gradient(to right, #000 88%, transparent);
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav.at-end { -webkit-mask-image: none; mask-image: none; }
  .nav-item { flex-direction: column; justify-content: center; gap: 4px; height: 52px; padding: 0 4px; font-size: 10px; flex: 0 0 68px; scroll-snap-align: start; }
  .nav-item .nav-caret { display: none; }
  .nav-icon { width: 26px; height: 26px; }

  .main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); gap: 16px; grid-template-rows: auto auto auto; }
  .chip, .back, .nav-subitem { min-height: 44px; }
  .nav-item { min-height: 52px; }
  .subnav.mobile-only { display: flex; }
  .nav-sub { display: none; }
  .view-economy { grid-template-rows: auto auto; }
  .status-mobile { display: flex; }
  .topbar { align-items: flex-start; }
  .view, .subview { overflow: visible; align-content: start; }
  .main { align-content: start; }

  .stats-3, .stats-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-hero { grid-column: 1 / -1; }
  .stats-4 .stat:last-child { grid-column: 1 / -1; }
  .stat { padding: 16px 18px; }
  .stat-value { font-size: 28px; }
  .stat-hero .stat-value { font-size: 38px; }

  .panels-2, .panels-3, .panels-overview, .panels-economy { grid-template-columns: 1fr; }
  .artist-row, .artist-row.with-bar { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; }
  .artist-row .m-secondary, .artist-row .chev, .artist-row .split-wrap { display: none; }
  .builder-row { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 14px; }
  .builder-row .artist-avatar { grid-row: 1 / span 2; align-self: start; width: 40px; height: 40px; }
  .builder-row .builder-tagline { grid-column: 2 / -1; grid-row: 2; font-size: 12px; }
  .builder-row .entry-cat { display: none; }
  .builder-row .entry-links { grid-column: 3; grid-row: 1; }
  .collector-row { grid-template-columns: 28px 40px minmax(0, 1fr) auto auto; gap: 10px; }
  .collector-row .artist-metric { display: none; min-width: 0; }
  #collectors-list .m-balance,
  #collectors-list[data-sort="boosted_tdh"] .m-boosted_tdh,
  #collectors-list[data-sort="unique_memes"] .m-unique_memes,
  #collectors-list[data-sort="memes_cards_sets"] .m-memes_cards_sets { display: flex; }
  #collectors-list[data-sort="unique_memes"] .m-balance,
  #collectors-list[data-sort="memes_cards_sets"] .m-balance { display: none; }
  #collectors-list[data-sort="unique_memes"] .m-boosted_tdh,
  #collectors-list[data-sort="memes_cards_sets"] .m-boosted_tdh { display: none; }
  .collector-row .artist-handles { display: none; }
  .collector-row .era-tag { display: none; }
  .card-hero { grid-template-columns: 1fr; }
  .card-hero img { max-width: 320px; }
  .search { min-width: 0; width: 100%; }
  .toolbar.toolbar-row .toolbar-note { margin-left: 0; }
  .detail-avatar { width: 64px; height: 64px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panels-3 > :last-child, .panels-overview .side { grid-column: auto; }
  .panels .chart { min-height: 220px; }
  .cards { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .pulse, .stat-hero .ring { animation: none; }
  .view > * > *, .view > .toolbar, .view > .scroll-area { animation: none; }
  .card, .chip, .icon-btn, .nav-item, .nav-icon, .entry-pfp { transition: none; }
}

/* ---------- Case view (embedded 3D viewer) ---------- */
.view-case { grid-template-rows: minmax(0, 1fr); }
.case-frame-wrap {
  position: relative; min-height: 0; height: 100%;
  border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
  background: var(--card); box-shadow: var(--shadow-sm);
}
.case-frame { display: block; width: 100%; height: 100%; border: 0; }
@media (max-width: 860px) {
  .view-case { min-height: 78dvh; }
  .case-frame-wrap { height: 78dvh; }
}
