@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&display=swap');

:root {
  /* Sanctum fire/forge palette — warm stone neutrals, volcanic red, flame orange */
  --bg: #0c0a09;          /* stone-950 */
  --surface: #1c1917;     /* stone-900 */
  --surface2: #292524;    /* stone-800 */
  --border: rgba(245, 235, 220, 0.13);
  --accent: #dc2626;      /* volcanic red */
  --accent2: #fb923c;     /* flame orange */
  --kpi: #ffd700;         /* gold — KPI/stat numbers only */
  --card-hover: #d6c4a8;  /* parchment — card hover (not a tier color) */
  --text: #fafaf9;        /* stone-50 */
  --muted: #a8a29e;       /* stone-400 */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  /* Display face for Sanctum wordmarks */
  --font-display: 'Syne', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  overflow-x: hidden;
  overflow-x: clip;
  width: 100%;
}
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Admin role-preview safety banner */
#role-preview-banner {
  position: sticky;
  top: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 16px;
  background: linear-gradient(90deg, rgba(234, 179, 8, 0.22), rgba(220, 38, 38, 0.18));
  border-bottom: 1px solid rgba(234, 179, 8, 0.45);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.35;
}
#role-preview-banner .rpb-text em {
  font-style: normal;
  font-weight: 700;
  color: #fde68a;
}
#role-preview-banner .rpb-exit {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(234, 179, 8, 0.5);
  background: rgba(12, 10, 9, 0.65);
  color: #fde68a;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
#role-preview-banner .rpb-exit:hover {
  background: rgba(234, 179, 8, 0.2);
  color: #fff;
}
#role-preview-banner .rpb-exit:disabled {
  opacity: 0.6;
  cursor: wait;
}
body.has-role-preview header {
  top: 0;
}

/* ── Jump typeahead (Series / Artists / Players / Events) ────────────────── */
/* Hero must sit above the editorial sections the dropdown overflows onto.   */
.ow-hero,
.mk-hero,
.ev-hero,
.series-jump-wrap {
  position: relative;
  z-index: 5;
}
#ow-content,
#mk-content,
#ev-content,
.series-wrap {
  position: relative;
  z-index: 1;
}
.jump {
  position: relative;
  z-index: 400;
}
.jump-drop {
  z-index: 401;
}

/* ── Global polish ───────────────────────────────────────────────────────── */
/* Film grain (landing ships its own, so it's excluded there) */
body:not(.landing-page)::after {
  content: "";
  position: fixed;
  inset: -60%;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.045;
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="2" stitchTiles="stitch"/><feColorMatrix type="saturate" values="0"/></filter><rect width="100%25" height="100%25" filter="url(%23n)"/></svg>');
  animation: grain-jitter 0.9s steps(4) infinite;
}
@keyframes grain-jitter {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 1.4%); }
  50% { transform: translate(1.6%, -1%); }
  75% { transform: translate(-1%, -1.8%); }
  100% { transform: translate(0, 0); }
}

/* Headings & big numbers: display type */
h1, h2, h3 { font-family: 'Outfit', sans-serif; }

/* Selection + scrollbar in theme accents */
::selection { background: var(--accent); color: #fff; }
html { scrollbar-width: thin; scrollbar-color: var(--surface2) var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  body:not(.landing-page)::after { animation: none; }
  .card-img-wrap::before { animation: none; }
  #refresh-btn.dirty { animation: none; }
}

/* ── Shared components: detail pages (Series / Owner / …) ──────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.8rem;
  margin-bottom: 16px;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent2); }

.sd-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin: 26px 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.sd-section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.split-wrap {
  display: flex;
  height: 14px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface2);
}
.split-wrap div { height: 100%; transition: width 0.6s ease; }
.split-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 0.72rem; color: var(--muted); }
.split-legend b { font-family: 'Outfit', sans-serif; }

.tier-bar { display: flex; height: 5px; border-radius: 4px; overflow: hidden; background: var(--surface2); }
.tier-bar span { display: block; height: 100%; }

.owners-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.owner-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, transform 0.2s;
}
.owner-chip:hover { border-color: var(--accent2); transform: translateY(-2px); }
.owner-chip img { width: 34px; height: 34px; border-radius: 50%; background: var(--surface2); flex-shrink: 0; }
.owner-chip .oc-name { font-size: 0.78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.owner-chip .oc-sub { font-size: 0.64rem; color: var(--muted); }

.sd-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.sd-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  content-visibility: auto;
  contain-intrinsic-size: 1px 260px;
}
.sd-card:hover { transform: translateY(-4px); }
.sd-card-art { aspect-ratio: 3/4; background: var(--surface2); position: relative; overflow: hidden; }
.sd-card-art img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.5s ease, transform 0.35s ease; }
.sd-card-art img.loaded { opacity: 1; }
.sd-card:hover .sd-card-art img { transform: scale(1.06); }
.sd-card-tier {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(12, 10, 9, 0.82);
}
.sd-card-burnt {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  font-size: 0.85rem;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(127, 29, 29, 0.88);
  border: 1px solid #f87171;
  cursor: help;
}
.sd-card.card-burnt .sd-card-art img { filter: grayscale(0.35) brightness(0.82); }
.sd-card-body { padding: 10px 12px 12px; }
.sd-card-name { font-size: 0.8rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.sd-card-sub { font-size: 0.66rem; color: var(--muted); }

.t-C { color: #22c55e; }
.t-R { color: #60a5fa; }
.t-SR { color: #c084fc; }
.t-SSR { color: #fbbf24; }
.t-UR { color: #f87171; }

/* Header — slim glass deck with a flame hairline; compacts on scroll */
header {
  background: rgba(12, 10, 9, 0.68);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  border-bottom: 1px solid var(--border);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  /* Keep logo / title fully visible — never clip sticky chrome */
  overflow: visible;
}
header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 4%, rgba(220, 38, 38, 0.5) 32%, rgba(251, 146, 60, 0.55) 58%, transparent 96%);
  opacity: 0.8;
}
@media (min-width: 801px) {
  header { transition: padding 0.25s ease, box-shadow 0.25s ease, background 0.25s ease; }
  header .logo-icon, header .logo-img { transition: width 0.25s ease, height 0.25s ease; }
  header .logo-text h1 { transition: font-size 0.25s ease; }
  header.is-compact {
    padding-top: 5px;
    padding-bottom: 5px;
    background: rgba(12, 10, 9, 0.82);
    box-shadow: 0 8px 28px rgba(0,0,0,0.55);
  }
  header.is-compact .logo-icon { width: 30px; height: 40px; }
  header.is-compact .logo-img { width: 100%; height: 100%; }
  header.is-compact .logo-text h1 { font-size: 1.05rem; }
  header.is-compact .how-to-use { height: 30px; font-size: 0.68rem; padding: 0 10px 0 8px; }
}
#user-expires {
  color: #9ca3af;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
}
@media (max-width: 800px) {
  header {
    padding: 8px 12px;
    gap: 10px;
    flex-wrap: nowrap;
    justify-content: space-between;
    /* backdrop-filter makes position:fixed children bind to the header box
       (drawer/dock would sit under the logo and get clipped). Solid fill on phone. */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(12, 10, 9, 0.96);
  }
  .logo { width: auto; justify-content: flex-start; text-align: left; flex-shrink: 1; min-width: 0; gap: 9px; }
  .logo-icon { width: 30px; height: 40px; }
  .logo-img { width: 100%; height: 100%; }
  .logo-text h1 { font-size: 0.95rem; letter-spacing: 0.5px; }
  .logo-text .v-context { display: none; }

  /* App pages with hamburger: account/logout in drawer; page label stays (smaller) */
  body:has(#site-nav-drawer) .header-utils {
    margin-left: auto;
    height: 44px;
    padding: 3px 3px 3px 8px;
    gap: 0;
  }
  body:has(#site-nav-drawer) .header-utils > #user-profile,
  body:has(#site-nav-drawer) .header-utils > #cache-pill.cache-pill--live,
  body:has(#site-nav-drawer) .header-utils > .ag-header-meta,
  body:has(#site-nav-drawer) .header-utils > .hu-vault {
    display: none !important;
  }
  body:has(#site-nav-drawer) .header-utils > #cache-pill:not(.cache-pill--live) {
    display: flex !important;
    font-size: clamp(0.58rem, 2.4vw, 0.7rem);
    font-weight: 600;
    letter-spacing: 0.01em;
    padding-left: 8px;
    padding-right: 4px;
    max-width: min(46vw, 11.5rem);
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* No page label (browse live pill hidden): menu alone, no empty capsule */
  body:has(#site-nav-drawer) .header-utils:not(:has(#cache-pill:not(.cache-pill--live))) {
    padding: 3px;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }
  body:has(#site-nav-drawer) .header-utils:not(:has(#cache-pill:not(.cache-pill--live))):focus-within {
    border-color: transparent;
    box-shadow: none;
  }
  body:has(#site-nav-drawer) .header-utils .nav-menu-toggle {
    width: 38px;
    height: 38px;
    min-width: 38px;
    margin-left: 0;
  }

  /* Landing (no drawer): keep a compact avatar + logout in the header */
  body:not(:has(#site-nav-drawer)) .header-utils {
    margin-left: auto;
    height: 44px;
    padding: 3px 3px 3px 8px;
  }
  body:not(:has(#site-nav-drawer)) #user-profile #user-name,
  body:not(:has(#site-nav-drawer)) #user-profile #user-role,
  body:not(:has(#site-nav-drawer)) #user-profile #user-expires {
    display: none !important;
  }
  body:not(:has(#site-nav-drawer)) .header-utils #user-avatar {
    width: 30px !important;
    height: 30px !important;
    border-width: 1px !important;
  }
  body:not(:has(#site-nav-drawer)) .header-utils .hu-logout {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }
}
@media (max-width: 480px) {
  #user-expires { display: none !important; }
}
.logo { display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; }
.logo-icon {
  width: 40px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(251,146,60,0.4));
}
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-text h1 { font-family: 'Outfit', sans-serif; font-size: 1.18rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.logo-text h1 .sanctum-mark,
.sanctum-mark { font-family: var(--font-display); font-weight: 800; letter-spacing: 0.04em; }
.logo-text h1 span { color: var(--accent2); }
.logo-text h1 .sanctum-mark { color: inherit; }

/* Shared site footer — left / right */
.landing-footer {
  margin-top: auto;
  position: relative;
  padding: 18px 28px;
  border-top: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 12px;
  background: rgba(12, 10, 9, 0.5);
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.landing-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 6%, rgba(220, 38, 38, 0.4) 35%, rgba(251, 146, 60, 0.45) 62%, transparent 94%);
  opacity: 0.75;
}
.landing-footer .footer-copy,
.landing-footer .footer-made {
  line-height: 1.4;
  white-space: nowrap;
  font-family: inherit;
  font-weight: inherit;
}
.landing-footer .footer-copy {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.landing-footer .footer-made { justify-self: end; }
.landing-footer .footer-accent {
  color: var(--accent2);
  font-family: inherit;
  font-weight: 700;
}
.footer-cookie {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.footer-cookie:hover { color: var(--text); border-color: var(--accent2); }
.footer-cookie .fc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #57534e;
  box-shadow: none;
}
.footer-cookie.is-on { color: var(--text); border-color: color-mix(in srgb, var(--success) 45%, transparent); }
.footer-cookie.is-on .fc-dot {
  background: var(--success);
  box-shadow: 0 0 8px color-mix(in srgb, var(--success) 70%, transparent);
}
@media (max-width: 700px) {
  .landing-footer {
    padding: 16px 18px;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 8px;
  }
  .landing-footer .footer-copy,
  .landing-footer .footer-made {
    justify-self: center;
  }
  .landing-footer .footer-copy { justify-content: center; }
}
.v-context { font-size: 0.68rem; font-weight: 600; color: var(--text); opacity: 0.8; margin-top: 2px; }

/* ── Site nav: desktop header rail + phone bottom dock + hamburger drawer ─ */
/* Phone: .main-nav is a floating bottom capsule (moved to <body> in auth.js).
   Desktop: icon rail centered in the header gap; hamburger stays available. */
.main-nav { display: none; }

.main-nav .nav-link {
  --nav-ico: var(--muted);
  --nav-ico-glow: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.18s, background 0.18s, box-shadow 0.18s, transform 0.18s;
}
.main-nav .nav-link[data-nav="browse"]   { --nav-ico: var(--accent2); --nav-ico-glow: rgba(251, 146, 60, 0.45); }
.main-nav .nav-link[data-nav="series"]   { --nav-ico: #e7c89a; --nav-ico-glow: rgba(214, 196, 168, 0.45); }
.main-nav .nav-link[data-nav="players"]  { --nav-ico: #c084fc; --nav-ico-glow: rgba(192, 132, 252, 0.4); }
.main-nav .nav-link[data-nav="artists"]  { --nav-ico: var(--accent); --nav-ico-glow: rgba(220, 38, 38, 0.45); }
.main-nav .nav-link[data-nav="events"]   { --nav-ico: #38bdf8; --nav-ico-glow: rgba(56, 189, 248, 0.4); }
.main-nav .nav-link[data-nav="records"]  { --nav-ico: var(--kpi); --nav-ico-glow: rgba(255, 215, 0, 0.4); }
.main-nav .nav-link[data-nav="settings"] { --nav-ico: #a8a29e; --nav-ico-glow: rgba(251, 146, 60, 0.4); }
.main-nav .nav-link .nav-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--nav-ico);
  opacity: 0.9;
  transition: color 0.18s, opacity 0.18s, filter 0.18s, transform 0.18s;
}
.main-nav .nav-link .nav-ico-svg { display: block; }
.main-nav .nav-link:hover,
.main-nav .nav-link:focus-visible {
  color: var(--text);
  background: color-mix(in srgb, var(--nav-ico) 14%, rgba(255, 255, 255, 0.04));
  outline: none;
}
.main-nav .nav-link:hover .nav-ico,
.main-nav .nav-link:focus-visible .nav-ico {
  opacity: 1;
  filter: drop-shadow(0 0 8px var(--nav-ico-glow));
  transform: scale(1.08);
}
.main-nav .nav-link[data-nav="settings"]:hover,
.main-nav .nav-link[data-nav="settings"]:focus-visible { --nav-ico: var(--accent2); }
.main-nav .nav-link.active {
  color: #fff;
  background: color-mix(in srgb, var(--nav-ico) 20%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nav-ico) 55%, transparent);
}
.main-nav .nav-link.active .nav-ico {
  opacity: 1;
  filter: drop-shadow(0 0 10px var(--nav-ico-glow));
}

@media (min-width: 801px) {
  .main-nav {
    display: flex;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface2) 88%, transparent);
    border: 1px solid var(--border);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.28);
    z-index: 2;
    max-width: min(52vw, 420px);
  }
  .main-nav .nav-link {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 999px;
  }
  .main-nav .nav-link .nav-txt {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  .main-nav .nav-link .nav-ico,
  .main-nav .nav-link .nav-ico-svg {
    width: 18px;
    height: 18px;
  }
  .main-nav .nav-link:hover { transform: translateY(-1px); }
  header.is-compact .main-nav .nav-link {
    width: 32px;
    height: 32px;
  }
  header.is-compact .main-nav .nav-link .nav-ico,
  header.is-compact .main-nav .nav-link .nav-ico-svg {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 800px) {
  body:has(.main-nav) {
    --site-bottom-nav-h: calc(60px + env(safe-area-inset-bottom, 0px));
    padding-bottom: var(--site-bottom-nav-h);
  }
  .main-nav {
    display: flex;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    z-index: 1100;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    padding: 5px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface2) 94%, transparent);
    border: 1px solid var(--border);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    max-width: none;
    width: auto;
    animation: nav-dock-in 0.34s cubic-bezier(0.4, 0, 0.2, 1) both;
  }
  .main-nav .nav-link {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 999px;
  }
  .main-nav .nav-link .nav-ico,
  .main-nav .nav-link .nav-ico-svg {
    width: 20px;
    height: 20px;
  }
  .main-nav .nav-link .nav-txt {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  body.nav-drawer-open .main-nav,
  body.filter-sheet-open .main-nav {
    opacity: 0;
    pointer-events: none;
  }
  .fetch-status-pill {
    bottom: calc(var(--site-bottom-nav-h, 12px) + 12px);
  }
}
@keyframes nav-dock-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 800px) and (prefers-reduced-motion: reduce) {
  .main-nav { animation: none; }
}

/* Right-side header cluster — merged capsule (match .cb-search metrics) */
.header-utils {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0;
  height: 40px;
  padding: 3px 3px 3px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  flex-shrink: 0;
  min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.header-utils:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

/* Segments inside the capsule */
.header-utils > #user-profile,
.header-utils > #cache-pill,
.header-utils > .ag-header-meta,
.header-utils > .hu-vault {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  margin: 0;
  padding: 0 8px;
  background: transparent !important;
  border: none !important;
  border-radius: 0;
  box-shadow: none !important;
  flex-shrink: 0;
  min-width: 0;
}
.header-utils > #user-profile {
  padding-left: 4px;
  padding-right: 4px;
  font-size: .88rem; /* match .cb-seg input */
}
.header-utils > #cache-pill,
.header-utils > .ag-header-meta {
  position: relative;
  padding-left: 12px;
  padding-right: 8px;
  color: var(--text);
  /* Scales down on narrower viewports so labels like "Series Explorer" fit */
  font-size: clamp(0.68rem, 0.52rem + 0.55vw, 0.88rem);
  font-weight: 600;
  white-space: nowrap;
}
.header-utils #user-name {
  font-size: .88rem;
  font-weight: 600;
  max-width: 160px;
}
.header-utils #user-role {
  font-size: .62rem; /* match .cb-seg-label */
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
}

/* App pages: role, username, and logout live in the hamburger (landing has no .main-nav). */
body:has(.main-nav) .header-utils #user-role,
body:has(.main-nav) .header-utils #user-name,
body:has(.main-nav) .header-utils .hu-logout {
  display: none !important;
}
.header-utils #user-avatar {
  width: 28px;
  height: 28px;
  border-width: 1.5px;
}
.header-utils > .hu-vault {
  font-family: 'Outfit', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent2);
  text-decoration: none;
  padding: 0 10px;
  white-space: nowrap;
}
.header-utils > .hu-vault:hover,
.header-utils > .hu-vault:focus-visible {
  color: var(--text);
  outline: none;
}

/* Vertical divider between profile and cache (match .cb-search-divider) */
.header-utils.is-authed > #cache-pill::before,
.header-utils.is-authed > .ag-header-meta::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 18px;
  transform: translateY(-50%);
  background: color-mix(in srgb, var(--border) 85%, #fff 15%);
  pointer-events: none;
}

/* Logout = red icon button (same footprint as .cb-search .btn-icon) */
.header-utils .hu-logout {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0 !important;
  border-radius: 999px !important;
  border: 1px solid transparent;
  background: transparent;
  color: var(--danger);
  text-decoration: none;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color .15s, background .15s, border-color .15s;
}
.header-utils .hu-logout svg { display: block; }
.header-utils .hu-logout:hover,
.header-utils .hu-logout:focus-visible {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: none;
  transform: none;
  text-decoration: none;
  outline: none;
}

.header-utils > #cache-pill.cache-pill--live {
  padding: 0 8px 0 12px;
  cursor: default;
}
.header-utils > #cache-pill.cache-pill--live.is-armed,
.header-utils > #cache-pill.cache-pill--live.is-updating {
  background: transparent !important;
}

.header-utils > .ag-header-meta {
  gap: 10px;
}

/* How to use — labeled pill after the logo (app) / fixed top-right (landing) */
.how-to-use {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px 0 10px;
  border: 1px solid color-mix(in srgb, var(--accent2) 55%, transparent);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.22), rgba(251, 146, 60, 0.16));
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  box-shadow: 0 0 0 1px rgba(251, 146, 60, 0.12), 0 4px 16px rgba(220, 38, 38, 0.22);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  z-index: 80;
}
.how-to-use:hover,
.how-to-use:focus-visible {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(251, 146, 60, 0.28), 0 8px 22px rgba(220, 38, 38, 0.35);
  outline: none;
}
.how-to-use svg {
  width: 15px;
  height: 15px;
  display: block;
  color: var(--kpi);
  flex-shrink: 0;
}
.how-to-use.is-fresh {
  animation: htu-glow 1.5s ease-in-out 2;
}
@keyframes htu-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 146, 60, 0), 0 4px 16px rgba(220, 38, 38, 0.22); }
  45% { box-shadow: 0 0 0 6px rgba(251, 146, 60, 0.22), 0 6px 20px rgba(220, 38, 38, 0.35); }
}
body.landing-page .how-to-use {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
}
@media (max-width: 800px) {
  header .how-to-use {
    height: 36px;
    padding: 0 10px 0 8px;
    font-size: 0.68rem;
  }
  body.landing-page .how-to-use {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    height: 38px;
    padding: 0 12px 0 10px;
    font-size: 0.72rem;
  }
}
@media (max-width: 380px) {
  header .how-to-use .htu-txt { font-size: 0.62rem; }
}
@media (prefers-reduced-motion: reduce) {
  .how-to-use.is-fresh { animation: none; }
}

