/* PeptideFolio — two-color brand: #1942F5 + white.
   Apple / GalaxyHQ aesthetic, hairline-only, generous whitespace.
*/

:root {
  --row-h: 64px;
  --row-pad-y: 16px;
  --gap: 16px;
  --radius: 14px;
  --radius-sm: 10px;

  /* Brand (constant) */
  --brand: #1942F5;
  --brand-rgb: 25, 66, 245;
  --brand-deep: #0E2DAE;

  /* Mode-dependent. Default = light (white bg, blue ink). */
  --bg: #FFFFFF;
  --bg-2: #F6F7FF;
  --surface: #FFFFFF;
  --surface-2: #F1F4FF;
  --ink-rgb: 25, 66, 245;     /* what tinted overlays are made of in this mode */
  --border: rgba(var(--ink-rgb), 0.10);
  --border-strong: rgba(var(--ink-rgb), 0.28);
  --line: rgba(var(--ink-rgb), 0.06);
  --fg: #0B1B6B;
  --fg-2: rgba(11, 27, 107, 0.62);
  --fg-3: rgba(11, 27, 107, 0.38);
  --accent: var(--brand);
  --accent-on: #FFFFFF;
  --hover: rgba(var(--ink-rgb), 0.04);
  --tick-strong: rgba(var(--ink-rgb), 0.12);
  --tick-soft:   rgba(var(--ink-rgb), 0.05);
  --pinned-bg: linear-gradient(90deg, rgba(var(--brand-rgb), 0.07), rgba(var(--brand-rgb), 0.015) 60%, rgba(var(--brand-rgb), 0));
  --pinned-bg-hover: linear-gradient(90deg, rgba(var(--brand-rgb), 0.13), rgba(var(--brand-rgb), 0.045) 60%, rgba(var(--brand-rgb), 0));
  --pinned-bar: var(--accent);
  --up: var(--accent);
  --down: rgba(11, 27, 107, 0.42);
  --shadow-sm: 0 1px 2px rgba(var(--brand-rgb), 0.06);
  --shadow-lg: 0 18px 60px rgba(var(--brand-rgb), 0.14), 0 2px 6px rgba(var(--brand-rgb), 0.06);
  --header-glass: rgba(255, 255, 255, 0.78);
  --skeleton: linear-gradient(90deg, rgba(var(--ink-rgb),.05), rgba(var(--ink-rgb),.12), rgba(var(--ink-rgb),.05));
  --backdrop: rgba(var(--brand-rgb), 0.20);
  --select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%231942F5' d='M0 0h10L5 6z'/></svg>");

  /* fonts */
  --f-display: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  --f-text: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* ── dark theme — brand stays #1942F5; surfaces and ink flip ───────────── */
[data-theme="dark"] {
  --bg: #07090F;
  --bg-2: #0B0E18;
  --surface: #0E1220;
  --surface-2: #141A2C;

  --ink-rgb: 200, 215, 255;
  --fg: #E6ECFF;
  --fg-2: rgba(230, 236, 255, 0.80);
  --fg-3: rgba(230, 236, 255, 0.58);

  --border: rgba(var(--ink-rgb), 0.08);
  --border-strong: rgba(var(--ink-rgb), 0.22);
  --line: rgba(var(--ink-rgb), 0.05);
  --hover: rgba(var(--ink-rgb), 0.05);
  --tick-strong: rgba(var(--brand-rgb), 0.20);
  --tick-soft:   rgba(var(--ink-rgb), 0.06);

  --pinned-bg: linear-gradient(90deg, rgba(var(--brand-rgb), 0.18), rgba(var(--brand-rgb), 0.04) 60%, rgba(var(--brand-rgb), 0));
  --pinned-bg-hover: linear-gradient(90deg, rgba(var(--brand-rgb), 0.28), rgba(var(--brand-rgb), 0.08) 60%, rgba(var(--brand-rgb), 0));

  --up: var(--accent);
  --down: rgba(230, 236, 255, 0.45);

  --header-glass: rgba(11, 14, 24, 0.72);
  --skeleton: linear-gradient(90deg, rgba(var(--ink-rgb),.04), rgba(var(--ink-rgb),.10), rgba(var(--ink-rgb),.04));
  --backdrop: rgba(0, 0, 0, 0.62);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 60px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.35);
  --select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23E6ECFF' d='M0 0h10L5 6z'/></svg>");

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body, #root {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-text);
  font-feature-settings: "ss01", "cv11", "tnum";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.005em;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

a { color: inherit; }
button { font: inherit; cursor: pointer; }
.tnum { font-variant-numeric: tabular-nums; }

::selection { background: rgba(var(--ink-rgb), 0.18); color: var(--fg); }

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ── header ──────────────────────────────────────────────────────────────── */
.app-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  padding: 18px 40px;
  border-bottom: 1px solid transparent;
  background: var(--header-glass);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  transition: border-color .25s ease;
}
.app-header.scrolled { border-bottom-color: var(--border); }

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-on);
  display: grid; place-items: center;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand-name {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.024em;
  color: var(--accent);
}
.brand-sub {
  font-size: 11px;
  color: var(--fg-3);
  margin-top: 1px;
  letter-spacing: 0.01em;
}

.search { position: relative; max-width: 480px; width: 100%; justify-self: center; }
.search input {
  width: 100%; height: 38px;
  padding: 0 60px 0 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--fg);
  font: inherit; font-size: 13px;
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.search input:focus {
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 4px rgba(var(--ink-rgb), 0.10);
}
.search input::placeholder { color: var(--fg-3); }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--fg-3); pointer-events: none; }
.search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--f-mono);
  font-size: 10.5px; color: var(--fg-2);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 5px;
}

.header-actions { display: flex; align-items: center; gap: 4px; position: relative; }
.icon-btn {
  position: relative;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--fg-2);
  transition: background .18s, color .18s, border-color .18s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--accent); }
.icon-btn.active { background: var(--surface-2); color: var(--accent); border-color: var(--border); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.header-swap-link {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px;
  padding: 0 10px;
  margin-right: 6px;
  background: transparent;
  color: var(--fg-2);
  border: 0;
  border-radius: 9px;
  font-family: var(--f-display);
  font-size: 13px; font-weight: 500;
  letter-spacing: -0.005em;
  text-decoration: none;
  transition: color .18s ease, background .18s ease;
}
.header-swap-link:hover {
  color: var(--accent);
  background: var(--surface-2);
}
.header-swap-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.header-swap-link svg { display: block; }

/* Hamburger toggle — hidden on desktop, shown on mobile */
.nav-hamburger {
  display: none;
  position: relative;
  width: 40px; height: 40px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--fg);
  cursor: pointer;
  padding: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  transition: background .18s ease, border-color .18s ease;
  z-index: 60;
}
.nav-hamburger:hover { background: var(--surface-2); }
.nav-hamburger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-hamburger-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform .22s ease, opacity .18s ease;
}
.nav-hamburger.is-open .nav-hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-hamburger.is-open .nav-hamburger-bar:nth-child(2) {
  opacity: 0;
}
.nav-hamburger.is-open .nav-hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* "Coming soon" hover tooltip on gated nav links */
.header-swap-link.is-soon { position: relative; }
.header-swap-link.is-soon::after {
  content: "COMING SOON";
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: var(--fg);
  color: var(--bg);
  font-family: var(--f-mono, var(--f-display));
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 50;
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}
.header-swap-link.is-soon::before {
  content: "";
  position: absolute;
  top: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  border: 5px solid transparent;
  border-bottom-color: var(--fg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 50;
}
.header-swap-link.is-soon:hover::after,
.header-swap-link.is-soon:focus-visible::after,
.header-swap-link.is-soon:hover::before,
.header-swap-link.is-soon:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 720px) {
  .header-swap-link { padding: 0 8px; height: 34px; }
  .header-swap-link span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .header-swap-link { transition: none; }
}

/* ── Mobile drawer (≤720px) ─────────────────────────────────────────── */
@media (max-width: 720px) {
  .nav-hamburger { display: inline-flex; }

  /* Header keeps brand + (search/spacer) + hamburger. Actions hide. */
  .app-header .header-actions {
    display: none;
  }

  /* When open, header-actions becomes a full-width drawer below the header */
  .app-header.nav-open .header-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    position: fixed;
    top: 64px;
    left: 0; right: 0;
    height: calc(100vh - 64px);
    height: calc(100dvh - 64px);
    background: var(--bg);
    z-index: 49;
    padding: 18px 18px 32px;
    border-top: 1px solid var(--border);
    overflow-y: auto;
    animation: nav-drawer-in .22s ease;
  }
  .app-header.nav-open .header-actions::before {
    content: "Menu";
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg-3);
    margin-bottom: 4px;
  }

  /* Reset the desktop pill styling for drawer entries */
  .app-header.nav-open .header-actions .header-swap-link {
    width: 100%;
    min-height: 52px;
    height: auto;
    flex: 0 0 auto;
    padding: 0 16px;
    justify-content: flex-start;
    gap: 12px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--fg);
    margin: 0;
  }
  .app-header.nav-open .header-actions .header-swap-link span {
    display: inline;
  }
  .app-header.nav-open .header-actions .header-swap-link:hover {
    background: var(--surface-2);
    color: var(--accent);
    border-color: var(--accent);
  }
  /* Coming-soon tooltip wouldn't fit drawer rows — hide */
  .app-header.nav-open .header-actions .header-swap-link.is-soon::after,
  .app-header.nav-open .header-actions .header-swap-link.is-soon::before {
    display: none;
  }
  .app-header.nav-open .header-actions .header-swap-link.is-soon {
    opacity: 0.72;
  }
  .app-header.nav-open .header-actions .header-swap-link.is-soon::after {
    /* re-purpose as a trailing "Soon" tag */
    content: "Soon";
    display: inline-block;
    position: static;
    transform: none;
    margin-left: auto;
    background: rgba(var(--brand-rgb), 0.12);
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 4px 8px;
    border-radius: 999px;
    box-shadow: none;
    opacity: 1;
    pointer-events: none;
  }

  .app-header.nav-open .header-actions .icon-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    min-height: 52px;
    height: auto;
    flex: 0 0 auto;
    justify-content: flex-start;
    padding: 0 16px;
    gap: 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--fg);
  }
  .app-header.nav-open .header-actions .icon-btn svg {
    flex-shrink: 0;
  }
  .app-header.nav-open .header-actions .icon-btn::after {
    content: attr(aria-label);
    font-size: 15px;
    font-weight: 500;
    color: inherit;
  }
  .app-header.nav-open .header-actions .icon-btn:hover {
    background: var(--surface-2);
    color: var(--accent);
    border-color: var(--accent);
  }

  /* HeaderConnect wallet button stretches inside drawer */
  .app-header.nav-open .header-actions > *:not(.header-swap-link):not(.icon-btn) {
    width: 100%;
  }

  /* Lock body scroll when drawer open */
  body:has(.app-header.nav-open) { overflow: hidden; }
}
@keyframes nav-drawer-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .app-header.nav-open .header-actions { animation: none; }
  .nav-hamburger-bar { transition: none; }
}

[data-density="compact"]  { --row-h: 52px; --row-pad-y: 12px; }
[data-density="comfy"]    { --row-h: 64px; --row-pad-y: 16px; }
[data-density="spacious"] { --row-h: 80px; --row-pad-y: 22px; }

.popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 14px;
  z-index: 100;
  display: flex; flex-direction: column; gap: 12px;
  animation: popIn .18s cubic-bezier(.2,.8,.2,1);
}
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.pop-section { display: flex; flex-direction: column; gap: 8px; }
.pop-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--fg-3);
}
.seg {
  display: flex; padding: 3px;
  background: var(--surface-2);
  border-radius: 9px;
  gap: 2px;
}
.seg button {
  flex: 1; height: 30px;
  background: transparent; border: 0; border-radius: 7px;
  color: var(--fg-2);
  font-size: 12px; font-weight: 500;
  transition: color .18s, background .18s;
}
.seg button:hover { color: var(--accent); }
.seg button.active { color: var(--accent); background: var(--bg); box-shadow: var(--shadow-sm); }

.crypto-filter button {
  flex: 0 0 auto;
  padding: 0 12px;
  height: 26px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  border-radius: 10px;
  font-weight: 500; font-size: 13px;
  text-decoration: none;
  transition: background .18s, border-color .18s, transform .12s, color .18s;
}
.btn:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: var(--accent);
  color: var(--accent-on);
  border-color: var(--accent);
}
.btn.primary:hover { opacity: 0.88; }

