:root {
  --bg: #07090f;
  --bg-elev: #0d111a;
  --bg-card: #111827;
  --bg-soft: #161e2e;
  --border: #1e293b;
  --border-strong: #334155;
  --text: #e8edf7;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --green: #34d399;
  --amber: #fbbf24;
  --pink: #f472b6;
  --purple: #a78bfa;
  --white: #f8fafc;
  --danger-soft: #fbbf24;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0,0,0,.45);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #12203a 0%, transparent 55%),
              radial-gradient(900px 500px at 90% 0%, #1a1430 0%, transparent 50%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.5;
}

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

.app { max-width: 1280px; margin: 0 auto; padding: 0 28px 80px; }

/* TOP CHROME (nav + whale banner stick together) */
.top-chrome {
  position: sticky; top: 0; z-index: 50;
  margin: 0 -28px;
  backdrop-filter: blur(14px);
  background: rgba(7,9,15,.92);
  border-bottom: 1px solid var(--border);
}
.nav {
  padding: 14px 28px;
  display: flex; align-items: center; gap: 24px; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; font-size: 1.15rem; color: var(--white); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(145deg, #1e3a5f, #0ea5e9 70%);
  display: grid; place-items: center; font-size: 15px;
  box-shadow: 0 0 0 1px rgba(56,189,248,.2);
}
.nav-links { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-links a {
  color: var(--text-muted); padding: 8px 12px; border-radius: 8px; font-size: .92rem; font-weight: 500;
}
.nav-links a:hover, .nav-links a.active { color: var(--white); background: var(--bg-soft); text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 12px; }

.mode-toggle {
  display: inline-flex; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px;
}
.mode-toggle button {
  border: 0; background: transparent; color: var(--text-muted);
  padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: .85rem; cursor: pointer;
}
.mode-toggle button.active-real { background: #0ea5e9; color: #041018; }
.mode-toggle button.active-whale { background: var(--amber); color: #1a1200; }

.banner-whale {
  display: none; margin: 0; padding: 10px 28px; border-radius: 0;
  background: rgba(251,191,36,.12); border: 0;
  border-top: 1px solid rgba(251,191,36,.28);
  color: #fde68a; font-size: .9rem;
}
.banner-whale.show { display: flex; align-items: flex-start; gap: 10px; }
.banner-whale strong { color: var(--amber); }

/* HERO */
.hero {
  display: grid; grid-template-columns: 1.08fr .92fr; gap: 32px; margin-top: 40px; align-items: start;
}
.hero-copy h1 {
  font-size: clamp(1.85rem, 2.8vw, 2.55rem); line-height: 1.15; letter-spacing: -.025em;
  margin: 0 0 14px; font-weight: 700; color: var(--white);
}
.hero-copy h1 span {
  background: linear-gradient(90deg, #7dd3fc, #93c5fd 55%, #a5b4fc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-copy p.lead {
  color: var(--text-muted); font-size: 1.02rem; line-height: 1.55; margin: 0 0 20px; max-width: 38rem;
}
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pill {
  font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); border: 1px solid var(--border); padding: 5px 11px; border-radius: 999px;
  background: rgba(255,255,255,.025);
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.025), transparent 42%), var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px;
}
.card h2 { margin: 0 0 4px; font-size: 1.12rem; letter-spacing: -.015em; font-weight: 600; color: var(--white); }
.card .sub { color: var(--text-dim); font-size: .86rem; margin: 0 0 18px; line-height: 1.45; }
.est-inline { font-weight: 500; color: var(--text-dim); font-size: .85em; }
.label-note { font-weight: 400; color: var(--text-dim); }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tabs button {
  flex: 1; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text-muted);
  padding: 10px; border-radius: 10px; font-weight: 600; cursor: pointer;
}
.tabs button.active { border-color: var(--accent); color: var(--white); background: rgba(56,189,248,.12); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: .82rem; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.field input, .field select {
  width: 100%; background: var(--bg); border: 1px solid var(--border-strong); color: var(--white);
  border-radius: 10px; padding: 12px 14px; font-size: 1.05rem; font-family: var(--mono);
}
.field input:focus { outline: 2px solid rgba(56,189,248,.35); border-color: var(--accent); }
.input-row { display: grid; grid-template-columns: 1.3fr 1fr .8fr auto; gap: 8px; align-items: end; }
.input-row .field { margin: 0; }

.btn {
  border: 0; border-radius: 11px; padding: 12px 18px; font-weight: 700; cursor: pointer; font-size: .95rem;
}
.btn-primary {
  background: linear-gradient(135deg, #38bdf8, #3b82f6); color: #041018;
  box-shadow: 0 6px 18px rgba(56,189,248,.18); width: 100%; margin-top: 8px;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost {
  background: transparent; border: 1px dashed var(--border-strong); color: var(--text-muted);
  width: 100%; margin-top: 10px;
}
.btn-ghost:hover { color: var(--white); border-color: var(--text-dim); }
.btn-sm { padding: 8px 10px; font-size: .8rem; }
.btn-danger-soft { background: rgba(248,113,113,.12); color: #fca5a5; border: 1px solid rgba(248,113,113,.25); }
.hint { font-size: .8rem; color: var(--text-dim); margin-top: 10px; }
.est-label {
  display: inline-block; margin-top: 8px; font-size: .75rem; font-weight: 600;
  color: var(--amber); background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.25);
  padding: 4px 8px; border-radius: 6px;
}

/* RESULTS */
.section { margin-top: 48px; }
.section-head {
  display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.section-head h2 { margin: 0; font-size: 1.28rem; letter-spacing: -.02em; font-weight: 600; color: var(--white); }
.section-head p { margin: 6px 0 0; color: var(--text-dim); font-size: .88rem; max-width: 40rem; }

.range-toggle { display: flex; gap: 4px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.range-toggle button {
  border: 0; background: transparent; color: var(--text-muted); padding: 7px 12px;
  border-radius: 8px; font-weight: 600; font-size: .82rem; cursor: pointer;
}
.range-toggle button.active { background: var(--bg-soft); color: var(--white); }

.series-toggles { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text-muted);
  font-size: .8rem; font-weight: 600; cursor: pointer; user-select: none;
}
.chip input { accent-color: var(--accent); }
.chip.on { color: var(--white); border-color: var(--border-strong); }
.dot { width: 8px; height: 8px; border-radius: 50%; }

.chart-wrap {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 16px 10px; position: relative; min-height: 380px;
}
.chart-wrap canvas { width: 100% !important; max-height: 420px; }
.chart-empty {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-dim); text-align: center; padding: 24px;
}
.data-badge {
  font-size: .78rem; color: var(--text-dim); margin-top: 10px; line-height: 1.45;
  padding: 10px 12px; border-radius: 8px; background: rgba(15,23,42,.55); border: 1px solid var(--border);
}

.verdict {
  margin-top: 18px; padding: 16px 18px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-elev);
}
.verdict.green { border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.07); }
.verdict.amber { border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.07); }
.verdict h3 { margin: 0 0 6px; font-size: 1.02rem; font-weight: 600; color: var(--white); }
.verdict p { margin: 0; color: var(--text-muted); font-size: .92rem; line-height: 1.5; }

.gap-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: .92rem; }
.gap-table th, .gap-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.gap-table th { color: var(--text-dim); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.gap-pos { color: var(--green); font-family: var(--mono); }
.gap-neg { color: var(--amber); font-family: var(--mono); }

.actions-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.btn-secondary {
  background: var(--bg-soft); color: var(--white); border: 1px solid var(--border-strong);
}

/* GRID SECTIONS */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.table-wrap { overflow-x: auto; }
table.lb { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.lb th, table.lb td { padding: 10px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.lb th { color: var(--text-dim); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
table.lb tr:hover td { background: rgba(255,255,255,.02); }
.rank { color: var(--text-dim); font-family: var(--mono); width: 36px; }
.mono { font-family: var(--mono); }
.pos { color: var(--green); }
.neg { color: #fca5a5; }
.source-tag { font-size: .72rem; color: var(--text-dim); margin-top: 10px; }

/* FEED */
.feed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.feed-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px; min-height: 220px;
}
.feed-card .cat { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-2); }
.feed-card .who { font-weight: 700; }
.feed-card .handle { color: var(--text-dim); font-size: .85rem; }
.post { font-size: .9rem; color: var(--text-muted); border-left: 2px solid var(--border-strong); padding-left: 10px; }
.post .date { font-size: .75rem; color: var(--text-dim); margin-top: 4px; }
.view-x {
  margin-top: auto; display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; font-size: .85rem; color: var(--white);
  background: #0f172a; border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 12px;
  width: fit-content;
}
.view-x:hover { border-color: var(--accent); text-decoration: none; }

/* MIRROR DEMO */
.demo-banner {
  margin-top: 18px; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: rgba(148,163,184,.06); color: var(--text-muted); font-size: .9rem; line-height: 1.5;
}
.demo-banner strong { color: var(--text); font-weight: 600; }

/* SHARE MODAL */
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 100;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  padding: 22px; max-width: 400px; width: 100%; box-shadow: var(--shadow);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;
}
.modal-head strong { font-size: .95rem; letter-spacing: -.01em; }
.btn-ghost-soft {
  background: transparent; color: var(--text-muted); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px; font-size: .8rem; font-weight: 600; cursor: pointer;
}
.btn-ghost-soft:hover { color: var(--white); border-color: var(--border-strong); }
.share-card {
  aspect-ratio: 9/16; max-height: 520px; width: 100%;
  border-radius: 20px; padding: 32px 26px; position: relative; overflow: hidden;
  background: linear-gradient(165deg, #0a1220 0%, #111c33 42%, #1a2744 100%);
  border: 1px solid rgba(148,163,184,.18);
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.share-card::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(600px 280px at 20% 0%, rgba(56,189,248,.12), transparent 60%),
    radial-gradient(500px 240px at 100% 80%, rgba(129,140,248,.1), transparent 55%);
  pointer-events: none;
}
.share-card > * { position: relative; z-index: 1; }
.share-kicker {
  font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #93c5fd;
}
.share-title {
  font-size: 1.45rem; font-weight: 700; letter-spacing: -.025em; margin: 14px 0 18px; line-height: 1.2; color: #f8fafc;
}
.share-stat {
  font-size: 3rem; font-weight: 700; font-family: var(--font); color: #f8fafc;
  letter-spacing: -0.03em; word-spacing: 0; white-space: nowrap;
  font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "tnum" 1, "lnum" 1;
}
.share-vs { color: #94a3b8; margin-top: 12px; font-size: .9rem; line-height: 1.45; }
.share-foot { font-size: .78rem; color: #64748b; letter-spacing: .01em; }

footer {
  margin-top: 64px; padding-top: 22px; border-top: 1px solid var(--border);
  color: var(--text-dim); font-size: .8rem; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .input-row { grid-template-columns: 1fr 1fr; }
  .input-row .rm { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .app { padding: 0 14px 60px; }
  .top-chrome { margin: 0 -14px; }
  .nav { padding: 12px 14px; flex-wrap: wrap; }
  .banner-whale { padding: 10px 14px; }
  .nav-links { display: none; }
  .input-row { grid-template-columns: 1fr; }
}