.header-utils .nav-menu-toggle {
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 35%, transparent);
}
.header-utils .nav-menu-toggle:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 45%, transparent);
  transform: translateY(-1px);
}
.header-utils .nav-menu-toggle:active {
  transform: translateY(0);
  filter: brightness(0.96);
}
.header-utils .nav-menu-toggle .nm-txt { display: none; }
.header-utils .nav-menu-toggle .nm-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 15px;
}
.header-utils .nav-menu-toggle .nm-bars i {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: all 0.2s ease;
}
.header-utils .nav-menu-toggle[aria-expanded="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
  filter: none;
}
.header-utils .nav-menu-toggle[aria-expanded="true"] .nm-bars i:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.header-utils .nav-menu-toggle[aria-expanded="true"] .nm-bars i:nth-child(2) { opacity: 0; }
.header-utils .nav-menu-toggle[aria-expanded="true"] .nm-bars i:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* Fallback if toggle lands outside .header-utils (landing/404) */
.nav-menu-toggle {
  margin-left: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}
.nav-menu-toggle:hover {
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}
.nav-menu-toggle .nm-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 16px;
}
.nav-menu-toggle .nm-bars i {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: all 0.2s ease;
}
.nav-menu-toggle[aria-expanded="true"] .nm-bars i:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.nav-menu-toggle[aria-expanded="true"] .nm-bars i:nth-child(2) { opacity: 0; }
.nav-menu-toggle[aria-expanded="true"] .nm-bars i:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

#site-nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1990;
  background: rgba(5, 4, 3, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.22s ease;
}
#site-nav-backdrop.open { opacity: 1; }

#site-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1995;
  width: min(320px, 88vw);
  background: rgba(18, 16, 15, 0.98);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-left: 1px solid var(--border);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  outline: none;
  overflow-y: auto;
}
#site-nav-drawer.open { transform: translateX(0); }
body.nav-drawer-open { overflow: hidden; }

.site-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.site-nav-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.site-nav-close {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}
.site-nav-close:hover { border-color: var(--accent2); color: var(--accent2); }

/* Drawer account — role + logout on all sizes; identity + vault on phone */
.site-nav-account {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface2) 70%, transparent);
}
.sna-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.sna-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid color-mix(in srgb, var(--accent2) 55%, var(--border));
  flex-shrink: 0;
}
.sna-avatar--empty {
  display: block;
  background: var(--surface);
  border-style: solid;
}
.sna-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  min-width: 0;
}
.sna-name {
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 0.98rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.sna-role {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  color: #fff;
}
.sna-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.1);
  color: #fecaca;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.sna-logout svg { display: block; flex-shrink: 0; }
.sna-logout:hover,
.sna-logout:focus-visible {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.65);
  color: #fff;
  outline: none;
}
.sna-vault {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent2) 45%, var(--border));
  background: color-mix(in srgb, var(--accent2) 12%, transparent);
  color: var(--accent2);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.sna-vault:hover,
.sna-vault:focus-visible {
  background: color-mix(in srgb, var(--accent2) 22%, transparent);
  border-color: var(--accent2);
  color: var(--text);
  outline: none;
}
@media (min-width: 801px) {
  /* Header shows vault + avatar; drawer keeps name, role, and logout. */
  .site-nav-account {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
  }
  .site-nav-account .sna-avatar,
  .site-nav-account .sna-vault {
    display: none;
  }
  .site-nav-account .sna-identity {
    display: flex;
    min-width: 0;
  }
  .site-nav-account .sna-logout {
    width: auto;
    flex: 1;
    max-width: 168px;
    min-height: 36px;
    margin-left: auto;
  }
}

.site-nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 12px 20px;
}
#site-nav-drawer .nav-link {
  --nav-ico: var(--muted);
  --nav-ico-glow: transparent;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.18s, background 0.18s, transform 0.18s, box-shadow 0.18s;
  min-height: 48px;
}
/* Theme tints per destination */
#site-nav-drawer .nav-link[data-nav="browse"]   { --nav-ico: var(--accent2); --nav-ico-glow: rgba(251, 146, 60, 0.45); }
#site-nav-drawer .nav-link[data-nav="series"]   { --nav-ico: #e7c89a; --nav-ico-glow: rgba(214, 196, 168, 0.45); }
#site-nav-drawer .nav-link[data-nav="players"]  { --nav-ico: #c084fc; --nav-ico-glow: rgba(192, 132, 252, 0.4); }
#site-nav-drawer .nav-link[data-nav="artists"]  { --nav-ico: var(--accent); --nav-ico-glow: rgba(220, 38, 38, 0.45); }
#site-nav-drawer .nav-link[data-nav="events"]   { --nav-ico: #38bdf8; --nav-ico-glow: rgba(56, 189, 248, 0.4); }
#site-nav-drawer .nav-link[data-nav="records"]  { --nav-ico: var(--kpi); --nav-ico-glow: rgba(255, 215, 0, 0.4); }
#site-nav-drawer .nav-link[data-nav="settings"] { --nav-ico: #a8a29e; --nav-ico-glow: rgba(251, 146, 60, 0.4); }

#site-nav-drawer .nav-link .nav-ico {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--nav-ico);
  opacity: 0.92;
  transition: color 0.18s, opacity 0.18s, filter 0.18s, transform 0.18s;
}
#site-nav-drawer .nav-link .nav-ico-svg {
  display: block;
  width: 20px;
  height: 20px;
}
#site-nav-drawer .nav-link:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--nav-ico) 12%, rgba(255, 255, 255, 0.03));
  transform: translateX(2px);
}
#site-nav-drawer .nav-link:hover .nav-ico {
  opacity: 1;
  filter: drop-shadow(0 0 8px var(--nav-ico-glow));
  transform: scale(1.08);
}
#site-nav-drawer .nav-link[data-nav="settings"]:hover { --nav-ico: var(--accent2); }
#site-nav-drawer .nav-link.active {
  color: #fff;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--nav-ico) 22%, transparent),
    color-mix(in srgb, var(--accent2) 10%, transparent)
  );
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nav-ico) 55%, transparent);
}
#site-nav-drawer .nav-link.active .nav-ico {
  opacity: 1;
  filter: drop-shadow(0 0 10px var(--nav-ico-glow));
}
#site-nav-drawer .nav-link .nav-txt {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
}

/* Mid-width: keep center rail, slim the side chrome so icons stay clear */
@media (min-width: 801px) and (max-width: 1180px) {
  header { padding: 8px 16px; gap: 12px; }
  .logo-text .v-context { display: none; }
  .main-nav { max-width: min(46vw, 360px); gap: 2px; }
  .how-to-use { height: 30px; padding: 0 10px 0 8px; font-size: 0.68rem; }
}

.tab-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  font-family: inherit; font-size: .82rem; font-weight: 600;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; transition: all .15s;
  margin-left: auto;
}
.tab-btn.active { background: var(--surface2); color: var(--text); }
.tab-btn:hover:not(.active) { color: var(--text); }
#cache-pill {
  font-size: .71rem; color: var(--muted);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 9px; white-space: nowrap;
}
#cache-pill > span,
#cache-pill .cache-pill-label { color: inherit; }

/* Compact live cache pill — label only; details on hover */
#cache-pill.cache-pill--live {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: default;
  padding: 5px 11px;
  font-weight: 600;
  color: var(--text);
  transition: border-color .15s, background .15s;
}
#cache-pill.cache-pill--live.is-armed {
  border-color: rgba(34, 197, 94, 0.35);
  color: var(--success, #22c55e);
}
#cache-pill.cache-pill--live.is-updating {
  border-color: rgba(255, 80, 40, 0.45);
  color: var(--accent2, #ff5028);
}
#cache-pill.cache-pill--live .cache-pill-label {
  color: inherit;
  font-variant-numeric: tabular-nums;
}
#cache-pill.cache-pill--live .cache-pill-tip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 9500;
  min-width: 188px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(12, 10, 9, 0.96);
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
  pointer-events: none;
  white-space: nowrap;
}
#cache-pill.cache-pill--live .cache-pill-tip::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 16px;
  width: 8px;
  height: 8px;
  background: rgba(12, 10, 9, 0.96);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
#cache-pill.cache-pill--live:hover .cache-pill-tip,
#cache-pill.cache-pill--live:focus-within .cache-pill-tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.cache-pill-tip-row {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: space-between;
  align-items: baseline;
  column-gap: 22px;
  font-size: 0.72rem;
  line-height: 1.3;
}
.cache-pill-tip-row + .cache-pill-tip-row {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(245, 235, 220, 0.08);
}
.cache-pill-tip-k {
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.cache-pill-tip-v {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
@media (prefers-reduced-motion: reduce) {
  #cache-pill.cache-pill--live .cache-pill-tip { transition: none; }
}

/* Pages */
.page { display: none; flex: 1; }
.page.active { display: flex; flex-direction: column; }

/* Settings page */
#page-settings { position: relative; min-height: 100vh; }
/* Legacy narrow settings column — Command Center (.cc-shell) opts out in settings.css */
#page-settings > div:not(.cc-shell):not(#settings-content) { padding: 22px; max-width: 680px; }
.scard {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; margin-bottom: 16px;
}
.scard h2 {
  font-size: .85rem; font-weight: 700; color: var(--accent2);
  margin-bottom: 14px; text-transform: uppercase; letter-spacing: .05em;
}
.srow {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.srow:last-child { margin-bottom: 0; }
.slabel { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.slabel strong { font-size: .85rem; font-weight: 600; }
.slabel small { font-size: .73rem; color: var(--muted); }
.sctl { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 150px; height: 4px;
  border-radius: 99px; background: var(--border); outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 15px; height: 15px;
  border-radius: 50%; background: var(--accent); cursor: pointer;
}
.rval { font-size: .85rem; font-weight: 700; color: var(--text); min-width: 38px; text-align: right; }
input[type=number], input[type=text], select {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); font-family: inherit;
  font-size: .83rem; padding: 6px 9px; outline: none; transition: border-color .15s; height: 32px;
}
input:focus, select:focus { border-color: var(--accent); }
.vrange { display: flex; align-items: center; gap: 7px; }
.vrange input { width: 63px; }
.vrange span { color: var(--muted); font-size: .83rem; }

/* ── Browse filter popover — field geometry ── */
.filter-popover .fg select,
.filter-popover .fg input[type=text],
.filter-popover .fg input[type=number] {
  width: 100%;
  min-width: 0;
  height: 34px;
  background: var(--surface2);
  border-color: var(--border);
}
.filter-popover .vrange input { width: auto; flex: 1; min-width: 0; }
.filter-popover .fg select:focus,
.filter-popover .fg input:focus { border-color: var(--accent); }

/* ── Browse filter panel — structure (chrome shell owns the glass) ── */
.filter-panel {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  border-radius: 0;
  padding: 2px 2px 8px;
}
.filter-panel-body {
  /* Must stay visible — #filter-popover is absolutely positioned below the
     command row and would otherwise be clipped to ~0 height. */
  overflow: visible;
}
/* ── Command bar — single line on wide screens, 2 rows when tight ── */
.command-bar-panel { position: relative; }
.cb-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  width: 100%;
}
.cb-row > * { flex-shrink: 0; }
.cb-row .cb-search {
  flex: 1 1 auto;
  min-width: 260px;
  height: 40px;
}
.cb-row .more-filters-btn {
  justify-content: center;
  margin-left: 0;
  white-space: nowrap;
  height: 40px;
}
.cb-row #f-time {
  width: auto;
  min-width: 118px;
  height: 40px;
  order: 1;
}
.cb-row .cb-search { order: 2; }
.cb-row .tier-seg {
  order: 3;
  min-width: 0;
  height: 40px;
  align-items: center;
}
.cb-row .more-filters-btn { order: 4; margin-left: auto; }
.cb-row .tier-seg button { flex: 0 0 auto; height: 32px; }

/* Tight widths: drop to 2 tidy rows — search+more, then time+tiers */
@media (min-width: 601px) and (max-width: 1180px) {
  .cb-row { display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "search more" "time tiers"; }
  .cb-row .cb-search { grid-area: search; }
  .cb-row .more-filters-btn { grid-area: more; height: 40px; }
  .cb-row #f-time { grid-area: time; height: 36px; }
  .cb-row .tier-seg { grid-area: tiers; margin-left: 0; justify-content: flex-end; height: 36px; }
  .cb-row .tier-seg button { height: 30px; }
}

/* Unified search shell: Name | Series | Search | Clear */
.cb-search {
  display: flex;
  align-items: center;
  gap: 0;
  height: 40px;
  padding: 3px 3px 3px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color .15s, box-shadow .15s;
  min-width: 0;
}
.cb-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.cb-seg {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  padding: 0 8px;
  margin: 0;
  cursor: text;
}
.cb-seg:first-child { padding-left: 4px; }
.cb-seg-label {
  flex-shrink: 0;
  font-family: 'Outfit', sans-serif;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent2);
  line-height: 1;
  user-select: none;
}
.cb-seg[for="f-name"] .cb-seg-label { color: var(--accent2); }   /* flame orange */
.cb-seg[for="f-series"] .cb-seg-label { color: #e7c89a; }        /* parchment */
.cb-seg input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: .88rem;
}
.cb-seg input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.cb-seg input:focus {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}
.cb-search-divider {
  width: 1px;
  height: 18px;
  background: color-mix(in srgb, var(--border) 85%, #fff 15%);
  flex-shrink: 0;
  align-self: center;
}
.cb-query-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding-left: 4px;
}
.cb-search .btn-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
}
.btn-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0 !important;
  border-radius: 999px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.btn-icon svg { display: block; }
.cb-search #clear-btn.btn-outline {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.cb-search #clear-btn.btn-outline.has-filters {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
}
.cb-search #clear-btn.btn-outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: transparent;
  color: #fff;
  box-shadow: none;
  transform: none;
}
.cb-search #clear-btn.btn-outline.has-filters:hover:not(:disabled) {
  color: #fecaca;
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.22);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  pointer-events: none;
}

/* Tier segmented chips */
.tier-seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  flex-shrink: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tier-seg::-webkit-scrollbar { display: none; }
.tier-seg button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: .78rem;
  font-weight: 700;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}
.tier-seg button:not(.active):hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
/* Tier-colored idle labels for quick scanning */
.tier-seg button[data-tier="C"]:not(.active)   { color: #4ade80; }
.tier-seg button[data-tier="R"]:not(.active)   { color: #60a5fa; }
.tier-seg button[data-tier="SR"]:not(.active)  { color: #c084fc; }
.tier-seg button[data-tier="SSR"]:not(.active) { color: #fbbf24; }
.tier-seg button[data-tier="UR"]:not(.active)  { color: #f87171; }
.tier-seg button[data-tier="C"]:hover   { background: rgba(74, 222, 128, 0.10); }
.tier-seg button[data-tier="R"]:hover   { background: rgba(96, 165, 250, 0.10); }
.tier-seg button[data-tier="SR"]:hover  { background: rgba(192, 132, 252, 0.10); }
.tier-seg button[data-tier="SSR"]:hover { background: rgba(251, 191, 36, 0.10); }
.tier-seg button[data-tier="UR"]:hover  { background: rgba(248, 113, 113, 0.10); }
.tier-seg button.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}
.tier-seg button[data-tier="C"].active   { background: rgba(168, 162, 158, 0.14); color: #d6d3d1; box-shadow: inset 0 0 0 1px #a8a29e; }
.tier-seg button[data-tier="R"].active   { background: rgba(96, 165, 250, 0.16); color: #93c5fd; box-shadow: inset 0 0 0 1px #60a5fa; }
.tier-seg button[data-tier="SR"].active  { background: rgba(168, 85, 247, 0.16); color: #c084fc; box-shadow: inset 0 0 0 1px #a855f7; }
.tier-seg button[data-tier="SSR"].active { background: rgba(245, 158, 11, 0.16); color: #fbbf24; box-shadow: inset 0 0 0 1px #f59e0b; }
.tier-seg button[data-tier="UR"].active  { background: rgba(239, 68, 68, 0.18); color: #f87171; box-shadow: inset 0 0 0 1px #ef4444; }

/* State segmented chips (Locked / Listed / New / Burnt) — same pill language
   as .tier-seg but stretched to fill the popover grid cell. */
.state-seg {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 100%;
}
.state-seg button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: .74rem;
  font-weight: 700;
  height: 32px;
  padding: 0 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.state-seg button:not(.active):hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.state-seg button.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}
/* Accent only the "positive" filter state so active filters pop at a glance. */
.seg-locked button[data-val="true"].active { background: rgba(239, 68, 68, 0.16);  color: #f87171; box-shadow: inset 0 0 0 1px #ef4444; }
.seg-listed button[data-val="true"].active { background: rgba(34, 197, 94, 0.16);  color: #4ade80; box-shadow: inset 0 0 0 1px #22c55e; }
.seg-new    button[data-val="true"].active { background: rgba(96, 165, 250, 0.16); color: #93c5fd; box-shadow: inset 0 0 0 1px #60a5fa; }
.seg-burnt  button[data-val="true"].active  { background: rgba(248, 113, 113, 0.16); color: #fca5a5; box-shadow: inset 0 0 0 1px #f87171; }
.seg-burnt  button[data-val="false"].active { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; box-shadow: inset 0 0 0 1px #34d399; }

/* Pill-styled native selects (time window, sort) */
.chip-select {
  appearance: none;
  -webkit-appearance: none;
  height: 34px;
  border-radius: 999px;
  padding: 0 28px 0 14px;
  background-color: var(--surface2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a8a29e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
  flex-shrink: 1;
  min-width: 0;
  max-width: 100%;
}

/* Time window: highlight only the closed pill — not the whole option list */
.chip-select--window {
  color: var(--accent2);
  font-weight: 700;
  border-color: color-mix(in srgb, var(--accent2) 55%, transparent);
  background-color: color-mix(in srgb, var(--accent2) 12%, var(--surface2));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23fb923c' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent2) 22%, transparent),
              0 0 18px color-mix(in srgb, var(--accent2) 16%, transparent);
  animation: window-hint 2.4s ease-in-out 1;
}
.chip-select--window:hover,
.chip-select--window:focus {
  border-color: var(--accent2);
  background-color: color-mix(in srgb, var(--accent2) 18%, var(--surface2));
}
/* Native dropdown list: keep normal readable colors (select color inherits otherwise) */
.chip-select--window option {
  color: var(--text);
  background-color: #1c1917;
  font-weight: 600;
}
.chip-select--window option:checked,
.chip-select--window option:hover {
  color: #fff;
}
@keyframes window-hint {
  0%, 100% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent2) 22%, transparent),
                          0 0 18px color-mix(in srgb, var(--accent2) 16%, transparent); }
  40% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent2) 45%, transparent),
                    0 0 26px color-mix(in srgb, var(--accent2) 35%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .chip-select--window { animation: none; }
}

/* More-filters trigger + active-count badge */
.more-filters-btn { height: 34px; border-radius: 999px; flex-shrink: 1; min-width: 0; }
.more-filters-count,
.filters-expand-count {
  padding: 1px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent2);
  font-size: .68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Phone-only Filters expand — never on desktop */
@media (min-width: 601px) {
  .filters-expand-btn { display: none !important; }
}
.filters-expand-btn {
  display: none;
  height: 34px;
  border-radius: 999px;
  flex-shrink: 0;
  gap: 6px;
  padding: 0 12px;
}
.filters-expand-chev {
  transition: transform 0.18s ease;
  opacity: 0.75;
}
/* Rotate the chevron while the filters sheet is open */
.filters-expand-btn[aria-expanded="true"] .filters-expand-chev {
  transform: rotate(180deg);
}

/* Advanced-filters popover — portaled to <body> (never fixed inside #controls) */
#filter-popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1290;
  background: rgba(5, 4, 3, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
#filter-popover-backdrop[hidden] { display: none; }
body.filter-sheet-open { overflow: hidden; }

.filter-popover {
  position: fixed;
  z-index: 1300;
  width: min(440px, calc(100vw - 24px));
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(18, 16, 15, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(220, 38, 38, 0.08);
}
.filter-popover[hidden] { display: none; }
/* Sheet header: grab handle + title + close — phone sheet only */
.fp-sheet-head {
  display: none;
  align-items: center;
  gap: 10px;
  padding-bottom: 2px;
}
.fp-sheet-grab {
  display: none;
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
}
.fp-sheet-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  flex: 1;
}
.fp-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fp-close-btn:hover { border-color: var(--accent2); color: var(--accent2); }
.fp-group-label {
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.fp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  align-items: end;
}
.fp-grid .fg-vrange { grid-column: span 2; }
/* Event names are long — always give the select the full row. */
.fp-grid .fg-event  { grid-column: span 2; }
/* Artist takes the full row unless the Owner field is visible beside it. */
.fp-grid .fg-artist { grid-column: span 2; }
.fp-grid.has-owner .fg-artist { grid-column: auto; }

/* Version range: number inputs + dual-thumb slider */
.vrange-reset {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .7rem;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  transition: color .15s, border-color .15s;
}
.vrange-reset:hover { color: var(--accent2); border-color: var(--accent); }
.vslider {
  position: relative;
  height: 26px;
  margin-top: 6px;
}
.vslider-track,
.vslider-fill {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  border-radius: 999px;
  pointer-events: none;
}
.vslider-track { left: 0; right: 0; background: var(--surface2); border: 1px solid var(--border); }
.vslider-fill { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
/* Both ranges share the same box; only the thumbs receive pointer events. */
.vslider input[type=range] {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 26px;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: none;
}
.vslider input[type=range]:focus { outline: none; }
.vslider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  cursor: grab;
}
.vslider input[type=range]::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.12); }
.vslider input[type=range]::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--accent);
  cursor: grab;
}
.vslider input[type=range]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent);
}
.vslider-scale {
  display: flex;
  justify-content: space-between;
  font-size: .62rem;
  color: var(--muted);
  margin-top: 2px;
}
.fp-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  font-size: .72rem;
  color: var(--muted);
}
.fp-apply { flex: 0 0 auto; height: 32px; padding: 0 18px; }

#fetch-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; border: none; border-radius: 9px; padding: 10px 24px;
  font-size: .9rem; font-weight: 700; cursor: pointer; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex; align-items: center; gap: 8px; font-family: inherit;
}
#fetch-btn:hover:not(:disabled) { transform: translateY(-2px) scale(1.02); box-shadow: 0 8px 25px rgba(220, 38, 38, 0.4); }
#fetch-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.spinner {
  display: none; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
#fetch-btn.loading .spinner { display: block; }
#fetch-btn.loading .btxt { display: inline; opacity: 0.8; }
@keyframes spin { to { transform: rotate(360deg); } }


/* Global Fetch Progress */
#global-fetch-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(0,0,0,0.3);
  z-index: 9999;
  display: none;
  overflow: hidden;
}
#global-fetch-progress.show {
  display: block;
}
#global-fetch-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  box-shadow: 0 0 10px var(--accent);
  transition: width 0.4s cubic-bezier(0.1, 0.5, 0.5, 1);
}

