/* ============================================================================
 * BBSS v6.16 · Components · Magic Eden + Polymarket style
 *   - 5% pixel rule: magenta only on CTA / active tab / brand moments
 *   - Hover = tonal surface lift, NOT colored glow
 *   - No shine sweeps, no halos, no gradient borders
 * ============================================================================ */

/* ────── Top Nav ──────────────────────────────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: var(--z-nav);
  background: rgba(21, 17, 29, 0.85);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border);
  min-height: 84px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  transition: box-shadow var(--t-base) var(--ease), background var(--t-base) var(--ease);
}
.topnav.is-scrolled {
  background: rgba(21, 17, 29, 0.95);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.topnav .nav-hamburger {
  display: none;
  background: none; border: none; color: var(--text-1);
  padding: 6px; cursor: pointer; border-radius: 6px;
}
.topnav .nav-hamburger:hover { background: var(--bg-2); }
@media (max-width: 920px) {
  .topnav .nav-hamburger { display: flex; align-items: center; }
  .topnav .nav-links { display: none; }
  .topnav .search-box { display: none; }
  .topnav .live-pill { display: none; }
}

.topnav .brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.012em;
  color: var(--text-1);
  padding: 0;
  border: 0;
}
.topnav .brand-mark-img {
  width: 72px; height: 72px;
  display: block;
  transition: transform var(--t-fast) var(--ease), filter var(--t-fast);
  object-fit: contain;
  background: transparent;
  /* No border-radius / no padding — let the transparent PNG breathe */
}
.topnav .brand:hover .brand-mark-img {
  transform: scale(1.04);
  filter: drop-shadow(0 0 14px rgba(255, 45, 170, 0.50)) drop-shadow(0 0 14px rgba(34, 211, 238, 0.35));
}
/* Legacy class kept for any remaining usage */
.topnav .brand-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--brand-magenta);
  display: grid; place-items: center;
  color: #FFFFFF;
  font-weight: 900;
  font-size: 16px;
  transition: transform var(--t-fast) var(--ease);
}
.topnav .nav-links { display: flex; align-items: center; gap: 4px; margin-left: 12px; flex-shrink: 0; }
.topnav .nav-link {
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-2);
  display: flex; align-items: center; gap: 6px;
  transition: all var(--t-fast) var(--ease);
  white-space: nowrap;
  flex-shrink: 0;
}
.topnav .nav-link:hover { color: var(--text-1); background: var(--bg-2); }
.topnav .nav-link.active {
  color: var(--text-1);
  background: var(--bg-2);
  position: relative;
}
.topnav .nav-link.active::after {
  content: '';
  position: absolute;
  left: 12px; right: 12px;
  bottom: -1px;
  height: 2px;
  background: var(--brand-magenta);
  border-radius: 1px;
}
.topnav .search-box {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  flex: 1 1 220px;
  max-width: 280px;
  min-width: 100px;
  overflow: hidden;
  transition: border-color var(--t-fast);
  position: relative;
}
.topnav .search-box:focus-within { border-color: var(--border-3); }
.topnav .search-box input { background: transparent; border: 0; outline: none; flex: 1; min-width: 0; font-size: 12.5px; color: var(--text-1); text-overflow: ellipsis; overflow: hidden; }
.topnav .search-box .key { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); padding: 1px 5px; border: 1px solid var(--border); border-radius: 4px; }

/* ── Search Dropdown ─────────────────────────────────────────────────── */
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(380px, calc(100vw - 32px));
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-overlay);
  padding: 4px;
  max-height: 420px;
  overflow-y: auto;
}
.search-empty {
  display: flex; align-items: center; gap: 8px;
  padding: 20px 14px;
  font-size: 12.5px;
  color: var(--text-3);
}
.search-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-1);
  font-size: 12.5px;
  text-align: left;
  transition: background var(--t-fast);
  cursor: pointer;
  border: 0;
}
.search-item:hover,
.search-item.is-active {
  background: var(--bg-2);
}
.search-item-icon { color: var(--text-3); flex-shrink: 0; }
.search-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.search-item-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item-sub { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item-badge {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-3);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
}
.search-hint {
  display: flex; gap: 12px; justify-content: center;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--text-3);
}
.search-hint kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 4px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-2);
}
.topnav .live-pill {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-2);
  flex-shrink: 0;
}
.topnav .btn { flex-shrink: 0; }
.topnav .live-pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--up);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.topnav .account-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-full);
  padding: 4px 12px 4px 4px;
  font-size: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}