/* ── live indicator ──────────────────────────────────────────────────────── */
.live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.10em;
  color: var(--accent);
  text-transform: uppercase;
}
.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
}
.live-dot::after {
  content: "";
  position: absolute; inset: -2px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.45;
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.45; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* ── main ────────────────────────────────────────────────────────────────── */
.app-main {
  flex: 1;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  padding: 56px 40px 40px;
}

/* ── hero ────────────────────────────────────────────────────────────────── */
.hero {
  margin-bottom: 56px;
  display: flex; flex-direction: column; gap: 28px;
}
.hero-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
  padding: 5px 11px 5px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  line-height: 1;
  background: rgba(var(--ink-rgb), 0.04);
}
.hero-eyebrow::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.hero-title {
  font-family: var(--f-display);
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.038em;
  font-weight: 600;
  margin: 0;
  color: var(--accent);
}
.hero-title em {
  font-style: normal;
  color: var(--fg-2);
}
.hero-sub {
  font-size: 18px;
  color: var(--fg-2);
  max-width: 620px;
  margin-top: 14px;
  line-height: 1.55;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.stat {
  padding: 4px 24px 4px 0;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
}
.stat:last-child { border-right: 0; padding-right: 0; }
.stat:not(:first-child) { padding-left: 24px; }
.stat-label {
  font-size: 10.5px;
  color: var(--fg-3);
  letter-spacing: 0.10em;
  font-weight: 600;
  text-transform: uppercase;
}
.stat-value {
  font-family: var(--f-display);
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 600;
  letter-spacing: -0.028em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 10px;
}

/* ── toolbar ─────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; gap: 16px;
}
.tabs {
  display: flex; gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 10px;
}
.tab {
  height: 32px; padding: 0 14px;
  background: transparent; border: 0; border-radius: 8px;
  color: var(--fg-2);
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  transition: color .18s, background .18s;
}
.tab:hover { color: var(--accent); }
.tab.active { background: var(--bg); color: var(--accent); box-shadow: var(--shadow-sm); }
.tab-count {
  font-size: 10.5px; color: var(--fg-3);
  background: var(--bg);
  padding: 1px 7px; border-radius: 4px;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
}
.tab.active .tab-count {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--accent);
}
.fav-icon { color: var(--accent); display: inline-flex; }

.sort-control {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--fg-3);
}
.sort-control select {
  height: 32px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--border);
  background: var(--surface) var(--select-arrow) no-repeat right 11px center;
  border-radius: 8px;
  color: var(--fg);
  font: inherit; font-size: 13px;
  appearance: none; -webkit-appearance: none;
  transition: border-color .18s;
}
.sort-control select:hover { border-color: var(--accent); }

/* ── table ───────────────────────────────────────────────────────────────── */
.table {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.thead, .row {
  display: grid;
  grid-template-columns:
    36px                  /* fav */
    36px                  /* rank */
    minmax(240px, 380px)  /* name (capped so mcap doesn't drift right) */
    140px                 /* mcap */
    140px                 /* price */
    140px                 /* vol */
    minmax(180px, 1fr)    /* socials (absorbs slack, left-aligned) */
    32px                  /* swap (fixed so all CTAs align) */
    28px;                 /* expand */
  align-items: center;
  gap: 20px;
  padding: 0 12px;
}

.thead {
  height: 44px;
  border-bottom: 1px solid var(--border);
  font-size: 10.5px; font-weight: 600;
  color: var(--fg-3);
  letter-spacing: 0.10em; text-transform: uppercase;
}

.cell { display: flex; align-items: center; min-width: 0; }
.c-price, .c-mcap, .c-vol { justify-content: flex-end; text-align: right; }
.c-rank { justify-content: center; }
.c-fav { justify-content: center; }
.c-socials { justify-content: flex-start; }
.c-swap { justify-content: flex-end; }
.c-expand { justify-content: center; color: var(--fg-3); }

.sort-head {
  background: transparent; border: 0; padding: 0;
  font: inherit; font-size: 10.5px; font-weight: 600;
  color: var(--fg-3);
  letter-spacing: 0.10em; text-transform: uppercase;
  display: flex; align-items: center; gap: 5px;
  height: 100%; width: 100%;
  transition: color .18s;
}
.sort-head:hover { color: var(--accent); }
.sort-head.active { color: var(--accent); }
.sort-caret { opacity: 0; transition: opacity .18s; display: inline-flex; }
.sort-head:hover .sort-caret { opacity: 0.6; }
.sort-caret.visible { opacity: 1; }

.row {
  min-height: var(--row-h);
  padding-top: var(--row-pad-y);
  padding-bottom: var(--row-pad-y);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  position: relative;
  transition: background .18s;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--hover); }
.row.expanded { background: var(--hover); }
.row.not-expandable { cursor: default; }
.row.not-expandable:hover { background: transparent; }
.row.not-expandable.pinned:hover { background: var(--pinned-bg); }

.row.pinned { background: var(--pinned-bg); }
.row.pinned:hover { background: var(--pinned-bg-hover); }
.row.pinned.expanded { background: var(--pinned-bg-hover); }
.row.pinned::before {
  content: "";
  position: absolute;
  left: -8px; top: 14px; bottom: 14px;
  width: 2px;
  background: var(--pinned-bar);
  border-radius: 1px;
}

/* tick flash on price update */
.row.tick-up { animation: tickUp 1.2s ease-out; }
.row.tick-down { animation: tickDown 1.2s ease-out; }
@keyframes tickUp   { 0% { background: var(--tick-strong); } 100% { background: transparent; } }
@keyframes tickDown { 0% { background: var(--tick-soft);   } 100% { background: transparent; } }

.fav {
  width: 30px; height: 30px;
  border: 0; background: transparent;
  color: var(--fg-3);
  display: grid; place-items: center;
  border-radius: 7px;
  transition: color .18s, background .18s, transform .12s;
}
.fav:hover { color: var(--accent); background: var(--surface-2); }
.fav.on { color: var(--accent); }
.fav.on:active { transform: scale(0.88); }

.rank-num {
  font-family: var(--f-mono);
  font-size: 12.5px; color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.pin-badge {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-on);
}

.c-name { gap: 14px; }
.name-block { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.name-line {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--f-display);
  font-weight: 600; font-size: 14.5px;
  letter-spacing: -0.018em;
  min-width: 0;
  color: var(--fg);
}
.name-line .name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}

.type-tag {
  flex-shrink: 0;
  font-size: 9px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  line-height: 1.4;
  border: 1px solid var(--border-strong);
  color: var(--accent);
}
.type-tag.type-crypto { color: var(--fg-2); border-color: var(--border); }
.type-tag.type-meme   { color: var(--accent); background: rgba(var(--ink-rgb), 0.08); border-color: transparent; }
[data-theme="dark"] .type-tag.type-meme { color: #FFFFFF; background: rgba(var(--ink-rgb), 0.18); }
.type-tag.type-stock  { color: var(--accent-on); background: var(--accent); border-color: var(--accent); }

.ticker-line {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--fg-3);
  min-width: 0;
}
.chain-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  flex-shrink: 0;
}
.chain-badge img {
  display: block;
  width: 100%; height: 100%;
  object-fit: contain;
}
.ticker {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.tagline-mini {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--fg-3);
}

.copy-ca {
  appearance: none;
  display: inline-flex; align-items: center; gap: 4px;
  height: 18px; padding: 0 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg-3);
  font-family: var(--f-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.copy-ca:hover {
  color: var(--fg);
  background: var(--hover);
  border-color: var(--border-strong);
}
.copy-ca:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.copy-ca svg { display: block; }
.copy-ca.ok {
  color: var(--up);
  border-color: rgba(var(--ink-rgb), 0.18);
  background: var(--hover);
}
.copy-ca-label { letter-spacing: 0.06em; }

/* ── Upvote chip (in row's ticker line) ─────────────────────────────────── */
.upvote-chip {
  appearance: none;
  display: inline-flex; align-items: center; gap: 4px;
  height: 18px; padding: 0 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg-3);
  font-family: var(--f-mono);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: color .15s ease, background .15s ease, border-color .15s ease, transform .12s ease;
}
.upvote-chip svg { display: block; }
.upvote-chip:hover:not(.disabled) {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--hover);
}
.upvote-chip:active:not(.disabled) { transform: scale(0.94); }
.upvote-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.upvote-chip.voted {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(25, 66, 245, 0.10);
}
.upvote-chip.voted svg { stroke-width: 2.4; }
.upvote-chip.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.upvote-count { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  .upvote-chip { transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  .copy-ca { transition: none; }
}

.c-price { flex-direction: column; align-items: flex-end; justify-content: center; gap: 3px; }
.price-main {
  font-family: var(--f-mono);
  font-weight: 500; font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--fg);
  line-height: 1;
}
.price-change {
  font-family: var(--f-mono);
  font-size: 11.5px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.up   { color: var(--up); }
.down { color: var(--down); }

.c-mcap, .c-vol {
  font-family: var(--f-mono);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.01em;
  line-height: 1;
}

.socials { display: flex; gap: 1px; align-items: center; flex-wrap: nowrap; }
.social-link {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--fg-2);
  text-decoration: none;
  transition: background .18s, color .18s;
}
.social-link:hover { background: var(--surface-2); color: var(--accent); }
.social-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.social-link[data-platform="dex"],
.social-link[data-platform="solscan"],
.social-link[data-platform="basescan"],
.social-link[data-platform="etherscan"],
.social-link[data-platform="pumpfun"] {
  color: var(--fg);
}
.social-mask {
  display: block;
  width: 13px; height: 13px;
  background-color: currentColor;
  -webkit-mask: var(--mask-url) center / contain no-repeat;
          mask: var(--mask-url) center / contain no-repeat;
}

.chev { display: inline-flex; color: var(--fg-3); transition: transform .25s ease, color .18s; }
.chev.open { transform: rotate(90deg); color: var(--accent); }

/* ── token avatar ────────────────────────────────────────────────────────── */
.token-img { width: 100%; height: 100%; object-fit: cover; border-radius: 999px; }
.avatar-mono {
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-on);
  font-family: var(--f-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.avatar-ring {
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--border);
}

