/* Pingroupie (Bun) — components on the shared tokens in tokens.css (loaded first).
   Same system as chempirical.com and martymonero.com: neutral surfaces, one pink accent. */

:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 8px;
  --chart-1: hsl(var(--accent));
  --chart-2: hsl(var(--info));
  --chart-3: hsl(var(--success));
  --chart-4: hsl(var(--warning));
  --chart-5: hsl(var(--partner));
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  font-feature-settings: "cv11", "ss01", "ss03";
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

main { flex: 1; }

::selection { background: hsl(var(--accent) / 0.16); }

* { scrollbar-width: thin; scrollbar-color: hsl(var(--border-strong)) transparent; }

h1, h2, h3 { letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 650; line-height: 1.1; letter-spacing: -0.035em; margin: 0 0 16px; }
h2 { font-size: 20px; font-weight: 600; line-height: 1.3; margin: 40px 0 12px; }
h3 { font-size: 16px; font-weight: 600; margin: 24px 0 8px; }
p { margin: 0 0 16px; }

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

img, svg { max-width: 100%; vertical-align: middle; }

code, kbd, pre { font-family: var(--mono); }
code { font-size: 0.88em; background: hsl(var(--background-subtle)); border: 1px solid hsl(var(--border)); padding: 0.05em 0.35em; border-radius: 5px; }
pre { background: hsl(var(--background-subtle)); border: 1px solid hsl(var(--border)); border-radius: 12px; padding: 16px; overflow-x: auto; font-size: 13px; }
pre code { background: none; border: 0; padding: 0; }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid hsl(var(--border)); border-bottom-width: 2px; border-radius: 5px; background: hsl(var(--background-subtle)); color: hsl(var(--muted-foreground)); font-family: var(--font); font-size: 11px; font-weight: 500; }

hr { border: none; border-top: 1px solid hsl(var(--border)); margin: 32px 0; }

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

.container { width: 100%; max-width: var(--content-width); margin-inline: auto; padding-inline: 24px; }
@media (max-width: 640px) { .container { padding-inline: 16px; } }

.page { padding-block: 40px 64px; }

.skip-link { position: absolute; left: -9999px; top: 0; z-index: 200; background: hsl(var(--card)); color: hsl(var(--foreground)); padding: 12px 16px; border-radius: 0 0 8px 0; }
.skip-link:focus { left: 0; }

.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: hsl(var(--subtle)); font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--header-height);
  border-bottom: 1px solid transparent;
  background: hsl(var(--background) / 0.72);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  transition: border-color 200ms ease;
}
.site-header[data-scrolled] { border-bottom-color: hsl(var(--border)); }

.nav { display: flex; align-items: center; gap: 24px; height: 100%; }

.brand { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; color: hsl(var(--foreground)); font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 24px; height: 24px; }

.nav-main { display: flex; align-items: center; gap: 4px; }

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 6px;
  color: hsl(var(--muted-foreground));
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease;
}
.nav-link:hover { color: hsl(var(--foreground)); background: hsl(var(--surface-hover)); text-decoration: none; }
.nav-link.active { color: hsl(var(--foreground)); }

.nav-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.nav-signin { padding: 6px 10px; border-radius: 6px; color: hsl(var(--muted-foreground)); font-size: 14px; font-weight: 500; white-space: nowrap; }
.nav-signin:hover { color: hsl(var(--foreground)); background: hsl(var(--surface-hover)); text-decoration: none; }

details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; user-select: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary::marker { content: ""; }

.chev { color: hsl(var(--subtle)); flex-shrink: 0; transition: transform 150ms ease; }
details.menu[open] > summary .chev { transform: rotate(180deg); }

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 90;
  min-width: 15rem;
  padding: 4px;
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  background: hsl(var(--popover));
  box-shadow: var(--elevation-medium);
}
.menu-panel.panel-right { left: auto; right: 0; }