/* Shared fetch-status pill (bottom-left) */
.fetch-status-pill {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 9200;
  display: none;
  align-items: flex-start;
  gap: 10px;
  max-width: min(340px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(18, 12, 20, 0.92);
  border: 1px solid rgba(255, 80, 40, 0.45);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.35;
}
.fetch-status-pill.show { display: flex; }
.fetch-status-spinner {
  width: 14px; height: 14px; margin-top: 3px; flex-shrink: 0;
  border: 2px solid rgba(255, 80, 40, 0.25);
  border-top-color: var(--accent2, #ff5028);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.fetch-status-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.fetch-status-title { font-weight: 700; color: var(--accent2, #ff5028); font-size: 0.8rem; }
.fetch-status-msg { color: var(--text); opacity: 0.92; word-break: break-word; }
.fetch-status-next { color: var(--muted); font-size: 0.72rem; }
.fetch-status-dismiss {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin: -8px -6px -8px 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
.fetch-status-dismiss:hover,
.fetch-status-dismiss:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}
#cache-pill.cache-pill-pulse {
  animation: cachePillPulse 1s ease-out;
}
@keyframes cachePillPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 80, 40, 0.55); }
  100% { box-shadow: 0 0 0 12px rgba(255, 80, 40, 0); }
}

/* Browse updating notice + skeleton grid */
.browse-updating-notice {
  display: none;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 80, 40, 0.35);
  background: rgba(255, 80, 40, 0.08);
  color: var(--text);
  font-size: 0.82rem;
}
.browse-updating-notice.show { display: flex; }
.browse-updating-notice .spin-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent2);
  animation: statusPulse 1.4s infinite ease-in-out;
}
#grid.skeleton-loading {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.skeleton-card {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  background: var(--surface2, #1a1420);
  border: 1px solid var(--border);
  overflow: hidden;
}
.skeleton-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  animation: skeleton-sweep 1.4s infinite;
}
.ag-updating-banner {
  display: none;
  margin: 10px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 80, 40, 0.35);
  background: rgba(255, 80, 40, 0.08);
  color: var(--text);
  font-size: 0.82rem;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ag-updating-banner.show { display: flex; }
.ag-updating-banner button {
  background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 1.1rem;
}
@media (prefers-reduced-motion: reduce) {
  .fetch-status-spinner { animation: none; border-top-color: var(--accent2); }
  .skeleton-card::before { animation: none; }
  #cache-pill.cache-pill-pulse { animation: none; }
  .browse-updating-notice .spin-dot { animation: none; }
}

@keyframes statusPulse {
  0% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
  100% { opacity: 0.8; transform: scale(1); }
}
#global-auto-status.active {
  animation: statusPulse 2s infinite ease-in-out;
  color: var(--text) !important;
}

/* Status dot */
.status-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
.dot-on  { background: var(--success); box-shadow: 0 0 6px var(--success); animation: statusPulse 2s infinite ease-in-out; }
.dot-run { background: var(--accent2); box-shadow: 0 0 6px var(--accent2); animation: statusPulse 1s infinite ease-in-out; }
.dot-off { background: var(--muted); }

/* Fetch params card separator */
.fetch-params-grid { border-left: 2px solid var(--border); padding-left: 12px; }


/* Living tier chips: compact count + proportional underlay bar */
.tier-seg button { position: relative; }
.tc-count {
  margin-left: 5px;
  font-size: .62rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tier-seg button.active .tc-count { color: inherit; opacity: .75; }
.tc-bar {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  width: 0;
  opacity: .55;
  transition: width .6s ease;
  pointer-events: none;
}
.tier-seg button.active .tc-bar { opacity: 1; }
.tier-seg button[data-tier="C"]   .tc-bar { background: #a8a29e; }
.tier-seg button[data-tier="R"]   .tc-bar { background: #60a5fa; }
.tier-seg button[data-tier="SR"]  .tc-bar { background: #a855f7; }
.tier-seg button[data-tier="SSR"] .tc-bar { background: #f59e0b; }
.tier-seg button[data-tier="UR"]  .tc-bar { background: #ef4444; }

/* Stats + Analyze as one segmented insight control */
.insight-seg {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 34px;
  padding: 2px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  flex-shrink: 0;
}
.insight-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  font-family: inherit;
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.insight-btn svg { flex-shrink: 0; }
.insight-stats {
  color: #7dd3fc;
}
.insight-stats:hover {
  background: rgba(56, 189, 248, 0.12);
  color: #bae6fd;
}
.insight-stats[aria-expanded="true"] {
  background: rgba(56, 189, 248, 0.16);
  color: #e0f2fe;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.55);
}
.insight-analyze {
  color: #fbbf24;
}
.insight-analyze:hover {
  background: rgba(251, 191, 36, 0.14);
  color: #fde68a;
}
.archive-stats-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 14px;
  /* Above sticky header (1000) and phone bottom nav (1100); body-ported on open. */
  z-index: 9600;
  width: min(360px, calc(100vw - 24px));
  max-height: 72vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: rgba(18, 16, 15, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(220, 38, 38, 0.08);
  color: var(--text);
}
/* When portaled to <body>, absolute coords are meaningless — pin to the
   viewport like a floating panel (desktop) / bottom sheet (phone). */
body > .archive-stats-popover {
  position: fixed;
  top: auto;
  right: 14px;
  bottom: 24px;
  left: auto;
}
.archive-stats-popover[hidden] { display: none; }
.archive-stats-popover::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 36px;
  width: 12px;
  height: 12px;
  background: rgba(18, 16, 15, 0.97);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
.asp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.asp-sheet-grab { display: none; }
.asp-close-btn { width: 28px; height: 28px; font-size: 0.78rem; }
.asp-title {
  font-size: .6rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}
.asp-total { font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; }
/* Proportional tier spectrum */
.asp-spectrum {
  display: flex;
  gap: 2px;
  height: 22px;
  border-radius: 7px;
  overflow: hidden;
}
.asp-seg { min-width: 5px; border-radius: 3px; transition: flex-grow .6s ease, filter .15s; cursor: pointer; }
.asp-seg:hover { filter: brightness(1.35); }
/* Legend: exact counts, always visible (honest readout for tiny segments) */
.asp-legend { display: flex; flex-direction: column; gap: 4px; }
.asp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .74rem;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.asp-row:hover { background: rgba(255, 255, 255, 0.05); }
.asp-dot { width: 8px; height: 8px; border-radius: 3px; flex-shrink: 0; }
.asp-row .asp-name { font-weight: 700; width: 34px; }
.asp-row .asp-cnt { font-variant-numeric: tabular-nums; color: var(--text); }
.asp-row .asp-pct { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Locked / Listed gauges */
.asp-gauges { display: flex; flex-direction: column; gap: 8px; }
.asp-gauge-label {
  display: flex;
  justify-content: space-between;
  font-size: .7rem;
  color: var(--muted);
  margin-bottom: 3px;
}
.asp-gauge-val { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.asp-gauge-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.asp-gauge-fill { height: 100%; border-radius: 999px; width: 0; transition: width .6s ease; }
.asp-fill-locked { background: linear-gradient(90deg, #b45309, #f59e0b); }
.asp-fill-listed { background: linear-gradient(90deg, #15803d, #4ade80); }
.asp-fact {
  font-size: .7rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 9px;
  line-height: 1.5;
}

/* Browse page — filters + stats as one sticky chrome unit under the header */
#controls {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 10px 22px 0;
  padding: 10px 14px 6px;
  background: rgba(28, 25, 23, 0.78);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  /* page-ux.js may leave an inline transform briefly — clear it so sticky works.
     Lift above the grid so filter / stats popovers cover later siblings. */
  position: sticky;
  top: 66px;
  z-index: 500;
  isolation: isolate;
  overflow: visible;
  transition: border-color .28s ease, box-shadow .28s ease, background .28s ease;
}
/* Theme rim fades in once the filter bar is stuck under the header */
#controls::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    120deg,
    color-mix(in srgb, var(--accent) 88%, transparent),
    color-mix(in srgb, var(--accent2) 92%, transparent) 55%,
    color-mix(in srgb, var(--kpi) 55%, transparent)
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  pointer-events: none;
  transition: opacity .32s ease;
  z-index: 0;
}
#controls > * { position: relative; z-index: 1; }
#controls.is-stuck {
  border-color: transparent;
  background: rgba(22, 18, 16, 0.9);
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.5),
    0 0 24px color-mix(in srgb, var(--accent) 18%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--accent2) 18%, transparent);
}
#controls.is-stuck::before { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  #controls,
  #controls::before { transition: none; }
}
body:has(header.is-compact) #controls {
  top: 54px;
}
@media (max-width: 600px) {
  #controls {
    margin: 8px 12px 0;
    padding: 8px 10px 6px;
    border-radius: 12px;
    /* Keep filters + view controls reachable while scrolling the grid */
    top: 58px;
  }
  .filter-panel { padding: 0 0 4px; }
  /* Phone sticky chrome: [ Search | Filters(n) ] only.
     Time / tiers / more / sort / view move INTO the sheet on open (JS). */
  .cb-row {
    display: flex;
    gap: 8px;
  }
  .cb-row .cb-search {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    padding: 3px 3px 3px 8px;
  }
  .filters-expand-btn {
    display: inline-flex;
    height: 44px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  /* These live in the sheet on phone — hidden from the sticky bar */
  .cb-row #f-time,
  .cb-row .tier-seg,
  .cb-row .more-filters-btn {
    display: none !important;
  }
  .cb-seg { gap: 4px; padding: 0 5px; }
  .cb-seg-label { font-size: .55rem; }
  .cb-seg input { font-size: .88rem; }
  .cb-search .btn-icon { width: 38px; height: 38px; min-width: 38px; }
  #controls .chip-select { height: 40px; }

  /* Filters sheet (portaled to body): full scroll, sticky footer Apply/Clear */
  .filter-popover {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: calc(var(--site-bottom-nav-h, 0px) + 10px);
    width: auto;
    max-height: 82vh;
    border-radius: 18px 18px 12px 12px;
    padding: 12px 12px 8px;
  }
  .filter-popover::before { display: none; }
  .filter-popover .fp-group-moved {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
  }
  .filter-popover .fp-group-moved .tier-seg { overflow-x: auto; scrollbar-width: none; }
  .filter-popover .fp-group-moved .tier-seg::-webkit-scrollbar { display: none; }
  .filter-popover .fp-group-moved .chip-select { width: 100%; height: 42px; }
  .filter-popover .fp-group-moved .view-seg { display: flex; gap: 6px; }
  .filter-popover .fp-group-moved .view-seg button { flex: 1; height: 40px; }
  .filter-popover .fp-group-moved .view-seg .view-seg-txt { display: inline; }
  /* Sticky footer with Apply stays reachable */
  .filter-popover .fp-footer {
    position: sticky;
    bottom: -8px;
    margin: 0 -12px -8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(18, 16, 15, 0.98);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .fp-apply { flex: 0 0 auto; }
  .fp-footer .kbd-hint { display: none; }
  /* Phone sheet: sticky head w/ grab handle + close button */
  .fp-sheet-head {
    display: flex;
    position: sticky;
    top: -12px;
    margin: -12px -12px 4px;
    padding: 8px 44px 8px 12px;
    background: rgba(18, 16, 15, 0.98);
    border-bottom: 1px solid var(--border);
    z-index: 2;
  }
  .fp-sheet-grab { display: block; margin: 0 auto; }
  .fp-close-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; }
  .fp-grid { grid-template-columns: 1fr; }
  .fp-grid .fg-vrange,
  .fp-grid .fg-event,
  .fp-grid .fg-artist { grid-column: auto; }
  /* Range inputs are excluded — the dual slider positions its own thumbs.
     .visually-hidden selects are excluded — chips drive them. */
  .filter-popover .fg input:not([type=range]), .filter-popover .fg select:not(.visually-hidden) { width: 100%; font-size: 0.9rem; height: 42px; }
  .state-seg button { height: 42px; font-size: .8rem; }
  .vrange { gap: 6px; flex-wrap: wrap; }
  .vrange input { flex: 1; min-width: 0; }
  .vrange-reset { width: auto; height: 36px; }
  /* Bigger thumbs and taller hit area for touch */
  .vslider { height: 40px; }
  .vslider input[type=range] { height: 40px; }
  .vslider input[type=range]::-webkit-slider-thumb { width: 24px; height: 24px; }
  .vslider input[type=range]::-moz-range-thumb { width: 24px; height: 24px; }
  .filter-chips { margin-left: 12px; margin-right: 12px; }
  /* Cols select only drives page size on phone (CSS owns columns) — drop from chrome */
  #cols-select { display: none; }
}
.fg { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fg label {
  font-size: .68rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.btn-outline {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); font-family: inherit; font-size: .82rem;
  padding: 5px 11px; cursor: pointer; height: 32px; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; align-items: center; gap: 5px;
}
.btn-outline:hover { transform: translateY(-1px); border-color: var(--accent); color: #fff; box-shadow: 0 4px 10px rgba(220, 38, 38, 0.2); }
.btn-outline:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: 1px solid color-mix(in srgb, var(--accent2) 65%, transparent);
  border-radius: 7px;
  color: #fff;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 700;
  padding: 5px 16px;
  cursor: pointer;
  height: 34px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 4px 18px rgba(220, 38, 38, 0.28);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(220, 38, 38, 0.4);
  color: #fff;
}
.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

#refresh-btn.btn-primary {
  align-self: auto;
}
#refresh-btn:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: var(--accent2);
  color: #fff;
  box-shadow: 0 6px 22px rgba(220, 38, 38, 0.4);
}
#refresh-btn.dirty {
  background: var(--accent);
  border-color: var(--accent2);
  color: var(--kpi);
  animation: search-pulse 0.75s ease-in-out infinite, search-scale 0.75s ease-in-out infinite;
  transform-origin: center;
}
@keyframes search-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(220,38,38,0.85), 0 0 14px 2px rgba(220,38,38,0.5); }
  50%  { box-shadow: 0 0 0 7px rgba(220,38,38,0),    0 0 22px 6px rgba(251,146,60,0.4); }
  100% { box-shadow: 0 0 0 0   rgba(220,38,38,0.85), 0 0 14px 2px rgba(220,38,38,0.5); }
}
@keyframes search-scale {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
#filter-hint {
  font-size: .68rem;
  color: var(--muted);
  line-height: 1.3;
  max-width: none;
}
#clear-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}
#stats-count strong { color: var(--kpi); }
.browse-scope {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent2) 38%, transparent);
  background: rgba(251, 146, 60, 0.08);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}
.browse-scope em {
  font-style: normal;
  color: var(--accent2);
}

/* Stats row — second band inside the sticky browse chrome (not independently sticky) */
.stats-bar {
  margin: 0;
  padding: 8px 4px 2px;
  display: flex; gap: 14px;
  align-items: center; font-size: .78rem;
  color: var(--muted); flex-wrap: wrap;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  position: relative;
  top: auto;
  z-index: auto;
  overflow: visible;
}
#controls > .stats-bar {
  margin-top: 2px;
}
/* Stats-bar zones: info (count + pages) left, actions right */
.sb-zone { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sb-info { flex: 1 1 auto; flex-wrap: wrap; }
.sb-actions {
  margin-left: auto; flex-wrap: wrap; justify-content: flex-end;
  border-left: 1px solid var(--border);
  padding-left: 14px;
}
/* Compact pill buttons inside the island */
.stats-bar .btn-outline {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: .76rem;
}
.stats-bar .btn-outline svg { flex-shrink: 0; }
/* Pager — segmented pill: chevron buttons flank a tabular-nums indicator */
.pagination-controls {
  align-items: center; gap: 2px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
}
.pagination-controls .btn-outline {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
}
.pagination-controls .btn-outline:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.14);
  border-color: transparent;
  box-shadow: none;
  transform: none;
  color: var(--accent2);
}
.pagination-controls .pg-btn {
  min-width: 28px;
  padding: 0 7px;
  justify-content: center;
}
.pg-ico { display: block; flex-shrink: 0; }
.pg-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .74rem;
  color: var(--muted);
  padding: 0 9px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pg-input {
  box-sizing: border-box;
  width: 9ch;
  min-width: 9ch;
  max-width: 9ch;
  height: 18px;
  margin: 0;
  padding: 0 4px;
  border: 1px solid rgba(245, 235, 220, 0.28);
  border-radius: 4px;
  background: #0a0908;
  color: #fff;
  font: inherit;
  font-size: .74rem;
  font-weight: 600;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  outline: none;
  caret-color: var(--accent2);
  vertical-align: middle;
  -moz-appearance: textfield;
  appearance: textfield;
}
.pg-input::-webkit-outer-spin-button,
.pg-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.pg-input::selection {
  background: #fbbf24;
  color: #1c1917;
}
.pg-input::-moz-selection {
  background: #fbbf24;
  color: #1c1917;
}
.pg-input:hover {
  border-color: rgba(245, 235, 220, 0.45);
  background: #120f0e;
}
.pg-input:focus {
  border-color: var(--accent2);
  background: #161311;
  color: #fff;
  box-shadow: 0 0 0 1px rgba(251, 146, 60, 0.35);
}
.stats-bar strong { color: var(--text); }
.stats-bar select { height: 30px; font-size: .78rem; }
@media (max-width: 600px) {
  #controls > .stats-bar {
    padding: 6px 0 0;
    gap: 6px;
  }
  /* One row: count (shrinks) | pager | Stats/Analyze icons */
  #controls > .stats-bar {
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
  }
  .insight-seg { height: 34px; }
  .archive-stats-popover,
  body > .archive-stats-popover {
    position: fixed;
    left: 8px;
    right: 8px;
    top: auto;
    bottom: calc(var(--site-bottom-nav-h, 0px) + 8px); /* clear the phone Quick Navigation dock */
    width: auto;
    max-height: 62vh;
    overflow-y: auto;
  }
  .archive-stats-popover::before { display: none; }
  /* Phone stats sheet: sticky head w/ grab + close */
  .archive-stats-popover .asp-head {
    position: sticky;
    top: 0;
    margin: -14px -14px 4px;
    padding: 8px 40px 8px 14px;
    background: rgba(18, 16, 15, 0.98);
    border-bottom: 1px solid var(--border);
    z-index: 2;
    align-items: center;
  }
  .asp-sheet-grab { display: block; width: 36px; height: 4px; border-radius: 999px; background: var(--border); margin: 0 auto 6px; }
  .archive-stats-popover .asp-head { flex-wrap: wrap; }
  .asp-close-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; }
  .archive-stats-popover { padding-top: 8px; }
  .tc-count { font-size: .58rem; }
  /* Count yields with an ellipsis rather than wrapping the row */
  .stats-bar { font-size: .72rem; }
  .sb-info { flex: 1 1 auto; min-width: 0; gap: 6px; }
  #stats-count {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .browse-scope {
    height: 22px;
    padding: 0 7px;
    font-size: 0.6rem;
  }
  .pagination-controls { flex-shrink: 0; }
  .pg-pill { padding: 0 4px; font-size: .68rem; }
  .asb-txt { display: none; }
  .insight-btn { padding: 0 9px; height: 30px; }
  /* View/sort/cols live in the sheet on phone */
  .sb-actions .view-seg,
  .sb-actions #cols-select,
  .sb-actions #sort-select {
    display: none !important;
  }
  .sb-actions {
    margin-left: 0;
    border-left: none;
    padding-left: 0;
    flex-wrap: nowrap;
    gap: 6px;
  }
  /* Touch targets */
  .stats-bar .btn-outline { height: 30px; }
  .pagination-controls { padding: 2px; }
  .pagination-controls .btn-outline { height: 28px; }
  .view-seg button { height: 30px; padding: 0 12px; }
  .stats-bar select { height: 34px; }
}