/* ── expanded row ────────────────────────────────────────────────────────── */
.exp { padding: 4px 12px 32px; overflow: hidden; }
.exp-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  padding-top: 18px;
}
.exp-chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.exp-chart-h {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px;
}
.exp-price {
  font-family: var(--f-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.028em;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
  color: var(--accent);
}
.muted { color: var(--fg-3); }
.small { font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }

.exp-iframe-wrap {
  position: relative;
  width: 100%;
  height: 380px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.exp-iframe-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }

.exp-side { display: flex; flex-direction: column; gap: 12px; }
.exp-tagline {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px; line-height: 1.55;
  color: var(--fg-2);
}
.exp-desc {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px; line-height: 1.6;
  color: var(--fg-2);
  white-space: pre-wrap;
}
.exp-meta {
  margin: 0; padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 12px;
}
.exp-meta > div {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px;
}
.exp-meta dt { color: var(--fg-3); margin: 0; letter-spacing: 0.02em; }
.exp-meta dd {
  margin: 0;
  font-family: var(--f-mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.exp-actions { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.exp-actions .btn {
  flex: 1 1 140px;
  height: 40px;
  padding: 0 14px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Center icon+label as a unit when text is ellipsised. */
.exp-actions .btn > span { overflow: hidden; text-overflow: ellipsis; }

/* Mobile-only socials block in expanded row (desktop has them in c-socials). */
.exp-socials-mobile { display: none; }
@media (max-width: 720px) {
  .exp-socials-mobile {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 4px;
  }
  .exp-socials-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--fg-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .exp-socials-mobile .socials { gap: 8px; flex-wrap: wrap; }
}

/* ── skeleton rows ───────────────────────────────────────────────────────── */
.skel {
  background: var(--skeleton);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skel-line { height: 12px; width: 100%; }
.skel-circle { width: 30px; height: 30px; border-radius: 999px; flex-shrink: 0; }

/* ── empty / error ──────────────────────────────────────────────────────── */
.empty {
  padding: 96px 24px;
  text-align: center;
  color: var(--fg-3);
}
.empty-icon {
  width: 48px; height: 48px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  color: var(--accent);
}
.empty-title {
  font-family: var(--f-display);
  font-size: 15px; font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
  letter-spacing: -0.015em;
}
.empty-sub { font-size: 13px; }

/* ── suggestion box ──────────────────────────────────────────────────────── */
.suggest {
  margin-top: 56px;
  padding: 32px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 36px;
  align-items: start;
}
.suggest-head { display: flex; flex-direction: column; }
.suggest-eyebrow {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.suggest-title {
  font-family: var(--f-display);
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 600;
  letter-spacing: -0.024em;
  margin: 0 0 8px;
  color: var(--accent);
  line-height: 1.15;
}
.suggest-sub {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.55;
  max-width: 360px;
  margin: 0;
}
.suggest-body { display: flex; flex-direction: column; gap: 14px; }
.suggest-input {
  resize: vertical;
  min-height: 110px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  border-radius: 10px;
  font: inherit; font-size: 13.5px;
  outline: none;
  line-height: 1.5;
  transition: border-color .18s, background .18s, box-shadow .18s;
  font-family: var(--f-text);
}
.suggest-input::placeholder { color: var(--fg-3); }
.suggest-input:focus {
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 4px rgba(var(--ink-rgb), 0.10);
}
.suggest-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.suggest-hint {
  font-size: 12px;
  color: var(--fg-3);
  font-family: var(--f-mono);
}
.suggest-hint.error { color: var(--down); }
.suggest-foot .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
@media (max-width: 720px) {
  .suggest { grid-template-columns: 1fr; padding: 24px; gap: 20px; margin-top: 36px; }
  .suggest-foot { flex-direction: column; align-items: stretch; }
  .suggest-foot .btn { width: 100%; }
}

/* ── footer ──────────────────────────────────────────────────────────────── */
.app-footer {
  display: flex; flex-direction: column; gap: 10px;
  padding: 56px 0 16px;
  font-size: 11.5px;
  color: var(--fg-3);
  letter-spacing: 0.02em;
}
.app-footer a { color: var(--accent); text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }
.footer-disclaimer {
  max-width: 760px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--fg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--bg-2);
}
.footer-disclaimer strong { color: var(--fg); font-weight: 600; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.footer-links span { color: var(--fg-3); }

.footer-density {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.footer-density-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-3);
  font-weight: 600;
}
.footer-density-seg {
  font-size: 11px;
  padding: 2px;
}
.footer-density-seg button {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
}

/* ── SSR shell (visible until React hydrates) ───────────────────────────── */
#ssr-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
  font-family: "Inter Tight", "Inter", system-ui, -apple-system, sans-serif;
}
.ssr-hero h1 {
  font-size: clamp(28px, 5vw, 56px);
  line-height: 1.05;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}
.ssr-hero p {
  font-size: 15px;
  line-height: 1.55;
  max-width: 640px;
  color: var(--fg-2, #888);
  margin: 0 0 24px;
}
.ssr-noscript {
  max-width: 640px;
  padding: 16px;
  border: 1px solid var(--border, #333);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}
.ssr-noscript a { color: var(--accent); }

/* ── modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: var(--backdrop);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: grid; place-items: center;
  animation: fadeIn .18s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 460px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: var(--f-display);
  font-weight: 600; font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.modal-sub { font-size: 12.5px; color: var(--fg-3); margin-top: 4px; }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.field > span { font-size: 11px; color: var(--fg-3); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.field > select, .field > input {
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  border-radius: 9px;
  font: inherit; font-size: 13.5px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.field > select {
  appearance: none; -webkit-appearance: none;
  padding-right: 32px;
  background-image: var(--select-arrow);
  background-repeat: no-repeat; background-position: right 12px center;
}
.field > input:focus, .field > select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(var(--ink-rgb), 0.10); }
.field-row { display: flex; gap: 12px; }
.alert-preview {
  padding: 14px 16px;
  background: rgba(var(--ink-rgb), 0.06);
  border-radius: 9px;
  font-size: 12.5px;
  color: var(--fg);
  line-height: 1.55;
}
.alert-preview b { font-weight: 600; color: var(--accent); }

.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ── responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 24px 0; }
  .stat:nth-child(2) { border-right: 0; padding-right: 0; }
  .stat:nth-child(3) { padding-left: 0; }
  .thead, .row {
    grid-template-columns: 32px 32px minmax(180px, 1fr) 116px 116px 116px minmax(120px, auto) 28px 24px;
    gap: 10px;
    padding: 0 8px;
  }
  .app-main { padding: 40px 28px; }
}
@media (max-width: 720px) {
  .app-main { padding: 28px 16px; }
  .app-header { padding: 14px 16px; gap: 12px; grid-template-columns: auto 1fr auto; }
  .brand-text { display: none; }
  .search { max-width: none; }
  .hero { margin-bottom: 36px; }
  .hero-title { font-size: 36px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3), .stat:nth-child(4) { display: none; }
  .stat:nth-child(2) { border-right: 0; padding-right: 0; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 9.5px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .c-price, .c-vol, .c-socials, .c-swap, .c-fav { display: none; }
  .thead, .row { grid-template-columns: 32px 1fr 110px 24px; gap: 8px; padding: 0 6px; }
  .thead {
    position: sticky;
    top: 66px;
    z-index: 20;
    background: var(--header-glass);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
  }
  .exp-grid { grid-template-columns: 1fr; }
}

/* Expanded-row favorite toggle — mobile only (desktop uses .c-fav). */
.exp-fav-mobile { display: none; }
@media (max-width: 720px) {
  .exp-fav-mobile {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    padding: 6px 12px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--fg-2);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
  }
  .exp-fav-mobile:hover {
    color: var(--accent);
    border-color: var(--accent);
  }
  .exp-fav-mobile.on {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(25, 66, 245, 0.10);
  }
  .exp-fav-mobile svg { display: block; }
}

/* ── legal / static pages (about, privacy, terms, contact, methodology) ── */
.legal-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  font-family: "Inter", "Inter Tight", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
}
.legal-nav { margin-bottom: 32px; font-size: 13px; }
.legal-nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.legal-nav a:hover { text-decoration: underline; }
.legal-page h1 {
  font-family: "Inter Tight", system-ui, sans-serif;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.legal-page h2 {
  font-family: "Inter Tight", system-ui, sans-serif;
  font-size: 20px;
  margin: 32px 0 8px;
  letter-spacing: -0.01em;
}
.legal-page h3 {
  font-size: 16px;
  margin: 20px 0 6px;
  font-weight: 600;
}
.legal-page p, .legal-page li { font-size: 15px; }
.legal-page ul { padding-left: 20px; }
.legal-page li { margin-bottom: 6px; }
.legal-page .lead { font-size: 17px; color: var(--fg-2); margin-bottom: 24px; }
.legal-page a { color: var(--accent); }
.legal-page .muted { color: var(--fg-3); }
.legal-page .small { font-size: 12.5px; }
.legal-page code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-2);
}

/* ── Swap (Jupiter Plugin) ─────────────────────────────────────────────── */
:root {
  --z-overlay: 50;
  --z-modal: 60;
}

.swap-chip {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 22px;
  padding: 0;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.swap-chip svg { width: 11px; height: 11px; display: block; }
.swap-chip:hover {
  background: var(--accent);
  color: var(--accent-on);
  border-color: var(--accent);
}
.swap-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.swap-chip:disabled,
.swap-chip[aria-disabled="true"] {
  background: transparent;
  color: var(--fg-3);
  border-color: var(--border);
  cursor: not-allowed;
}
.swap-chip:disabled:hover,
.swap-chip[aria-disabled="true"]:hover {
  background: transparent;
  color: var(--fg-3);
  border-color: var(--border);
}
@media (prefers-reduced-motion: reduce) {
  .swap-chip { transition: none; }
}

.swap-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: pf-swap-fade 180ms ease-out;
}

.swap-modal {
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pf-swap-pop 220ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

.swap-page {
  max-width: 460px;
  margin: 0 auto;
  padding: 56px 16px 80px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}
.swap-page-shell {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.swap-page-disclaimer {
  margin: 4px 4px 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--fg-3);
  line-height: 1.5;
}
@media (max-width: 720px) {
  .swap-page { padding: 28px 12px 56px; }
}

.swap-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.swap-head-token { display: flex; align-items: center; gap: 12px; min-width: 0; }
.swap-head-img {
  width: 32px; height: 32px;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
}
.swap-head-mono {
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-on);
  font-weight: 600; font-size: 12px;
  font-family: var(--f-mono);
}
.swap-head-text { min-width: 0; }
.swap-head-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.swap-head-ticker { color: var(--accent); font-family: var(--f-mono); }
.swap-head-sub {
  font-size: 12px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.swap-body {
  flex: 1;
  position: relative;
  overflow: auto;
  background: var(--bg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.swap-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 24px;
  text-align: center;
}
.swap-error-title { font-weight: 600; color: var(--fg); }
.swap-success-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 20px;
  color: var(--fg);
  letter-spacing: -0.01em;
}

/* ── Swap success receipt ──────────────────────────────────────────────── */
.swap-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 16px 20px;
}
.swap-success-check {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(var(--brand-rgb), 0.12);
  color: var(--accent);
  margin-bottom: 2px;
  animation: pf-success-pop 360ms cubic-bezier(0.2, 0.9, 0.3, 1.4);
}
@keyframes pf-success-pop {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.swap-receipt {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.swap-receipt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px;
}
.swap-receipt-img {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
}
.swap-receipt-mono {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-on);
  font-family: var(--f-mono);
  font-weight: 700;
  font-size: 12px;
}
.swap-receipt-text {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.swap-receipt-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-3);
  margin-bottom: 2px;
}
.swap-receipt-amount {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--fg);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.swap-receipt-amount span {
  color: var(--fg-2);
  font-weight: 500;
  margin-left: 4px;
}
.swap-receipt-arrow {
  display: grid;
  place-items: center;
  color: var(--fg-3);
  margin: -2px 0;
}

.swap-solscan {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-2);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  transition: color .15s, background .15s;
}
.swap-solscan:hover { color: var(--accent); background: var(--hover); }
.swap-solscan:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.swap-success-actions {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}
.swap-success-actions .btn {
  flex: 1;
  height: 44px;
}

.swap-spinner {
  width: 28px; height: 28px;
  border-radius: 999px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: pf-swap-spin 0.8s linear infinite;
}

.swap-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  background: var(--bg-2);
}

@keyframes pf-swap-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pf-swap-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pf-swap-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .swap-backdrop,
  .swap-modal { animation: none; }
  .swap-spinner { animation-duration: 1.6s; }
}

@media (max-width: 480px) {
  .swap-backdrop { padding: 0; align-items: stretch; }
  .swap-modal {
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    border: none;
  }
}

/* ── Wallet kit modal — scoped resets ───────────────────────────────────── */
/* The wallet kit ships Tailwind-via-Emotion utility styles but no preflight,
   so native list bullets leak in. Strip them inside any dialog. */
[role="dialog"] ul,
[role="dialog"] ol {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

/* ── ConnectModal (PeptideFolio's own wallet picker) ───────────────────── */
.connect-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal) + 10);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: pf-swap-fade 180ms ease-out;
}
.connect-modal {
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pf-swap-pop 220ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.connect-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.connect-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.connect-sub {
  font-size: 12px;
  color: var(--fg-3);
  margin-top: 2px;
}
.connect-body {
  padding: 8px 12px;
  overflow: auto;
}
.connect-section {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-3);
  font-weight: 600;
  padding: 12px 8px 6px;
}
.connect-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.connect-wallet {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  color: var(--fg);
  font-family: inherit;
  transition: background .12s, border-color .12s;
}
.connect-wallet:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border);
}
.connect-wallet:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.connect-wallet:disabled { opacity: 0.55; cursor: wait; }

.connect-wallet-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
  background: var(--bg-2);
  flex-shrink: 0;
}
.connect-wallet-mono {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-on);
  font-family: var(--f-mono);
  font-weight: 700;
  font-size: 11px;
}
.connect-wallet-text {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.connect-wallet-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--fg);
}
.connect-wallet-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(var(--brand-rgb), 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}
.connect-wallet-chev { color: var(--fg-3); flex-shrink: 0; }
.connect-wallet:hover .connect-wallet-chev { color: var(--accent); }

.connect-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  text-align: center;
}
.connect-foot a { color: var(--accent); text-decoration: none; }
.connect-foot a:hover { text-decoration: underline; }

.connect-empty {
  padding: 32px 16px;
  text-align: center;
}
.connect-empty-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--fg);
  margin-bottom: 6px;
}
.connect-empty-sub {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.5;
}
.connect-empty-sub a { color: var(--accent); }

@media (max-width: 480px) {
  .connect-backdrop { padding: 0; align-items: stretch; }
  .connect-modal {
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    border: none;
  }
}

/* ── Wallet pill (header) ───────────────────────────────────────────────── */
.wallet-pill-wrap { position: relative; }
.wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 12px;
}
.wallet-pill.active { border-color: var(--accent); color: var(--accent); }
.wallet-pill .wallet-dot {
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--brand-rgb), 0.18);
}
.wallet-pill .wallet-addr {
  letter-spacing: 0.01em;
}

.wallet-pop {
  width: 280px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wallet-pop-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.wallet-pop-img {
  width: 28px; height: 28px;
  border-radius: 6px;
  object-fit: contain;
  background: var(--bg-2);
  flex-shrink: 0;
}
.wallet-pop-mono {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-on);
  font-family: var(--f-mono);
  font-weight: 700;
  font-size: 11px;
}
.wallet-pop-text {
  flex: 1;
  min-width: 0;
}
.wallet-pop-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--fg);
  margin-bottom: 2px;
}
.wallet-pop-addr {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--fg-3);
  font-family: var(--f-mono);
  font-size: 11.5px;
  cursor: pointer;
  position: relative;
}
.wallet-pop-addr:hover { color: var(--accent); }
.wallet-pop-addr:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wallet-pop-copied {
  position: absolute;
  left: 100%;
  margin-left: 8px;
  background: var(--accent);
  color: var(--accent-on);
  font-family: var(--f-text);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  animation: pf-swap-fade 160ms ease-out;
}

.wallet-pop-balance {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.wallet-pop-bal-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-3);
  font-weight: 600;
  margin-bottom: 4px;
}
.wallet-pop-bal-value {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.wallet-pop-bal-value span {
  color: var(--fg-2);
  font-weight: 500;
  font-size: 13px;
  margin-left: 4px;
}
.wallet-pop-bal-loading { color: var(--fg-3); }

.wallet-pop-disconnect {
  width: 100%;
  height: 38px;
  justify-content: center;
}
.wallet-pop-disconnect:hover {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.4);
  color: #dc2626;
}

/* ── Swap sides (two-token form) ────────────────────────────────────────── */
.swap-side {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.swap-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--fg-3);
  margin-bottom: 8px;
  gap: 8px;
}
.swap-balance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.swap-balance b {
  font-weight: 600;
  color: var(--fg-2);
  font-family: var(--f-mono);
  font-size: 11.5px;
}
.swap-max {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--accent);
  font-weight: 600;
  font-size: 10.5px;
  padding: 2px 7px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.swap-max:hover { background: var(--accent); color: var(--accent-on); border-color: var(--accent); }
.swap-max:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.swap-side-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.swap-token-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color .18s, background .18s;
}
.swap-token-btn:hover { border-color: var(--accent); }
.swap-token-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.swap-token-img {
  width: 24px; height: 24px;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
}
.swap-token-mono {
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-on);
  font-size: 9px; font-weight: 700;
  font-family: var(--f-mono);
}

.swap-amount {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 24px;
  color: var(--fg);
  text-align: right;
  letter-spacing: -0.02em;
  padding: 0;
}
.swap-amount::placeholder { color: var(--fg-3); }
.swap-amount-out {
  text-align: right;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 24px;
  color: var(--fg-2);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.swap-flip-wrap {
  display: flex;
  justify-content: center;
  margin: -10px 0;
  z-index: 1;
}
.swap-flip {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg-2);
  cursor: pointer;
  transition: color .18s, border-color .18s, transform .25s;
}
.swap-flip:hover { color: var(--accent); border-color: var(--accent); transform: rotate(180deg); }
.swap-flip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.swap-quote-meta {
  font-size: 12px;
  color: var(--fg-2);
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 4px;
}
.swap-quote-meta > div {
  display: flex;
  justify-content: space-between;
}
.swap-quote-meta .swap-warn { color: #d97706; }
.swap-quote-meta .swap-warn-faint { color: var(--fg); font-family: var(--f-mono); font-size: 11.5px; }

/* ── Slippage control ───────────────────────────────────────────────────── */
.swap-slip {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 4px;
}
.swap-slip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.swap-slip-label {
  font-size: 12px;
  color: var(--fg-2);
}
.swap-slip-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--fg);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--f-mono);
}
.swap-slip-current:hover { color: var(--accent); }
.swap-slip-current:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.swap-slip-presets {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.swap-slip-preset {
  flex: 1;
  min-width: 56px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg-2);
  font-weight: 600;
  font-size: 12.5px;
  font-family: var(--f-mono);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.swap-slip-preset:hover { border-color: var(--accent); color: var(--accent); }
.swap-slip-preset.active {
  background: var(--accent);
  color: var(--accent-on);
  border-color: var(--accent);
}
.swap-slip-custom {
  flex: 1.4;
  min-width: 90px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--fg-2);
  transition: border-color .15s;
}
.swap-slip-custom:focus-within { border-color: var(--accent); }
.swap-slip-custom.active { border-color: var(--accent); }
.swap-slip-custom input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  padding: 7px 0;
  color: var(--fg);
  font-family: var(--f-mono);
  font-size: 12.5px;
  font-weight: 600;
}
.swap-slip-custom span { color: var(--fg-3); }
.swap-slip-warn {
  margin-top: 8px;
  font-size: 11.5px;
  color: #d97706;
}

.swap-error {
  font-size: 12.5px;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: 8px;
  padding: 8px 12px;
}