.menu-header { padding: 8px 10px 10px; border-bottom: 1px solid hsl(var(--border)); margin: 0 -4px 4px; padding-inline: 14px; }
.menu-user-email { margin: 0; max-width: 16rem; overflow: hidden; font-size: 14px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.menu-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.menu-group { padding: 2px 0; }
.menu-group + .menu-group { border-top: 1px solid hsl(var(--border)); margin: 0 -4px; padding: 4px; }

.menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: none;
  border-radius: 6px;
  background: none;
  color: hsl(var(--foreground));
  font-family: inherit;
  font-size: 13.5px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms ease;
}
.menu-link:hover { background: hsl(var(--surface-hover)); text-decoration: none; }
.menu-link .badge { margin-left: auto; }

.menu-upgrade, .mobile-upgrade {
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 8px;
  background: hsl(var(--accent) / 0.1);
  color: hsl(var(--accent-text));
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}
.menu-upgrade { width: calc(100% - 8px); margin: 4px; min-height: 34px; padding: 0 10px; font-size: 13.5px; }
.mobile-upgrade { width: calc(100% - 32px); margin: 8px 16px; min-height: 44px; padding: 0 16px; font-size: 15px; }
.menu-upgrade:hover, .mobile-upgrade:hover { background: hsl(var(--accent) / 0.16); }

.user-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--card));
  box-shadow: var(--elevation-small), var(--highlight);
  font-size: 14px;
  font-weight: 500;
  color: hsl(var(--foreground));
}
.user-summary:hover { border-color: hsl(var(--border-strong)); }
.user-email { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-burger { display: none; }
/* A closed <details> still lays out its content in Chrome and it counts toward page width. */
details.nav-burger:not([open]) > .mobile-panel { display: none; }

/* The header's backdrop-filter makes it the containing block for fixed children,
   so the panel is placed by top + explicit height, not by bottom: 0. */
.mobile-panel {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: calc(100dvh - var(--header-height));
  z-index: 90;
  overflow-y: auto;
  padding-bottom: 40px;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--background));
}
.mobile-user { padding: 16px; border-bottom: 1px solid hsl(var(--border)); }
.mobile-section { padding: 20px 16px 6px; color: hsl(var(--subtle)); font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; }
.mobile-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 16px;
  border: none;
  background: none;
  color: hsl(var(--foreground));
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.mobile-link:hover, .mobile-link.active { background: hsl(var(--surface-hover)); text-decoration: none; }
.mobile-link-accent { color: hsl(var(--accent-text)); }

/* The toggle shows the theme it switches to: a moon in light, a sun in dark. */
.icon-sun { display: none; }
.icon-moon { display: inline; }
:root[data-theme="dark"] .icon-sun { display: inline; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: inline; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

@media (max-width: 900px) {
  .nav-main, .nav-right .user-menu, .nav-right .nav-signin, .nav-right > .btn { display: none; }
  .nav-burger { display: block; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: hsl(var(--foreground));
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(0.5px); }

.btn-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); box-shadow: var(--elevation-small); }
.btn-primary:hover { background: hsl(var(--primary) / 0.88); }

.btn-accent { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08), 0 6px 20px -8px hsl(var(--accent)); }
.btn-accent:hover { background: hsl(var(--accent) / 0.9); }

.btn-ghost { background: hsl(var(--card)); border-color: hsl(var(--border)); box-shadow: var(--elevation-small), var(--highlight); }
.btn-ghost:hover { background: hsl(var(--surface-raised)); border-color: hsl(var(--border-strong)); }

.btn-danger { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }
.btn-danger:hover { background: hsl(var(--destructive) / 0.88); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; border-radius: 6px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 15px; border-radius: 10px; }