.topnav .account-pill .avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: grid; place-items: center;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
}

/* ────── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-2);
  background: var(--bg-2);
  color: var(--text-1);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--bg-3); border-color: var(--border-3); }
.btn:active { background: var(--bg-2); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--brand-magenta);
  color: #FFFFFF;
  border-color: var(--brand-magenta);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--brand-magenta-hover);
  border-color: var(--brand-magenta-hover);
}
.btn-primary:active { background: #C81E68; }

.btn-ghost { background: transparent; border-color: var(--border-2); color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-2); border-color: var(--border-3); color: var(--text-1); }

.btn-outline-neon {
  background: transparent;
  border: 1px solid var(--brand-magenta);
  color: var(--brand-magenta);
}
.btn-outline-neon:hover { background: var(--brand-magenta-soft); }

.btn-danger {
  background: rgba(255, 89, 82, 0.10);
  border-color: rgba(255, 89, 82, 0.40);
  color: var(--down);
}
.btn-danger:hover { background: rgba(255, 89, 82, 0.16); }

.btn-up {
  background: rgba(39, 208, 128, 0.12);
  border-color: rgba(39, 208, 128, 0.40);
  color: var(--up);
}
.btn-up:hover { background: rgba(39, 208, 128, 0.18); }

.btn-sm { font-size: 12px; padding: 6px 11px; gap: 6px; }
.btn-lg { font-size: 14px; padding: 11px 20px; }

/* ────── Card ──────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
  transition: background var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.card-hover { cursor: pointer; }
.card-hover:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-2);
}
/* card-neon: kept name for backward compat but now neutral lifted card */
.card-neon {
  background: var(--bg-2);
  border-color: var(--border-2);
}

/* ────── Chips & Badges ───────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.chip-neon, .chip-pink, .chip-magenta {
  background: var(--brand-magenta-soft);
  color: var(--brand-magenta);
  border-color: var(--border-magenta);
}
.chip-cyan {
  background: var(--brand-cyan-soft);
  color: var(--brand-cyan);
  border-color: var(--border-cyan);
}
.chip-purple {
  background: var(--brand-purple-soft);
  color: var(--brand-purple);
  border-color: rgba(108, 92, 231, 0.30);
}
.chip-amber {
  background: var(--neon-amber-soft);
  color: var(--neon-amber);
  border-color: rgba(255, 181, 71, 0.30);
}
.chip-up {
  background: rgba(39, 208, 128, 0.12);
  color: var(--up);
  border-color: var(--border-up);
}
.chip-down {
  background: rgba(255, 89, 82, 0.12);
  color: var(--down);
  border-color: var(--border-down);
}
.chip-live::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--up);
  animation: pulse 1.6s infinite;
}

/* ────── KPI Stat ─────────────────────────────────────────────────────── */
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: background var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.kpi .kpi-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 6px;
  font-weight: 500;
}
.kpi .kpi-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  margin-top: 6px;
  letter-spacing: -0.02em;
  color: var(--text-1);
  line-height: 1.15;
}
.kpi .kpi-value.mono {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum';
}
.kpi .kpi-trend { font-size: 11px; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.kpi:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-2);
}