.swap-cta {
  margin-top: 8px;
  height: 48px;
  font-size: 15px;
  font-weight: 600;
}
.swap-cta:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Token picker dialog ────────────────────────────────────────────────── */
.picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal) + 5);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: pf-swap-fade 160ms ease-out;
}
.picker {
  width: 100%;
  max-width: 420px;
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.picker-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.picker-search {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--f-text);
  font-size: 14px;
  color: var(--fg);
  outline: 0;
}
.picker-search:focus { border-color: var(--accent); }
.picker-list {
  flex: 1;
  overflow: auto;
  padding: 6px;
}
.picker-empty {
  padding: 24px;
  text-align: center;
  color: var(--fg-3);
  font-size: 13px;
}
.picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  color: var(--fg);
  font-family: inherit;
  transition: background .12s;
}
.picker-row:hover:not(:disabled) { background: var(--hover); }
.picker-row.selected { background: var(--surface-2); }
.picker-row.disabled, .picker-row:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.picker-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.picker-img {
  width: 32px; height: 32px;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
}
.picker-mono {
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-on);
  font-size: 11px; font-weight: 700;
  font-family: var(--f-mono);
}
.picker-text { flex: 1; min-width: 0; }
.picker-ticker {
  font-weight: 600;
  font-size: 14px;
  color: var(--fg);
}
.picker-name {
  font-size: 12px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.picker-mcap {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  flex-shrink: 0;
  min-width: 96px;
  justify-content: flex-end;
}
.picker-mcap-value {
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}
.picker-mcap-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-3);
}

/* Custom scrollbar for the picker list — white track, accent thumb */
.picker-list {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--surface);
}
.picker-list::-webkit-scrollbar {
  width: 8px;
}
.picker-list::-webkit-scrollbar-track {
  background: var(--surface);
  border-radius: 4px;
}
.picker-list::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
  border: 2px solid var(--surface);
}
.picker-list::-webkit-scrollbar-thumb:hover {
  background: var(--brand-deep);
}

@media (max-width: 480px) {
  .picker-backdrop { padding: 0; align-items: stretch; }
  .picker {
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    border: none;
  }
}

/* ── Chain badges (TokenPicker rows) ─────────────────────────────────────── */
.picker-chain {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 4px;
  border: 1px solid transparent;
  text-transform: uppercase;
  vertical-align: middle;
  line-height: 1;
}
.picker-chain.chain-solana {
  background: rgba(153, 69, 255, 0.12);
  border-color: rgba(153, 69, 255, 0.35);
  color: #b388ff;
}
.picker-chain.chain-base {
  background: rgba(0, 82, 255, 0.12);
  border-color: rgba(0, 82, 255, 0.35);
  color: #4a7dff;
}
.picker-chain.chain-ethereum {
  background: rgba(98, 126, 234, 0.12);
  border-color: rgba(98, 126, 234, 0.35);
  color: #7e96ff;
}
[data-theme="light"] .picker-chain.chain-solana { color: #6a2bd9; }
[data-theme="light"] .picker-chain.chain-base { color: #0036c2; }
[data-theme="light"] .picker-chain.chain-ethereum { color: #3046a8; }

/* ── ConnectModal: chain section heads ──────────────────────────────────── */
.connect-chain-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 4px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.connect-chain-head-spaced { margin-top: 18px; }
.connect-chain-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.connect-chain-dot.chain-solana { background: linear-gradient(135deg, #9945ff, #14f195); }
.connect-chain-dot.chain-base { background: #0052ff; }
.connect-chain-dot.chain-ethereum { background: #627eea; }
.connect-chain-label { flex: 1; }
.connect-chain-status {
  font-size: 10.5px;
  font-weight: 700;
  color: #16a34a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.connect-chain-disconnect {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-3);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}
.connect-chain-disconnect:hover {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.4);
  color: #dc2626;
}

/* ── HeaderConnect popover: dual-wallet additions ───────────────────────── */
.wallet-pop-chain {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 4px;
  text-transform: uppercase;
  vertical-align: middle;
  line-height: 1;
  border: 1px solid transparent;
}
.wallet-pop-chain.chain-solana {
  background: rgba(153, 69, 255, 0.12);
  border-color: rgba(153, 69, 255, 0.35);
  color: #b388ff;
}
.wallet-pop-chain.chain-base {
  background: rgba(0, 82, 255, 0.12);
  border-color: rgba(0, 82, 255, 0.35);
  color: #4a7dff;
}
[data-theme="light"] .wallet-pop-chain.chain-solana { color: #6a2bd9; }
[data-theme="light"] .wallet-pop-chain.chain-base { color: #0036c2; }

.wallet-pop-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}
.wallet-pop-add {
  width: 100%;
  height: 36px;
  justify-content: center;
  font-size: 13px;
  margin-top: 8px;
  color: var(--accent);
  border-color: var(--border);
}
.wallet-pop-add:hover {
  background: rgba(25, 66, 245, 0.08);
  border-color: var(--accent);
}

/* ── Swap pending (sent, awaiting confirmation) ─────────────────────────── */
.swap-pending-spin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(25, 66, 245, 0.1);
  color: var(--accent);
  margin: 0 auto 12px;
  animation: pf-spin 1s linear infinite;
}
@keyframes pf-spin {
  to { transform: rotate(360deg); }
}
.swap-pending-sub {
  font-size: 13px;
  color: var(--fg-3);
  text-align: center;
  margin: 6px 0 16px;
  line-height: 1.5;
}
@media (prefers-reduced-motion: reduce) {
  .swap-pending-spin { animation: none; }
}


/* ── Wallet Portfolio ─────────────────────────────────────────────────── */
.pf-port {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pf-port-home {
  margin: 16px 0 24px;
}

.pf-port-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-2), var(--surface));
}
.pf-port.collapsed .pf-port-head { border-bottom: 0; }

.pf-port-head-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  min-width: 0;
}
.pf-port-head-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 6px;
}

.pf-port-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pf-port-eyebrow {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-3);
  font-weight: 600;
}
.pf-port-total {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.015em;
  color: var(--fg);
  line-height: 1.15;
}
.pf-port-chev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: var(--fg-3);
}

.pf-port-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg-2);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.pf-port-refresh:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--hover);
}
.pf-port-refresh.spin svg { animation: pf-spin 0.9s linear infinite; }

.pf-port-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  max-height: 640px;
  overflow-y: auto;
}

.pf-port-empty {
  padding: 28px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.pf-port-empty-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--fg);
}
.pf-port-empty-sub {
  font-size: 12.5px;
  color: var(--fg-3);
  line-height: 1.5;
  max-width: 260px;
}
.pf-port-empty-cta {
  margin-top: 10px;
  height: 36px;
  padding: 0 18px;
}

.pf-port-skel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
}
.pf-port-skel-row {
  height: 52px;
  border-radius: 10px;
  background: var(--skeleton);
  background-size: 200% 100%;
  animation: pf-skel 1.4s ease-in-out infinite;
}
@keyframes pf-skel {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.pf-port-group { display: flex; flex-direction: column; padding: 6px 4px 4px; }
.pf-port-group + .pf-port-group { margin-top: 4px; border-top: 1px dashed var(--border); padding-top: 10px; }
.pf-port-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 8px;
}
.pf-port-group-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 700;
}
.pf-port-group-label.muted { color: var(--fg-3); }
.pf-port-group-count {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--fg-3);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  font-family: var(--f-mono);
}
.pf-port-group-count.muted { color: var(--fg-3); }

.pf-port-list { display: flex; flex-direction: column; gap: 2px; }

.pf-port-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px;
  border-radius: 10px;
  transition: background 150ms ease;
}
.pf-port-row:hover { background: var(--hover); }
.pf-port-row.muted { opacity: 0.55; }
.pf-port-row.muted:hover { opacity: 0.85; }

.pf-port-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.pf-port-avatar-wrap { position: relative; flex-shrink: 0; }
.pf-port-img {
  width: 28px; height: 28px;
  border-radius: 999px;
  object-fit: cover;
  background: var(--bg-2);
  border: 1px solid var(--border);
}
.pf-port-img.muted { filter: grayscale(0.85); }
.pf-port-mono {
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--fg-2);
  font-family: var(--f-mono);
  font-weight: 600;
  border: 1px solid var(--border);
}
.pf-port-mono.muted { color: var(--fg-3); }

.pf-port-chaindot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.pf-port-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pf-port-ticker {
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pf-port-row.muted .pf-port-ticker { color: var(--fg-2); }
.pf-port-sub {
  font-size: 11.5px;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pf-port-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.pf-port-usd {
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.pf-port-row.muted .pf-port-usd { color: var(--fg-2); }
.pf-port-dash { color: var(--fg-3); font-weight: 400; }

.pf-port-swap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 8px;
  color: var(--fg-2);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.pf-port-swap:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--hover);
}

/* ── /swap two-column layout (sidepanel + form) ─────────────────────── */
.swap-page-with-panel {
  max-width: 1080px;
  padding-top: 40px;
}
.swap-layout {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 460px);
  gap: 20px;
  align-items: start;
  justify-content: center;
}
.swap-sidepanel {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
}
.swap-page-with-panel .swap-page-shell {
  width: 100%;
  max-width: 460px;
  justify-self: center;
}
@media (max-width: 880px) {
  .swap-page-with-panel { padding: 28px 12px 56px; max-width: 100%; }
  .swap-layout {
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 460px;
    margin: 0 auto;
  }
  .swap-sidepanel { position: static; order: 2; }
  .swap-page-with-panel .swap-page-shell { order: 1; }
}

.pf-port-viewmore {
  display: block;
  width: calc(100% - 8px);
  margin: 6px 4px 4px;
  padding: 8px 10px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.pf-port-viewmore:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--hover);
}

.pf-port-group-toggle {
  width: 100%;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 8px;
  text-align: left;
  color: inherit;
  border-radius: 6px;
  transition: background 150ms ease;
}
.pf-port-group-toggle:hover { background: var(--hover); }
.pf-port-group-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.pf-port-group-chev {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-3);
}

/* ═══════════════════════════════════════════════════════════════════════
   MARKETPLACE
   ═══════════════════════════════════════════════════════════════════════ */

.mk-main {
  flex: 1;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 40px 96px;
  display: flex;
  flex-direction: column;
  gap: 72px;
}

.mk-section { width: 100%; }

.mk-section-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
  max-width: 720px;
}
.mk-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0 0 4px;
}
.mk-eyebrow::before {
  content: "";
  width: 18px; height: 1px;
  background: var(--accent);
  display: inline-block;
}
.mk-section-title {
  font-family: var(--f-display);
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.028em;
  font-weight: 600;
  color: var(--fg);
  margin: 0;
  line-height: 1.1;
}