#back-to-top {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: 2px solid var(--accent2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}
#back-to-top.show {
  opacity: 1;
  visibility: visible;
}
#back-to-top:hover {
  transform: translateY(-5px);
  background: var(--accent2);
  color: var(--bg);
}
@media (max-width: 800px) {
  #back-to-top {
    bottom: calc(var(--site-bottom-nav-h, 70px) + 12px);
    right: 16px;
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}
#grid {
  --grid-cols: 4;
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
  gap: clamp(10px, 1.2vw, 16px);
  padding: 18px 22px;
}
#grid[data-cols="6"] .cname,
#grid[data-cols="8"] .cname,
#grid[data-cols="10"] .cname { font-size: .88rem; }
#grid[data-cols="6"] .cseries,
#grid[data-cols="8"] .cseries,
#grid[data-cols="10"] .cseries { font-size: .72rem; }
#grid[data-cols="6"] .cbody,
#grid[data-cols="8"] .cbody,
#grid[data-cols="10"] .cbody { padding: 10px; }
#grid[data-cols="6"] .mr,
#grid[data-cols="8"] .mr,
#grid[data-cols="10"] .mr { font-size: .66rem; }
#grid[data-cols="8"] .cname,
#grid[data-cols="10"] .cname { font-size: .82rem; }
#grid[data-cols="10"] .cbody { padding: 8px; }

/* Sanctum ledger — catalog list rows */
#grid.list-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 18px 22px;
}
#grid.list-view .card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 10px 14px 10px 12px;
  border-radius: 12px;
  overflow: hidden;
  border-left-width: 3px;
  content-visibility: auto;
  contain-intrinsic-size: 1px 76px;
}
#grid.list-view .card:hover {
  transform: translateY(-2px);
  border-color: var(--card-hover);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(214, 196, 168, 0.2);
}
#grid.list-view .card:hover .card-img-wrap img { transform: none; }
#grid.list-view .card-UR {
  border-left-color: #ef4444;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.12), transparent 36%), var(--surface);
}
#grid.list-view .card-SSR {
  border-left-color: #f59e0b;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.12), transparent 36%), var(--surface);
}
#grid.list-view .card-SR {
  border-left-color: #a855f7;
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.12), transparent 36%), var(--surface);
}
#grid.list-view .card-R {
  border-left-color: #3b82f6;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.1), transparent 36%), var(--surface);
}
#grid.list-view .card-C {
  border-left-color: #10b981;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.1), transparent 36%), var(--surface);
}
#grid.list-view .card-img-wrap {
  width: 54px;
  height: 72px;
  aspect-ratio: auto;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(245, 235, 220, 0.12), 0 4px 12px rgba(0, 0, 0, 0.35);
}
#grid.list-view .cbadges,
#grid.list-view .tb,
#grid.list-view .ext-links,
#grid.list-view .cmeta,
#grid.list-view .mrow,
#grid.list-view hr.div { display: none !important; }
#grid.list-view .copy-id-btn {
  top: 8px;
  right: 8px;
  opacity: 0;
}
#grid.list-view .card:hover .copy-id-btn { opacity: 1; }
#grid.list-view .cbody {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "name owner"
    "flags owner"
    "meta owner";
  align-items: center;
  column-gap: 16px;
  row-gap: 3px;
  padding: 0;
  min-width: 0;
  flex: 1;
}
#grid.list-view .cname-stack {
  grid-area: name;
  min-width: 0;
  flex-shrink: 1;
}
#grid.list-view .cname {
  width: auto;
  font-size: 0.9rem;
  margin: 0;
  letter-spacing: 0.15px;
}
#grid.list-view .cseries {
  width: auto;
  font-size: 0.72rem;
  margin: 0;
  opacity: 0.85;
}
#grid.list-view .lflags { grid-area: flags; }
#grid.list-view .lmeta { grid-area: meta; }
#grid.list-view .orow {
  grid-area: owner;
  margin: 0;
  min-width: 110px;
  justify-self: end;
  align-self: center;
}
#grid.list-view .cbody:not(:has(.orow)) {
  grid-template-columns: 1fr;
  grid-template-areas:
    "name"
    "flags"
    "meta";
}