/* ────── Progress ─────────────────────────────────────────────────────── */
.progress {
  height: 6px;
  background: var(--bg-2);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.progress > .bar {
  height: 100%;
  background: var(--brand-magenta);
  border-radius: inherit;
  transition: width var(--t-slow) var(--ease);
}
.progress-thin { height: 3px; }
.progress-up > .bar { background: var(--up); }

/* ────── Tab ──────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
  overflow-x: auto;
  scrollbar-width: none;
  flex-wrap: nowrap;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex; align-items: center; gap: 6px;
  transition: color var(--t-fast), border-color var(--t-fast);
  position: relative;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.tab:hover { color: var(--text-2); }
.tab.active {
  color: var(--text-1);
  border-color: var(--brand-magenta);
  font-weight: 600;
}
/* Reduce padding and font-size slightly for tabs in narrow sidebars so they fit perfectly */
.split-aside-main-320 .tab {
  padding: 9px 8px;
  font-size: 12px;
}
.split-aside-main-320 .tab .count {
  padding: 1px 4px;
  font-size: 10px;
}
.tab .count {
  font-size: 11px;
  color: var(--text-dim);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-2);
}
.tab.active .count { background: var(--brand-magenta-soft); color: var(--brand-magenta); }

/* Pills (compact tab variant) */
.pills { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.pill {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: var(--radius-full);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: flex; align-items: center; gap: 5px;
  transition: all var(--t-fast);
}
.pill:hover { color: var(--text-1); border-color: var(--border-2); background: var(--bg-3); }
.pill.active {
  background: var(--brand-magenta-soft);
  border-color: var(--brand-magenta);
  color: var(--brand-magenta);
  font-weight: 600;
}

/* ────── Tables ───────────────────────────────────────────────────────── */
.tbl { width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.tbl thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  position: sticky; top: 0;
}
.tbl tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.tbl tbody tr { transition: background var(--t-fast); }
.tbl tbody tr:hover { background: var(--bg-2); }
.tbl tbody tr:hover td:first-child { color: var(--text-1); }
.tbl tbody tr:last-child td { border-bottom: 0; }

/* ────── LIVE Ticker ──────────────────────────────────────────────────── */
.live-ticker {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 0;
  overflow: hidden;
  position: relative;
}
.live-ticker::before, .live-ticker::after {
  content: '';
  position: absolute; top: 0; bottom: 0; width: 64px;
  z-index: 2;
  pointer-events: none;
}
.live-ticker::before { left: 0; background: linear-gradient(90deg, var(--bg-card), transparent); }
.live-ticker::after { right: 0; background: linear-gradient(-90deg, var(--bg-card), transparent); }
.live-track {
  display: flex; gap: 28px;
  animation: tickerScroll 60s linear infinite;
  white-space: nowrap;
  width: max-content;
}
.live-track:hover { animation-play-state: paused; }
@keyframes tickerScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.live-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  color: var(--text-2);
  font-family: var(--font-mono);
}
.live-item .ic { color: var(--text-2); display: inline-flex; }
.live-item .actor { color: var(--text-1); }
.live-item .tag {
  font-size: 10px; padding: 1px 7px; border-radius: var(--radius-full);
  background: var(--bg-2); color: var(--text-3); border: 1px solid var(--border);
}
.live-item .ago { color: var(--text-dim); font-size: 11px; }
.live-item.kind-challenge .ic { color: var(--neon-amber); }
.live-item.kind-stake .ic     { color: var(--info-blue); }
.live-item.kind-admin .ic     { color: var(--brand-purple); }
.live-item.kind-task .ic      { color: var(--brand-magenta); }
.live-divider { width: 1px; background: var(--border); align-self: stretch; }

/* ────── Hero ─────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: 28px 0 24px;
  overflow: visible;     /* let logo extend past bottom into next section */
  z-index: 0;
}
/* Hero container — same width as page .container */
.hero > .container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 24px;
}
.hero h1 {
  animation: heroFadeIn 0.5s var(--ease) both;
}
@keyframes heroFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.hero .hero-tagline {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 5px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-full);
  background: var(--bg-2);
  text-transform: uppercase;
}
.hero .hero-tagline::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--up);
  animation: pulse 1.8s ease-in-out infinite;
  flex-shrink: 0;
}
.hero h1 {
  font-size: clamp(40px, 6.5vw, 84px);
  font-weight: 600;
  letter-spacing: -0.032em;
  margin-bottom: 18px;
  line-height: 1.04;
  color: var(--text-1);
}
.hero p.lede {
  font-size: 16px;
  color: var(--text-2);
  max-width: 620px;
  line-height: 1.6;
}
.hero .glow-grid { display: none; }
/* 3D hero — align toward left of right column */
.hero-with-3d .hero-3d { margin-left: 0; }

