/* ---------- theme tokens ---------- */
:root {
  --bg-0: #07090c;
  --bg-1: #0b0d10;
  --bg-2: #111418;
  --bg-3: #181c22;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.12);
  --text-1: #e8ecef;
  --text-2: #9aa3ad;
  --text-3: #5d6671;
  --accent: #00ffa3;
  --accent-2: #00e1ff;
  --accent-dim: rgba(0,255,163,0.16);
  --warn: #ffb547;
  --danger: #ff5f7a;
  --success: #00ffa3;

  --grad-accent: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  --grad-soft: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0));

  --shadow-1: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 0 1px rgba(0,255,163,0.14), 0 0 48px rgba(0,255,163,0.18);

  --radius-1: 10px;
  --radius-2: 16px;
  --radius-3: 22px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --font: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  --topbar-h: 60px;
  --ticker-h: 32px;
  --bottomnav-h: 64px;
}

[data-theme="light"] {
  --bg-0: #f7f8fa;
  --bg-1: #ffffff;
  --bg-2: #f0f2f5;
  --bg-3: #e6e9ee;
  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.16);
  --text-1: #0b0d10;
  --text-2: #4a5260;
  --text-3: #8a93a0;
  --shadow-glow: 0 0 0 1px rgba(0,179,114,0.16), 0 0 48px rgba(0,179,114,0.14);
  --accent: #00b372;
  --accent-2: #009fb3;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: dark; }
html, body { width: 100%; max-width: 100vw; }
body {
  font-family: var(--font);
  background: var(--bg-0);
  color: var(--text-1);
  min-height: 100dvh;
  font-feature-settings: "ss01" on, "cv01" on;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
  overflow-y: auto;
}
body::before {
  content: "";
  position: fixed; inset: -20%;
  pointer-events: none;
  background:
    radial-gradient(40% 40% at 20% 30%, rgba(0,255,163,0.10), transparent 70%),
    radial-gradient(35% 35% at 80% 20%, rgba(0,225,255,0.09), transparent 70%),
    radial-gradient(30% 30% at 60% 80%, rgba(132,99,255,0.07), transparent 70%);
  z-index: 0;
  animation: aurora 28s ease-in-out infinite alternate;
  filter: blur(40px);
  will-change: transform;
}
@keyframes aurora {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(2%, -2%, 0) scale(1.05); }
  100% { transform: translate3d(-2%, 2%, 0) scale(1); }
}
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(900px 600px at 50% 0%, black, transparent 85%);
  z-index: 0;
}

/* ---------- cursor radial glow ---------- */
#cursor-glow {
  position: fixed;
  width: 540px; height: 540px;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(0,255,163,0.10), transparent 60%);
  transform: translate(-50%, -50%);
  z-index: 1;
  transition: opacity 0.3s;
  opacity: 0;
}
@media (hover: hover) and (pointer: fine) {
  #cursor-glow { opacity: 1; }
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; left: 0; right: 0;
  z-index: 50;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  background: rgba(11,13,16,0.72);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--space-4);
  padding: 0 var(--space-5);
  max-width: 1280px;
  margin: 0 auto;
}
.brand {
  display: inline-flex; align-items: center; gap: var(--space-2);
  color: var(--text-1); text-decoration: none;
  font-weight: 600; letter-spacing: -0.01em;
}
.brand-mark { display: inline-flex; }
.brand-name { font-size: 16px; }
.brand-dot { color: var(--accent); }
.brand-suffix { color: var(--text-2); font-weight: 500; }

.topnav { display: flex; align-items: center; gap: var(--space-2); margin-left: var(--space-4); flex: 1; }
.topnav a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}
.topnav a:hover { color: var(--text-1); background: rgba(255,255,255,0.04); }
.topnav a.active {
  color: var(--text-1);
  background: rgba(255,255,255,0.06);
}

.top-actions { display: flex; align-items: center; gap: var(--space-2); }
.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 36px; height: 36px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.ghost-btn:hover { color: var(--text-1); border-color: var(--border-strong); background: rgba(255,255,255,0.03); }

