/* ─── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #080720;
  --bg-card:     #13123a;
  --bg-card-alt: #1c1a50;
  --border:      rgba(255,255,255,.1);
  --accent:      #2763e1;
  --accent-2:    #4f8ef7;
  --success:     #22c55e;
  --warning:     #eab308;
  --danger:      #ef4444;
  --text:        #e8eaf6;
  --text-muted:  #8b93b8;
  --nav-h:       60px;
  --radius:      12px;
  --shadow:      0 4px 32px rgba(0,0,0,.6);
  --font:        'Inter', system-ui, -apple-system, sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(39,99,225,.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(79,142,247,.1) 0%, transparent 55%);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ─── Top Nav ────────────────────────────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(2,0,62,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 0;
  padding: 0 2rem;
}

.topnav__logo {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; font-size: 1.1rem; letter-spacing: -.3px;
  margin-right: 2.5rem;
}

.topnav__logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
}

.topnav__links { display: flex; gap: .25rem; }

.topnav__link {
  padding: .45rem .9rem;
  border-radius: 8px;
  font-size: .9rem;
  color: var(--text-muted);
  transition: background .15s, color .15s;
  cursor: pointer;
}

.topnav__link:hover, .topnav__link.router-link-active {
  background: var(--bg-card);
  color: var(--text);
}

.topnav__link.router-link-active { color: var(--accent); }


/* ═══════════════════════════════════════════════════════════════
   Source Tooling
   ═══════════════════════════════════════════════════════════════ */

.st-root {
  flex: 1; overflow-y: auto;
  background: #02003e; color: var(--text);
  font-family: var(--font);
  padding: 2rem;
}

/* ── Header ─────────────────────────────────────────────────── */
.st-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.75rem;
}
.st-title {
  font-size: 1.75rem; font-weight: 800; letter-spacing: -.4px; color: #fff;
}
.st-subtitle { color: var(--text-muted); margin-top: .3rem; font-size: .92rem; }