/* ──── Hero 3D · full-width backdrop strip + bigger centered-right logo ──── */
.hero-3d {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 1380px;
  /* extends below hero into next section to allow ticker overlap */
  height: calc(100% + 120px);
  pointer-events: auto;
  perspective: 900px;       /* deeper perspective = more pronounced 3D tilt */
  cursor: crosshair;
  user-select: none;
  z-index: 0;
}
.hero-3d-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
/* Right cluster (ring + logo), absolutely positioned within the strip */
/* Bigger logo, pushed toward center, extends below hero */
.hero-3d-right {
  position: absolute;
  right: clamp(90px, 14vw, 250px);     /* +30px left vs prior — closer to center */
  top: 50%;
  transform: translateY(-46%);
  width: clamp(360px, 36vw, 540px);
  height: clamp(360px, 36vw, 540px);
  pointer-events: none;
  z-index: 1;
}
.hero-3d-ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: rotate(var(--ring-rot, 0deg));
  filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.20))
          drop-shadow(0 0 10px rgba(255, 45, 170, 0.18));
  will-change: transform;
}
.hero-3d-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transform-style: preserve-3d;
  pointer-events: none;
}
.hero-3d-logo {
  width: 86%;
  height: auto;
  transform-style: preserve-3d;
  will-change: transform;
  transition: filter var(--t-base) var(--ease);
  filter:
    drop-shadow(0 0 36px rgba(255, 45, 170, 0.50))
    drop-shadow(0 0 36px rgba(34, 211, 238, 0.40));
  pointer-events: none;
}
.hero-3d:hover .hero-3d-logo {
  filter:
    drop-shadow(0 0 56px rgba(255, 45, 170, 0.65))
    drop-shadow(0 0 56px rgba(34, 211, 238, 0.55));
}

/* Hero text container sits on top of the canvas strip but clicks fall through */
.hero .container {
  position: relative;
  z-index: 2;
  pointer-events: none;   /* let mouse events fall through to the 3D strip behind */
}
.hero .hero-text {
  pointer-events: auto;   /* re-enable inside the text block so buttons work */
  max-width: clamp(360px, 50vw, 680px);   /* limit width — right side empty/clickable */
  margin-left: 20px;      /* shift right */
  margin-top: 15px;       /* shift down */
}

/* The LIVE ticker section (first section after hero) must overlay the logo bottom */
.hero ~ .container > section:first-child,
.hero + .container > section:first-child {
  position: relative;
  z-index: 5;
}
.c-content > .container { position: relative; z-index: 3; }