/* ── HERO ─────────────────────────────────────────────────────────────── */
.mk-hero {
  position: relative;
  border: 1px solid var(--border-strong);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(var(--brand-rgb), 0.025), transparent 60%), var(--surface);
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 1px 0 rgba(var(--ink-rgb), 0.04), 0 24px 60px -32px rgba(var(--brand-rgb), 0.18);
}
.mk-hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(var(--ink-rgb), 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--ink-rgb), 0.06) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: -1px -1px;
  mask-image: radial-gradient(900px 480px at 70% 20%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(900px 480px at 70% 20%, #000 0%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}
.mk-hero-glow {
  position: absolute; inset: 0;
  background:
    radial-gradient(900px 380px at 90% -20%, rgba(var(--brand-rgb), 0.26), transparent 60%),
    radial-gradient(700px 360px at -10% 110%, rgba(var(--brand-rgb), 0.14), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
[data-theme="dark"] .mk-hero-glow {
  background:
    radial-gradient(900px 380px at 90% -20%, rgba(var(--brand-rgb), 0.20), transparent 60%),
    radial-gradient(700px 360px at -10% 110%, rgba(var(--brand-rgb), 0.10), transparent 60%);
}
.mk-hero-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: stretch;
}
.mk-hero-inner {
  padding: 72px 32px 56px 64px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.mk-hero-media {
  position: relative;
  display: grid;
  place-items: center;
  padding: 24px 48px 24px 0;
  pointer-events: none;
}
.mk-hero-video {
  width: 100%;
  height: auto;
  max-height: 560px;
  object-fit: contain;
  display: block;
  background: transparent;
  filter: drop-shadow(0 30px 60px rgba(var(--brand-rgb), 0.28));
}
.mk-hero-meta { display: flex; gap: 8px; }

.mk-hero-title {
  font-family: var(--f-display);
  font-size: clamp(40px, 6.2vw, 78px);
  line-height: 0.98;
  letter-spacing: -0.04em;
  font-weight: 600;
  margin: 6px 0 4px;
  color: var(--accent);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mk-hero-title-line {
  display: block;
  will-change: transform, opacity;
}
.mk-hero-title-em {
  color: var(--fg);
  font-style: normal;
  opacity: 0.78;
}

.mk-hero-sub {
  font-size: 18px;
  color: var(--fg-2);
  max-width: 600px;
  line-height: 1.55;
  margin: 6px 0 4px;
}

.mk-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}
/* Identical pill-button frame for both children — alignment lives here */
.mk-hero-actions > .mk-coupon,
.mk-hero-actions > .mk-hero-link {
  display: inline-flex;
  align-items: center;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-family: var(--f-text);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  box-sizing: border-box;
  margin: 0;
  text-decoration: none;
  white-space: nowrap;
  flex: 0 0 auto;
}
.mk-hero-link {
  gap: 8px;
  color: var(--fg);
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.mk-hero-link:hover { color: var(--accent); border-color: var(--accent); background: var(--hover); }
.mk-hero-link svg { transition: transform .2s ease; }
.mk-hero-link:hover svg { transform: translateX(3px); }

.mk-trust {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  font-size: 13px;
  color: var(--fg-2);
}
.mk-trust li { display: inline-flex; align-items: center; gap: 8px; }
.mk-trust svg { color: var(--accent); flex-shrink: 0; }

.mk-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.mk-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 18px 0 0;
  border-right: 1px solid var(--border);
}
.mk-stat:last-child { border-right: 0; }
.mk-stat-num {
  font-family: var(--f-display);
  font-size: clamp(26px, 2.8vw, 36px);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--fg);
  line-height: 1;
}
.mk-stat-lbl {
  font-size: 11.5px;
  color: var(--fg-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ── PILLS ────────────────────────────────────────────────────────────── */
.mk-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 11px;
  border-radius: 999px;
  line-height: 1;
  border: 1px solid var(--border-strong);
  background: rgba(var(--ink-rgb), 0.04);
  color: var(--fg-2);
  white-space: nowrap;
}
.mk-pill svg { color: var(--accent); }
.mk-pill-strong {
  color: var(--accent);
  border-color: var(--border-strong);
  background: rgba(var(--brand-rgb), 0.08);
}
.mk-pill-onart {
  position: absolute;
  top: 14px; left: 14px;
  background: var(--surface);
  color: var(--accent);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  z-index: 2;
}
.mk-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

/* ── COUPON ───────────────────────────────────────────────────────────── */
.mk-coupon {
  gap: 10px;
  padding-right: 6px; /* tighter right side to hug the icon chip; left + height inherit from shared pill frame */
  border-style: dashed;
  background: rgba(var(--brand-rgb), 0.05);
  color: var(--fg);
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .15s ease;
}
.mk-coupon:hover {
  background: rgba(var(--brand-rgb), 0.10);
  border-color: var(--accent);
}
.mk-coupon:active { transform: translateY(1px); }
.mk-coupon.is-copied { border-style: solid; border-color: var(--accent); }
.mk-coupon-label { color: var(--fg-2); font-weight: 500; }
.mk-coupon-code {
  font-family: var(--f-mono);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.mk-coupon-icon {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  flex: 0 0 22px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  transition: background .2s ease;
}
.mk-coupon-icon svg { width: 11px; height: 11px; }
.mk-coupon.is-copied .mk-coupon-icon {
  background: var(--accent);
  color: var(--accent-on);
  border-color: var(--accent);
}

/* ── BUY BUTTON ───────────────────────────────────────────────────────── */
.mk-buy {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-decoration: none;
  border: 1.5px solid var(--accent);
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
  white-space: nowrap;
}
.mk-buy:hover {
  background: rgba(var(--brand-rgb), 0.08);
}
.mk-buy:active { background: rgba(var(--brand-rgb), 0.14); }
.mk-buy:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.mk-buy-label { position: relative; z-index: 1; }

.mk-buy-arrows {
  position: relative;
  z-index: 1;
  width: 13px; height: 13px;
  display: inline-block;
  overflow: hidden;
}
.mk-buy-arrow {
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .35s cubic-bezier(.6, .04, .2, 1);
}
.mk-buy-arrow-2 { transform: translate(-110%, 110%); }
.mk-buy:hover .mk-buy-arrow { transform: translate(110%, -110%); }
.mk-buy:hover .mk-buy-arrow-2 { transform: translate(0, 0); }

.mk-buy-sm { padding: 9px 14px; font-size: 12.5px; }
.mk-buy-md { padding: 11px 16px; font-size: 13.5px; }
.mk-buy-lg { padding: 14px 22px; font-size: 14.5px; }

/* ── SELLER CHIP ──────────────────────────────────────────────────────── */
.mk-seller {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-2);
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
}
.mk-seller-mono {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-on);
  font-family: var(--f-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  overflow: hidden;
}
.mk-seller-mono-sm { width: 18px; height: 18px; font-size: 9px; }
.mk-seller-mono-lg { width: 36px; height: 36px; font-size: 13px; }
.mk-seller-mono.has-logo { background: transparent; padding: 0; }
.mk-seller-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mk-seller-name { color: var(--fg); font-weight: 600; }
.mk-seller-handle {
  font-size: 11px;
  color: var(--fg-3);
  font-family: var(--f-mono);
  letter-spacing: 0.04em;
  padding-left: 6px;
  border-left: 1px solid var(--border);
}
.mk-seller-sm {
  padding: 3px 8px 3px 3px;
  font-size: 11.5px;
}

/* ── FEATURED ─────────────────────────────────────────────────────────── */
.mk-featured {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.2fr);
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color .25s ease, box-shadow .25s ease;
}
.mk-featured:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}
.mk-featured-art {
  position: relative;
  display: grid;
  place-items: center;
  padding: 64px;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  min-height: 420px;
  overflow: hidden;
}
.mk-featured-tags {
  position: absolute;
  bottom: 22px; left: 22px; right: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.mk-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-2);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
}

.mk-featured-body {
  padding: 48px 48px 44px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mk-featured-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.mk-featured-eyebrow {
  font-size: 14px;
  color: var(--fg-2);
  font-style: italic;
  margin-top: 4px;
}
.mk-featured-name {
  font-family: var(--f-display);
  font-size: clamp(32px, 3.6vw, 48px);
  letter-spacing: -0.035em;
  font-weight: 600;
  color: var(--fg);
  margin: 4px 0 0;
  line-height: 1.02;
  text-transform: uppercase;
}
.mk-featured-sub {
  color: var(--fg-2);
  font-size: 14px;
  font-family: var(--f-mono);
  letter-spacing: -0.005em;
}
.mk-featured-desc {
  color: var(--fg-2);
  font-size: 15px;
  line-height: 1.6;
  max-width: 540px;
  margin: 6px 0 12px;
}
.mk-featured-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── PRICE ────────────────────────────────────────────────────────────── */
.mk-price-block { display: flex; flex-direction: column; gap: 4px; }
.mk-price-row {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.mk-price {
  font-family: var(--f-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--fg);
  line-height: 1;
}
.mk-price-strike {
  font-size: 14px;
  color: var(--fg-3);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.mk-save {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(var(--brand-rgb), 0.10);
  border: 1px solid var(--border-strong);
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1;
}
.mk-price-meta { font-size: 12px; color: var(--fg-3); }
.mk-stock-low {
  font-size: 11.5px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ── TOOLBAR ──────────────────────────────────────────────────────────── */
.mk-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.mk-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.mk-cat {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-2);
  cursor: pointer;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
  white-space: nowrap;
}
.mk-cat:hover { color: var(--fg); background: var(--hover); border-color: var(--border-strong); }
.mk-cat.is-on {
  color: var(--accent-on);
  background: var(--accent);
  border-color: var(--accent);
}
.mk-cat:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.mk-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mk-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  min-width: 240px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.mk-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.12);
}
.mk-search-icon { color: var(--fg-3); display: inline-flex; }
.mk-search input {
  appearance: none;
  border: 0;
  background: transparent;
  outline: none;
  font: inherit;
  color: var(--fg);
  width: 100%;
  min-width: 0;
  font-size: 14px;
}
.mk-search input::placeholder { color: var(--fg-3); }

/* ── SORT MENU ────────────────────────────────────────────────────────── */
.mk-sort { position: relative; }
.mk-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  color: var(--fg);
  transition: border-color .18s ease, background .18s ease;
}
.mk-sort-btn:hover { border-color: var(--border-strong); background: var(--hover); }
.mk-sort-btn[aria-expanded="true"] { border-color: var(--accent); }
.mk-sort-label { color: var(--fg-3); font-size: 12px; }
.mk-sort-value { font-weight: 500; }
.mk-sort-caret { display: inline-flex; color: var(--fg-3); }
.mk-sort-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 30;
  list-style: none;
  margin: 0;
}
.mk-sort-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
  font-size: 13px;
  color: var(--fg);
  cursor: pointer;
  transition: background .15s ease;
}
.mk-sort-item:hover { background: var(--hover); }
.mk-sort-item.is-on { color: var(--accent); }
.mk-sort-check { color: var(--accent); display: inline-flex; }

/* ── SELLER FILTER ROW ────────────────────────────────────────────────── */
.mk-sellers {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 0 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.mk-sellers-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-right: 6px;
}
.mk-seller-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}
.mk-seller-chip:hover { border-color: var(--border-strong); background: var(--hover); }
.mk-seller-chip.is-on {
  border-color: var(--accent);
  background: rgba(var(--brand-rgb), 0.08);
  color: var(--accent);
}
.mk-seller-chip.is-on .mk-seller-mono { background: var(--accent); color: var(--accent-on); }
.mk-seller-count {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--fg-3);
  background: var(--bg-2);
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.mk-seller-chip.is-on .mk-seller-count {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--border-strong);
}
.mk-clear {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--fg-3);
  font-size: 12px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 999px;
  transition: color .15s ease, background .15s ease;
}
.mk-clear:hover { color: var(--accent); background: var(--hover); }

/* ── GRID ─────────────────────────────────────────────────────────────── */
.mk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 18px;
}

/* ── CARD ─────────────────────────────────────────────────────────────── */
.mk-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}
.mk-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 14px 38px rgba(var(--brand-rgb), 0.10), var(--shadow-sm);
}
.mk-card-art {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  transition: background .25s ease;
}
.mk-card:hover .mk-card-art {
  background: var(--surface-2);
}
.mk-card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.mk-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mk-card-cat {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.mk-card-name {
  font-family: var(--f-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.022em;
  color: var(--fg);
  margin: 4px 0 0;
  line-height: 1.15;
}
.mk-card-sub {
  font-size: 12.5px;
  color: var(--fg-2);
  line-height: 1.45;
  min-height: 36px;
}
.mk-card-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.mk-card .mk-buy {
  margin-top: 12px;
  width: 100%;
}

/* ── VIAL ─────────────────────────────────────────────────────────────── */
.mk-vial {
  display: inline-grid;
  place-items: center;
  width: 100%;
}
.mk-vial-svg {
  width: 110px;
  height: auto;
  filter: drop-shadow(0 14px 30px rgba(var(--brand-rgb), 0.22));
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
  overflow: visible;
}
.mk-vial-lg .mk-vial-svg { width: 200px; }

.mk-card:hover .mk-vial-svg { transform: translateY(-4px) scale(1.03); }

/* Real product photo — same footprint as the vial so card layouts don't shift */
.mk-photo {
  display: inline-grid;
  place-items: center;
  width: 100%;
}
.mk-photo img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
}
.mk-photo-lg img { width: 240px; height: 240px; }
.mk-card:hover .mk-photo img { transform: translateY(-4px) scale(1.03); }

/* SVG parts — two-color brand discipline */
.mk-vial-cap-top { fill: var(--brand-deep); }
.mk-vial-cap { fill: var(--accent); }
.mk-vial-body {
  fill: var(--surface);
  stroke: rgba(var(--brand-rgb), 0.45);
  stroke-width: 1.2;
}
.mk-vial-liquid { fill: rgba(var(--brand-rgb), 0.18); }
.mk-vial-meniscus { fill: rgba(var(--brand-rgb), 0.45); transform-box: fill-box; }
.mk-vial-label-bg {
  fill: var(--surface);
  stroke: rgba(var(--brand-rgb), 0.30);
  stroke-width: 0.7;
}
.mk-vial-rule {
  stroke: rgba(var(--brand-rgb), 0.30);
  stroke-width: 0.5;
}
.mk-vial-shine {
  fill: rgba(255,255,255,0.55);
}
[data-theme="dark"] .mk-vial-shine { fill: rgba(255,255,255,0.10); }
[data-theme="dark"] .mk-vial-body { fill: var(--surface-2); }
[data-theme="dark"] .mk-vial-label-bg { fill: var(--surface); }

/* Label HTML inside foreignObject */
.mk-vial-label {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--f-display);
  color: var(--accent);
  line-height: 1.05;
  padding: 0 1px;
  overflow: hidden;
}
.mk-vial-brand {
  font-size: 3.6px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: rgba(var(--brand-rgb), 0.55);
  margin-bottom: 1px;
}
.mk-vial-name {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
  word-break: break-word;
  hyphens: auto;
}
.mk-vial-name[data-len="11"], .mk-vial-name[data-len="12"] { font-size: 8.5px; }
.mk-vial-name[data-len="13"], .mk-vial-name[data-len="14"] { font-size: 7.8px; }
.mk-vial-name[data-len="15"], .mk-vial-name[data-len="16"] { font-size: 7.2px; }
.mk-vial-name[data-len="17"], .mk-vial-name[data-len="18"], .mk-vial-name[data-len="19"], .mk-vial-name[data-len="20"] { font-size: 6.6px; }
.mk-vial-name[data-len="21"], .mk-vial-name[data-len="22"], .mk-vial-name[data-len="23"], .mk-vial-name[data-len="24"], .mk-vial-name[data-len="25"] { font-size: 6.0px; }
.mk-vial-sub {
  font-family: var(--f-mono);
  font-size: 4.6px;
  color: rgba(var(--brand-rgb), 0.65);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* ── EMPTY ────────────────────────────────────────────────────────────── */
.mk-empty {
  border: 1px dashed var(--border-strong);
  border-radius: 20px;
  padding: 64px 24px;
  text-align: center;
  background: var(--surface);
}
.mk-empty-title {
  font-family: var(--f-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.02em;
}
.mk-empty-sub { color: var(--fg-2); font-size: 14px; margin-top: 4px; }

/* ── SELLERS DIRECTORY ────────────────────────────────────────────────── */
.mk-sellers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.mk-seller-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color .25s ease, box-shadow .25s ease, transform .15s ease;
}
.mk-seller-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.mk-seller-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.mk-seller-card-name {
  font-family: var(--f-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-top: 6px;
}
.mk-seller-card-blurb {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.5;
}
.mk-seller-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--fg-3);
  padding-top: 12px;
  margin-top: auto;
  border-top: 1px solid var(--border);
}
.mk-seller-card-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-weight: 500;
}
.mk-seller-card:hover .mk-seller-card-link { text-decoration: underline; }