.btn[disabled], .btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease;
}
.btn-icon:hover { background: hsl(var(--surface-hover)); color: hsl(var(--foreground)); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  background: hsl(var(--card));
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-premium, .badge-beta { border-color: hsl(var(--accent) / 0.3); background: hsl(var(--accent) / 0.1); color: hsl(var(--accent-text)); }
.badge-beta { height: 20px; padding: 0 6px; font-size: 11px; }
.badge-admin { border-color: hsl(var(--info) / 0.35); background: hsl(var(--info) / 0.1); color: hsl(var(--info)); }
.badge-muted { background: hsl(var(--background-subtle)); }
.badge-success { border-color: hsl(var(--success) / 0.35); background: hsl(var(--success) / 0.1); color: hsl(var(--success)); }
.badge-warning { border-color: hsl(var(--warning) / 0.35); background: hsl(var(--warning) / 0.1); color: hsl(var(--warning)); }
.badge-danger { border-color: hsl(var(--destructive) / 0.35); background: hsl(var(--destructive) / 0.1); color: hsl(var(--destructive)); }

/* Surfaces */
.card, .stat-card {
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  background: hsl(var(--card));
  box-shadow: var(--elevation-small), var(--highlight);
}
.card { padding: 20px; }
.card-title { margin: 0 0 12px; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

.stat-card { padding: 16px 20px; }
.stat-label { color: hsl(var(--subtle)); font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; }
.stat-value { margin-top: 6px; font-size: 26px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-sub { margin-top: 4px; color: hsl(var(--muted-foreground)); font-size: 12.5px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 16px 0; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid hsl(var(--border)); border-radius: 12px; background: hsl(var(--card)); box-shadow: var(--elevation-small), var(--highlight); }
.table-scroll { max-height: 70vh; overflow: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.5; font-variant-numeric: tabular-nums; }
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 40px;
  padding: 0 14px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background-subtle));
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
thead th a { color: inherit; }
thead th a:hover { color: hsl(var(--foreground)); text-decoration: none; }
tbody td { padding: 10px 14px; border-bottom: 1px solid hsl(var(--border)); vertical-align: middle; }
tbody td a.truncate { color: hsl(var(--foreground)); font-weight: 500; }
tbody td a.truncate:hover { color: hsl(var(--foreground)); text-decoration: underline; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: hsl(var(--background-subtle)); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.table-empty { padding: 40px 16px; color: hsl(var(--muted-foreground)); text-align: center; }

/* Forms */
label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; }

input, select, textarea {
  max-width: 100%;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
input, select { height: 34px; padding: 0 10px; }
textarea { width: 100%; min-height: 110px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: hsl(var(--border-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: hsl(var(--accent)); box-shadow: 0 0 0 3px hsl(var(--accent) / 0.12); }
input[aria-invalid="true"] { border-color: hsl(var(--destructive)); }
::placeholder { color: hsl(var(--subtle)); }
select { cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; padding: 0; accent-color: hsl(var(--accent)); cursor: pointer; }

fieldset { margin: 0 0 16px; padding: 16px 20px; border: 1px solid hsl(var(--border)); border-radius: 12px; }
legend { padding: 0 6px; font-size: 13px; font-weight: 600; }

.field { margin-bottom: 16px; }
.field input, .field select { width: 100%; }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; }
.form-row .field { flex: 1; min-width: 180px; }
.filters { padding: 16px 18px; }
.filters .field { margin-bottom: 0; }
.filters .form-row.mt-2 { margin-top: 12px; }
.filters label { margin-bottom: 6px; font-size: 13px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row label { margin: 0; font-weight: 500; cursor: pointer; }
.help-text { margin-top: 4px; color: hsl(var(--muted-foreground)); font-size: 12.5px; }
.error-text { margin-top: 4px; color: hsl(var(--destructive)); font-size: 13px; }

/* Flash messages */
.flash { border-bottom: 1px solid hsl(var(--border)); background: hsl(var(--card)); font-size: 14px; }
.flash-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; }
.flash-success { background: hsl(var(--success) / 0.08); border-bottom-color: hsl(var(--success) / 0.3); }
.flash-error { background: hsl(var(--destructive) / 0.08); border-bottom-color: hsl(var(--destructive) / 0.3); }
.flash-info { background: hsl(var(--info) / 0.08); border-bottom-color: hsl(var(--info) / 0.3); }
.flash-close { padding: 2px 6px; border: none; background: none; color: hsl(var(--muted-foreground)); font-size: 18px; line-height: 1; cursor: pointer; }
.flash-close:hover { color: hsl(var(--foreground)); }

/* Dialog */
dialog { width: calc(100% - 32px); max-width: 540px; padding: 24px; border: 1px solid hsl(var(--border)); border-radius: 16px; background: hsl(var(--popover)); color: hsl(var(--foreground)); box-shadow: var(--elevation-large); }
dialog::backdrop { background: rgb(0 0 0 / 0.5); backdrop-filter: blur(2px); }
.dialog-title { margin: 0 0 12px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 24px 0; }
.page-link {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--elevation-small);
}
.page-link:hover { border-color: hsl(var(--border-strong)); background: hsl(var(--surface-raised)); text-decoration: none; }
.page-link.current { border-color: hsl(var(--accent) / 0.3); background: hsl(var(--accent) / 0.1); color: hsl(var(--accent-text)); font-weight: 600; box-shadow: none; }
.page-link.disabled { opacity: 0.45; box-shadow: none; }
.page-gap { display: inline-grid; place-items: center; min-width: 24px; color: hsl(var(--subtle)); }

/* Charts */
.chart { width: 100%; margin: 0; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--grid-line); stroke-width: 1; }
.chart .zero { stroke: hsl(var(--muted-foreground)); stroke-width: 1; stroke-dasharray: 4 3; }
.chart .tick { fill: hsl(var(--subtle)); font-family: var(--font); font-size: 11px; }
.chart .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { opacity: 0.9; }
.chart .pt-hit { opacity: 0; }
.chart .pt-hit:hover { opacity: 0.9; }
.chart .bar { fill: var(--chart-1); opacity: 0.85; }
.chart .bar:hover { opacity: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; color: hsl(var(--muted-foreground)); font-size: 12.5px; }
.legend-item { display: inline-flex; align-items: center; }
.legend-swatch { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; }
.chart-empty { padding: 40px 16px; border: 1px dashed hsl(var(--border-strong)); border-radius: 12px; color: hsl(var(--muted-foreground)); font-size: 14px; text-align: center; }
.chart-tooltip { position: fixed; z-index: 120; max-width: 280px; padding: 6px 10px; border: 1px solid hsl(var(--border)); border-radius: 8px; background: hsl(var(--popover)); box-shadow: var(--elevation-medium); font-size: 12.5px; pointer-events: none; }

/* Search suggestions */
.suggest-wrap { position: relative; }
.suggest-panel { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 70; overflow: hidden; padding: 4px; border: 1px solid hsl(var(--border)); border-radius: 12px; background: hsl(var(--popover)); box-shadow: var(--elevation-medium); }
.suggest-item { display: block; width: 100%; padding: 7px 10px; border: none; border-radius: 6px; background: none; color: hsl(var(--foreground)); font-family: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.suggest-item:hover, .suggest-item.active { background: hsl(var(--surface-hover)); }

[data-watch].watched { color: hsl(var(--accent-text)); border-color: hsl(var(--accent) / 0.4); }

/* Admin shell */
.admin-shell { display: flex; min-height: calc(100vh - var(--header-height)); }
.admin-nav { position: sticky; top: var(--header-height); width: 220px; height: calc(100vh - var(--header-height)); flex-shrink: 0; overflow-y: auto; padding: 12px 8px; border-right: 1px solid hsl(var(--border)); }
.admin-nav a { display: block; padding: 6px 10px; border-radius: 6px; color: hsl(var(--muted-foreground)); font-size: 13.5px; font-weight: 500; }
.admin-nav a:hover { background: hsl(var(--surface-hover)); color: hsl(var(--foreground)); text-decoration: none; }
.admin-nav a.active { background: hsl(var(--accent) / 0.1); color: hsl(var(--accent-text)); }
.admin-content { flex: 1; min-width: 0; padding: 24px; }

@media (max-width: 900px) {
  .admin-shell { display: block; min-height: 0; }
  .admin-nav { position: static; display: flex; gap: 4px; width: auto; height: auto; overflow-x: auto; border-right: none; border-bottom: 1px solid hsl(var(--border)); }
  .admin-nav nav { display: flex; gap: 4px; }
  .admin-nav a { white-space: nowrap; }
}

/* Footer */
.site-footer { margin-top: 64px; border-top: 1px solid hsl(var(--border)); color: hsl(var(--subtle)); font-size: 13.5px; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-block: 32px; }
.footer-inner nav, .footer-links { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-inner a { color: hsl(var(--subtle)); }
.footer-inner a:hover { color: hsl(var(--foreground)); text-decoration: none; }

/* 404 */
.notfound { padding-top: 80px; text-align: center; }
.notfound-code { margin: 0; color: hsl(var(--subtle)); font-family: var(--mono); font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
.notfound h1 { margin: 12px 0 8px; }
.notfound-actions { display: flex; justify-content: center; gap: 12px; margin-top: 24px; }

/* Hero */
.hero { padding: 48px 0 32px; }
.hero h1 { margin-bottom: 12px; }

.hero-home { position: relative; isolation: isolate; overflow: clip; margin-inline: -24px; padding: 88px 24px 72px; }
.hero-home::before { content: ""; position: absolute; inset: -40% -10% auto; height: 720px; z-index: -1; background: radial-gradient(closest-side, var(--glow), transparent 72%); pointer-events: none; }
.hero-home::after { content: ""; position: absolute; inset: 0; z-index: -2; background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: 56px 56px; mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, black 30%, transparent 75%); pointer-events: none; }
.hero-home h1 {
  max-width: 760px;
  margin-bottom: 24px;
  font-size: clamp(40px, 6.2vw, 68px);
  font-weight: 650;
  line-height: 1.02;
  letter-spacing: -0.045em;
  background: linear-gradient(180deg, hsl(var(--foreground)) 30%, hsl(var(--foreground) / 0.55));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-accent, .hero-home h1 em {
  font-style: normal;
  background: linear-gradient(100deg, hsl(var(--accent-text)), hsl(var(--accent)) 60%, hsl(var(--partner)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-home .lead { max-width: 580px; margin: 0 0 32px; font-size: 18px; line-height: 1.6; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-cta .icon, .hero-cta svg { width: 16px; height: 16px; }
@media (max-width: 640px) { .hero-home { margin-inline: -16px; padding: 56px 16px 48px; } }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 500px); align-items: center; gap: 64px; }
.hero-search { position: relative; display: flex; align-items: center; max-width: 540px; }
.hero-search > svg { position: absolute; left: 14px; color: hsl(var(--subtle)); pointer-events: none; }
.hero-search input { width: 100%; height: 48px; padding: 0 92px 0 40px; border-radius: 10px; font-size: 15px; box-shadow: var(--elevation-small), var(--highlight); }
.hero-search .btn { position: absolute; right: 7px; }
.hero-cta { margin-top: 16px; }
@media (max-width: 1000px) { .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 48px; } }

.btn-subtle { color: hsl(var(--muted-foreground)); }
.btn-subtle:hover { background: hsl(var(--surface-hover)); color: hsl(var(--foreground)); }

/* A product "window": chrome bar, ranked rows, optional footer */
.window { min-width: 0; overflow: hidden; border: 1px solid hsl(var(--border)); border-radius: 16px; background: hsl(var(--card)); box-shadow: var(--elevation-large); }
.window-bar { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 16px; border-bottom: 1px solid hsl(var(--border)); background: hsl(var(--background-subtle)); }
.window-dots { display: flex; gap: 6px; }
.window-dots i { width: 10px; height: 10px; border-radius: 50%; background: hsl(var(--border-strong)); }
.window-title { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.window-title svg { color: hsl(var(--subtle)); }
.window-note { margin-left: auto; color: hsl(var(--subtle)); font-size: 12px; }
.live-badge { margin-left: auto; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: hsl(var(--accent)); }

.rank-list { margin: 0; padding: 0; list-style: none; }
.rank-list li + li { border-top: 1px solid hsl(var(--border)); }
.rank-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; color: hsl(var(--foreground)); transition: background-color 150ms ease; }
.rank-row:hover { background: hsl(var(--background-subtle)); text-decoration: none; }
.rank { width: 20px; flex-shrink: 0; color: hsl(var(--subtle)); font-family: var(--mono); font-size: 12px; text-align: right; }
.rank-body { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.rank-name { font-size: 14px; font-weight: 500; }
.rank-meta { color: hsl(var(--muted-foreground)); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Stat strip under the hero */
.home-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; padding: 0; overflow: hidden; }
.home-stat { margin: 0; padding: 20px 24px; }
.home-stat + .home-stat { border-left: 1px solid hsl(var(--border)); }
.home-stat dd { margin: 8px 0 0; }
@media (max-width: 760px) {
  .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-stat:nth-child(3) { border-left: 0; }
  .home-stat:nth-child(n+3) { border-top: 1px solid hsl(var(--border)); }
}

.home-section { padding: 80px 0 0; }
.home-section > h2, .split h2 { margin: 12px 0 8px; font-size: clamp(26px, 3vw, 34px); font-weight: 650; letter-spacing: -0.03em; }
.feature-grid { margin-top: 40px; gap: 40px 32px; }
.feature-grid h3 { margin: 0 0 6px; font-size: 15px; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: 64px; }
.split.flip > :first-child { order: 2; }
@media (max-width: 1000px) { .split { grid-template-columns: minmax(0, 1fr); gap: 32px; } .split.flip > :first-child { order: 0; } }

.tool-card h3, .link-card h3 { margin: 16px 0 6px; font-size: 15px; }
.tool-card .btn svg { width: 14px; height: 14px; }
.link-card { display: flex; flex-direction: column; color: hsl(var(--foreground)); transition: transform 200ms var(--ease-out, ease), box-shadow 200ms ease; }
.link-card h3 { margin-top: 0; }
.link-card:hover { transform: translateY(-2px); box-shadow: var(--elevation-medium); text-decoration: none; }
.link-card p { flex: 1; }
.link-card-go { display: inline-flex; align-items: center; gap: 4px; color: hsl(var(--muted-foreground)); font-size: 14px; font-weight: 500; }
.link-card-go svg { width: 14px; height: 14px; }

.lead { max-width: 640px; margin: 0 0 24px; color: hsl(var(--muted-foreground)); font-size: 17px; }

.page-intro { padding: 16px 0 32px; }
.page-intro h1 { margin: 16px 0 14px; font-size: clamp(30px, 4.4vw, 44px); line-height: 1.06; letter-spacing: -0.04em; }
.page-intro .lead { font-size: 17px; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0; }

.section-title { margin: 32px 0 12px; color: hsl(var(--subtle)); font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase; }

/* Long-form copy */
.prose { max-width: 680px; font-size: 16px; line-height: 1.75; }
.prose h2 { margin-top: 40px; font-size: 22px; }
.prose h3 { margin-top: 28px; }
.prose img { margin: 16px 0; border-radius: 12px; }
.prose blockquote { margin: 20px 0; padding: 4px 0 4px 20px; border-left: 2px solid hsl(var(--accent)); color: hsl(var(--muted-foreground)); }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 24px; }
.prose li { margin-bottom: 6px; }
.prose a { text-decoration: underline; text-decoration-color: hsl(var(--accent) / 0.35); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: currentColor; }

/* Layout helpers */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .form-row { flex-direction: column; align-items: stretch; }
}

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.muted { color: hsl(var(--muted-foreground)); }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12.5px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: hsl(var(--success)); }
.text-danger { color: hsl(var(--destructive)); }
.text-warning { color: hsl(var(--warning)); }
.text-accent { color: hsl(var(--accent-text)); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.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; }

/* Entity images */
.entity-thumb { width: 40px; height: 40px; flex-shrink: 0; border: 1px solid hsl(var(--border)); border-radius: 8px; background: hsl(var(--surface-raised)); object-fit: cover; }
.entity-thumb.round { border-radius: 50%; }
.avatar-lg { width: 88px; height: 88px; border: 1px solid hsl(var(--border)); border-radius: 50%; background: hsl(var(--surface-raised)); object-fit: cover; }

.btn .icon-heart { transition: fill 150ms ease, color 150ms ease; }
.btn.watched { color: hsl(var(--accent-text)); border-color: hsl(var(--accent) / 0.4); }
.btn.watched .icon-heart { fill: hsl(var(--accent)); color: hsl(var(--accent)); }

/* Custom select: a styled trigger over the native select, which keeps working without JS */
.custom-select { position: relative; }
.custom-select .native-select { width: 100%; }
.custom-select .select-ui { display: none; }
.js .custom-select .native-select { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.js .custom-select .select-ui { display: block; }
.select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease;
}
.select-trigger:hover { border-color: hsl(var(--border-strong)); }
.select-trigger .chev { margin-left: auto; transition: transform 150ms ease; }
.custom-select[data-open] .select-trigger { border-color: hsl(var(--accent)); box-shadow: 0 0 0 3px hsl(var(--accent) / 0.12); }
.custom-select[data-open] .select-trigger .chev { transform: rotate(180deg); }
.select-panel { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 70; display: none; max-height: 22rem; overflow-y: auto; }
.custom-select[data-open] .select-panel { display: block; }
.select-option { justify-content: flex-start; }
.select-option.selected { color: hsl(var(--accent-text)); font-weight: 600; }

.premium-featured {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-color: hsl(var(--accent) / 0.3);
  box-shadow: var(--elevation-medium), var(--highlight);
}
.premium-featured::before { content: ""; position: absolute; inset: -160px 0 auto; z-index: -1; height: 320px; background: radial-gradient(closest-side, var(--glow), transparent); pointer-events: none; }
.premium-featured .btn-primary { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08), 0 6px 20px -8px hsl(var(--accent)); }
.premium-featured .btn-primary:hover { background: hsl(var(--accent) / 0.9); }

/* Loading placeholders */
.skeleton, .skeleton-block, .skeleton-line {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, hsl(var(--surface-raised)), hsl(var(--surface-hover)), hsl(var(--surface-raised)));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-line { height: 14px; margin: 8px 0; }
.skeleton-block { height: 120px; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid hsl(var(--border-strong)); border-top-color: hsl(var(--accent)); border-radius: 50%; animation: spin 700ms linear infinite; }

@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .skeleton, .skeleton-block, .skeleton-line, .spinner { animation: none; } }

/* Home: "Explore all" + checkout in one row, the plan picker above, the note below. */
.cta-block { display: grid; justify-items: start; gap: 10px; margin-top: 16px; }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.plan-picker { display: inline-flex; height: 32px; padding: 2px; border: 1px solid hsl(var(--border)); border-radius: 8px; background: hsl(var(--surface-raised)); }
.plan-picker:empty { visibility: hidden; } /* its space is kept until the plans arrive */
.plan-picker button { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 12px; border: 0; border-radius: 6px; background: none; color: hsl(var(--muted-foreground)); font: inherit; font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.plan-picker button:hover { color: hsl(var(--foreground)); }
.plan-picker button[aria-pressed="true"] { background: hsl(var(--card)); color: hsl(var(--foreground)); box-shadow: var(--elevation-small), var(--highlight); }
.plan-price { opacity: 0.8; }
.badge-save { padding: 0 6px; border-radius: 999px; background: hsl(var(--success) / 0.1); color: hsl(var(--success)); font-size: 11px; white-space: nowrap; }
.billing-note { min-height: 20px; margin: 0; color: hsl(var(--muted-foreground)); font-size: 13px; }