/* Mobile: stack — text first, logo below */
@media (max-width: 920px) {
  .hero {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .hero > .container { order: 1; }
  .hero-3d { order: 2; }
  .hero-3d {
    position: relative;
    height: auto;
    min-height: 320px;
    margin-top: 24px;
    top: auto; left: auto; right: auto;
  }
  .hero-3d-right {
    position: relative;
    right: auto; top: auto;
    transform: none;
    margin: 0 auto;
    width: 280px;
    height: 280px;
  }
  .hero-3d-canvas { position: absolute; inset: 0; }
  .hero .hero-text { padding-right: 0; max-width: 100%; }
}

/* ────── Form ─────────────────────────────────────────────────────────── */
.input, .select, .textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-1);
  width: 100%;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-magenta);
  background: var(--bg-1);
}
.input::placeholder { color: var(--text-dim); }
.field-label {
  display: block;
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

/* ────── Modal ────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 8, 18, 0.78);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: grid; place-items: center;
  animation: fadeIn var(--t-base) var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: min(440px, 92vw);
  box-shadow: var(--shadow-lg);
  animation: modalIn var(--t-base) var(--ease-spring);
  position: relative;
}
@keyframes modalIn { from { transform: translateY(8px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* ────── Helpers ──────────────────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.gap-sm { gap: 8px; }
.gap-md { gap: 14px; }
.gap-lg { gap: 24px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }

.glow-text { color: var(--text-1); }
.gradient-border {
  position: relative;
  border-color: var(--border-2);
}

/* ────── Mobile-safe split layouts ────────────────────────────────────── */
.split-main-aside-280  { display: grid; gap: 16px; grid-template-columns: 1fr 280px; }
.split-main-aside-320  { display: grid; gap: 16px; grid-template-columns: 1fr 320px; }
.split-main-aside-340  { display: grid; gap: 20px; grid-template-columns: 1fr 340px; }
.split-main-aside-360  { display: grid; gap: 20px; grid-template-columns: 1fr 360px; }
.split-main-aside-380  { display: grid; gap: 20px; grid-template-columns: 1fr 380px; }
.split-aside-main-240  { display: grid; gap: 16px; grid-template-columns: 240px 1fr; }
.split-aside-main-320  { display: grid; gap: 16px; grid-template-columns: 320px 1fr; }
.split-2fr-1fr         { display: grid; gap: 20px; grid-template-columns: 2fr 1fr; }
.split-admin-kpi       { display: grid; gap: 14px; grid-template-columns: 1fr 1fr 1fr 1fr 220px; }

/* ────── Table horizontal scroll wrapper ────────────────────────────── */
.tbl-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl-scroll table { min-width: 640px; }

/* ────── Legacy mobile drawer hidden ──────────────────────────────────── */
.nav-toggle, .nav-drawer { display: none; }
.topnav-row2 { display: none; }
.topnav-spacer { display: none; }

/* ────── Nav compact breakpoint ───────────────────────────────────────── */
@media (max-width: 1360px) {
  .topnav { gap: 10px; }
  .topnav .search-box { flex: 1 1 160px; max-width: 200px; min-width: 80px; }
  .topnav .btn.btn-outline-neon span,
  .topnav .btn.btn-primary span { display: none; }
  .topnav .btn.btn-outline-neon,
  .topnav .btn.btn-primary { padding: 8px 10px; min-width: 36px; }
  .topnav .account-pill > div:not(.avatar) { display: none; }
  .topnav .account-pill { padding: 4px; border-radius: 50%; }
}

/* ────── Tablet breakpoint ────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topnav .search-box { display: none; }
  .split-main-aside-280,
  .split-main-aside-320,
  .split-main-aside-340,
  .split-main-aside-360,
  .split-main-aside-380 { grid-template-columns: minmax(0, 1fr); }
  .split-aside-main-240,
  .split-aside-main-320 { grid-template-columns: minmax(0, 1fr); }
  .split-2fr-1fr { grid-template-columns: minmax(0, 1fr); }
  .split-admin-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  [data-mobile-static] { position: static !important; }
}

/* Grid children should also be allowed to shrink below content size */
[class*="split-"] > * { min-width: 0; }

.card, .kpi, .live-ticker { overflow: hidden; }
.row, .col { min-width: 0; }
.row > *, .col > * { min-width: 0; }

/* ────── Mobile breakpoint (≤920px) ──────────────────────────────────── */
@media (max-width: 920px) {
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: minmax(0, 1fr); }
  .split-admin-kpi { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .grid > * { min-width: 0; }

  /* container padding */
  .container, .container-wide { padding: 0 14px; }

  /* 2-row mobile topnav */
  .topnav {
    min-height: 76px;
    padding: 8px 14px 0;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
  }
  .topnav .search-box { display: none; }
  .topnav .live-pill { display: none; }
  .topnav .brand { margin-right: auto; gap: 8px; }
  .topnav .brand span { display: inline; font-size: 16px; font-weight: 700; }
  .topnav .brand-mark { width: 28px; height: 28px; font-size: 13px; }
  .topnav .brand-mark-img { width: 56px; height: 56px; }
  .topnav .btn.btn-primary,
  .topnav .btn.btn-outline-neon,
  .topnav .btn.btn-ghost {
    padding: 8px 12px;
    font-size: 12.5px;
    min-height: 36px;
    min-width: 36px;
  }
  .topnav .account-pill {
    padding: 4px 8px 4px 4px;
    background: var(--bg-2);
    flex-shrink: 0;
  }
  .topnav .account-pill > div:not(.avatar) { display: none; }
  .topnav .account-pill .avatar { width: 32px; height: 32px; font-size: 12px; }
  .topnav .nav-links {
    order: 99;
    flex: 0 0 100%;
    margin: 0 -14px;
    padding: 6px 14px 8px;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid var(--border);
    background: rgba(21, 17, 29, 0.4);
    flex-wrap: nowrap;
    display: flex;
    align-items: center;
  }
  .topnav .nav-links::-webkit-scrollbar { display: none; }
  .topnav .nav-link {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: var(--radius-md);
    white-space: nowrap;
  }
  .topnav .nav-link.active::after { display: none; }
  .topnav .nav-link.active {
    background: var(--brand-magenta-soft);
    color: var(--brand-magenta);
  }

  /* hero */
  .hero { padding: 48px 0 28px; }
  .hero .hero-tagline { font-size: 10px; letter-spacing: 0.14em; padding: 4px 10px; }
  .hero h1 { font-size: clamp(32px, 9vw, 48px); line-height: 1.06; margin-bottom: 16px; }
  .hero p.lede { font-size: 14px; line-height: 1.6; }

  h1 { font-size: clamp(22px, 6.5vw, 30px) !important; }
  .kpi .kpi-value { font-size: 20px; }
  .card { padding: 14px; }

  .row.wrap > .pills { width: 100%; }
  table.tbl { display: block; overflow-x: auto; min-width: 100%; -webkit-overflow-scrolling: touch; }

  section + section { margin-top: 40px; }
  .section-title { flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
  .section-title h2 { font-size: 18px; }

  .btn-primary { min-height: 44px; padding: 11px 18px; }

  .row.between { flex-wrap: wrap; gap: 10px; }
  /* Force right side of row.between with inline flex:1 to next row on mobile */
  .row.between > [style*="flex: 1"] { flex-basis: 100% !important; }
  .row.between > [style*="flex:1"]  { flex-basis: 100% !important; }
  .row.between > [style*="min-width: 200"],
  .row.between > [style*="minWidth: 200"] { min-width: 0 !important; width: 100%; text-align: left !important; }

  .container > .row.between > .row { flex-wrap: wrap; }

  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; flex-shrink: 0; }
  .pills {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    width: 100%;
    max-width: 100%;
    scrollbar-width: none;
  }
  .pills::-webkit-scrollbar { display: none; }
  .pill { white-space: nowrap; flex-shrink: 0; }

  #scanlines, #grain-overlay { opacity: 0.015; }

  h1, h2, h3 { overflow-wrap: break-word; }
  .card span, .kpi span { overflow-wrap: break-word; }
  .text-2 { overflow-wrap: break-word; }
}

/* ────── Small mobile (≤380px) ──────────────────────────────────────── */
@media (max-width: 380px) {
  .topnav { padding: 8px 12px 0; gap: 6px; }
  .topnav .btn.btn-primary { padding: 7px 10px; min-width: 36px; }
  .topnav .btn.btn-primary span,
  .topnav .btn.btn-outline-neon span { display: none; }
  .container, .container-wide { padding: 0 12px; }
  .hero h1 { font-size: clamp(28px, 9vw, 36px); }
  .kpi { padding: 14px 14px; }
  .kpi .kpi-value { font-size: 22px; }
  .card { padding: 14px; }
  .section-title h2 { font-size: 16px; }
  .split-aside-main-240, .split-aside-main-320 { grid-template-columns: 1fr !important; }
  .pills, .tabs { width: 100%; max-width: 100%; }
}

/* iOS safe-area bottom */
@supports (padding: env(safe-area-inset-bottom)) {
  body { padding-bottom: env(safe-area-inset-bottom); }
}

/* ════════════════════════════════════════════════════════════════════════
 * v6.16 NEW · Community Chat, Plaza, Rich Editor, Notifications, Activation
 * ════════════════════════════════════════════════════════════════════════ */

/* ──── Community Chat ──────────────────────────────────────────────── */
.chat-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  height: 560px;
  overflow: hidden;
}
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  flex-shrink: 0;
}
.chat-header h3 { font-size: 14px; font-weight: 600; }
.chat-online {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  display: flex; align-items: center; gap: 6px;
}
.chat-online::before {
  content: ''; width: 6px; height: 6px;
  border-radius: 50%; background: var(--up);
  animation: pulse 1.6s infinite;
}
.chat-pinned {
  padding: 10px 16px;
  background: var(--brand-magenta-bg);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
  display: flex; align-items: flex-start; gap: 8px;
}
.chat-pinned .pin-icon { color: var(--brand-magenta); flex-shrink: 0; margin-top: 2px; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chat-msg {
  display: flex;
  gap: 10px;
  animation: msgIn 0.3s var(--ease) both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.chat-msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-3);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  color: var(--text-1);
  flex-shrink: 0;
}
.chat-msg-avatar.role-top1 { background: var(--brand-magenta); }
.chat-msg-avatar.role-broker { background: var(--info-blue); }
.chat-msg-avatar.role-admin { background: var(--brand-purple); }
.chat-msg-body { flex: 1; min-width: 0; }
.chat-msg-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  margin-bottom: 3px;
}
.chat-msg-name { color: var(--text-1); font-weight: 600; }
.chat-msg-badge {
  font-size: 9.5px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-2);
  color: var(--text-3);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
}
.chat-msg-badge.top1 { background: var(--brand-magenta-soft); color: var(--brand-magenta); border-color: var(--border-magenta); }
.chat-msg-badge.broker { background: var(--info-blue-soft); color: var(--info-blue); border-color: rgba(46,92,255,0.30); }
.chat-msg-badge.admin { background: var(--brand-purple-soft); color: var(--brand-purple); border-color: rgba(108,92,231,0.30); }
.chat-msg-time { color: var(--text-dim); font-size: 11px; margin-left: auto; }
.chat-msg-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  word-break: break-word;
}
.chat-msg-text .tx-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--info-blue);
}
.chat-input {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-1);
  flex-shrink: 0;
}
.chat-input input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-1);
  outline: none;
}
.chat-input input:focus { border-color: var(--brand-magenta); }
.chat-gate {
  padding: 10px 16px;
  color: var(--text-3);
  font-size: 12px;
  display: flex; flex-direction: row; align-items: center; gap: 10px;
  justify-content: center;
}