/* ── URL bar ─────────────────────────────────────────────────── */
.st-url-bar {
  display: flex; align-items: center; gap: .6rem;
  background: #16164d; border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px; padding: .65rem 1rem;
  margin-bottom: 1.5rem;
  transition: border-color .2s;
}
.st-url-bar:focus-within { border-color: #2763e1; }
.st-url-bar__icon { font-size: 1rem; flex-shrink: 0; opacity: .6; }
.st-url-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: #fff; font-size: .88rem;
  font-family: 'JetBrains Mono','Fira Mono',monospace;
}
.st-url-input::placeholder { color: var(--text-muted); font-family: var(--font); font-style: italic; font-size: .85rem; }
.st-url-clear {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: .9rem; padding: 0 .2rem; transition: color .15s;
}
.st-url-clear:hover { color: #fff; }

/* ── Sport pills ─────────────────────────────────────────────── */
.st-sport-bar {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin-bottom: 1.75rem;
}
.st-sport-pill {
  display: flex; align-items: center; gap: .45rem;
  background: #16164d; border: 1px solid rgba(255,255,255,.15);
  color: var(--text-muted); border-radius: 99px;
  padding: .45rem 1rem; font-size: .88rem; font-weight: 500;
  cursor: pointer; font-family: var(--font);
  transition: background .15s, border-color .15s, color .15s;
}
.st-sport-pill:hover { background: #1c1a5e; color: #fff; border-color: rgba(255,255,255,.3); }
.st-sport-pill--active {
  background: #2763e1; border-color: #2763e1; color: #fff; font-weight: 600;
}

/* ── Section label ───────────────────────────────────────────── */
.st-section-label {
  font-size: .7rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: .75rem;
}

/* ── Endpoint grid ───────────────────────────────────────────── */
.st-endpoint-section { margin-bottom: 2rem; }
.st-endpoint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .75rem;
}
.st-ep-card {
  background: #16164d; border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; padding: .9rem 1.1rem;
  text-align: left; cursor: pointer; font-family: var(--font);
  transition: border-color .15s, background .15s, transform .15s;
}
.st-ep-card:hover { background: #1c1a5e; border-color: rgba(255,255,255,.3); transform: translateY(-1px); }
.st-ep-card--active { border-color: #2763e1; background: rgba(39,99,225,.15); }
.st-ep-card__label { font-size: .9rem; font-weight: 600; color: #fff; margin-bottom: .35rem; }
.st-ep-card__pattern {
  font-size: .72rem; color: var(--text-muted);
  font-family: 'JetBrains Mono','Fira Mono',monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Node tree ───────────────────────────────────────────────── */
.st-tree-section {
  background: #16164d; border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px; overflow: hidden;
}
.st-tree-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem; background: #1c1a5e;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.st-tree-title { font-size: 1rem; font-weight: 700; color: #fff; }
.st-tree-desc  { font-size: .82rem; color: var(--text-muted); margin-top: .2rem; }
.st-expand-btn {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  color: #d1d5db; border-radius: 6px; padding: .3rem .75rem;
  font-size: .78rem; cursor: pointer; font-family: var(--font);
  white-space: nowrap; flex-shrink: 0;
  transition: background .15s;
}
.st-expand-btn:hover { background: rgba(255,255,255,.15); }

.st-tree { padding: .5rem 0; }

/* Node row */
.st-node { }
.st-node--child { padding-left: calc(var(--depth, 0) * 1.5rem); }

.st-node__row {
  display: flex; align-items: baseline; gap: .5rem;
  padding: .45rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.05);
  cursor: default; transition: background .12s;
}
.st-node__row:hover { background: rgba(255,255,255,.04); }
.st-node--child .st-node__row { cursor: default; }

.st-node__arrow {
  font-size: 1rem; font-weight: 700; color: var(--text-muted);
  transition: transform .15s, color .15s; flex-shrink: 0;
  width: 16px; text-align: center; cursor: pointer;
  line-height: 1;
}
.st-node__arrow--open  { transform: rotate(90deg); color: #2763e1; }
.st-node__arrow--leaf  { cursor: default; font-size: .7rem; }

.st-node__key {
  font-family: 'JetBrains Mono','Fira Mono',monospace;
  font-size: .82rem; font-weight: 600; color: #e8eaf6;
  white-space: nowrap;
}
.st-node__label {
  font-size: .8rem; color: var(--text-muted); flex-shrink: 0;
}
.st-node__notes {
  font-size: .78rem; color: var(--text-muted); font-style: italic;
  flex: 1; min-width: 0;
}

.st-node__children { }

/* ── Source badges ───────────────────────────────────────────── */
.st-badge {
  display: inline-block; flex-shrink: 0;
  font-size: .68rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: .15rem .5rem;
  border-radius: 99px; border: 1px solid transparent;
  white-space: nowrap;
}
.st-badge--maindb   { background: rgba(39,99,225,.2);  color: #7eb3ff; border-color: rgba(39,99,225,.4); }
.st-badge--s3p      { background: rgba(124,90,245,.2); color: #c4b5fd; border-color: rgba(124,90,245,.4); }
.st-badge--sds      { background: rgba(20,184,166,.2); color: #5eead4; border-color: rgba(20,184,166,.4); }
.st-badge--statsapi { background: rgba(249,115,22,.2); color: #fdba74; border-color: rgba(249,115,22,.4); }
.st-badge--mixed    { background: rgba(156,163,175,.1);color: #d1d5db; border-color: rgba(255,255,255,.2); }

/* ── Legend ──────────────────────────────────────────────────── */
.st-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  padding: .75rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.15);
}
.st-legend-item { display: flex; align-items: center; }
.st-legend-hint { font-size: .75rem; color: var(--text-muted); margin-left: auto; }

/* ── Empty state ─────────────────────────────────────────────── */
.st-empty {
  text-align: center; padding: 4rem 2rem;
  color: var(--text-muted);
}
.st-empty__icon { font-size: 2.5rem; margin-bottom: .75rem; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