/* ── DISCLOSURE ───────────────────────────────────────────────────────── */
.mk-disc-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg-2);
  padding: 26px 30px;
}
.mk-disc-title {
  font-family: var(--f-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.mk-disc-card p {
  margin: 0;
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.65;
  max-width: 860px;
}
.mk-disc-card a { color: var(--accent); text-decoration: none; }
.mk-disc-card a:hover { text-decoration: underline; }

/* ── RESPONSIVE ───────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .mk-hero-inner { padding: 56px 24px 44px 44px; }
  .mk-hero-media { padding: 16px 32px 16px 0; }
  .mk-hero-video { max-height: 460px; }
  .mk-featured-art { padding: 48px; min-height: 320px; }
  .mk-featured-body { padding: 36px 36px 32px; }
}

@media (max-width: 900px) {
  .mk-main { padding: 20px 20px 64px; gap: 48px; }
  .mk-hero { border-radius: 20px; }
  .mk-hero-layout { grid-template-columns: 1fr; }
  .mk-hero-inner { padding: 40px 24px 32px; gap: 14px; }
  .mk-hero-media { padding: 0 24px 32px; }
  .mk-hero-video { max-height: 320px; }
  .mk-hero-title { font-size: clamp(38px, 9vw, 56px); }
  .mk-hero-sub { font-size: 16px; }
  .mk-stats { grid-template-columns: repeat(2, 1fr); gap: 0; }
  .mk-stat { padding: 14px 14px 14px 0; border-bottom: 1px solid var(--border); }
  .mk-stat:nth-child(2) { border-right: 0; }
  .mk-stat:nth-last-child(-n+2) { border-bottom: 0; }
  .mk-featured { grid-template-columns: 1fr; border-radius: 20px; }
  .mk-featured-art {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    min-height: 260px;
    padding: 36px;
  }
  .mk-featured-body { padding: 28px 24px; }
  .mk-featured-foot { flex-direction: column; align-items: stretch; gap: 14px; }
  .mk-featured-foot .mk-buy { width: 100%; }
  .mk-toolbar { gap: 12px; }
  .mk-toolbar-right { width: 100%; }
  .mk-search { flex: 1; min-width: 0; }
  .mk-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
}

@media (max-width: 520px) {
  .mk-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .mk-card-body { padding: 12px 14px 14px; }
  .mk-card-name { font-size: 16px; }
  .mk-card-sub { font-size: 12px; min-height: 0; }
  .mk-trust { gap: 14px; font-size: 12px; }
  .mk-featured-name { font-size: 32px; }
  .mk-mark-lg .mk-mark-svg { width: 110px; height: 150px; }
  .mk-mark-lg .mk-mark-letters { font-size: 26px; padding-top: 28px; }
  .mk-toolbar-right { flex-wrap: wrap; }
  .mk-sort-btn { flex: 1; justify-content: space-between; }
}


/* ── WIKI ──────────────────────────────────────────────────────────────── */
.wiki-main {
  max-width: 1140px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  width: 100%;
}
.wiki-section { margin-top: 40px; }
.wiki-section-head {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 16px;
  margin-bottom: 18px;
}
.wiki-section-title {
  font-family: var(--f-display);
  font-size: 22px; font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

/* Hero */
.wiki-hero {
  position: relative;
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(var(--brand-rgb), 0.03), transparent 60%), var(--surface);
  padding: 56px 40px 48px;
  margin-top: 8px;
  box-shadow: 0 1px 0 rgba(var(--ink-rgb), 0.04), 0 24px 60px -32px rgba(var(--brand-rgb), 0.18);
}
.wiki-hero-bg {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.wiki-hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(var(--ink-rgb), 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(var(--ink-rgb), 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at 50% 30%, rgba(0,0,0,1) 30%, transparent 70%);
}
.wiki-hero-glow {
  position: absolute; inset: -20% -10% auto auto; width: 60%; height: 80%;
  background: radial-gradient(circle, rgba(var(--brand-rgb),0.26) 0%, transparent 60%);
  filter: blur(40px);
  pointer-events: none;
}
[data-theme="dark"] .wiki-hero-glow {
  background: radial-gradient(circle, rgba(var(--brand-rgb),0.18) 0%, transparent 60%);
}
.wiki-hero-inner { position: relative; max-width: 760px; }
.wiki-hero-meta { margin-bottom: 18px; }
.wiki-hero-title {
  font-family: var(--f-display);
  font-size: clamp(34px, 4.4vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 0 0 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.wiki-hero-em { color: var(--brand); }
.wiki-hero-sub {
  color: var(--fg-2);
  font-size: 16px;
  max-width: 600px;
  margin: 0 0 24px;
}
.wiki-search {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 14px;
  width: 100%;
  max-width: 520px;
  transition: box-shadow 120ms ease, border-color 120ms ease;
}
.wiki-search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.15);
}
.wiki-search.is-open {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.15);
}
.wiki-search input {
  flex: 1; border: 0; outline: 0; background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  min-width: 0;
}
.wiki-search-icon { color: var(--fg-3); display: flex; flex-shrink: 0; }
.wiki-search-clear {
  border: 0;
  background: transparent;
  color: var(--fg-3);
  font-size: 18px;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wiki-search-clear:hover { background: var(--hover); color: var(--fg); }

/* Live-search dropdown */
.wiki-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: 480px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  animation: wiki-search-dropdown-in 120ms ease;
}
@keyframes wiki-search-dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.wiki-search-group { padding: 4px 0; }
.wiki-search-group + .wiki-search-group {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 10px;
}
.wiki-search-group-label {
  padding: 6px 12px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.wiki-search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--fg);
  cursor: pointer;
}
.wiki-search-result.is-active,
.wiki-search-result:hover { background: var(--hover); }
.wiki-search-result .wiki-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.wiki-search-result .wiki-mark img,
.wiki-search-result .wiki-mark span {
  width: 36px;
  height: 36px;
  font-size: 13px;
}
.wiki-search-result-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--brand);
  flex-shrink: 0;
}
.wiki-search-result-text { flex: 1; min-width: 0; }
.wiki-search-result-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wiki-search-result-meta {
  font-size: 12px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.wiki-search-result-arrow {
  color: var(--fg-3);
  display: flex;
  flex-shrink: 0;
  transition: color 120ms ease, transform 120ms ease;
}
.wiki-search-result.is-active .wiki-search-result-arrow,
.wiki-search-result:hover .wiki-search-result-arrow {
  color: var(--brand);
  transform: translateX(2px);
}
.wiki-search-empty {
  padding: 18px 14px;
  text-align: center;
  color: var(--fg-3);
  font-size: 13px;
}

/* Stack rows in the dropdown */
.wiki-search-stack { padding-bottom: 4px; }
.wiki-search-stack + .wiki-search-stack { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.wiki-search-stack-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--fg);
  cursor: pointer;
}
.wiki-search-stack-head.is-active,
.wiki-search-stack-head:hover { background: var(--hover); }
.wiki-search-stack-head-static { cursor: default; }
.wiki-search-stack-head-static:hover { background: transparent; }
.wiki-search-stack-count {
  margin-left: 6px;
  font-weight: 500;
  color: var(--fg-3);
  font-size: 12px;
}
.wiki-search-stack-members {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 14px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}
.wiki-search-result-nested {
  padding: 8px 10px;
}
.wiki-search-result-nested .wiki-mark {
  width: 28px;
  height: 28px;
}
.wiki-search-result-nested .wiki-mark img,
.wiki-search-result-nested .wiki-mark span {
  width: 28px;
  height: 28px;
  font-size: 11px;
}
.wiki-search-result-nested .wiki-search-result-name {
  font-size: 13px;
}
.wiki-search-result-nested .wiki-search-result-meta {
  font-size: 11px;
}
.wiki-search-stack-note {
  font-size: 11px;
  color: var(--fg-3);
  padding: 4px 12px 0 26px;
  font-style: italic;
}

/* Pills */
.wiki-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-2);
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.wiki-pill:hover { background: var(--hover); color: var(--fg); }
.wiki-pill.is-active {
  background: var(--brand);
  color: var(--accent-on);
  border-color: var(--brand);
}
.wiki-pill-strong {
  background: rgba(var(--brand-rgb), 0.08);
  border-color: rgba(var(--brand-rgb), 0.18);
  color: var(--brand);
}
.wiki-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.wiki-tag {
  display: inline-flex; padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--fg-2);
  font-size: 11px;
  font-family: var(--f-mono);
}

/* Grid */
.wiki-rowlabel {
  font-size: 12px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 24px 0 10px;
}
.wiki-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

/* Card */
.wiki-card {
  display: flex; flex-direction: column;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 16px;
  padding: 18px 18px 16px;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
  color: var(--fg);
}
.wiki-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.wiki-card.is-featured {
  border-color: rgba(var(--brand-rgb), 0.28);
  background: linear-gradient(180deg, rgba(var(--brand-rgb), 0.04), transparent 60%), var(--surface);
}
.wiki-card-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.wiki-card-cat {
  font-size: 11px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.wiki-mark {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: #fff;
  color: var(--brand);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-mono);
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.04em;
  overflow: hidden;
  flex-shrink: 0;
}
.wiki-mark img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
[data-theme="dark"] .wiki-mark { background: #fff; }
.wiki-mark-lg {
  width: 110px; height: 110px;
  border-radius: 18px;
}
.wiki-mark-lg span { font-size: 24px; }
.wiki-detail-headrow {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 14px;
}
.wiki-detail-headtext { flex: 1; min-width: 0; }
@media (max-width: 560px) {
  .wiki-detail-headrow { flex-direction: column; gap: 16px; }
  .wiki-mark-lg { width: 88px; height: 88px; border-radius: 14px; }
}
.wiki-card-name {
  font-family: var(--f-display);
  font-size: 19px; font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.wiki-card-alias {
  font-size: 12px; color: var(--fg-3);
  margin-top: 2px;
}
.wiki-card-summary {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.5;
  margin: 12px 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wiki-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }

/* Featured guide */
.wiki-feature {
  position: relative;
  display: block;
  text-decoration: none;
  color: var(--fg);
  border: 1px solid rgba(var(--brand-rgb), 0.28);
  border-radius: 24px;
  padding: 44px 40px 40px;
  background: linear-gradient(135deg, rgba(var(--brand-rgb), 0.06), transparent 60%), var(--surface);
  overflow: hidden;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.wiki-feature:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.wiki-feature-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(var(--brand-rgb), 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(var(--brand-rgb), 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at 80% 20%, transparent 0%, rgba(0,0,0,1) 70%);
}
.wiki-feature-glow {
  position: absolute; right: -10%; top: -30%; width: 50%; height: 120%;
  background: radial-gradient(circle, rgba(var(--brand-rgb),0.22) 0%, transparent 60%);
  filter: blur(40px);
  pointer-events: none;
}
.wiki-feature-inner { position: relative; max-width: 720px; }
.wiki-feature-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.wiki-feature-title {
  font-family: var(--f-display);
  font-size: clamp(28px, 3.6vw, 40px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 10px;
}
.wiki-feature-sub {
  font-size: 16px;
  color: var(--fg-2);
  margin: 0 0 16px;
}
.wiki-feature-blurb {
  font-size: 15px;
  color: var(--fg-2);
  line-height: 1.6;
  margin: 0 0 20px;
  max-width: 640px;
}
.wiki-feature-cta {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--brand);
  font-weight: 600;
  font-size: 14px;
}

/* AI Peptide Coach teaser — non-link variant of .wiki-feature */
.wiki-coach-teaser { cursor: default; }
.wiki-coach-teaser:hover { transform: none; box-shadow: none; }
.wiki-coach-teaser-form {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin: 4px 0 14px;
  max-width: 520px;
}
.wiki-coach-teaser-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(var(--brand-rgb), 0.22);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.wiki-coach-teaser-input:focus {
  border-color: rgba(var(--brand-rgb), 0.55);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.18);
}
.wiki-coach-teaser-input:disabled { opacity: 0.6; }
.wiki-coach-teaser-submit {
  flex: 0 0 auto;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 140ms ease, transform 140ms ease;
}
.wiki-coach-teaser-submit:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.wiki-coach-teaser-submit:disabled { opacity: 0.65; cursor: default; }
.wiki-coach-teaser-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.wiki-coach-teaser-success {
  display: inline-block;
  padding: 12px 16px;
  margin: 4px 0 14px;
  border-radius: 10px;
  background: rgba(var(--brand-rgb), 0.10);
  border: 1px solid rgba(var(--brand-rgb), 0.28);
  color: var(--fg);
  font-size: 14px;
  font-weight: 500;
}
.wiki-coach-teaser-error {
  margin: -8px 0 14px;
  font-size: 13px;
  color: #c0392b;
}
.wiki-coach-teaser-foot {
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.55;
  margin: 0;
  max-width: 640px;
}

@media (max-width: 640px) {
  .wiki-coach-teaser-form {
    flex-direction: column;
    gap: 8px;
  }
  .wiki-coach-teaser-submit { width: 100%; }
}

/* Detail */
.wiki-detail { max-width: 820px; }
.wiki-back {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
  color: var(--fg-2);
  font-size: 13px;
  margin-bottom: 24px;
}
.wiki-back:hover { color: var(--fg); }

.wiki-detail-head { margin-bottom: 28px; }
.wiki-detail-eyebrow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 14px;
}
.wiki-detail-head h1 {
  font-family: var(--f-display);
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0 0 8px;
}
.wiki-detail-aliases {
  font-size: 13px;
  color: var(--fg-3);
  font-family: var(--f-mono);
  margin-bottom: 16px;
}
.wiki-detail-summary {
  font-size: 18px;
  line-height: 1.55;
  color: var(--fg-2);
  margin: 0;
  max-width: 720px;
}
.wiki-guide-blurb {
  font-size: 15px;
  line-height: 1.7;
  color: var(--fg-2);
  margin: 14px 0 0;
  max-width: 720px;
}

/* Fact grid */
.wiki-fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin: 24px 0 28px;
  background: var(--surface);
}
.wiki-fact {
  padding: 14px 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.wiki-fact-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-3);
  margin-bottom: 4px;
}
.wiki-fact-val {
  font-size: 13px;
  color: var(--fg);
  line-height: 1.5;
}

/* Sections */
.wiki-detail-section { margin: 28px 0; }
.wiki-detail-section h2 {
  font-family: var(--f-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
}
.wiki-detail-section p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--fg);
}
.wiki-list {
  margin: 0; padding: 0; list-style: none;
}
.wiki-list li {
  padding: 10px 0 10px 18px;
  position: relative;
  font-size: 14px; line-height: 1.6;
  color: var(--fg);
  border-bottom: 1px solid var(--line);
}
.wiki-list li:last-child { border-bottom: 0; }
.wiki-list li::before {
  content: ""; position: absolute; left: 0; top: 18px;
  width: 6px; height: 6px;
  background: var(--brand);
  border-radius: 999px;
}