/* ──── Plaza Feed (社群动态流) ─────────────────────────────────────── */
.plaza-feed {
  display: flex; gap: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
  scrollbar-width: thin;
}
.plaza-feed::-webkit-scrollbar { height: 6px; }
.plaza-post {
  flex: 0 0 320px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.plaza-post:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-2);
}
.plaza-post-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.plaza-post-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-3);
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 600;
}
.plaza-post-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.3;
  margin-bottom: 6px;
}
.plaza-post-body {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.plaza-post-meta {
  display: flex; align-items: center; gap: 14px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-3);
}
.plaza-post-meta .item { display: flex; align-items: center; gap: 4px; }

/* ──── Rich Editor ─────────────────────────────────────────────────── */
.rich-editor {
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  overflow: hidden;
}
.rich-editor:focus-within { border-color: var(--brand-magenta); }
.rich-toolbar {
  display: flex; align-items: center; gap: 2px;
  padding: 6px 8px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.rich-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: var(--text-2);
  font-size: 12px;
  transition: background var(--t-fast), color var(--t-fast);
}
.rich-btn:hover { background: var(--bg-2); color: var(--text-1); }
.rich-btn.active { background: var(--brand-magenta-soft); color: var(--brand-magenta); }
.rich-divider { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.rich-content {
  padding: 12px 14px;
  min-height: 120px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-1);
  outline: none;
}
.rich-content[data-empty="true"]::before {
  content: attr(data-placeholder);
  color: var(--text-dim);
  pointer-events: none;
}
.rich-content h1, .rich-content h2, .rich-content h3 { margin: 12px 0 6px; font-weight: 600; }
.rich-content h1 { font-size: 18px; }
.rich-content h2 { font-size: 16px; }
.rich-content h3 { font-size: 14px; }
.rich-content p { margin: 6px 0; }
.rich-content a { color: var(--brand-magenta); text-decoration: underline; }
.rich-content code {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.rich-content blockquote {
  border-left: 3px solid var(--brand-magenta);
  padding-left: 12px;
  margin: 8px 0;
  color: var(--text-2);
}

/* ──── Notification Center ─────────────────────────────────────────── */
.noti-trigger {
  position: relative;
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  display: grid; place-items: center;
  color: var(--text-2);
  transition: background var(--t-fast), color var(--t-fast);
}
.noti-trigger:hover { background: var(--bg-3); color: var(--text-1); }
.noti-trigger .dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand-magenta);
  border: 2px solid var(--bg-2);
}
.noti-dropdown {
  position: absolute;
  top: 48px; right: 0;
  width: min(360px, calc(100vw - 32px));
  max-height: 480px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  z-index: var(--z-overlay);
  animation: notiIn 0.18s var(--ease) both;
}
@keyframes notiIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
.noti-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.noti-head h3 { font-size: 14px; font-weight: 600; }
.noti-list { flex: 1; overflow-y: auto; }
.noti-item {
  display: flex; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t-fast);
}
.noti-item:hover { background: var(--bg-3); }
.noti-item.unread { background: var(--brand-magenta-bg); }
.noti-item:last-child { border-bottom: 0; }
.noti-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  background: var(--bg-1);
  display: grid; place-items: center;
  color: var(--text-2);
  flex-shrink: 0;
}
.noti-icon.task { color: var(--brand-magenta); }
.noti-icon.up { color: var(--up); }
.noti-icon.warn { color: var(--neon-amber); }
.noti-body { flex: 1; min-width: 0; }
.noti-title { font-size: 13px; color: var(--text-1); font-weight: 500; margin-bottom: 3px; }
.noti-sub { font-size: 11.5px; color: var(--text-3); }
.noti-time { font-size: 10.5px; color: var(--text-dim); font-family: var(--font-mono); margin-top: 4px; }
.noti-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