/* List-only meta + chips (hidden in grid) */
.lflags,
.lmeta { display: none; }
#grid.list-view .lflags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 0;
}
#grid.list-view .lmeta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 1px;
}
#grid.list-view .lmeta strong { color: var(--text); font-weight: 600; }
#grid.list-view .lmeta-dot { opacity: 0.45; }
.lf {
  font-size: .64rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1.2;
  border: 1px solid transparent;
  white-space: nowrap;
}
.lf-tier-C { background: linear-gradient(135deg, #10b981, #6ee7b7); color: #000; }
.lf-tier-R { background: linear-gradient(135deg, #3b82f6, #93c5fd); color: #fff; }
.lf-tier-SR { background: linear-gradient(135deg, #a855f7, #d8b4fe); color: #fff; }
.lf-tier-SSR { background: linear-gradient(135deg, #f59e0b, #fde047); color: #000; }
.lf-tier-UR { background: linear-gradient(135deg, #ef4444, #fca5a5); color: #fff; }
.lf-ver { background: rgba(0, 0, 0, .5); color: #fbbf24; border-color: var(--accent); }
.lf-new {
  background: linear-gradient(135deg, rgba(99, 102, 241, .9), rgba(168, 85, 247, .9));
  color: #fff;
  border-color: #a855f7;
}
.lf-burnt {
  background: linear-gradient(135deg, rgba(127, 29, 29, .95), rgba(185, 28, 28, .9));
  color: #fecaca;
  border-color: #f87171;
  cursor: help;
}
.lf-locked { background: rgba(0, 0, 0, .55); color: #fbbf24; border-color: #fbbf24; }
.lf-listed { background: rgba(0, 0, 0, .55); color: #10b981; border-color: #10b981; }

.cname-stack { display: flex; flex-direction: column; min-width: 150px; flex-shrink: 0; }

/* Segmented view control */
.view-seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px;
}
.view-seg button {
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  font-family: inherit;
  font-size: .8rem;
  font-weight: 600;
  padding: 4px 10px;
  height: 26px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.view-seg button svg { flex-shrink: 0; display: block; }
.view-seg button:not(.active):hover { color: #fff; background: rgba(220, 38, 38, 0.08); }
.view-seg button.active {
  background: rgba(220, 38, 38, 0.15);
  color: var(--accent2);
  box-shadow: inset 0 0 0 1px var(--accent);
}
#cols-select[hidden],

@media (max-width: 720px) {
  #grid.list-view .card { gap: 10px; padding: 10px 12px; }
  #grid.list-view .cbody {
    grid-template-columns: 1fr;
    grid-template-areas:
      "name"
      "flags"
      "meta"
      "owner";
  }
  #grid.list-view .orow {
    justify-self: start;
    min-width: 0;
    margin-top: 2px;
  }
}

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  overflow: hidden; display: flex; flex-direction: column; transition: transform .3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow .3s ease, border-color .3s ease;
  position: relative; box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  will-change: transform, box-shadow;
  content-visibility: auto; contain-intrinsic-size: 1px 350px;
}
/* Card entrance is choreographed by anime.js v4 (stagger from center) — respects reduced-motion */

.card:hover {
  transform: translateY(-5px);
  border-color: var(--card-hover);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(214, 196, 168, 0.18);
}

/* Rarity Themes */
.card-UR {
  border: 1px solid #ef4444;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.2);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.02) 100%);
}
.card-UR:hover {
  box-shadow: 0 10px 40px rgba(239, 68, 68, 0.45);
  border-color: #fca5a5;
}
.card-UR .tb { background: linear-gradient(135deg, #ef4444, #fca5a5); box-shadow: 0 0 12px rgba(239, 68, 68, 0.6); }

.card-SSR {
  border: 1px solid #f59e0b;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.2);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.02) 100%);
}
.card-SSR:hover {
  box-shadow: 0 10px 40px rgba(245, 158, 11, 0.45);
  border-color: #fde047;
}
.card-SSR .tb { background: linear-gradient(135deg, #f59e0b, #fde047); color: #000; box-shadow: 0 0 12px rgba(245, 158, 11, 0.6); }

.card-SR {
  border: 1px solid #a855f7;
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.2);
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.1) 0%, rgba(168, 85, 247, 0.02) 100%);
}
.card-SR:hover {
  box-shadow: 0 10px 40px rgba(168, 85, 247, 0.45);
  border-color: #d8b4fe;
}
.card-SR .tb { background: linear-gradient(135deg, #a855f7, #d8b4fe); box-shadow: 0 0 12px rgba(168, 85, 247, 0.6); }

.card-R {
  border: 1px solid #3b82f6;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.02) 100%);
}
.card-R:hover {
  border-color: #93c5fd;
  box-shadow: 0 10px 35px rgba(59, 130, 246, 0.35);
}
.card-R .tb { background: linear-gradient(135deg, #3b82f6, #93c5fd); color: #fff; }

.card-C {
  border: 1px solid #10b981;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.15);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.02) 100%);
}
.card-C:hover {
  border-color: #6ee7b7;
  box-shadow: 0 10px 35px rgba(16, 185, 129, 0.35);
}
.card-C .tb { background: linear-gradient(135deg, #10b981, #6ee7b7); color: #000; }

.card-img-wrap { position: relative; background: var(--surface2); aspect-ratio: 3/4; overflow: hidden; cursor: pointer; }
/* Skeleton shimmer while the art loads — stops as soon as the image is ready */
.card-img-wrap::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,0.07) 50%, transparent 80%);
  background-size: 220% 100%;
  animation: skeleton-sweep 1.5s linear infinite;
}
.card-img-wrap:has(img.loaded)::before { display: none; }
@keyframes skeleton-sweep { from { background-position: 160% 0; } to { background-position: -60% 0; } }
.card-img-wrap img { position: relative; width: 100%; height: 100%; object-fit: cover; transition: transform .3s, opacity 0.5s ease; opacity: 0; }
.card-img-wrap img.loaded { opacity: 1; }
.card:hover .card-img-wrap img { transform: scale(1.04); }
.img-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; color: var(--border); }

.copy-id-btn {
  position: absolute; top: 7px; right: 7px; background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.2); color: #fff; border-radius: 6px;
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 12px; opacity: 0; transition: opacity 0.2s; z-index: 2;
}
.card:hover .copy-id-btn { opacity: 1; }
.copy-id-btn:hover { background: var(--accent); }

.cbadges { position: absolute; top: 7px; left: 7px; display: flex; flex-direction: column; gap: 3px; z-index: 1; }
.badge { border-radius: 5px; font-size: .65rem; font-weight: 700; padding: 3px 6px; line-height: 1; text-transform: uppercase; }
.bv { background: rgba(0,0,0,.75); color: #fbbf24; border: 1px solid var(--accent); }
.bl { background: rgba(0,0,0,0.85); color: #fbbf24; border: 1px solid #fbbf24; }
.bls { background: rgba(0,0,0,0.85); color: #10b981; border: 1px solid #10b981; }
.bnew { background: linear-gradient(135deg, rgba(99,102,241,0.9), rgba(168,85,247,0.9)); color: #fff; border: 1px solid #a855f7; animation: bnew-pulse 2s ease-in-out infinite; }
@keyframes bnew-pulse { 0%, 100% { box-shadow: 0 0 4px rgba(168,85,247,0.6); } 50% { box-shadow: 0 0 10px rgba(168,85,247,1); } }
.bburnt {
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.95), rgba(185, 28, 28, 0.9));
  color: #fecaca;
  border: 1px solid #f87171;
  cursor: help;
}
.card-burnt .card-img-wrap img { filter: grayscale(0.35) brightness(0.82); }
.card-burnt .card-img-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.12), rgba(0, 0, 0, 0.28));
  pointer-events: none;
}
.ext-links { position: absolute; bottom: 7px; right: 7px; display: flex; gap: 5px; opacity: 0; transition: opacity 0.2s; z-index: 2; }
.card:hover .ext-links { opacity: 1; }
.ext-btn {
  background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; border-radius: 6px; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; font-size: 12px; transition: all 0.2s;
}
.ext-btn:hover { background: var(--accent); border-color: var(--accent2); transform: scale(1.1); }
.tb { position: absolute; top: 7px; right: 7px; border-radius: 6px; padding: 3px 6px; font-size: .68rem; font-weight: 800; pointer-events: none; }
.tier-C { background: rgba(34,197,94,.9); color: #000; }
.tier-R { background: rgba(96,165,250,.9); color: #fff; }
.tier-SR { background: rgba(192,132,252,.9); color: #fff; }
.tier-SSR { background: rgba(245,158,11,.9); color: #fff; }
.tier-UR { background: rgba(239,68,68,.9); color: #fff; }

.cbody { padding: 12px; }
.cname {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem; font-weight: 700; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; margin-bottom: 2px; cursor: pointer; letter-spacing: 0.2px;
}
.cname:hover { color: var(--text); text-decoration: underline; }
.cseries { font-family: 'Outfit', sans-serif; font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 8px; }
.cmeta { display: flex; flex-direction: column; gap: 3px; }
.mr { display: flex; gap: 4px; align-items: center; font-size: .71rem; color: var(--muted); }
.mr.summon-highlight { color: var(--text) !important; font-weight: 600; }
.mr.summon-highlight strong { color: #fff !important; }
.mr .ic { font-size: .8rem; width: 13px; text-align: center; }
.mr strong { color: var(--text); font-weight: 500; }
hr.div { border: none; border-top: 1px solid var(--border); margin: 7px 0; }
.orow { display: flex; align-items: center; gap: 6px; font-size: .74rem; cursor: pointer; }
.oav { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.oaf {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: .57rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.oname { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; transition: color 0.2s ease; }
.orow:hover .oname { text-decoration: none; color: var(--accent2); }
.oprem { font-size: .65rem; color: var(--warning); margin-left: auto; pointer-events: none; }
.mrow { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.mc { background: var(--surface2); border: 1px solid var(--border); border-radius: 4px; padding: 2px 5px; font-size: .65rem; color: var(--success); }
#empty { grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--muted); }
#empty .ei { font-size: 2.5rem; margin-bottom: 8px; }

/* Toast */
#toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--success); color: #000;
  padding: 10px 20px; border-radius: 8px; font-weight: 600; font-size: .9rem;
  transform: translateY(100px); opacity: 0; transition: all 0.3s; z-index: 999;
}
#toast.show { transform: translateY(0); opacity: 1; }
@media(max-width: 600px) {
  #toast { left: 12px; right: 12px; bottom: 12px; text-align: center; }
}

@media(max-width: 600px) {
  header, #grid, #page-settings > div { padding-left: 12px; padding-right: 12px; }
  #grid { grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 8px; padding: 8px 12px; }
  
  /* Art-first cards on phone: image + badges only; details in lightbox */
  #grid:not(.list-view) .card { padding: 0; }
  #grid:not(.list-view) .cbody { display: none; }
  #grid:not(.list-view) .ext-links { display: none; }
  .card-img-wrap { aspect-ratio: 3/4; }
  .badge { font-size: 0.55rem; padding: 2px 4px; }
  .tb { font-size: 0.58rem; padding: 2px 4px; }
  .cbody { padding: 6px 8px 8px; }
  .cname { font-size: 0.78rem; line-height: 1.2; }
  .cseries { font-size: 0.62rem; margin-bottom: 0; }
  #grid:not(.list-view) hr.div { margin: 6px 0 4px; }
  .cmeta { gap: 2px; }
  .mr { font-size: 0.62rem; }
  .mr .ic { font-size: 0.7rem; width: 10px; }
  .orow { font-size: 0.65rem; margin-top: 4px; }
  .oav, .oaf { width: 18px; height: 18px; font-size: 0.5rem; }
  .badge { font-size: 0.55rem; padding: 2px 4px; }
  .tb { font-size: 0.58rem; padding: 2px 4px; }

  /* Stats Pages responsiveness in style.css */
  .owners-grid, .makers-grid, .events-grid { grid-template-columns: 1fr !important; padding: 10px !important; }
  .owner-card, .maker-card, .event-card { min-width: 0 !important; width: 100% !important; }

  /* Settings Page */
  #page-settings > div { padding: 15px 12px; }
  .scard { padding: 15px; }
  .srow { flex-direction: column; align-items: flex-start; gap: 8px; }
  input[type=range] { width: 100%; }
  .sctl { width: 100%; justify-content: space-between; }
  #fetch-btn { width: 100%; justify-content: center; }
  #admin-pwd { width: 100% !important; }
  #unlock-btn { width: 100% !important; }
}

/* Utility for Stats Pages */
.rarity-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.05); }
.rarity-table { min-width: 320px; }

/* Footer */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 30px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: auto;
  border-bottom: 5px solid var(--accent);
}
footer .btman { color: var(--accent); font-weight: 800; letter-spacing: 1px; }

/* ── Analytics Dashboard — Mobile ─────────────────────────────────────────*/
@media (max-width: 600px) {
  /* Collapse two-column grids to single column */
  #analytics-card [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
  /* Shrink hour cells to fit 24 across narrow screens */
  .an-hour-cell { width: 22px; height: 22px; font-size: .55rem; border-radius: 4px; }
  /* Tighten bar label width so track still has room */
  .an-bar-label { width: 72px; font-size: .72rem; }
  .an-bar-cnt   { width: 28px; font-size: .7rem; }
  /* KPI grid: 2 per row instead of 4 */
  #analytics-card [style*="minmax(130px"] { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ── Analytics Dashboard ───────────────────────────────────────────────────*/
.stat-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: center;
}
.stat-box-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffd700;
  line-height: 1.2;
}
.stat-box-label {
  font-size: .7rem;
  color: var(--muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Horizontal bar used for filter/tier/event breakdowns */
.an-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
}
.an-bar-label {
  width: 110px;
  flex-shrink: 0;
  color: var(--muted);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.an-bar-track {
  flex: 1;
  height: 7px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.an-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width .4s ease;
}
.an-bar-cnt {
  width: 36px;
  text-align: right;
  color: var(--text);
  font-weight: 600;
  font-size: .75rem;
}

/* Daily sparkbar chart */
.an-day-bar {
  flex: 1;
  min-width: 3px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  opacity: 0.75;
  transition: opacity .2s;
  cursor: default;
}
.an-day-bar:hover { opacity: 1; }

/* Hourly heatmap cells */
.an-hour-cell {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .6rem;
  font-weight: 600;
  color: var(--text);
  cursor: default;
  border: 1px solid var(--border);
  transition: transform .15s;
}
.an-hour-cell:hover { transform: scale(1.15); }

/* Ranked list items (top names/owners) */
.an-rank-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.an-rank-item:last-child { border-bottom: none; }
.an-rank-item span:first-child { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70%; }
.an-rank-badge {
  background: var(--surface2);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: .7rem;
  font-weight: 700;
  color: var(--accent2);
  flex-shrink: 0;
}

/* ── Admin Dashboard (Settings analytics) ────────────────────────────────── */
.admin-dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.admin-dash-sub {
  font-size: .72rem;
  color: var(--muted);
  margin-top: 4px;
}
.admin-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 14px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
}
.admin-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, background .15s, border-color .15s;
}
.admin-tab:hover { color: var(--text); background: var(--surface2); }
.admin-tab.active {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--border);
  border-bottom-color: var(--surface2);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.admin-panel { margin-top: 4px; }
.admin-range {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.admin-range-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.admin-range-btn.active {
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-color: transparent;
}
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.admin-kpi .ad-delta {
  display: block;
  font-size: .68rem;
  margin-top: 4px;
  font-weight: 600;
}
.ad-delta.up { color: var(--success); }
.ad-delta.down { color: var(--danger); }
.ad-delta.muted { color: var(--muted); }
.admin-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.admin-chip {
  font-size: .72rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
}
.admin-chip.ok { border-color: rgba(16,185,129,.4); color: var(--success); }
.admin-chip.danger, .admin-chip.fetch-running {
  border-color: rgba(220,38,38,.5);
  color: #fca5a5;
}
.admin-chip.accent { border-color: rgba(251,146,60,.45); color: var(--accent2); }
.admin-section-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 14px 0 8px;
}
.admin-help {
  font-size: .72rem;
  color: var(--muted);
  margin: -4px 0 10px;
}
.admin-trend {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  min-height: 120px;
}
.admin-trend-svg { width: 100%; height: 120px; display: block; }
.admin-trend-legend {
  display: flex;
  gap: 12px;
  font-size: .68rem;
  color: var(--muted);
  margin-top: 6px;
  flex-wrap: wrap;
}
.admin-trend-legend .lg-v::before,
.admin-trend-legend .lg-s::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 3px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}
.admin-trend-legend .lg-v::before { background: var(--accent); }
.admin-trend-legend .lg-s::before { background: var(--accent2); }
.admin-hourly {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}
.admin-feed {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-feed-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .78rem;
}
.admin-feed-main {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.admin-feed-meta {
  color: var(--muted);
  font-size: .7rem;
  flex-shrink: 0;
}
.admin-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
}
.admin-pill {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
}
.admin-pill.ok { color: var(--success); border-color: rgba(16,185,129,.35); }
.admin-pill.warn { color: var(--warning); border-color: rgba(245,158,11,.35); }
.admin-pill.danger { color: var(--danger); border-color: rgba(239,68,68,.4); }
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
}
.admin-table th, .admin-table td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
}
.admin-table th { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; }
.admin-demand-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.admin-empty { font-size: .75rem; color: var(--muted); }
.admin-updated {
  margin-top: 14px;
  font-size: .68rem;
  color: var(--muted);
  text-align: right;
}
.admin-banner {
  font-size: .75rem;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}
.admin-banner.danger {
  background: rgba(239,68,68,.08);
  border-color: rgba(239,68,68,.35);
  color: #fca5a5;
}
.admin-error summary {
  cursor: pointer;
  color: var(--danger);
  font-size: .7rem;
}
.admin-error pre {
  white-space: pre-wrap;
  font-size: .68rem;
  color: var(--muted);
  margin-top: 4px;
}
.ops-card {
  transition: border-color .2s, box-shadow .2s;
}
.ops-card:hover {
  border-color: rgba(251,146,60,.28);
  box-shadow: 0 0 0 1px rgba(251,146,60,.08);
}

@media (max-width: 640px) {
  .admin-demand-grid { grid-template-columns: 1fr; }
  .admin-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  #analytics-card .admin-tabs { -webkit-overflow-scrolling: touch; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANALYTICS PAGE — /analytics.html
   All rules prefixed with .ag- (analytics graph) to avoid any collision
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Page layout ─────────────────────────────────────────────────────────── */
.ag-body { --ag-serif: 'Playfair Display', Georgia, 'Times New Roman', serif; }
#ag-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 18px 22px 40px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}
.ag-console { display: flex; flex-direction: column; gap: 0; }
.ag-header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 0;
}
.ag-page-spacer { height: 60px; }

/* ── Loading overlay ─────────────────────────────────────────────────────── */
#ag-loading {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(12, 10, 9, 0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  transition: opacity 0.4s ease;
}
#ag-loading.hidden { opacity: 0; pointer-events: none; }
.ag-loader-mark {
  width: 56px;
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ag-loader-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.95;
  filter: drop-shadow(0 0 12px rgba(251,146,60,0.35));
}
.ag-loader-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .22em;
  text-transform: uppercase;
}
.ag-loader-bar-track {
  width: 220px;
  height: 3px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.ag-loader-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  transition: width 0.3s ease;
}

/* ── Error state ─────────────────────────────────────────────────────────── */
#ag-error {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 60px 20px;
  text-align: center;
}
#ag-error .ag-err-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--accent2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ag-serif);
  font-size: 1.4rem;
  font-weight: 700;
}
#ag-error h3 {
  font-family: var(--ag-serif);
  color: var(--text);
  font-weight: 600;
}
#ag-error p { color: var(--muted); font-size: .88rem; }

/* ── Filter summary banner ───────────────────────────────────────────────── */
#ag-filter-banner {
  background: rgba(12, 10, 9, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px 14px;
  margin-bottom: 18px;
}
.ag-filter-eyebrow {
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.ag-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#ag-filter-banner .ag-banner-title {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--muted);
  flex-shrink: 0;
}
#ag-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.ag-chip {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: .74rem;
  font-weight: 600;
  color: var(--accent2);
  white-space: nowrap;
}
.ag-total-chip {
  margin-left: auto;
  background: rgba(220, 38, 38, 0.15);
  border-color: var(--accent);
  color: var(--text);
  font-size: .78rem;
}
.ag-total-chip strong {
  color: var(--kpi);
  font-family: 'Outfit', sans-serif;
  font-variant-numeric: tabular-nums;
}
.ag-back-btn {
  font-size: 0.72rem !important;
  padding: 3px 10px !important;
  height: auto !important;
  flex-shrink: 0;
}

/* ── Insight strip ───────────────────────────────────────────────────────── */
.ag-insights {
  margin-bottom: 16px;
}
.ag-insights[hidden] { display: none !important; }
.ag-insights-eyebrow {
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.ag-insights-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.ag-insights-list:has(.ag-insight:nth-child(3):last-child) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.ag-insights-list:has(.ag-insight:nth-child(2):last-child) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 900px) {
  .ag-insights-list,
  .ag-insights-list:has(.ag-insight:nth-child(3):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 520px) {
  .ag-insights-list,
  .ag-insights-list:has(.ag-insight:nth-child(3):last-child),
  .ag-insights-list:has(.ag-insight:nth-child(2):last-child) {
    grid-template-columns: 1fr;
  }
}
.ag-insight {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  border-left: 2px solid color-mix(in srgb, var(--accent2) 65%, transparent);
}
.ag-insight-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.ag-insight-val {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--kpi);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.ag-insight-hint {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}

/* ── KPI row ─────────────────────────────────────────────────────────────── */
#ag-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
@media (max-width: 700px) { #ag-kpi-row { grid-template-columns: repeat(2, 1fr); } }
.ag-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ag-kpi-val {
  font-family: 'Outfit', sans-serif;
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--kpi);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ag-kpi-label {
  font-size: .6rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .22em;
}

/* ── Chart rooms ─────────────────────────────────────────────────────────── */
.ag-room {
  margin-bottom: 28px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.ag-room:first-of-type { border-top: 0; padding-top: 0; }
.ag-room-head { margin: 0 0 14px; }
.ag-room-eyebrow {
  font-size: 0.6rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}
.ag-room-title {
  font-family: var(--ag-serif);
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--text);
  margin: 6px 0 4px;
}
.ag-room-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

/* ── Progressive phase loading ───────────────────────────────────────────── */
.ag-phase-status {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent2, #fb923c);
}
[data-ag-phase].is-loading .ag-phase-status,
.ag-room.is-loading .ag-phase-status { opacity: 1; }
[data-ag-phase].is-error .ag-phase-status { color: #f87171; }
.ag-phase-host {
  position: relative;
  min-height: 140px;
}
.ag-phase-skel {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  padding: 8px 4px 0;
}
.ag-phase-host .ag-phase-skel {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.ag-phase-skel span {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(
    180deg,
    rgba(251, 146, 60, 0.22),
    rgba(251, 146, 60, 0.06)
  );
  animation: ag-skel-pulse 1.2s ease-in-out infinite;
}
.ag-phase-skel span:nth-child(1) { height: 42%; animation-delay: 0s; }
.ag-phase-skel span:nth-child(2) { height: 78%; animation-delay: 0.15s; }
.ag-phase-skel span:nth-child(3) { height: 55%; animation-delay: 0.3s; }
@keyframes ag-skel-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.95; }
}
.ag-phase-err {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  padding: 12px;
  font-size: 0.78rem;
  color: #f87171;
  text-align: center;
}
.ag-phase-host .ag-phase-err {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(28, 25, 23, 0.72);
}

/* ── Graph section card ──────────────────────────────────────────────────── */
.ag-section {
  background: rgba(28, 25, 23, 0.72);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 18px 20px;
  margin-bottom: 0;
  min-width: 0;
}
.ag-section-title {
  font-family: 'Outfit', sans-serif;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .02em;
  margin-bottom: 4px;
  text-transform: none;
}
.ag-section-sub {
  font-size: .72rem;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.4;
}

/* Two-column grid for paired sections */
.ag-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
@media (max-width: 700px) { .ag-grid-2 { grid-template-columns: 1fr; } }

/* ── Bento layout (analytics) ────────────────────────────────────────────── */
.ag-bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ag-bento > .ag-section { margin-bottom: 0; min-width: 0; }
.ag-bento .ag-span-2 { grid-column: span 2; }
.ag-bento .ag-span-3 { grid-column: span 3; }
@media (max-width: 1100px) {
  .ag-bento { grid-template-columns: repeat(2, 1fr); }
  .ag-bento .ag-span-3 { grid-column: span 2; }
}
@media (max-width: 760px) {
  .ag-bento { grid-template-columns: 1fr; }
  .ag-bento .ag-span-2, .ag-bento .ag-span-3 { grid-column: span 1; }
  .ag-header-meta #ag-utc-clock { display: none; }
}

/* ── Bar chart (vertical) ────────────────────────────────────────────────── */
.ag-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 120px;
  width: 100%;
  overflow: hidden;
}
.ag-bar-chart.tall { height: 160px; }
.ag-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 3px;
  min-width: 0;
  position: relative;
}
.ag-bar-ghost {
  position: absolute;
  bottom: 16px;
  left: 15%;
  right: 15%;
  border-radius: 3px 3px 0 0;
  background: rgba(168, 162, 158, 0.22);
  pointer-events: none;
  z-index: 0;
}
.ag-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--accent2) 0%, var(--accent) 100%);
  transform-origin: bottom;
  transform: scaleY(0);
  transition: none;
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.ag-bar.v10-bar {
  background: linear-gradient(180deg, var(--accent2) 0%, #c2410c 100%);
}
.ag-bar-tick {
  font-size: .52rem;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  padding: 0 1px;
}
.ag-bar-tooltip {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: .7rem;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 10;
}
.ag-bar-col:hover .ag-bar-tooltip { opacity: 1; }

/* ── Area / line chart (months) ──────────────────────────────────────────── */
.ag-line-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.ag-line-svg {
  display: block;
  min-width: 300px;
  width: 100%;
  height: 140px;
}
.ag-line-path {
  fill: none;
  stroke: var(--accent2);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 9999;
  stroke-dashoffset: 9999;
}
.ag-line-path.v10 { stroke: var(--accent2); }
.ag-area-path {
  fill: url(#ag-area-grad);
  opacity: 0;
  transition: opacity .4s;
}
.ag-area-path.v10 { fill: url(#ag-area-grad-v10); }
.ag-line-dot {
  fill: var(--accent2);
  r: 3;
  opacity: 0;
}
.ag-line-dot.v10 { fill: var(--accent2); }
.ag-line-label {
  font-size: 9px;
  fill: var(--muted);
  text-anchor: middle;
}
.ag-line-legend {
  display: flex;
  gap: 14px;
  margin-top: 8px;
  font-size: .7rem;
}
.ag-line-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}
.ag-line-legend span i {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

/* ── Tier×Hour heatmap ───────────────────────────────────────────────────── */
.ag-heatmap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.ag-hm-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ag-hm-label {
  width: 46px;
  flex-shrink: 0;
  font-size: .72rem;
  font-weight: 800;
  text-align: center;
  padding: 2px 4px;
  border-radius: 5px;
  background: rgba(255,255,255,0.06);
  letter-spacing: .04em;
  color: var(--muted);
  white-space: nowrap;
  overflow: visible;
}
.ag-hm-cell {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  opacity: 0;
  position: relative;
}
.ag-hm-cell:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent2) 55%, transparent);
  z-index: 5;
}
.ag-hm-hour-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.ag-hm-hour-label {
  width: 24px;
  font-size: .52rem;
  text-align: center;
  color: var(--muted);
  flex-shrink: 0;
}
.ag-hm-spacer { width: 46px; flex-shrink: 0; }

/* tier colour accents for heatmap rows - bold pill badges */
.ag-hm-label.tier-C   { color: #86efac; background: rgba(134,239,172,0.12); border: 1px solid rgba(134,239,172,0.35); }
.ag-hm-label.tier-R   { color: #7dd3fc; background: rgba(125,211,252,0.12); border: 1px solid rgba(125,211,252,0.35); }
.ag-hm-label.tier-SR  { color: #d8b4fe; background: rgba(216,180,254,0.12); border: 1px solid rgba(216,180,254,0.35); }
.ag-hm-label.tier-SSR { color: #fda4af; background: rgba(253,164,175,0.12); border: 1px solid rgba(253,164,175,0.35); font-size: .65rem; }
.ag-hm-label.tier-UR  { color: #ff8a65; background: rgba(220,38,38,0.15); border: 1px solid rgba(220,38,38,0.45); font-weight: 900; }

/* ── Zero-state: universal style for any is-zero cell or bar ─────────────── */
.is-zero {
  background: transparent !important;
  border: 1px dashed rgba(255,255,255,0.12) !important;
  opacity: 0.45;
}
/* Bar charts need a slightly different treatment (they're divs not grid cells) */
.ag-bar.is-zero,
.ag-dow-bar.is-zero,
.ag-ver-bar.is-zero {
  background: transparent !important;
  border: 1px dashed rgba(255,255,255,0.15) !important;
  border-radius: 2px 2px 0 0 !important;
  opacity: 0.5;
  box-shadow: none !important;
}

/* ── Donut chart ─────────────────────────────────────────────────────────── */
.ag-donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.ag-donut-svg {
  width: 130px;
  height: 130px;
  flex-shrink: 0;
}
.ag-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: .78rem;
}
.ag-donut-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
}
.ag-donut-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Day-of-week chart ───────────────────────────────────────────────────── */
.ag-dow-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100px;
}
.ag-dow-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  height: 100%;
}
.ag-dow-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--success) 0%, #0c9e6a 100%);
  transform-origin: bottom;
  transform: scaleY(0);
}
.ag-dow-tick {
  font-size: .68rem;
  font-weight: 600;
  color: var(--muted);
}

/* ── Locked/Listed grouped bar ───────────────────────────────────────────── */
.ag-ll-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ag-ll-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ag-ll-tier-label {
  width: 36px;
  font-size: .7rem;
  font-weight: 700;
  flex-shrink: 0;
  text-align: right;
}
.ag-ll-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ag-ll-bar-track {
  height: 10px;
  background: var(--surface2);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}
.ag-ll-bar-fill {
  height: 100%;
  border-radius: 5px;
  transform-origin: left;
  transform: scaleX(0);
}
.ag-ll-bar-fill.locked  { background: #f87171; }
.ag-ll-bar-fill.listed  { background: #fbbf24; }
.ag-ll-bar-fill.free    { background: var(--success); }
.ag-ll-legend {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  font-size: .68rem;
}
.ag-ll-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.ag-ll-legend i {
  width: 10px; height: 10px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
  transform: none !important;
}

/* ── Top series horizontal bars ─────────────────────────────────────────── */
.ag-series-chart {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.ag-series-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .75rem;
}
.ag-series-name {
  width: 130px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  text-align: right;
  font-size: .7rem;
}
@media (max-width: 600px) { .ag-series-name { width: 90px; } }
.ag-series-track {
  flex: 1;
  height: 12px;
  background: var(--surface2);
  border-radius: 6px;
  overflow: hidden;
}
.ag-series-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transform-origin: left;
  transform: scaleX(0);
}
.ag-series-count {
  width: 36px;
  text-align: right;
  color: var(--muted);
  font-size: .68rem;
  flex-shrink: 0;
}

/* ── Top 25 Owners Chart ─────────────────────────────────────────────────────── */
.ag-owners-chart {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.ag-owner-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}
.ag-owner-av {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}
.ag-owner-av-fallback {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .55rem;
  font-weight: 700;
  color: var(--muted);
}
.ag-owner-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .72rem;
  color: var(--text);
  flex-shrink: 0;
}
.ag-owner-track {
  flex: 1;
  min-width: 3px;
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}
.ag-owner-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transform-origin: left;
  transform: scaleX(0);
}
.ag-owner-count {
  width: 36px;
  text-align: right;
  color: var(--muted);
  font-size: .68rem;
  flex-shrink: 0;
}
.ag-owner-row .oprem {
  font-size: .65rem;
  flex-shrink: 0;
}

/* ── Latest pulse (Room G) ─────────────────────────────────────────────────── */
.ag-pulse {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ag-pulse-intensity-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.ag-pulse-intensity-head .ag-section-sub { margin-bottom: 0; }
.ag-pulse-intensity-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(200px, 0.85fr);
  gap: 20px 28px;
  align-items: center;
  margin-top: 10px;
}
@media (max-width: 860px) {
  .ag-pulse-intensity-body { grid-template-columns: 1fr; }
}
.ag-cal-board {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  width: 100%;
}
.ag-cal-ydays {
  display: grid;
  grid-template-rows: repeat(7, minmax(16px, 1fr));
  gap: 4px;
  height: 100%;
  min-height: 140px;
  font-size: .6rem;
  color: var(--muted);
  line-height: 1;
  text-align: right;
  user-select: none;
  align-items: center;
}
.ag-cal-ydays span {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}
.ag-cal-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .68rem;
  font-weight: 600;
  color: #d6d3d1; /* stone-300 — readable on charcoal panels */
  flex-shrink: 0;
}
.ag-cal-swatch {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: #57534e; /* stone-600 — visible "less" cell */
  border: 1px solid rgba(245, 235, 220, 0.28);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.ag-cal-swatch.s0 { background: #44403c; }
.ag-cal-swatch.s1 { background: rgba(220, 38, 38, 0.28); border-color: transparent; }
.ag-cal-swatch.s2 { background: rgba(220, 38, 38, 0.48); border-color: transparent; }
.ag-cal-swatch.s3 { background: rgba(251, 146, 60, 0.72); border-color: transparent; }
.ag-cal-swatch.s4 { background: #ffd700; border-color: transparent; }
.ag-pulse-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  min-width: 0;
}
.ag-pulse-stat {
  padding: 10px 12px 11px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%);
  min-width: 0;
}
.ag-pulse-stat-label {
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.ag-pulse-stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ag-pulse-stat-hint {
  font-size: .65rem;
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ag-pulse-stat.is-peak .ag-pulse-stat-value { color: var(--accent2, #ff6b4a); }
.ag-pulse-stat.is-quiet .ag-pulse-stat-value { color: var(--muted); }

/* ── Recent Grabs ───────────────────────────────────────────────────────────── */
.ag-recent-grabs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.ag-grab-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 0;
}
.ag-grab-img-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}
.ag-grab-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}
.ag-grab-img-ph {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 4px;
  font-size: 1.4rem;
}
.ag-grab-badges {
  position: absolute;
  top: -6px;
  left: -6px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  max-width: 60px;
}
.ag-grab-badge {
  font-size: .6rem;
  padding: 2px 4px;
  border-radius: 4px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
}
.ag-grab-badge.bnew {
  background: #22c55e;
  color: #000;
}
.ag-grab-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.ag-grab-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ag-grab-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .65rem;
  color: var(--muted);
  margin-top: 4px;
}
.ag-grab-tier {
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: .6rem;
}
.ag-grab-tier.tier-C { background: #22c55e33; color: #22c55e; }
.ag-grab-tier.tier-R { background: #60a5fa33; color: #60a5fa; }
.ag-grab-tier.tier-SR { background: #a78bfa33; color: #a78bfa; }
.ag-grab-tier.tier-SSR { background: #f472b633; color: #f472b6; }
.ag-grab-tier.tier-UR { background: #ff220033; color: #ff2200; }
.ag-grab-owner {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ag-grab-time {
  font-size: .65rem;
  color: var(--muted);
  margin-top: 4px;
}
.ag-grab-links {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.ag-grab-links a {
  font-size: .95rem;
  text-decoration: none;
  opacity: 0.6;
  transition: opacity .15s;
}
.ag-grab-links a:hover { opacity: 1; }

/* ── 30-day calendar heatmap (week grid) ─────────────────────────────────── */
.ag-cal {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, minmax(16px, 1fr));
  grid-auto-columns: minmax(16px, 1fr);
  gap: 4px;
  flex: 1;
  width: 100%;
  max-width: 380px;
  min-height: 140px;
  justify-content: start;
}
.ag-cal-day {
  width: 100%;
  height: 100%;
  min-height: 16px;
  border-radius: 3px;
  background: var(--surface2);
  cursor: pointer;
  opacity: 0;
  transition: transform .12s ease, outline-color .12s;
  outline: 1px solid transparent;
}
.ag-cal-day.is-pad {
  visibility: hidden;
  pointer-events: none;
}
.ag-cal-day:hover:not(.is-pad) {
  transform: scale(1.18);
  outline-color: color-mix(in srgb, var(--text) 35%, transparent);
  z-index: 2;
}
.ag-cal-month-labels {
  display: none;
}

/* ── Version histogram ───────────────────────────────────────────────────── */
.ag-ver-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 110px;
}
.ag-ver-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  height: 100%;
}
.ag-ver-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--warning) 0%, #b45309 100%);
  transform-origin: bottom;
  transform: scaleY(0);
}
.ag-ver-bar-range {
  background: linear-gradient(180deg, var(--accent2) 0%, #c2410c 100%);
}
.ag-ver-tick {
  font-size: .63rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}
.ag-ver-count {
  font-size: .6rem;
  color: var(--muted);
  text-align: center;
}

#chart-ver-ranges {
  gap: 6px;
}
#chart-ver-ranges .ag-ver-tick {
  font-size: .58rem;
  letter-spacing: .01em;
}

@media (max-width: 768px) {
  #chart-ver-ranges {
    gap: 4px;
  }
  #chart-ver-ranges .ag-ver-tick {
    font-size: .54rem;
  }
}

/* ── Radial clock ────────────────────────────────────────────────────────── */
.ag-clock-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 240px;
}
.ag-clock-svg {
  width: min(100%, 240px);
  height: auto;
  display: block;
}
.ag-clock-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.62rem;
  font-weight: 600;
  color: #d6d3d1;
}
.ag-clock-leg-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}
.ag-peak-hours {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 140px;
}
.ag-peak-row {
  display: grid;
  grid-template-columns: 22px 44px 1fr 52px 40px;
  gap: 8px;
  align-items: center;
}
.ag-peak-rank {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}
.ag-peak-hour {
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.ag-peak-track {
  height: 8px;
  background: rgba(41, 37, 36, 0.9);
  border-radius: 99px;
  overflow: hidden;
}
.ag-peak-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent2), #ffd700);
  transform-origin: left;
  transform: scaleX(0);
}
.ag-peak-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ag-peak-pct {
  font-size: 0.68rem;
  color: var(--kpi);
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ── Punchcard ───────────────────────────────────────────────────────────── */
.ag-punchcard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.ag-punch-head,
.ag-punch-row {
  display: grid;
  grid-template-columns: 36px repeat(24, minmax(10px, 1fr));
  gap: 3px;
  align-items: center;
  min-width: 420px;
}
.ag-punch-head span {
  font-size: 0.55rem;
  color: var(--muted);
  text-align: center;
}
.ag-punch-dow {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.ag-punch-dot {
  justify-self: center;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: rgba(41, 37, 36, 0.9);
  cursor: pointer;
  appearance: none;
}
.ag-punch-dot.is-zero {
  opacity: 0.35;
  background: rgba(41, 37, 36, 0.7);
}

/* ── Streamgraph + treemap ───────────────────────────────────────────────── */
.ag-stream-svg {
  width: 100%;
  height: 180px;
  display: block;
}
.ag-treemap-wrap {
  width: 100%;
  min-height: 260px;
}
.ag-treemap-svg {
  display: block;
  width: 100%;
  height: 260px;
}
.ag-treemap-svg rect[data-series]:hover {
  stroke: var(--accent2) !important;
  stroke-width: 1.5px;
}

/* ── History drawer (desktop only) ──────────────────────────────────────── */
#ag-history-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 800;
  background: var(--surface);
  border-top: 2px solid var(--border);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
  transform: translateY(calc(100% - 42px));
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  max-height: 60vh;
  display: flex;
  flex-direction: column;
}
#ag-history-drawer.open { transform: translateY(0); }

/* Hide entirely on mobile */
@media (max-width: 768px) { #ag-history-drawer { display: none !important; } }

#ag-drawer-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  height: 42px;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
  border-radius: 14px 14px 0 0;
}
#ag-drawer-handle:hover { background: rgba(255,255,255,0.03); }
.ag-drawer-title {
  font-family: var(--ag-serif);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .04em;
  text-transform: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ag-drawer-title .ag-hist-count {
  background: var(--accent);
  color: #fff;
  font-size: .62rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 99px;
}
.ag-drawer-chevron {
  font-size: .9rem;
  color: var(--muted);
  transition: transform 0.3s;
}
#ag-history-drawer.open .ag-drawer-chevron { transform: rotate(180deg); }

#ag-drawer-body {
  overflow-y: auto;
  padding: 0 18px 16px;
  flex: 1;
}
.ag-drawer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.ag-drawer-actions span {
  font-size: .72rem;
  color: var(--muted);
}
.ag-clear-all-btn {
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-family: inherit;
  font-size: .72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.ag-clear-all-btn:hover { background: rgba(248,113,113,0.1); }

.ag-hist-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ag-hist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  opacity: 0;
  transform: translateX(-12px);
}
.ag-hist-item:hover { border-color: color-mix(in srgb, var(--accent2) 70%, transparent); background: rgba(220, 38, 38, 0.08); }
.ag-hist-item.active { border-color: var(--accent2); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent2) 55%, transparent); }
.ag-hist-icon { font-size: 1rem; flex-shrink: 0; }
.ag-hist-info { flex: 1; min-width: 0; }
.ag-hist-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ag-hist-meta {
  font-size: .65rem;
  color: var(--muted);
  margin-top: 2px;
}
.ag-hist-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: .85rem;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  flex-shrink: 0;
  line-height: 1;
  transition: color .15s;
}
.ag-hist-remove:hover { color: var(--danger); }
.ag-hist-empty {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: .8rem;
}