.primary-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--grad-accent);
  color: #03130b;
  font-weight: 600;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 0;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0,255,163,0.2), 0 8px 28px rgba(0,255,163,0.18);
  transition: transform 0.15s ease-out, box-shadow 0.2s;
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(0,255,163,0.32), 0 14px 36px rgba(0,255,163,0.28); }
.primary-btn:active { transform: translateY(0); }

/* ---------- ticker strip ---------- */
.ticker-strip {
  height: var(--ticker-h);
  overflow: hidden;
  border-top: 1px solid var(--border);
  background: rgba(11,13,16,0.4);
  position: relative;
}
.ticker-strip::before, .ticker-strip::after {
  content: "";
  position: absolute; top: 0; bottom: 0; width: 60px;
  z-index: 2; pointer-events: none;
}
.ticker-strip::before { left: 0; background: linear-gradient(90deg, var(--bg-0), transparent); }
.ticker-strip::after { right: 0; background: linear-gradient(-90deg, var(--bg-0), transparent); }
.ticker-track {
  display: flex; align-items: center; gap: var(--space-5);
  height: 100%;
  white-space: nowrap;
  animation: tickerScroll 38s linear infinite;
}
.ticker-track:hover { animation-play-state: paused; }
@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ticker-item {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: 12px; color: var(--text-2);
  font-family: var(--font-mono);
}
.ticker-item strong { color: var(--text-1); font-weight: 600; }
.ticker-item .up { color: var(--accent); }
.ticker-item .down { color: var(--danger); }

/* ---------- bottom mobile nav ---------- */
.bottomnav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 49;
  backdrop-filter: blur(18px) saturate(160%);
  background: rgba(11,13,16,0.86);
  border-top: 1px solid var(--border);
}
.bottomnav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  color: var(--text-3);
  text-decoration: none;
  font-size: 10px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: color 0.2s;
}
.bottomnav a.active { color: var(--text-1); }
.bottomnav a.active svg { stroke: var(--accent); }

@media (max-width: 768px) {
  .topnav { display: none; }
  .bottomnav { display: flex; }
  main.app-root { padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + 24px); }
}

/* ---------- footer ---------- */
.footer {
  margin-top: var(--space-8);
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, transparent, rgba(0,255,163,0.02));
  position: relative;
  z-index: 1;
}
.footer::before {
  content: "";
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 60%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
  animation: glow 6s ease-in-out infinite alternate;
}
@keyframes glow {
  0% { opacity: 0.18; }
  100% { opacity: 0.5; }
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-7) var(--space-5) var(--space-5);
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-5);
}
.footer-col h4 {
  margin: 0 0 var(--space-3);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
}
.footer-col a {
  display: block;
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  padding: 4px 0;
  transition: color 0.2s;
}
.footer-col a:hover { color: var(--text-1); }
.footer-col p { margin: var(--space-2) 0 0; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.footer-brand { font-size: 16px; font-weight: 600; }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding: var(--space-3) var(--space-5);
  max-width: 1280px;
  margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
}
.muted { color: var(--text-2); }
.muted.small { font-size: 12px; }

@media (max-width: 768px) {
  .footer-inner { grid-template-columns: 1fr; gap: var(--space-4); }
  .footer-col { width: 100%; }
}

/* ---------- main + page transitions ---------- */
.app-root {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5);
  position: relative;
  z-index: 2;
  min-height: 60vh;
  width: 100%;
}

.page-in {
  animation: pageIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes pageIn {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ---------- skeleton shimmer ---------- */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- modal + toast ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(7,9,12,0.72);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-3);
  padding: var(--space-5);
  max-width: 560px; width: calc(100vw - 32px);
  box-shadow: var(--shadow-1);
  max-height: 90vh; overflow-y: auto;
}
.modal-title { font-size: 18px; font-weight: 600; margin: 0 0 var(--space-3); }
@media (max-width: 640px) {
  .modal-backdrop { align-items: flex-end; }
  .modal { width: 100%; border-radius: 20px 20px 0 0; max-height: 88vh; animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

#toast-root {
  position: fixed; top: 80px; right: 16px; z-index: 110;
  display: flex; flex-direction: column; gap: var(--space-2);
}
.toast {
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  max-width: 320px;
  box-shadow: var(--shadow-1);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.success { border-color: rgba(0,255,163,0.4); }
.toast.error { border-color: rgba(255,95,122,0.5); }
@keyframes toastIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