/* ──── Activation / KYC Page ───────────────────────────────────────── */
.activation-shell {
  max-width: 540px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}
.activation-step {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 24px;
}
.activation-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  color: var(--text-3);
}
.activation-dot.active { background: var(--brand-magenta); color: #FFFFFF; border-color: var(--brand-magenta); }
.activation-dot.done { background: var(--up); color: #FFFFFF; border-color: var(--up); }
.activation-line { flex: 1; height: 1px; background: var(--border); }
.activation-line.done { background: var(--up); }

.bid-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.bid-row + .bid-row { margin-top: 8px; }

/* ──── Fraud flag ──────────────────────────────────────────────────── */
.fraud-flag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255, 89, 82, 0.12);
  border: 1px solid var(--border-down);
  color: var(--down);
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 500;
}

/* ──── App Footer ────────────────────────────────────────────────────── */
.app-footer {
  margin-top: 80px;
  border-top: 1px solid var(--border);
  background: var(--bg-1);
  padding: 52px 0 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 280px repeat(4, 1fr);
  gap: 24px 40px;
}
.footer-brand-col { min-width: 0; }
.footer-socials {
  display: flex; gap: 10px;
}
.footer-social-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--text-3);
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.footer-social-icon:hover {
  color: var(--text-1);
  border-color: var(--border-2);
  background: var(--bg-3);
}
.footer-link-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-col-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}
.footer-link {
  font-size: 13px;
  color: var(--text-3);
  background: none;
  border: none;
  padding: 2px 0;
  cursor: pointer;
  transition: color var(--t-fast);
  text-decoration: none;
  display: inline-block;
  line-height: 1.5;
}
.footer-link:hover { color: var(--text-1); }
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  margin-top: 44px;
  border-top: 1px solid var(--border);
}

/* Footer responsive */
@media (max-width: 920px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 28px 20px;
  }
  .footer-brand-col { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; gap: 6px; text-align: center; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .app-footer { padding: 32px 0 0; }
  .footer-bottom { margin-top: 28px; }
}