/* ── UTC Clock (analytics page, in header) ─────────────────────────────── */
#ag-utc-clock {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 4px 10px;
  user-select: none;
  pointer-events: none;
}
#ag-utc-label {
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
}
#ag-utc-time {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  line-height: 1;
}
@media (max-width: 768px) {
  #ag-utc-clock { padding: 4px 8px; }
  #ag-utc-time  { font-size: .75rem; }
}

/* ── Auth User Profile ───────────────────────────────────────────────────── */
#user-profile {
  display: none;
  margin-left: 0;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}
#user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
}
.header-utils #user-avatar {
  border-color: color-mix(in srgb, var(--accent2) 55%, var(--border));
}
#user-name {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
#user-role {
  display: none;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  color: #fff;
}
@media (max-width: 800px) {
  #user-profile { width: auto; justify-content: flex-end; margin-top: 0; }
}

/* ── Cookie Consent Overlay ──────────────────────────────────────────────── */
.cc-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(220, 38, 38, 0.16) 0%, rgba(0, 0, 0, 0.88) 62%),
    rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: 'Inter', sans-serif;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.cc-overlay.show { opacity: 1; }

.cc-modal {
  width: 100%;
  max-width: 440px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 28px 26px 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(251, 146, 60, 0.09), transparent 160px),
    var(--surface);
  box-shadow: 0 0 50px rgba(220, 38, 38, 0.16), 0 26px 70px rgba(0, 0, 0, 0.72);
  text-align: center;
  transform: translateY(10px) scale(0.975);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.175, 0.885, 0.32, 1.15), opacity 0.24s ease;
}
.cc-overlay.show .cc-modal {
  transform: none;
  opacity: 1;
}
.cc-modal:focus { outline: none; }

.cc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border: 1px solid color-mix(in srgb, var(--accent2) 38%, transparent);
  border-radius: 15px;
  background: linear-gradient(140deg, rgba(220, 38, 38, 0.22), rgba(251, 146, 60, 0.12));
  color: var(--accent2);
}
.cc-title {
  margin-bottom: 12px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text);
}
.cc-body {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.62;
  text-align: left;
}
.cc-list {
  margin: 0 0 14px;
  padding: 0 0 0 1.15em;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.55;
  text-align: left;
}
.cc-list li {
  margin-bottom: 6px;
}
.cc-list li:last-child {
  margin-bottom: 0;
}
.cc-note {
  margin-bottom: 20px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent2);
  border-radius: 9px;
  background: var(--surface2);
  color: var(--muted);
  font-size: 0.81rem;
  line-height: 1.55;
  text-align: left;
}
.cc-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cc-accept { height: 40px; padding: 0 24px; font-size: 0.88rem; }
.cc-decline {
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.cc-decline:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--danger) 55%, transparent);
}

@media (max-width: 480px) {
  .cc-modal { padding: 24px 18px 20px; }
  .cc-actions { flex-direction: column-reverse; align-items: stretch; }
  .cc-accept, .cc-decline { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .cc-overlay,
  .cc-modal { transition: none !important; }
}

/* ── Card Detail Lightbox ────────────────────────────────────────────────── */
body.lb-lock { overflow: hidden; }

.lb {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: none;
  align-items: center;
  justify-content: center;
  --lb-tier: #10b981;
}
.lb.open { display: flex; }

.lb-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 10%, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.9) 72%),
    rgba(0,0,0,0.88);
  cursor: pointer;
}
/* Grain baked into the backdrop so the theater mode matches the site's texture */
.lb-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.06;
  pointer-events: none;
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="2" stitchTiles="stitch"/><feColorMatrix type="saturate" values="0"/></filter><rect width="100%25" height="100%25" filter="url(%23n)"/></svg>');
}

.lb-panel {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: 28px;
  width: min(940px, 94vw);
  max-height: 88vh;
  padding: 30px;
  background:
    radial-gradient(130% 90% at 50% 0%, color-mix(in srgb, var(--lb-tier) 22%, transparent) 0%, transparent 62%),
    color-mix(in srgb, var(--lb-tier) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--lb-tier) 42%, var(--border));
  border-radius: 16px;
  box-shadow:
    0 40px 120px rgba(0,0,0,0.65),
    0 0 80px color-mix(in srgb, var(--lb-tier) 18%, transparent),
    inset 0 1px 0 rgba(245, 235, 220, 0.05);
}

/* Close sits where the old tier chip lived — top-right of the panel */
.lb-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--lb-tier) 30%, var(--border));
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(8px);
  color: var(--muted);
  font-size: 0.92rem;
  cursor: pointer;
  transition: color .2s, border-color .2s, transform .2s, background .2s;
}
.lb-close-x {
  font-size: 0.95rem;
  line-height: 1;
  font-weight: 700;
}
.lb-esc {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 6px;
  background: var(--surface2);
}
.lb-close:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--lb-tier) 55%, var(--accent));
  background: color-mix(in srgb, var(--lb-tier) 14%, var(--surface));
  transform: scale(1.04);
}
.lb-close:hover .lb-esc {
  color: var(--text);
  border-color: color-mix(in srgb, var(--lb-tier) 40%, var(--border));
}

.lb-art {
  position: relative;
  align-self: center;
  touch-action: pan-y;
}
.lb-art-glow {
  position: absolute;
  inset: -12%;
  background: radial-gradient(50% 50% at 50% 55%, color-mix(in srgb, var(--lb-tier) 38%, transparent), transparent 72%);
  filter: blur(28px);
  z-index: -1;
  pointer-events: none;
}
#lb-img {
  width: 100%;
  height: auto;
  max-height: 74vh;
  object-fit: contain;
  border-radius: 14px;
  display: block;
}
.lb-art .cbadges { top: 10px; left: 10px; }

.lb-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 6px;
  padding-top: 4px;
}
.lb-name {
  margin: 0;
  padding-right: 72px;
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-size: clamp(1.55rem, 3vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.08;
  color: var(--text);
}
.lb-series {
  margin-top: -8px;
  color: var(--muted);
  font-size: 0.9rem;
}
/* Hairline-divided definition rows — fixed label/value columns */
.lb-rows {
  display: flex;
  flex-direction: column;
  border-top: 1px solid rgba(245, 235, 220, 0.08);
}
.lb-row {
  display: grid;
  grid-template-columns: minmax(6.5rem, 32%) minmax(0, 1fr);
  align-items: baseline;
  column-gap: 16px;
  padding: 9px 2px;
  border-bottom: 1px solid rgba(245, 235, 220, 0.06);
  font-size: 0.82rem;
  color: var(--muted);
}
.lb-k {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-weight: 500;
}
.lb-k .ic { flex-shrink: 0; opacity: 0.9; }
.lb-v {
  min-width: 0;
  text-align: right;
  justify-self: end;
}
.lb-v strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.lb-v em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  opacity: 0.72;
  font-size: 0.74rem;
}
.lb-owner {
  align-self: flex-start;
  cursor: pointer;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color .2s, background .2s;
}
.lb-owner:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.lb-owner .oav,
.lb-owner .oaf {
  width: 30px;
  height: 30px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  font-size: 0.58rem;
}
.lb-owner .oname { font-size: 0.86rem; }
.lb-versions .lb-ver-head {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.lb-ver-list { display: flex; flex-wrap: wrap; gap: 6px; }
.lb-ver-chip {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: border-color .2s, color .2s;
}
.lb-ver-chip:hover { border-color: var(--accent2); color: var(--text); }
.lb-ver-chip.cur {
  border-color: var(--accent);
  color: var(--accent2);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.lb-ver-more { font-size: 0.72rem; color: var(--muted); align-self: center; }
.lb-ver-loading { font-size: 0.78rem; color: var(--muted); }

.lb-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 2px; }
.lb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .2s, color .2s, transform .2s, filter .2s;
}
.lb-btn:hover { border-color: var(--accent); color: var(--accent2); transform: translateY(-1px); }
.lb-btn.lb-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.lb-btn.lb-primary:hover { filter: brightness(1.12); color: #fff; }
.lb-hint { font-size: 0.72rem; color: var(--muted); }

.lb-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(8px);
  color: var(--text);
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.lb-nav:hover { border-color: var(--accent); color: var(--accent2); }
.lb-prev { left: max(18px, 3vw); }
.lb-next { right: max(18px, 3vw); }

@media (max-width: 720px) {
  .lb-panel {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 18px;
    overflow-y: auto;
  }
  .lb-art { width: min(280px, 70vw); margin: 0 auto; }
  .lb-nav { display: none; }
  .lb-close { top: 12px; right: 12px; padding: 7px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .lb-close,
  .lb-owner,
  .lb-ver-chip,
  .lb-nav { transition: none !important; }
  .ag-hm-cell,
  .ag-cal-day,
  .ag-hist-item { transition: none !important; }
  #ag-history-drawer { transition: none !important; }
}

/* ── Active Filter Chips ─────────────────────────────────────────────────── */
.filter-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 22px 2px;
}
.fchip-label {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 2px;
}
.fchip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent2);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s;
}
.fchip:hover {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.fchip-x { opacity: 0.65; margin-left: 3px; }
.fchip-clear {
  border-color: var(--border);
  background: transparent;
  color: var(--muted);
}
.fchip-clear:hover { border-color: var(--accent); color: var(--accent2); }

/* ── Keyboard Hints ──────────────────────────────────────────────────────── */
.kbd-hint {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}
.kbd-hint kbd, .lb-hint kbd {
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  font-family: inherit;
  font-size: 0.68rem;
  color: var(--text);
}
@media (max-width: 900px) {
  .kbd-hint { display: none; }
}

/* ── Shared wait stage (Anime.js loading diversion) ─────────────────────── */
.ow-state:has(.wait-stage),
.mk-state:has(.wait-stage),
.ev-state:has(.wait-stage) {
  padding: 0;
}
.wait-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 72px 20px 88px;
  text-align: center;
  min-height: 280px;
  color: var(--muted);
  position: relative;
}
.wait-orbit {
  position: relative;
  width: 132px;
  height: 132px;
}
.wait-shards {
  position: absolute;
  inset: 0;
}
.wait-ring {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent2) 35%, transparent);
  box-shadow:
    0 0 28px rgba(220, 38, 38, 0.18),
    inset 0 0 24px rgba(251, 146, 60, 0.08);
}
.wait-core {
  position: absolute;
  inset: 38px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(251, 146, 60, 0.55), transparent 55%),
    radial-gradient(circle at 50% 55%, rgba(220, 38, 38, 0.45), rgba(12, 10, 9, 0.2) 70%);
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  box-shadow: 0 0 22px rgba(220, 38, 38, 0.28);
}
.wait-shard {
  --i: 0;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 26px;
  margin: -13px 0 0 -9px;
  border-radius: 3px 3px 4px 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  /* Orbit seat — Anime.js only breathes scale/opacity on top */
  transform: rotate(calc(var(--i) * 72deg - 90deg)) translateY(-48px) rotate(calc(90deg - var(--i) * 72deg));
  transform-origin: 50% 50%;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.wait-shard::after {
  content: "";
  position: absolute;
  inset: 3px 3px auto;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.22);
}
.wait-shard[data-t="UR"]  { background: linear-gradient(160deg, #ff2200, #7f1d1d); }
.wait-shard[data-t="SSR"] { background: linear-gradient(160deg, #f472b6, #9d174d); }
.wait-shard[data-t="SR"]  { background: linear-gradient(160deg, #a78bfa, #5b21b6); }
.wait-shard[data-t="R"]   { background: linear-gradient(160deg, #60a5fa, #1d4ed8); }
.wait-shard[data-t="C"]   { background: linear-gradient(160deg, #22c55e, #166534); }
.wait-spark {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent2);
  box-shadow: 0 0 8px rgba(251, 146, 60, 0.8);
  opacity: 0;
  pointer-events: none;
}
.wait-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent2) 80%, var(--muted));
}
.wait-label {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  min-height: 1.4em;
  max-width: 28rem;
  line-height: 1.35;
}
.wait-sub {
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 26rem;
  line-height: 1.45;
}

/* Shared load-error + Try again (replaces stuck wait stages) */
.load-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 20px 100px;
  text-align: center;
  min-height: 220px;
}
.load-error-title {
  color: var(--danger);
  font-size: 1.05rem;
  font-weight: 600;
}
.load-error-sub {
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 28rem;
  line-height: 1.45;
  margin: 0;
}
.load-error-retry {
  margin-top: 6px;
}
.load-error-retry:disabled {
  opacity: 0.65;
  cursor: wait;
}
.hl-retry {
  display: inline-flex;
  margin-top: 10px;
}
.wait-bar {
  width: min(240px, 70vw);
  height: 3px;
  border-radius: 99px;
  background: var(--surface2);
  overflow: hidden;
  position: relative;
}
.wait-bar-fill {
  height: 100%;
  width: 28%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent2), #ffd700);
  box-shadow: 0 0 12px rgba(251, 146, 60, 0.45);
}
@media (prefers-reduced-motion: reduce) {
  .wait-spark { display: none; }
}

/* === scope-charts-badges ===
   Owned by AGENT-UI-CHARTS — charts, badges, shared tooltips only.
   Do not put dossier layout / filter-bar rules here. */
.scope-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.scope-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  color: currentColor;
}

.sc-chart {
  min-height: 1.5rem;
  color: var(--text);
  font-family: 'Outfit', sans-serif;
}
.sc-empty {
  color: var(--muted);
  font-size: 0.78rem;
}

/* Shared floating tooltip (charts + badges) */
.sc-tip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  max-width: 280px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity 0.12s ease;
  white-space: normal;
}
.sc-tip.show { opacity: 1; }
.pb-tip-label {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.76rem;
  color: var(--text);
  margin-bottom: 2px;
}
.pb-tip-desc {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
}

/* Donut */
.sc-donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.sc-donut-svg { flex-shrink: 0; }
.sc-donut-center {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  fill: var(--text);
}
.sc-donut-arc {
  cursor: pointer;
  outline: none;
}
.sc-donut-arc:focus-visible {
  filter: brightness(1.15);
}
.sc-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.75rem;
  flex: 1;
  min-width: 120px;
}
.sc-donut-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.sc-swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
}
.sc-leg-tier { color: var(--text); font-weight: 600; }
.sc-leg-pct { color: var(--muted); }
.sc-leg-n { color: var(--muted); font-size: 0.65rem; }