/* Dosing */
.wiki-dosing {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--surface);
}
.wiki-dosing > div {
  font-size: 14px;
  color: var(--fg);
}
.wiki-dosing-tier {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand);
  background: rgba(var(--brand-rgb), 0.08);
  padding: 2px 8px;
  border-radius: 6px;
  margin-right: 10px;
  min-width: 70px;
  text-align: center;
}
.wiki-note {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.6;
  margin: 12px 0 0;
  padding: 10px 14px;
  border-left: 2px solid rgba(var(--brand-rgb), 0.4);
  background: rgba(var(--brand-rgb), 0.04);
  border-radius: 0 8px 8px 0;
}

/* Timeline */
.wiki-timeline {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.wiki-timeline-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.wiki-timeline-row:last-child { border-bottom: 0; }
.wiki-timeline-when {
  color: var(--brand);
  font-weight: 600;
  font-size: 13px;
}
.wiki-timeline-what { color: var(--fg); line-height: 1.55; }

/* Stacks */
.wiki-stacks { display: grid; gap: 12px; }
.wiki-stack {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--surface);
}
.wiki-stack-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
  margin-bottom: 6px;
}
.wiki-stack-with {
  font-size: 12px;
  color: var(--fg-3);
  font-family: var(--f-mono);
}
.wiki-stack p {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.6;
  margin: 0;
}

/* Sources */
.wiki-sources ul { list-style: none; padding: 0; margin: 0; }
.wiki-sources li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.wiki-sources li:last-child { border-bottom: 0; }
.wiki-sources a {
  color: var(--brand);
  text-decoration: none;
  font-family: var(--f-mono);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.wiki-sources a:hover { text-decoration: underline; }

/* Disclaimer */
.wiki-disclaimer {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  background: var(--surface-2);
  margin-top: 60px;
}
.wiki-disclaimer h3 {
  margin: 0 0 10px;
  font-family: var(--f-display);
  font-size: 16px;
  font-weight: 600;
}
.wiki-disclaimer p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--fg-2);
  margin: 0 0 8px;
}
.wiki-disclaimer-line {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--fg-3);
  line-height: 1.5;
}

/* Cat head */
.wiki-cat-head h1 {
  font-family: var(--f-display);
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.wiki-cat-head p {
  font-size: 16px;
  color: var(--fg-2);
  margin: 0 0 24px;
  max-width: 640px;
}

/* Empty state */
.wiki-empty {
  padding: 40px 0;
  text-align: center;
  color: var(--fg-3);
  font-size: 14px;
}
.wiki-empty-state { padding: 80px 0; text-align: center; }
.wiki-empty-state h1 {
  font-family: var(--f-display);
  font-size: 32px;
  margin: 0 0 8px;
}
.wiki-empty-state p { color: var(--fg-2); margin: 0 0 20px; }
.wiki-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
}

/* Footer */
.wiki-footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  color: var(--fg-3);
  font-size: 12px;
}

/* ── WIKI v2: citations, evidence, legality, rail, marketplace ─────────── */

/* Tone palette for the wiki v2 components (works in both themes). */
:root {
  --tone-ok-fg:   #1f8a4c;
  --tone-ok-bg:   rgba(31, 138, 76, 0.10);
  --tone-warn-fg: #b8741a;
  --tone-warn-bg: rgba(184, 116, 26, 0.12);
  --tone-bad-fg:  #c8341a;
  --tone-bad-bg:  rgba(200, 52, 26, 0.10);
}
[data-theme="dark"] {
  --tone-ok-fg:   #4ed28b;
  --tone-ok-bg:   rgba(78, 210, 139, 0.12);
  --tone-warn-fg: #f0b260;
  --tone-warn-bg: rgba(240, 178, 96, 0.14);
  --tone-bad-fg:  #ff6b58;
  --tone-bad-bg:  rgba(255, 107, 88, 0.14);
}

/* Inline citation marker. */
.wiki-cite {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}
.wiki-cite sup {
  font-size: 10px;
  padding: 0 1px;
  letter-spacing: 0.01em;
}
.wiki-cite:hover sup { text-decoration: underline; }
.wiki-cite-missing { color: var(--tone-bad-fg); font-weight: 700; }

/* Evidence-grade badge. */
.wiki-evbadge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  white-space: nowrap;
}
.wiki-evbadge-ring { flex-shrink: 0; }
.wiki-evbadge-ok   { color: var(--tone-ok-fg);   background: var(--tone-ok-bg);   border-color: transparent; }
.wiki-evbadge-warn { color: var(--tone-warn-fg); background: var(--tone-warn-bg); border-color: transparent; }
.wiki-evbadge-bad  { color: var(--tone-bad-fg);  background: var(--tone-bad-bg);  border-color: transparent; }

/* TL;DR hero block on detail page. */
.wiki-tldr {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.wiki-tldr-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 8px;
}
.wiki-tldr ul { margin: 0; padding-left: 18px; }
.wiki-tldr li { margin: 4px 0; color: var(--fg); line-height: 1.55; }

.wiki-detail-reviewed {
  font-size: 12px;
  color: var(--fg-3);
  margin-top: 6px;
}

/* Legality grid. */
.wiki-legality {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 6px;
}
.wiki-legality-cell {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.wiki-legality-region {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 700;
}
.wiki-legality-status {
  margin-top: 4px;
  font-weight: 700;
  font-size: 14px;
  color: var(--fg);
}
.wiki-legality-note {
  margin-top: 4px;
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.4;
}
.wiki-legality-ok   { background: var(--tone-ok-bg);   border-color: transparent; }
.wiki-legality-ok   .wiki-legality-status { color: var(--tone-ok-fg); }
.wiki-legality-warn { background: var(--tone-warn-bg); border-color: transparent; }
.wiki-legality-warn .wiki-legality-status { color: var(--tone-warn-fg); }
.wiki-legality-bad  { background: var(--tone-bad-bg);  border-color: transparent; }
.wiki-legality-bad  .wiki-legality-status { color: var(--tone-bad-fg); }

/* Two-column detail layout: main + sticky right rail. */
.wiki-detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  align-items: start;
  margin-top: 24px;
}
.wiki-detail-main { min-width: 0; }
.wiki-detail-rail {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.wiki-rail-card {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.wiki-rail-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 6px;
}
.wiki-rail-card p { margin: 0; color: var(--fg); font-size: 14px; line-height: 1.5; }

/* Marketplace panel (disabled until WIKI_MARKETPLACE_LIVE). */
.wiki-mkt {
  position: relative;
  padding: 18px 18px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  overflow: hidden;
}
.wiki-mkt-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}
.wiki-mkt-title {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
}
.wiki-mkt-blurb {
  margin: 8px 0 14px;
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.5;
}
.wiki-mkt-cta {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  font-size: 13px;
  font-weight: 700;
  background: var(--brand);
  color: #FFFFFF;
  cursor: pointer;
  text-decoration: none;
}
.wiki-mkt-cta:hover { background: var(--brand-deep, var(--brand)); }
.wiki-mkt-cta:disabled,
.wiki-mkt-cta[aria-disabled="true"] {
  background: var(--surface-2);
  color: var(--fg-3);
  cursor: not-allowed;
  border: 1px dashed var(--border-strong);
}
.wiki-mkt-secondary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--fg-2);
  text-decoration: none;
}
.wiki-mkt-secondary:hover { color: var(--brand); }
.wiki-mkt-soon::after {
  content: "Soon";
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--fg-3);
  border: 1px solid var(--border);
}

/* Drug interactions block. */
.wiki-interactions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.wiki-interaction {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.wiki-interaction-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.wiki-interaction-sev {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--fg-3);
}
.wiki-interaction p { margin: 0; font-size: 13px; color: var(--fg-2); line-height: 1.5; }
.wiki-interaction-avoid    { background: var(--tone-bad-bg);  border-color: transparent; }
.wiki-interaction-avoid    .wiki-interaction-sev { color: var(--tone-bad-fg); background: rgba(0,0,0,0); }
.wiki-interaction-caution  { background: var(--tone-warn-bg); border-color: transparent; }
.wiki-interaction-caution  .wiki-interaction-sev { color: var(--tone-warn-fg); background: rgba(0,0,0,0); }
.wiki-interaction-synergy  { background: var(--tone-ok-bg);   border-color: transparent; }
.wiki-interaction-synergy  .wiki-interaction-sev { color: var(--tone-ok-fg); background: rgba(0,0,0,0); }

/* Monitoring rows. */
.wiki-monitoring {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wiki-monitor-row {
  display: grid;
  grid-template-columns: 160px 180px 1fr;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--fg-2);
}
.wiki-monitor-test  { font-weight: 700; color: var(--fg); }
.wiki-monitor-when  { color: var(--fg-3); font-size: 12px; }
.wiki-monitor-concern { line-height: 1.45; }

/* Cost rows. */
.wiki-cost {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wiki-cost-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--fg);
}
.wiki-cost-tier {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}

/* Questions for doctor — bordered list. */
.wiki-list-asks {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wiki-list-asks li {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border-left: 3px solid var(--brand);
  color: var(--fg);
  line-height: 1.5;
}

/* Numbered bibliography. */
.wiki-bib {
  margin: 0;
  padding-left: 24px;
}
.wiki-bib li {
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-2);
}
.wiki-bib li a {
  color: var(--fg);
  text-decoration: none;
  word-break: break-word;
}
.wiki-bib li a:hover { color: var(--brand); }
.wiki-bib-title   { font-weight: 600; }
.wiki-bib-journal { color: var(--fg-2); }
.wiki-bib-year    { color: var(--fg-3); }
.wiki-bib-note    { color: var(--fg-3); font-size: 12px; margin-top: 2px; }

/* Detail layout responsive — collapse rail under main on tablet/mobile. */
@media (max-width: 960px) {
  .wiki-detail-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .wiki-detail-rail {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .wiki-detail-rail > * { flex: 1 1 240px; }
}
@media (max-width: 720px) {
  .wiki-monitor-row { grid-template-columns: 1fr; gap: 4px; }
  .wiki-cost-row    { grid-template-columns: 1fr; gap: 2px; }
}

/* ────────────────────────────────────────────────────────────────────────
   WIKI DETAIL v2 — editorial × clinical, NEJM × Linear/Vercel
   ──────────────────────────────────────────────────────────────────────── */

/* Scroll progress bar */
.wiki-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 100;
  pointer-events: none;
}
.wiki-scroll-progress-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, rgba(var(--brand-rgb), 0.4) 100%);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 80ms linear;
  box-shadow: 0 0 12px rgba(var(--brand-rgb), 0.4);
}

/* Outer detail container */
.wiki-detail-v2 {
  max-width: 1280px;
  padding-top: 16px;
}

/* Mono font util */
.wiki-mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-feature-settings: "ss01", "ss02";
  letter-spacing: -0.01em;
}

/* ── HERO BENTO ──────────────────────────────────────────────────────── */
.wiki-hero-bento {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  padding: 28px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(var(--ink-rgb), 0.04), 0 30px 80px -40px rgba(var(--brand-rgb), 0.22);
  overflow: hidden;
  margin-top: 8px;
}

/* Soft gradient mesh background */
.wiki-mesh {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(at 20% 0%, rgba(var(--brand-rgb), 0.18) 0px, transparent 45%),
    radial-gradient(at 100% 0%, rgba(var(--brand-rgb), 0.10) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(var(--brand-rgb), 0.08) 0px, transparent 55%);
  filter: blur(40px);
  opacity: 0.85;
  pointer-events: none;
  z-index: 0;
  animation: wiki-mesh-drift 24s ease-in-out infinite alternate;
}
@keyframes wiki-mesh-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-2%, 1%, 0) scale(1.04); }
  100% { transform: translate3d(2%, -1%, 0) scale(1.02); }
}
@media (prefers-reduced-motion: reduce) {
  .wiki-mesh { animation: none; }
}

.wiki-bento-cell {
  position: relative;
  z-index: 1;
  border-radius: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.wiki-bento-cell:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px -12px rgba(var(--brand-rgb), 0.14);
}

.wiki-bento-name      { grid-column: span 4; }
.wiki-bento-evidence  { grid-column: span 2; }
.wiki-bento-tldr      { grid-column: span 4; }
.wiki-bento-fact      { grid-column: span 1; }
.wiki-bento-fact-wide { grid-column: span 2; }

.wiki-bento-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.wiki-bento-namerow {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 4px;
}
.wiki-bento-namerow .wiki-mark-lg {
  flex-shrink: 0;
}
.wiki-bento-namestack {
  flex: 1;
  min-width: 0;
}
.wiki-bento-title {
  margin: 0 0 4px;
  font-family: var(--f-display, inherit);
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--fg);
  font-variation-settings: "wght" 600;
}
.wiki-bento-aliases {
  font-size: 13px;
  color: var(--fg-2);
  margin-top: 2px;
}
.wiki-bento-reviewed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--fg-3);
  margin-top: 8px;
  font-weight: 500;
}
.wiki-bento-reviewed-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #1f8a4c;
  box-shadow: 0 0 8px rgba(31, 138, 76, 0.6);
}
.wiki-bento-summary {
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--fg);
  max-width: 60ch;
}

/* Evidence cell + ring */
.wiki-bento-evidence {
  align-items: center;
  text-align: center;
  padding: 18px;
}
.wiki-bento-evidence-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.wiki-hero-evidence-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0;
}
.wiki-hero-evidence-ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: inherit;
  font-variant-numeric: tabular-nums;
}
.wiki-hero-evidence-ring-pct {
  font-size: 14px;
  margin-left: 1px;
  opacity: 0.6;
}
.wiki-bento-evidence-grade {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 2px;
}
.wiki-bento-evidence-blurb {
  font-size: 11px;
  color: var(--fg-3);
  margin-top: 4px;
  line-height: 1.4;
}
.wiki-bento-evidence-ok   { color: var(--tone-ok-fg);   background: linear-gradient(180deg, var(--tone-ok-bg), var(--surface)); }
.wiki-bento-evidence-warn { color: var(--tone-warn-fg); background: linear-gradient(180deg, var(--tone-warn-bg), var(--surface)); }
.wiki-bento-evidence-bad  { color: var(--tone-bad-fg);  background: linear-gradient(180deg, var(--tone-bad-bg), var(--surface)); }