/* Stacked tier bars */
.sc-stack-chart,
.sc-complete-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sc-stack-row,
.sc-complete-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sc-stack-label,
.sc-complete-label {
  width: 96px;
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sc-stack-track {
  flex: 1;
  display: flex;
  height: 14px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface2);
  min-width: 0;
}
.sc-stack-seg {
  height: 100%;
  min-width: 2px;
  transform-origin: left center;
  cursor: pointer;
  outline: none;
}
.sc-stack-seg:focus-visible {
  outline: 1px solid var(--kpi);
  outline-offset: 1px;
}
.sc-stack-total,
.sc-complete-meta {
  width: 48px;
  flex-shrink: 0;
  text-align: right;
  font-size: 0.68rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Version histogram */
.sc-ver-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  padding-top: 8px;
}
.sc-ver-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  height: 100%;
}
.sc-ver-bar {
  width: 100%;
  max-width: 22px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--accent2), var(--accent));
  transform-origin: bottom center;
  cursor: pointer;
  outline: none;
}
.sc-ver-bar.is-zero {
  background: var(--surface2);
  opacity: 0.55;
}
.sc-ver-bar:focus-visible {
  outline: 1px solid var(--kpi);
  outline-offset: 1px;
}
.sc-ver-tick {
  margin-top: 6px;
  font-size: 0.58rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* Concentration curve */
.sc-conc-svg { display: block; max-width: 100%; }
.sc-conc-eq {
  stroke: rgba(245, 235, 220, 0.18);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}
.sc-conc-area {
  fill: rgba(220, 38, 38, 0.16);
}
.sc-conc-line {
  stroke: var(--accent2);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sc-conc-dot {
  fill: var(--kpi);
  cursor: pointer;
  outline: none;
}
.sc-conc-axis {
  fill: var(--muted);
  font-size: 9px;
  font-family: 'Outfit', sans-serif;
}

/* Heatmap */
.sc-heatmap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sc-hm-row,
.sc-hm-col-row {
  display: flex;
  align-items: center;
  gap: 3px;
}
.sc-hm-label,
.sc-hm-spacer {
  width: 36px;
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
  padding-right: 4px;
}
.sc-hm-cell {
  flex: 1;
  min-width: 8px;
  height: 14px;
  border-radius: 2px;
  background: var(--surface2);
  cursor: pointer;
  outline: none;
}
.sc-hm-cell.is-zero { opacity: 0.45; }
.sc-hm-cell:focus-visible {
  outline: 1px solid var(--kpi);
  outline-offset: 1px;
}
.sc-hm-col-label {
  flex: 1;
  min-width: 8px;
  text-align: center;
  font-size: 0.52rem;
  color: var(--muted);
}

/* Sparkline */
.sc-spark { display: block; overflow: visible; }
.sc-spark-line { vector-effect: non-scaling-stroke; }

/* Completion bars */
.sc-complete-track {
  flex: 1;
  height: 10px;
  border-radius: 99px;
  background: var(--surface2);
  overflow: hidden;
  min-width: 0;
}
.sc-complete-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--kpi));
  transform-origin: left center;
  cursor: pointer;
  outline: none;
  min-width: 0;
}
.sc-complete-fill:focus-visible {
  outline: 1px solid var(--kpi);
  outline-offset: 2px;
}

/* Enter animations (transform/opacity only) */
.sc-enter-fade {
  animation: sc-fade-in 0.35s ease-out both;
}
.sc-enter-bar {
  animation: sc-bar-in 0.4s ease-out both;
}
.sc-enter-draw {
  animation: sc-draw-in 0.7s ease-out both;
}
@keyframes sc-fade-in {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes sc-bar-in {
  from { transform: scaleX(0); opacity: 0.4; }
  to { transform: scaleX(1); opacity: 1; }
}
@keyframes sc-draw-in {
  to { stroke-dashoffset: 0; }
}

/* Player badges */
.pb-badges { width: 100%; }
.pb-empty {
  color: var(--muted);
  font-size: 0.8rem;
}
.pb-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.pb-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  min-height: 44px;
}
.pb-badge:hover,
.pb-badge:focus-visible {
  border-color: color-mix(in srgb, var(--accent2) 55%, var(--border));
  background: color-mix(in srgb, var(--surface2) 85%, var(--accent) 15%);
  outline: none;
}
.pb-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 70%, var(--accent) 30%);
  color: var(--kpi);
  flex-shrink: 0;
}
.pb-icon-emoji { font-size: 1.15rem; background: transparent; }
.pb-icon-svg { color: var(--kpi); }
.pb-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.pb-label,
.pb-badge .b-label {
  font-size: 0.78rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: var(--text);
}
.pb-desc,
.pb-badge .b-desc {
  font-size: 0.64rem;
  color: var(--muted);
  line-height: 1.35;
}

@media (max-width: 600px) {
  .sc-stack-label,
  .sc-complete-label { width: 72px; font-size: 0.68rem; }
  .sc-donut-wrap { gap: 12px; }
  .sc-ver-tick { font-size: 0.52rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sc-tip,
  .pb-badge { transition: none !important; }
  .sc-enter-fade,
  .sc-enter-bar,
  .sc-enter-draw {
    animation: none !important;
  }
  .sc-spark-line {
    stroke-dasharray: none !important;
    stroke-dashoffset: 0 !important;
  }
}

/* === scope-filter-bar === */
/* Locked page-axis chip — non-removable; mirrors Browse .fchip geometry. */
.fchip.fchip-locked {
  cursor: default;
  border-color: color-mix(in srgb, var(--muted) 55%, transparent);
  background: color-mix(in srgb, var(--surface2) 80%, transparent);
  color: var(--text);
  font-weight: 700;
}
.fchip.fchip-locked:hover {
  transform: none;
  border-color: color-mix(in srgb, var(--muted) 55%, transparent);
  background: color-mix(in srgb, var(--surface2) 80%, transparent);
}
.fchip.fchip-locked .fchip-x { display: none; }

/* === scope-dossier === */
.scope-dossier {
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  padding-bottom: 48px;
}
.scope-dossier .back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--accent2);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.scope-dossier .back-link:hover { color: var(--text); }

/* Players-listing kicker (eyebrow + ruled accent) */
.scope-sec-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--accent2);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 0 0 12px;
}
.scope-sec-kicker::before {
  content: "";
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  flex-shrink: 0;
}

.scope-hero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 18px;
}
.scope-hero-art {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center top;
  filter: blur(28px) saturate(1.1);
  opacity: 0.28;
  transform: scale(1.12);
}
.scope-hero-inner {
  position: relative;
  display: flex;
  gap: 18px;
  padding: 22px 20px;
  align-items: flex-end;
}
.scope-hero-card {
  width: 96px; height: 134px; flex-shrink: 0;
  border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface2);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.scope-hero-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scope-hero.has-watch .scope-hero-inner {
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 22px 24px;
}
.scope-hero.has-watch .scope-hero-meta { order: 1; }
.scope-hero.has-watch .scope-hero-card {
  order: 2;
  width: var(--ar-w);
  min-width: var(--ar-w);
  height: auto;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  --ar-w: clamp(168px, min(22vw, 32dvh), 240px);
}
.scope-hero.has-watch .scope-hero-card .arts-stage {
  --ar-w: inherit;
  width: var(--ar-w);
  align-items: stretch;
}
.scope-hero.has-watch .scope-hero-card .arts-rotator-slot {
  --ar-w: inherit;
  width: var(--ar-w);
  height: calc(var(--ar-w) * 1.4);
}
.scope-hero.has-watch .scope-hero-card .arts-meta {
  max-width: none;
  min-height: 0;
  text-align: center;
}
.arts-stage--vault .arts-meta-series {
  color: var(--accent2);
  margin-top: 2px;
}
.arts-stage--vault .arts-meta-maker {
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--kpi);
}
.arts-stage--vault .arts-meta-maker:empty { display: none; }
.arts-stage--vault .arts-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.arts-ver-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.15em;
  padding: 6px 10px 5px;
  border-radius: 8px;
  background: #0a0a0a;
  color: var(--kpi);
  border: 1px solid #f5f5f5;
  font-family: "Outfit", sans-serif;
  font-size: 0.92rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.scope-watch-sk {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--ar-w);
  gap: 8px;
}
.scope-watch-sk-art {
  position: relative;
  width: var(--ar-w);
  height: calc(var(--ar-w) * 1.4);
  border-radius: 16px;
  background: var(--surface2);
  overflow: hidden;
}
.scope-watch-sk-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,0.07) 50%, transparent 80%);
  background-size: 220% 100%;
  animation: skeleton-sweep 1.5s linear infinite;
}
.scope-type-player .scope-watch-sk-art::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 2.35em;
  height: 1.3em;
  border-radius: 8px;
  background: #0a0a0a;
  border: 1px solid rgba(245, 245, 245, 0.45);
}
.scope-watch-sk-line {
  display: block;
  width: 78%;
  height: 10px;
  border-radius: 4px;
  background: var(--surface2);
}
.scope-watch-sk-line--sub { width: 62%; height: 8px; }
.scope-watch-sk-line--maker { width: 50%; height: 8px; }
@media (prefers-reduced-motion: reduce) {
  .scope-watch-sk-art::before { animation: none; }
}
.scope-hero.has-watch .scope-hero-card[hidden] { display: none; }
.scope-hero-meta { min-width: 0; flex: 1; }
.scope-hero-meta h2 {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(1.55rem, 3.2vw, 2.35rem);
  line-height: 1.05;
  color: var(--text);
  letter-spacing: -0.02em;
}
.scope-subtitle { color: var(--muted); font-size: 0.88rem; margin-top: 6px; line-height: 1.45; }
.scope-kpis {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 16px;
}
.scope-kpi {
  position: relative;
  overflow: hidden;
  min-width: 76px;
  padding: 10px 12px 10px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.scope-kpi::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  opacity: 0.7;
}
.scope-kpi small {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}
.scope-kpi strong {
  font-family: var(--serif);
  font-weight: 800;
  color: var(--kpi);
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

/* Sticky chrome for dossier FilterBar — #controls alone cannot stick because
   .scope-filters is only as tall as the bar; stick the wrapper for the full dossier. */
.scope-filters {
  position: sticky;
  top: 66px;
  z-index: 500;
  margin-bottom: 16px;
  /* Opaque band so cards don’t show through while stuck under the header */
  background: var(--bg);
  padding: 2px 0 6px;
}
body:has(header.is-compact) .scope-filters { top: 54px; }
@media (max-width: 600px) {
  .scope-filters { top: 58px; }
}
.scope-filters #controls {
  /* Parent owns sticky; keep the glass bar flush in the sticky band */
  position: relative;
  top: auto;
  margin: 0;
  z-index: auto;
}

/* Tier mix — one unified panel (donut | unique | windows) */
.scope-core {
  margin-bottom: 18px;
}
.scope-tier-mix {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface2) 55%, transparent), transparent 42%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px 14px;
}
.scope-tier-mix > .scope-sec-kicker {
  margin: 0 0 10px;
}
.scope-tier-mix-body {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: 0;
}
.scope-tier-charts {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  gap: 0;
}
.scope-chart-cell {
  min-width: 0;
  padding: 4px 14px 2px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.scope-chart-cell + .scope-chart-cell,
.scope-windows {
  border-left: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  padding-left: 14px;
}
.scope-chart-cell--donut { flex: 1.15 1 0; }
.scope-chart-cell--stack {
  flex: 1 1 0;
  padding-right: 14px;
  justify-content: center;
}
.scope-chart-label {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  line-height: 1.2;
}
.scope-tier-mix .sc-donut-wrap {
  gap: 10px;
  flex-wrap: nowrap;
  align-items: center;
}
.scope-tier-mix .sc-donut-svg {
  width: 112px;
  height: 112px;
}
.scope-tier-mix .sc-donut-legend {
  gap: 3px;
  min-width: 0;
  font-size: 0.7rem;
}
.scope-tier-mix .sc-donut-legend-item { gap: 5px; }
.scope-tier-mix .sc-leg-n { display: none; }
.scope-tier-mix .sc-stack-label { display: none; }
.scope-tier-mix .sc-stack-row { gap: 8px; }
.scope-tier-mix .sc-stack-track { height: 16px; border-radius: 5px; }
.scope-tier-mix .sc-stack-total {
  width: auto;
  min-width: 40px;
  font-size: 0.78rem;
  color: var(--text);
  font-weight: 600;
}
.scope-windows {
  flex: 0 0 168px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4px 0 2px 14px;
  min-width: 0;
}
.scope-window-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.scope-window-chip {
  background: color-mix(in srgb, var(--surface2) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 8px;
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.scope-window-chip small {
  color: var(--muted);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.scope-window-chip strong {
  color: var(--kpi);
  font-size: 1.02rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.scope-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 14px;
}
.scope-view-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.scope-view-label {
  font-size: 0.62rem;
  color: var(--muted);
  padding: 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}
.scope-view-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 40px;
  transition: background .15s, color .15s;
}
.scope-view-btn:hover { color: var(--text); }
.scope-view-btn.active {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface2));
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent2) 35%, transparent);
}
.scope-sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}
.scope-sort select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  min-height: 44px;
}

.scope-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}
.scope-pager-count {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.scope-pg-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  color: var(--muted);
  padding: 0 6px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.scope-dossier .scope-page-input.pg-input {
  width: 5ch;
  min-width: 5ch;
  max-width: 9ch;
}
.scope-pg-btn {
  font-size: 0.78rem;
  padding: 6px 12px;
  min-height: 34px;
}
.scope-pg-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Top-level dossier sections: Cards | Points of Interest | Leaderboards */
.scope-section-strip {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 20px 0 18px;
  padding: 0 0 2px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}
.scope-section-tab {
  position: relative;
  flex: 1 1 0;
  min-width: max-content;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 12px 14px 14px;
  border-radius: 0;
  cursor: pointer;
  min-height: 44px;
  transition: color .15s;
}
.scope-section-tab:hover { color: var(--text); }
.scope-section-tab.active {
  color: var(--kpi);
  background: transparent;
  box-shadow: none;
}
.scope-section-tab.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, #ffd700, #fb923c);
}
.scope-section-panel[hidden] { display: none !important; }
.scope-section-panel { margin-bottom: 8px; }
.scope-subtab-title {
  margin: 22px 0 8px;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.scope-tabstrip {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0;
  margin: 0 0 14px;
  border-bottom: 1px solid var(--border);
}
.scope-tab {
  position: relative;
  flex: 0 0 auto;
  scroll-snap-align: start;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 10px 12px 12px;
  border-radius: 0;
  cursor: pointer;
  min-height: 42px;
}
.scope-tab:hover { color: var(--text); }
.scope-tab.active {
  color: var(--kpi);
  border-color: transparent;
  background: transparent;
  font-weight: 700;
}
.scope-tab.active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, #ffd700, #fb923c);
}

.scope-row, .scope-board-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  color: inherit;
  text-decoration: none;
  contain: layout style;
}
a.scope-row:hover, a.scope-board-row:hover {
  background: color-mix(in srgb, var(--card-hover) 8%, transparent);
}
.scope-rank {
  width: 52px;
  flex-shrink: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
}
.scope-row-main { min-width: 0; flex: 1; }
.scope-row-label {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  font-size: 0.9rem;
}
.scope-row-metric {
  text-align: right;
  flex-shrink: 0;
}
.scope-row-metric strong { color: var(--kpi); display: block; }
.scope-row-metric small { color: var(--muted); font-size: 0.7rem; }

.scope-tier-line { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.scope-tier-chip {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface2);
  color: var(--muted);
  font-weight: 600;
}
.scope-tier-chip b { margin-left: 3px; color: inherit; font-weight: 700; }

/* Breakdown — share rails + stacked tier mix (all entity tabs) */
.scope-bd-rows {
  --scope-row-h: 58px;
  min-height: calc(var(--scope-row-h) * 20);
}
.scope-bd-row .scope-row-main,
.scope-ver-row .scope-row-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.scope-bd-head,
.scope-ver-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
}
.scope-ver-label {
  flex: 0 0 52px;
  min-width: 52px;
  color: var(--accent2);
  font-variant-numeric: tabular-nums;
}
.scope-bd-head .scope-row-label:not(.scope-ver-label) {
  flex: 0 1 140px;
  min-width: 72px;
  max-width: 180px;
}
.scope-share-rail,
.scope-ver-rail {
  flex: 1;
  min-width: 0;
  height: 8px;
  border-radius: 99px;
  background: var(--surface2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.scope-share-rail-thin { height: 4px; opacity: 0.85; }
.scope-share-rail i,
.scope-ver-rail i {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.scope-tier-stack {
  display: flex;
  width: 100%;
  height: 5px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--surface2);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.scope-tier-stack span { display: block; height: 100%; min-width: 0; }
.scope-row-filler,
.scope-card-filler,
.scope-insight-filler {
  pointer-events: none;
  visibility: hidden;
}
.scope-row-filler {
  min-height: var(--scope-row-h, 58px);
  border-bottom: 1px solid transparent;
}
.scope-cards.sd-cards {
  --scope-card-min-h: 260px;
  min-height: calc(var(--scope-card-min-h) * 2 + 14px);
}
.scope-card-filler {
  min-height: var(--scope-card-min-h);
  border: 1px solid transparent;
  background: transparent;
  border-radius: 12px;
}
.scope-tab-panel { min-height: calc(58px * 20); }

.scope-insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 8px;
  --scope-insight-h: 168px;
  min-height: calc(var(--scope-insight-h) * 2 + 10px);
}
.scope-insight-tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  color: inherit;
  text-decoration: none;
  min-height: var(--scope-insight-h, 168px);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  contain: layout style;
  transition: border-color .15s, transform .15s;
}
.scope-insight-filler {
  background: transparent;
  border-color: transparent;
}
.scope-insight-empty { grid-column: 1 / -1; }
a.scope-insight-tile:hover {
  border-color: color-mix(in srgb, var(--accent2) 45%, var(--border));
  transform: translateY(-1px);
}
.scope-insight-head {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  min-width: 0;
}
.scope-insight-head > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scope-insight-head .scope-tip-btn {
  margin-left: auto;
  flex-shrink: 0;
}
.scope-insight-who {
  margin-top: 10px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.scope-who-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}
.scope-who-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  color: inherit;
  text-decoration: none;
}
a.scope-who-chip:hover .scope-who-name { color: var(--accent2); }
.scope-who-list .scope-who-ava,
.scope-who-list .scope-who-ava-fb {
  width: 24px;
  height: 24px;
}
.scope-who-list .scope-who-name { font-size: 0.8rem; }
.scope-who-ava,
.scope-who-ava-fb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface2);
}
.scope-who-ava-fb {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.58rem;
  font-weight: 800;
  color: var(--accent2);
}
.scope-who-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scope-insight-headline {
  margin-top: 8px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.98rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scope-insight-headline-compact {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text);
  white-space: normal;
  line-height: 1.35;
}
.scope-insight-gap-line {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 6px;
}
.scope-insight-gap-sep { color: var(--muted); font-weight: 500; }
.scope-insight-tiergap-detail {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}
.scope-insight-gap-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}
.scope-insight-gap-bar {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.scope-insight-gap-bar-lab {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
}
.scope-insight-gap-bar-n {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 1.5em;
  text-align: right;
}
.scope-insight-tiergap .scope-tier-stack { margin-top: 2px; }
.scope-insight-tiergap .scope-tier-line { margin-top: 0; }
.scope-insight-card-link {
  color: inherit;
  text-decoration: none;
}
.scope-insight-card-link:hover { color: var(--accent2); }
.scope-insight-detail {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}
.scope-insight-tier { font-weight: 600; }
.scope-insight-tier-sep { color: var(--muted); }
.scope-insight-cover-link {
  display: inline-block;
  margin-top: 8px;
  max-width: 100%;
}
.scope-insight-cover {
  display: block;
  width: 40px; height: 56px; object-fit: cover; border-radius: 6px;
  margin-top: 8px; border: 1px solid var(--border);
}
.scope-insight-cover-link .scope-insight-cover { margin-top: 0; }

.scope-board-nav { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.scope-board-group-label {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.scope-board-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.scope-board-chip-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.scope-board-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 40px;
  transition: border-color .15s, color .15s, background .15s;
}
.scope-board-chip:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent2) 40%, var(--border)); }
.scope-board-chip.active {
  color: var(--kpi);
  border-color: rgba(255, 215, 0, 0.45);
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.09), rgba(255, 215, 0, 0.02));
}
.scope-tip-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  line-height: 1;
  padding: 6px 4px;
  cursor: help;
  min-width: 28px;
  min-height: 28px;
  border-radius: 999px;
}
.scope-tip-btn:hover,
.scope-tip-btn:focus-visible {
  color: var(--accent2);
  outline: none;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.scope-board-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.scope-board-rows {
  --scope-board-row-h: 52px;
  min-height: calc(var(--scope-board-row-h) * 20);
}
.scope-board-rows .scope-row-filler {
  min-height: var(--scope-board-row-h);
}
.scope-board-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.scope-board-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--serif);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.scope-tip {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  max-width: 280px;
  background: #292524;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity 0.15s;
}
.scope-tip.show { opacity: 1; }
.scope-board-av {
  width: 28px; height: 28px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0; background: var(--surface2);
}

.scope-empty, .scope-region-err {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 18px 4px;
}
.scope-region-err { color: var(--danger); }
.scope-region-busy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.scope-region-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-top-color: var(--accent2);
  animation: scope-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes scope-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .scope-region-spinner { animation: none; border-top-color: var(--muted); }
}
/* Dim content while busy — no skeleton grids in the dossier. */
[data-scope-region].is-loading > :not(.scope-region-busy):not(.sd-section-title):not(.scope-sec-kicker) {
  opacity: 0.35;
  pointer-events: none;
}

@media (max-width: 980px) {
  .scope-tier-mix-body {
    flex-wrap: wrap;
    gap: 12px 0;
  }
  .scope-tier-charts {
    flex: 1 1 100%;
  }
  .scope-chart-cell--stack { padding-right: 0; }
  .scope-windows {
    flex: 1 1 100%;
    border-left: 0;
    border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
    padding: 12px 0 0;
  }
  .scope-window-strip { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 720px) {
  .scope-tier-charts {
    flex-direction: column;
    gap: 10px;
  }
  .scope-chart-cell {
    padding: 0;
  }
  .scope-chart-cell + .scope-chart-cell {
    border-left: 0;
    border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
    padding: 10px 0 0;
  }
  .scope-tier-mix .sc-donut-wrap { flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .scope-hero-inner { flex-direction: column; align-items: stretch; }
  .scope-hero-card { width: 72px; height: 100px; }
  .scope-hero.has-watch .scope-hero-inner {
    align-items: center;
    text-align: center;
  }
  .scope-hero.has-watch .scope-hero-card {
    order: -1;
    width: var(--ar-w);
    min-width: var(--ar-w);
    height: auto;
    --ar-w: min(200px, 68vw);
  }
  .scope-hero.has-watch .scope-hero-meta { order: 0; }
  .scope-hero.has-watch .scope-kpis { justify-content: center; }
  .scope-tier-mix { padding: 10px 12px 12px; }
  .scope-window-strip { grid-template-columns: 1fr 1fr; gap: 6px; }
  .scope-boards .scope-board-nav { gap: 14px; }
  .scope-insight-grid {
    grid-template-columns: 1fr 1fr;
    min-height: calc(var(--scope-insight-h, 132px) * 3 + 20px);
  }
  .scope-tabstrip { gap: 4px; }
  .scope-section-strip { gap: 4px; padding: 3px; }
  .scope-section-tab { font-size: 0.8rem; padding: 10px 12px; }
  .scope-bd-head .scope-row-label:not(.scope-ver-label) {
    flex: 0 1 96px;
    max-width: 120px;
  }
}
@media (max-width: 420px) {
  .scope-insight-grid {
    grid-template-columns: 1fr;
    min-height: calc(var(--scope-insight-h, 132px) * 6 + 50px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .scope-insight-tile,
  .scope-board-row,
  .scope-view-btn,
  .scope-section-tab,
  .scope-tip { transition: none !important; }
}

/* ── "Site guide" drawer entry ───────────────────────────────────────────── */
/* Its own class rather than .nav-link: enhanceMainNav() rebuilds every
   .nav-link from its href, which would strip this button's icon. */
#site-nav-drawer .site-nav-guide {
  --nav-ico: #38bdf8;
  --nav-ico-glow: rgba(56, 189, 248, 0.4);
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 12px 14px;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 12px;
  background: none;
  color: var(--muted);
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: left;
  cursor: pointer;
  transition: color 0.18s, background 0.18s, transform 0.18s;
}
#site-nav-drawer .site-nav-guide .nav-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: var(--nav-ico);
  opacity: 0.92;
  transition: opacity 0.18s, filter 0.18s, transform 0.18s;
}
#site-nav-drawer .site-nav-guide:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--nav-ico) 12%, rgba(255, 255, 255, 0.03));
  transform: translateX(2px);
}
#site-nav-drawer .site-nav-guide:hover .nav-ico {
  opacity: 1;
  filter: drop-shadow(0 0 8px var(--nav-ico-glow));
  transform: scale(1.08);
}

/* ── Post-login Welcome Lightbox ─────────────────────────────────────────── */
body.welcome-lock { overflow: hidden; }

.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 9800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(220, 38, 38, 0.16) 0%, rgba(0, 0, 0, 0.86) 62%),
    rgba(0, 0, 0, 0.84);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.welcome-overlay.show { opacity: 1; }

.welcome-modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 30px 30px 26px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(251, 146, 60, 0.09), transparent 190px),
    var(--surface);
  box-shadow: 0 0 50px rgba(220, 38, 38, 0.16), 0 26px 70px rgba(0, 0, 0, 0.72);
  transform: translateY(12px) scale(0.97);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.15), opacity 0.28s ease;
}
.welcome-overlay.show .welcome-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.welcome-modal:focus { outline: none; }

.welcome-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(12, 10, 9, 0.6);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.welcome-close:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent2) 55%, transparent);
  background: rgba(220, 38, 38, 0.14);
}

/* Brand lockup — mark sits above the wordmark (same asset as landing) */
.welcome-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.welcome-mark {
  display: block;
  width: clamp(78px, 20vw, 110px);
  height: auto;
  object-fit: contain;
  /* Soft plate so the black mark card doesn't vanish into the dark dialog */
  padding: 8px 10px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 40%, rgba(251, 146, 60, 0.22), transparent 68%),
    rgba(0, 0, 0, 0.55);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent2) 35%, transparent),
    0 10px 28px rgba(251, 146, 60, 0.22);
  filter: drop-shadow(0 0 14px rgba(251, 146, 60, 0.35));
}
.welcome-wordmark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  text-align: center;
  user-select: none;
}
.welcome-wm-top {
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-weight: 900;
  font-size: clamp(1.45rem, 5.6vw, 1.95rem);
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  line-height: 1;
  color: #f5f0e8;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}
.welcome-wm-bot {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: min(100%, 17rem);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: clamp(0.6rem, 2vw, 0.73rem);
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  line-height: 1;
  color: var(--accent2);
  text-transform: uppercase;
}
.welcome-wm-bot::before,
.welcome-wm-bot::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent2));
  opacity: 0.85;
}
.welcome-wm-bot::after { background: linear-gradient(90deg, var(--accent2), transparent); }

.welcome-greet {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
  text-align: center;
  text-wrap: balance;
}

/* Paged tour — slides share one grid cell so paging never resizes the dialog */
.welcome-deck {
  display: grid;
  overflow: hidden;
}
.welcome-slide {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 14px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface2);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translateX(14px);
  transition: opacity 0.26s ease, transform 0.26s ease, visibility 0.26s;
}
.welcome-slide.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.welcome-art {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 12px;
}
.welcome-art-svg {
  width: min(208px, 72%);
  height: auto;
}
.welcome-slide-title {
  margin-bottom: 6px;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.welcome-slide-body {
  max-width: 44ch;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
}
.welcome-slide-body a {
  color: var(--accent2);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent2) 45%, transparent);
}
.welcome-slide-body a:hover { color: var(--text); }

.welcome-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
}
.welcome-dots { display: flex; align-items: center; gap: 7px; }
.welcome-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #44403c;
  cursor: pointer;
  transition: background 0.2s ease, width 0.2s ease;
}
.welcome-dot:hover { background: #6b625c; }
.welcome-dot.is-on {
  width: 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.welcome-nav { display: flex; align-items: center; gap: 8px; }
.welcome-back {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.welcome-back:hover:not(:disabled) {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent2) 55%, transparent);
}
.welcome-back:disabled { opacity: 0.32; cursor: not-allowed; }
.welcome-next { height: 36px; padding: 0 20px; font-size: 0.84rem; }

@media (max-width: 560px) {
  .welcome-overlay { padding: 12px; align-items: flex-end; }
  .welcome-modal {
    max-height: calc(100dvh - 24px);
    padding: 24px 16px 20px;
    border-radius: 16px;
  }
  .welcome-lockup { gap: 10px; margin-bottom: 12px; }
  .welcome-greet { margin-bottom: 14px; font-size: 0.82rem; }
  .welcome-slide { padding: 14px 10px 16px; }
  .welcome-art-svg { width: min(180px, 80%); }
  .welcome-foot { gap: 10px; }
  .welcome-back { padding: 0 12px; }
  .welcome-next { padding: 0 16px; }
}

/* Laptops and landscape phones: keep the whole tour above the fold */
@media (max-height: 760px) {
  .welcome-modal { padding: 22px 24px 18px; }
  .welcome-mark { width: clamp(58px, 12vh, 78px); padding: 6px 8px; }
  .welcome-lockup { gap: 8px; margin-bottom: 10px; }
  .welcome-wm-top { font-size: 1.45rem; }
  .welcome-greet { margin-bottom: 12px; font-size: 0.82rem; }
  .welcome-slide { padding: 12px 12px 14px; }
  .welcome-art { margin-bottom: 9px; }
  .welcome-art-svg { width: min(168px, 62%); }
  .welcome-foot { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .welcome-overlay,
  .welcome-modal,
  .welcome-slide { transition: none !important; }
}

/* ── Showcase spot cards (Players / Artists / Events) ───────────────────── */
/* Big fading art + side list (rank / name / stats) */
.spot-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 22px;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 18px 16px;
  color: inherit;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
  min-height: 0;
}
.spot-card:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: var(--surface2);
  transform: translateY(-2px);
}
.spot-card--hero {
  border-color: rgba(255, 215, 0, 0.5);
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.09), rgba(255, 215, 0, 0.02) 55%, transparent);
  padding: 22px 24px 20px;
}
.spot-card--hero:hover {
  border-color: rgba(255, 215, 0, 0.75);
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.13), rgba(255, 215, 0, 0.04) 55%, transparent);
}
.spot-card--hero::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px dashed rgba(255, 215, 0, 0.3);
  border-radius: 11px;
  pointer-events: none;
}
.spot-side {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  padding-right: 4px;
  container-type: inline-size;
  container-name: spot-side;
}
.spot-rank {
  font-family: var(--font-display, 'Fraunces', Georgia, serif);
  font-weight: 900;
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  line-height: 0.9;
  color: transparent;
  -webkit-text-stroke: 1.3px rgba(245, 235, 220, 0.28);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.spot-card--hero .spot-rank {
  -webkit-text-stroke: 1.4px rgba(255, 215, 0, 0.55);
  font-size: clamp(2.8rem, 6vw, 3.8rem);
}
.spot-who {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}
.spot-who:hover .spot-name { color: var(--accent2); }
.spot-emoji {
  font-size: 1.45rem;
  line-height: 1;
  flex-shrink: 0;
}
.spot-name {
  font-family: var(--font-display, 'Fraunces', Georgia, serif);
  font-weight: 800;
  font-size: clamp(1.05rem, 4.6cqi, 1.65rem);
  letter-spacing: -0.015em;
  color: var(--text);
  line-height: 1.2;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  transition: color 0.2s;
}
.spot-card--hero .spot-name {
  font-size: clamp(1.2rem, 6.2cqi, 2.4rem);
  -webkit-line-clamp: 3;
}
.spot-eyebrow {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ffd700;
}
.spot-stats {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.spot-stats li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.spot-stats li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent2) 70%, transparent);
  flex-shrink: 0;
  transform: translateY(-1px);
}
.spot-stats b {
  color: var(--text);
  font-weight: 700;
  min-width: 3.2ch;
}
.spot-statboard {
  display: flex;
  width: 100%;
  max-width: 22rem;
  margin-top: 2px;
  padding: 10px 4px 8px 0;
  border-top: 1px solid var(--border);
  gap: 0;
}
.spot-stat {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 2px 12px 2px 0;
  position: relative;
}
.spot-stat + .spot-stat {
  padding-left: 12px;
}
.spot-stat + .spot-stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14%;
  bottom: 14%;
  width: 1px;
  background: var(--accent2);
  opacity: 0.7;
}
.spot-stat-label {
  font-family: "Outfit", sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
}
.spot-stat-val {
  font-family: "Outfit", sans-serif;
  font-size: clamp(0.95rem, 2.1vw, 1.22rem);
  font-weight: 800;
  color: var(--kpi);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.spot-stat-val--ur { color: #f87171; }
.spot-card--hero .spot-stat-val {
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
}
.spot-art {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  --ar-w: clamp(168px, 18vw, 230px);
  min-width: 0;
}
.spot-card--hero .spot-art {
  --ar-w: clamp(200px, min(24vw, 34dvh), 300px);
}
.spot-art .arts-stage {
  --ar-w: inherit;
  width: var(--ar-w);
}
.spot-art .arts-meta {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--ar-w);
  min-height: 0;
}
.spot-art .arts-stat--series .arts-stat-val { color: var(--accent2); }
.spot-art .arts-stat--maker .arts-stat-val { color: var(--kpi); }

.spot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 15px;
}
.spot-grid:empty { display: none; }
@media (max-width: 900px) {
  .spot-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .spot-card {
    grid-template-columns: 1fr;
    justify-items: stretch;
    padding: 14px 14px 14px;
    gap: 12px;
  }
  .spot-card--hero { padding: 16px 14px 14px; }
  .spot-art { justify-self: center; order: -1; }
  .spot-side { align-items: stretch; padding-right: 0; }
  .spot-card--hero .spot-side { align-items: center; text-align: center; }
  .spot-card--hero .spot-who { justify-content: center; }
  .spot-stat { align-items: center; padding-right: 8px; }
  .spot-rank { font-size: clamp(1.8rem, 10vw, 2.4rem); }
  .spot-card--hero .spot-rank { font-size: clamp(2rem, 11vw, 2.7rem); }
  .spot-name {
    font-size: clamp(1.02rem, 5.4vw, 1.28rem);
    -webkit-line-clamp: 3;
  }
  .spot-card--hero .spot-name {
    font-size: clamp(1.12rem, 6.4vw, 1.55rem);
    -webkit-line-clamp: 3;
  }
  .spot-stats li { font-size: 0.78rem; }
  .spot-card:hover { transform: none; }
}

/* Arts rotator sizes — big fade hero for spot cards */
.arts-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  min-width: 0;
}
.arts-rotator {
  --ar-w: 168px;
  --ar-h: 234px;
  position: relative;
  display: block;
  width: var(--ar-w);
  height: var(--ar-h);
  margin: 0;
  flex-shrink: 0;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface2);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
  font: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
}
button.arts-rotator { cursor: zoom-in; }
button.arts-rotator:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
}
.arts-rotator--hl,
.arts-rotator--spot-lg {
  --ar-w: 210px;
  --ar-h: 294px;
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.48);
}
.arts-rotator--billed,
.arts-rotator--spot,
.arts-rotator--ev {
  --ar-w: 168px;
  --ar-h: 234px;
}
.arts-rotator--hero {
  --ar-w: min(220px, 42vw);
  --ar-h: calc(var(--ar-w) * 1.4);
  width: var(--ar-w);
  height: var(--ar-h);
  border-radius: 16px;
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.55);
}
.arts-rotator--watch {
  --ar-w: min(240px, 68vw);
  --ar-h: calc(var(--ar-w) * 1.4);
  width: var(--ar-w);
  height: var(--ar-h);
  border-radius: 16px;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.arts-rotator-slot {
  position: relative;
  width: var(--ar-w, 240px);
  height: calc(var(--ar-w, 240px) * 1.4);
  flex-shrink: 0;
  z-index: 1;
}
.arts-art-glow {
  position: absolute;
  inset: -3%;
  z-index: 0;
  pointer-events: none;
  border-radius: 20px;
  overflow: hidden;
  filter: blur(11px) saturate(1.15);
  opacity: 0.32;
  transform: scale(1.01);
}
.arts-art-glow img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.75s ease;
}
.arts-art-glow img.is-active { opacity: 1; }
.arts-rotator-slot .arts-rotator--watch {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  --ar-w: inherit;
  --ar-h: calc(var(--ar-w) * 1.4);
}
.arts-meta-series {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.3;
}
.arts-meta-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.arts-meta-kicker {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent2);
}
.arts-meta-claimed {
  margin-top: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.arts-statbar {
  display: flex;
  width: 100%;
  max-width: var(--ar-w, 256px);
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}
.arts-stat {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 5px 6px 6px;
  min-width: 0;
  position: relative;
}
.arts-stat + .arts-stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 1px;
  background: var(--accent2);
  opacity: 0.7;
}
.arts-stat-label {
  font-family: "Outfit", sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
}
.arts-stat-val {
  font-family: "Outfit", sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.arts-stat--tier[data-tier="C"] .arts-stat-val { color: #4ade80; }
.arts-stat--tier[data-tier="R"] .arts-stat-val { color: #7dd3fc; }
.arts-stat--tier[data-tier="SR"] .arts-stat-val { color: #d8b4fe; }
.arts-stat--tier[data-tier="SSR"] .arts-stat-val { color: #fbbf24; }
.arts-stat--tier[data-tier="UR"] .arts-stat-val { color: #f87171; }
.arts-stat--ver .arts-stat-val { color: var(--accent2); }
.arts-stat--claimed .arts-stat-val { color: var(--text); font-weight: 700; }
.arts-claimed-time { color: var(--kpi); }
.arts-stat--name .arts-stat-val {
  font-size: 0.78rem;
}
.arts-stat--series .arts-stat-val {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
}
.arts-stat--maker .arts-stat-val {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--kpi);
}
.arts-stat-val.arts-meta-name,
.arts-stat-val.arts-meta-series,
.arts-stat-val.arts-meta-maker {
  display: block;
  -webkit-line-clamp: unset;
  overflow-wrap: normal;
  word-break: normal;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.arts-rotator img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.75s ease;
  pointer-events: none;
  user-select: none;
}
.arts-rotator img.is-active {
  opacity: 1;
  z-index: 1;
}
.arts-meta {
  width: 100%;
  max-width: var(--ar-w, 168px);
  text-align: center;
  min-height: 2.5em;
}
.arts-meta-name {
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.arts-meta-ver {
  margin-top: 2px;
  font-size: 0.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent2);
  letter-spacing: 0.04em;
}
.arts-meta-tier {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  background: var(--surface2);
  color: var(--muted);
}
.arts-meta-tier[data-tier="C"] { background: #22c55e; color: #052e16; }
.arts-meta-tier[data-tier="R"] { background: #60a5fa; color: #0b1f3a; }
.arts-meta-tier[data-tier="SR"] { background: #c084fc; color: #2e1064; }
.arts-meta-tier[data-tier="SSR"] { background: #fbbf24; color: #1c1403; }
.arts-meta-tier[data-tier="UR"] { background: #f87171; color: #2a0b0b; }
.spot-card:hover .arts-rotator {
  border-color: color-mix(in srgb, var(--accent2) 55%, var(--border));
}
.ev-show-ph {
  width: 168px;
  height: 234px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: var(--surface2);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
}
@media (max-width: 560px) {
  .arts-rotator--hl,
  .arts-rotator--spot-lg {
    --ar-w: 168px;
    --ar-h: 234px;
  }
  .arts-rotator--billed,
  .arts-rotator--spot,
  .arts-rotator--ev {
    --ar-w: 148px;
    --ar-h: 206px;
  }
  .arts-rotator--hero {
    --ar-w: min(168px, 46vw);
    --ar-h: calc(var(--ar-w) * 1.4);
  }
  .arts-rotator--watch {
    --ar-w: min(220px, 72vw);
    --ar-h: calc(var(--ar-w) * 1.4);
  }
}

/* Card preview lightbox */
.arts-preview {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 24px;
}
.arts-preview[hidden] { display: none !important; }
.arts-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.arts-preview-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: min(92vw, 420px);
  transform: translateY(10px) scale(0.97);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.arts-preview.is-open .arts-preview-backdrop { opacity: 1; }
.arts-preview.is-open .arts-preview-panel {
  opacity: 1;
  transform: none;
}
.arts-preview-art {
  width: min(78vw, 320px);
  height: auto;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent2) 40%, var(--border));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  background: var(--surface2);
}
.arts-preview-caption {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.65);
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.arts-preview-name {
  font-weight: 800;
  font-size: 1.05rem;
}
.arts-preview-sub {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.arts-preview-claimed {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent2);
}
.arts-preview-close {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  z-index: 2;
}
.arts-preview-close:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}
body.arts-preview-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .arts-rotator img,
  .arts-preview-backdrop,
  .arts-preview-panel { transition: none !important; }
}