/* TL;DR cell */
.wiki-bento-tldr-list {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wiki-bento-tldr-list li {
  position: relative;
  padding-left: 20px;
  color: var(--fg);
  font-size: 14px;
  line-height: 1.55;
}
.wiki-bento-tldr-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--brand);
  transform: rotate(45deg);
}

/* Bento fact tiles (formula, half-life, routes, type) */
.wiki-bento-fact {
  padding: 14px 16px;
}
.wiki-bento-fact-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.wiki-bento-fact-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.4;
  word-break: break-word;
}

@media (max-width: 960px) {
  .wiki-hero-bento { grid-template-columns: repeat(2, 1fr); padding: 18px; }
  .wiki-bento-name      { grid-column: span 2; }
  .wiki-bento-evidence  { grid-column: span 2; }
  .wiki-bento-tldr      { grid-column: span 2; }
  .wiki-bento-fact-wide { grid-column: span 2; }
}
@media (max-width: 540px) {
  .wiki-bento-namerow { flex-direction: column; gap: 10px; }
}

/* ── THREE-COLUMN BODY ───────────────────────────────────────────────── */
.wiki-detail-body-v2 {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 300px;
  gap: 40px;
  align-items: start;
  margin-top: 32px;
}
.wiki-detail-toc-col,
.wiki-detail-rail {
  position: sticky;
  top: 84px;
}
.wiki-detail-main-v2 { min-width: 0; }

@media (max-width: 1100px) {
  .wiki-detail-body-v2 {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 32px;
  }
  .wiki-detail-toc-col { display: none; }
}
@media (max-width: 960px) {
  .wiki-detail-body-v2 { grid-template-columns: minmax(0, 1fr); }
  .wiki-detail-rail {
    position: static;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }
  .wiki-detail-rail > * { flex: 1 1 240px; }
}

/* ── STICKY TOC ──────────────────────────────────────────────────────── */
.wiki-toc {
  font-size: 13px;
  border-left: 1px solid var(--border);
  padding-left: 14px;
}
.wiki-toc-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 12px;
}
.wiki-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wiki-toc li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  color: var(--fg-3);
  text-decoration: none;
  font-weight: 500;
  line-height: 1.35;
  transition: color 180ms ease;
  cursor: pointer;
}
.wiki-toc-bullet {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.5;
  transition: width 220ms ease, height 220ms ease, background 180ms ease, opacity 180ms ease;
  flex-shrink: 0;
}
.wiki-toc li a:hover { color: var(--fg); }
.wiki-toc li.is-active a { color: var(--brand); font-weight: 600; }
.wiki-toc li.is-active .wiki-toc-bullet {
  width: 6px;
  height: 6px;
  background: var(--brand);
  opacity: 1;
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.15);
}

/* ── SECTION EYEBROW ─────────────────────────────────────────────────── */
.wiki-section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 6px;
}
.wiki-section-eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--brand);
}
.wiki-detail-v2 .wiki-detail-section h2 {
  font-family: var(--f-display, inherit);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 4px 0 14px;
  color: var(--fg);
}
.wiki-detail-v2 .wiki-detail-section {
  padding-top: 18px;
  scroll-margin-top: 96px;
}

/* Mechanism list — leading numerical indicator */
.wiki-list-mechanism {
  list-style: none;
  padding-left: 0;
  counter-reset: mech;
}
.wiki-list-mechanism li {
  position: relative;
  padding-left: 38px;
  margin: 8px 0;
  counter-increment: mech;
  line-height: 1.6;
}
.wiki-list-mechanism li::before {
  content: counter(mech, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 0.05em;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 6px;
  min-width: 28px;
  text-align: center;
}

/* ── HORIZONTAL TIMELINE ─────────────────────────────────────────────── */
.wiki-htl {
  position: relative;
  padding: 8px 0 4px;
}
.wiki-htl-rail {
  position: absolute;
  top: 22px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
}
.wiki-htl-rail-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, rgba(var(--brand-rgb), 0.3) 100%);
  border-radius: 2px;
  transform-origin: left center;
}
.wiki-htl-steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.wiki-htl-step {
  position: relative;
  padding-top: 50px;
}
.wiki-htl-dot {
  position: absolute;
  top: 12px;
  left: 0;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--surface);
  border: 2px solid var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--brand);
  z-index: 1;
}
.wiki-htl-dot-num {
  font-family: ui-monospace, monospace;
  font-size: 10px;
}
.wiki-htl-when {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 4px;
}
.wiki-htl-what {
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg);
}

/* ── DOSING TIERS ────────────────────────────────────────────────────── */
.wiki-dose-tiers {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
}
.wiki-dose-pill {
  flex: 1 1 180px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: relative;
  transition: transform 180ms ease, border-color 180ms ease;
}
.wiki-dose-pill:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
.wiki-dose-pill-tier {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.wiki-dose-pill-low    .wiki-dose-pill-tier { color: var(--tone-ok-fg); }
.wiki-dose-pill-moderate .wiki-dose-pill-tier { color: var(--tone-warn-fg); }
.wiki-dose-pill-high   .wiki-dose-pill-tier { color: var(--tone-bad-fg); }
.wiki-dose-pill-value {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  font-weight: 500;
}
.wiki-dose-link {
  align-self: center;
  width: 30px;
  height: 8px;
  flex-shrink: 0;
  color: var(--border-strong);
}
.wiki-dose-link path {
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 4 4;
  fill: none;
}
.wiki-dose-notes {
  flex: 1 1 100%;
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.55;
}
@media (max-width: 720px) {
  .wiki-dose-link { display: none; }
}

/* ── LEGALITY 3D GRID ────────────────────────────────────────────────── */
.wiki-legality-3d {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  perspective: 1000px;
}
.wiki-legality-3d-card {
  position: relative;
  height: 130px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: default;
  transform-style: preserve-3d;
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.3, 1.2), box-shadow 240ms ease;
  outline: none;
}
.wiki-legality-3d-card:hover,
.wiki-legality-3d-card:focus-visible {
  transform: rotateY(180deg);
  box-shadow: 0 12px 32px -16px rgba(var(--brand-rgb), 0.3);
}
.wiki-legality-3d-front,
.wiki-legality-3d-back {
  position: absolute;
  inset: 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backface-visibility: hidden;
  border-radius: 14px;
}
.wiki-legality-3d-back {
  transform: rotateY(180deg);
  background: var(--surface);
}
.wiki-legality-3d-region {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.wiki-legality-3d-status {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.wiki-legality-3d-hint {
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 0.04em;
}
.wiki-legality-3d-note {
  font-size: 11px;
  line-height: 1.45;
  color: var(--fg-2);
  margin-top: 4px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}
.wiki-legality-3d-ok   { background: linear-gradient(160deg, var(--tone-ok-bg), var(--surface-2)); }
.wiki-legality-3d-ok   .wiki-legality-3d-status { color: var(--tone-ok-fg); }
.wiki-legality-3d-warn { background: linear-gradient(160deg, var(--tone-warn-bg), var(--surface-2)); }
.wiki-legality-3d-warn .wiki-legality-3d-status { color: var(--tone-warn-fg); }
.wiki-legality-3d-bad  { background: linear-gradient(160deg, var(--tone-bad-bg), var(--surface-2)); }
.wiki-legality-3d-bad  .wiki-legality-3d-status { color: var(--tone-bad-fg); }

@media (prefers-reduced-motion: reduce) {
  .wiki-legality-3d-card { transition: none; }
  .wiki-legality-3d-card:hover,
  .wiki-legality-3d-card:focus-visible { transform: none; }
  .wiki-legality-3d-front { display: none; }
  .wiki-legality-3d-back { transform: none; position: relative; }
}

/* ── CITATION POPOVER ────────────────────────────────────────────────── */
.wiki-cite-wrap {
  position: relative;
  display: inline-block;
}
.wiki-cite-pop {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% + 6px);
  z-index: 50;
  width: 280px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  font-weight: normal;
  font-style: normal;
  pointer-events: none;
  animation: wiki-cite-pop-in 140ms ease;
}
.wiki-cite-pop-above {
  top: auto;
  bottom: calc(100% + 6px);
}
@keyframes wiki-cite-pop-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.wiki-cite-pop-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.35;
}
.wiki-cite-pop-meta {
  font-size: 11px;
  color: var(--fg-2);
}
.wiki-cite-pop-note {
  font-size: 11px;
  color: var(--fg-3);
  line-height: 1.4;
}
.wiki-cite-pop-cta {
  font-size: 11px;
  color: var(--brand);
  font-weight: 600;
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ── MAGNETIC BUTTON BASE ────────────────────────────────────────────── */
.wiki-magnetic { transition: transform 240ms cubic-bezier(0.2, 0.8, 0.3, 1.2); }
@media (prefers-reduced-motion: reduce) {
  .wiki-magnetic { transition: none; transform: none !important; }
}

/* ── PASSWORD GATE ─────────────────────────────────────────────────────── */
body.gate-open { overflow: hidden; }

.pf-gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 80% at 50% 0%, rgba(var(--brand-rgb), 0.12), transparent 60%), var(--bg);
  z-index: 9999;
  padding: 20px;
}
.pf-gate-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 28px 24px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.pf-gate-brand {
  font-family: var(--f-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--fg-3);
  text-transform: uppercase;
}
.pf-gate-eyebrow {
  font-family: var(--f-mono, var(--f-display));
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 2px;
}
.pf-gate-title {
  font-family: var(--f-display);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--fg);
  line-height: 1.05;
  margin: 4px 0 2px;
}
.pf-gate-hint {
  color: var(--fg-2);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 10px;
}
.pf-gate-input {
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2, var(--bg));
  padding: 0 14px;
  font-size: 15px;
  font-family: var(--f-mono, inherit);
  color: var(--fg);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.pf-gate-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.15);
}
.pf-gate-btn {
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-on);
  font-family: var(--f-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform .12s ease, opacity .18s ease;
}
.pf-gate-btn:hover { opacity: 0.92; }
.pf-gate-btn:active { transform: scale(0.98); }
.pf-gate-error {
  color: #d4504e;
  font-size: 12.5px;
  font-family: var(--f-mono, inherit);
  margin-top: -2px;
}
.pf-gate-back {
  font-size: 12.5px;
  color: var(--fg-3);
  text-decoration: none;
  margin-top: 8px;
  align-self: flex-start;
}
.pf-gate-back:hover { color: var(--fg-2); }

@keyframes pf-gate-shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.pf-gate-card.is-shake { animation: pf-gate-shake .45s ease; }

/* ─────────────────────────────────────────────────────────────────────────
   WIKI MOBILE OVERRIDES — must come last so they win source-order against
   the bento / detail / legality-3d / hero rules defined earlier.
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .wiki-main { padding: 20px 16px 60px; }
  .wiki-hero { padding: 32px 20px 28px; border-radius: 18px; }
  .wiki-hero-title { font-size: clamp(28px, 7.5vw, 36px); margin-bottom: 14px; }
  .wiki-hero-sub { font-size: 14px; margin-bottom: 18px; }
  .wiki-feature { padding: 28px 20px; border-radius: 18px; }
  .wiki-feature-title { font-size: clamp(24px, 6vw, 30px); }
  .wiki-feature-sub { font-size: 14px; }
  .wiki-feature-blurb { font-size: 13.5px; }
  .wiki-section { margin-top: 32px; }
  .wiki-section-title { font-size: 18px; }
  .wiki-grid { grid-template-columns: 1fr; gap: 12px; }
  .wiki-card { padding: 16px; }
  .wiki-fact-grid { grid-template-columns: 1fr; }
  .wiki-fact { border-right: 0; }
  .wiki-timeline-row { grid-template-columns: 1fr; gap: 4px; }
  .wiki-search { padding: 9px 12px; }
  .wiki-search-dropdown { max-height: min(60vh, 420px); left: -4px; right: -4px; }

  /* Detail layout */
  .wiki-detail-v2 { padding-top: 8px; }
  .wiki-detail-head h1 { font-size: clamp(26px, 6.5vw, 34px); }
  .wiki-detail-section h2,
  .wiki-detail-v2 .wiki-detail-section h2 { font-size: 20px; }

  /* Bento on phones */
  .wiki-hero-bento { padding: 14px; gap: 10px; border-radius: 18px; grid-template-columns: 1fr; }
  .wiki-bento-cell { padding: 14px 16px; border-radius: 14px; }
  .wiki-bento-name,
  .wiki-bento-evidence,
  .wiki-bento-tldr,
  .wiki-bento-fact,
  .wiki-bento-fact-wide { grid-column: span 1; }
  .wiki-bento-title { font-size: clamp(26px, 6.5vw, 32px); }
  .wiki-bento-summary { font-size: 14px; }

  /* Horizontal timeline → stack vertical */
  .wiki-htl-rail { display: none; }
  .wiki-htl-steps { grid-template-columns: 1fr; gap: 12px; }
  .wiki-htl-step { padding-top: 0; padding-left: 36px; }
  .wiki-htl-dot { top: 0; left: 0; }

  /* Dosing pills full width */
  .wiki-dose-pill { flex: 1 1 100%; }

  .wiki-detail-rail { gap: 10px; }
  .wiki-footer { padding: 18px 16px; font-size: 11.5px; line-height: 1.5; }

  /* Legality 3D — replace flip with static back content (no hover on touch) */
  .wiki-legality-3d .wiki-legality-3d-card {
    height: auto;
    min-height: 110px;
    transform: none !important;
  }
  .wiki-legality-3d .wiki-legality-3d-front { display: none !important; }
  .wiki-legality-3d .wiki-legality-3d-back {
    transform: none !important;
    position: relative !important;
    backface-visibility: visible !important;
    inset: auto;
    height: auto;
  }

  .wiki-coach-teaser-form { max-width: 100%; }
  .wiki-cat-head h1 { font-size: clamp(26px, 6.5vw, 34px); }
}

@media (max-width: 420px) {
  .wiki-main { padding: 16px 12px 48px; }
  .wiki-hero { padding: 26px 16px 22px; border-radius: 16px; }
  .wiki-feature { padding: 22px 16px; }
  .wiki-hero-bento { padding: 12px; gap: 8px; }
  .wiki-bento-cell { padding: 12px 14px; }
  .wiki-search { padding: 8px 10px; }
  .wiki-search input { font-size: 13px; }
  .wiki-pill { font-size: 11px; padding: 4px 8px; }
}
