:root {
  --bg: #0a0e14;
  --surface: #12171f;
  --surface2: #1a2030;
  --surface3: #222b3a;
  --border: #263040;
  --border-light: #334155;
  --text: #e2e8f0;
  --text-dim: #64748b;
  --text-muted: #475569;
  --accent: #ef4444;
  --accent2: #f59e0b;
  --green: #22c55e;
  --blue: #3b82f6;
  --purple: #a78bfa;
  --cyan: #06b6d4;
  --orange: #f97316;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 13px;
}

/* ── HEADER ── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,14,20,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.logo-icon {
  width: 24px;
  height: 24px;
  background: var(--accent);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
}
.scan-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text);
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
}
.scan-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.scan-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}
.scan-btn.scanning {
  border-color: var(--accent2);
  color: var(--accent2);
  animation: scan-pulse 1s infinite;
}
@keyframes scan-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── SEARCH ── */
.header-center { flex: 1; max-width: 400px; margin: 0 20px; }
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  padding: 6px 32px 6px 30px;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--border-light);
  background: var(--surface2);
}
.search-icon {
  position: absolute;
  left: 9px;
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-shortcut {
  position: absolute;
  right: 8px;
  font-size: 10px;
  color: var(--text-muted);
  background: var(--surface3);
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
  pointer-events: none;
  transition: opacity 0.15s;
}
.search-overlay {
  display: none;
  position: fixed;
  inset: 44px 0 0 0;
  z-index: 99;
  background: rgba(10,14,20,0.85);
  backdrop-filter: blur(8px);
  overflow-y: auto;
  padding: 20px;
}
.search-overlay.active { display: block; }
.search-results-panel {
  max-width: 700px;
  margin: 0 auto;
}
.search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}
.search-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 16px;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.search-close:hover { background: var(--surface2); color: var(--text); }
.search-no-results {
  color: var(--text-muted);
  font-size: 12px;
  padding: 40px 16px;
  text-align: center;
}

/* ── KPI BAR ── */
.kpi-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid var(--border);
}
.kpi {
  padding: 14px 20px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kpi:last-child { border-right: none; }
.kpi-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.kpi-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.kpi-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.kpi-delta {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
}
.delta-up { background: rgba(34,197,94,0.12); color: var(--green); }
.delta-down { background: rgba(239,68,68,0.12); color: var(--accent); }
.kpi-sub { font-size: 10px; color: var(--text-muted); }

/* ── LAYOUT ── */
.dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  margin: 0;
}
.dashboard > * {
  background: var(--bg);
}
.panel {
  padding: 16px 20px;
}
.panel-full {
  grid-column: 1 / -1;
  padding: 16px 20px;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.panel-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title::before {
  content: '';
  width: 3px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}
.pt-players::before { background: var(--cyan); }
.pt-sources::before { background: var(--orange); }
.pt-scores::before { background: var(--purple); }
.pt-games::before { background: var(--accent); }
.pt-intel::before { background: var(--blue); }
.pt-signals::before { background: var(--green); }
.pt-community::before { background: var(--accent2); }
.pt-trends::before { background: var(--purple); }
.panel-count {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
}

/* ── PLAYERS TABLE ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.data-table th:not(:first-child) { text-align: right; }
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(38,48,64,0.5);
  font-variant-numeric: tabular-nums;
}
.data-table td:not(:first-child) { text-align: right; }
.data-table thead { position: sticky; top: 0; background: var(--bg); z-index: 1; }
.data-table-scroll {
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent;
}
.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: var(--surface); }
.data-table tbody tr:last-child td { border-bottom: none; }
.game-name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.game-rank {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--text-dim);
  font-weight: 700;
  flex-shrink: 0;
}
.rank-1 { background: rgba(245,158,11,0.2); color: var(--accent2); }
.rank-2 { background: rgba(148,163,184,0.15); color: #94a3b8; }
.rank-3 { background: rgba(180,83,9,0.15); color: #b45309; }
.player-val { font-weight: 700; }
.peak-val { color: var(--text-dim); }
.change { font-weight: 600; font-size: 12px; }
.up { color: var(--green); }
.down { color: var(--accent); }
.flat { color: var(--text-muted); }
.spark-cell { width: 100px; padding-right: 6px !important; }

/* ── DONUT ── */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  justify-content: center;
  padding: 8px 0;
}
.donut-svg { transform: rotate(-90deg); }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.donut-center-val { font-size: 20px; font-weight: 700; }
.donut-center-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.donut-rel { position: relative; width: 130px; height: 130px; }
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dl-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.dl-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.dl-name { color: var(--text-dim); flex: 1; }
.dl-val { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 32px; text-align: right; }
.dl-bar-bg {
  width: 48px;
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  overflow: hidden;
}
.dl-bar-fill { height: 100%; border-radius: 2px; }

/* ── SCORE HISTOGRAM ── */
.histogram {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100px;
  padding: 12px 0 0;
}
.histo-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}
.histo-bar {
  width: 100%;
  border-radius: 2px 2px 0 0;
  transition: opacity 0.2s;
  position: relative;
}
.histo-bar:hover { opacity: 0.75; }
.histo-val {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 600;
}
.histo-label {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 2px;
}
.histo-axis {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-muted);
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}

/* ── INTEL FEED ── */
.intel-feed { display: flex; flex-direction: column; gap: 1px; max-height: 600px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--surface3) transparent; }
.intel-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  padding: 10px;
  background: var(--surface);
  border-radius: 4px;
  align-items: center;
  transition: background 0.15s;
}
.intel-item:hover { background: var(--surface2); }
.intel-link { text-decoration: none; color: inherit; display: block; }
.intel-clickable { cursor: pointer; }
.intel-clickable:hover { border-left: 2px solid var(--accent); }
.intel-score {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
  border: 1px solid;
}
.intel-score span { font-size: 8px; font-weight: 500; letter-spacing: 0.5px; margin-top: 1px; }
.score-s { background: rgba(34,197,94,0.08); border-color: rgba(34,197,94,0.3); color: var(--green); }
.score-a { background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.3); color: var(--blue); }
.score-b { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.3); color: var(--accent2); }
.score-na { background: rgba(100,116,139,0.08); border-color: rgba(100,116,139,0.3); color: var(--text-muted); }
.score-upcoming { background: rgba(6,182,212,0.08); border-color: rgba(6,182,212,0.3); color: var(--cyan); }
.video-item {
  display: grid;
  grid-template-columns: 120px 1fr 44px;
  gap: 10px;
  padding: 8px;
  background: var(--surface);
  border-radius: 4px;
  align-items: center;
  transition: background 0.15s;
}
.video-item:hover { background: var(--surface2); }
.video-thumb {
  width: 120px;
  height: 68px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--surface3);
}
.video-body { min-width: 0; }
.intel-body {}
.intel-title { font-weight: 600; font-size: 12px; line-height: 1.3; font-family: -apple-system, 'Segoe UI', sans-serif; }
.intel-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 3px;
  font-size: 10px;
  color: var(--text-muted);
}
.src-tag {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 2px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.src-steam { background: rgba(102,192,244,0.1); color: #66c0f4; }
.src-reddit { background: rgba(255,69,0,0.1); color: #ff6b35; }
.src-yt { background: rgba(255,0,0,0.1); color: #ff4444; }
.src-rss { background: rgba(245,166,35,0.1); color: #f5a623; }
.intel-time { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.intel-type {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 2px;
  background: var(--surface3);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* ── SIGNAL CARDS (new games) ── */
.signals-grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 600px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent;
}
.signal-upcoming { border-left: 2px solid var(--cyan) !important; }
.upcoming-badge {
  display: inline-block;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 2px;
  background: rgba(6,182,212,0.15);
  color: var(--cyan);
  letter-spacing: 0.5px;
  margin-right: 6px;
  vertical-align: middle;
}
.signal-link {
  text-decoration: none;
  color: inherit;
  display: block;
}
.signal-card {
  display: grid;
  grid-template-columns: 80px 44px 1fr auto;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: 4px;
  align-items: center;
  transition: all 0.2s;
  border-left: 2px solid transparent;
}
.signal-card:hover { background: var(--surface2); }
.signal-clickable { cursor: pointer; }
.signal-clickable:hover { border-left-color: var(--accent); }
.signal-img {
  width: 80px;
  height: 38px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--surface2);
}
.signal-card:not(:has(.signal-img)) {
  grid-template-columns: 44px 1fr auto;
}
.signal-body {}
.signal-title { font-weight: 700; font-size: 13px; font-family: -apple-system, 'Segoe UI', sans-serif; margin-bottom: 3px; }
.signal-desc { font-size: 11px; color: var(--text-dim); line-height: 1.4; font-family: -apple-system, 'Segoe UI', sans-serif; }
.signal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.stag {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--surface3);
  color: var(--text-dim);
  letter-spacing: 0.2px;
}
.stag-match { background: rgba(239,68,68,0.1); color: var(--accent); border: 1px solid rgba(239,68,68,0.2); }
.signal-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.signal-time { font-size: 10px; color: var(--text-muted); white-space: nowrap; }

/* ── READ STATE ── */
.item-read {
  border-left: 2px solid var(--green) !important;
  background: linear-gradient(90deg, rgba(34,197,94,0.06) 0%, var(--surface) 40%) !important;
}
.item-read:hover {
  background: linear-gradient(90deg, rgba(34,197,94,0.10) 0%, var(--surface2) 40%) !important;
}
.read-check {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(34,197,94,0.15);
  border: 1px solid rgba(34,197,94,0.4);
  color: var(--green);
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  flex-shrink: 0;
}
.item-read .read-check { display: flex; align-items: center; justify-content: center; }
.item-read .intel-title,
.item-read .signal-title { opacity: 0.7; }

/* ── COMMUNITY ── */
.comm-list { display: flex; flex-direction: column; gap: 1px; }
.comm-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border-radius: 4px;
  align-items: center;
  transition: background 0.15s;
}
.comm-item:hover { background: var(--surface2); }
.comm-votes {
  font-weight: 800;
  font-size: 13px;
  color: var(--accent2);
  text-align: center;
}
.comm-body {}
.comm-title { font-size: 12px; font-weight: 500; font-family: -apple-system, 'Segoe UI', sans-serif; line-height: 1.3; }
.comm-sub { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.comm-time { font-size: 10px; color: var(--text-muted); white-space: nowrap; }

/* ── TRENDS ── */
.trends-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(5, auto);
  grid-auto-flow: column;
  gap: 1px;
}
.trend-row {
  display: grid;
  grid-template-columns: 24px 1fr auto auto;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: 4px;
  align-items: center;
  transition: background 0.15s;
}
.trend-row:hover { background: var(--surface2); }
.trend-idx { font-size: 11px; color: var(--text-muted); font-weight: 700; text-align: center; }
.trend-info {}
.trend-name { font-weight: 600; font-size: 12px; font-family: -apple-system, 'Segoe UI', sans-serif; }
.trend-detail { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.trend-spark { width: 64px; }
.trend-badge {
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 2px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.tb-new { background: rgba(239,68,68,0.12); color: var(--accent); }
.tb-hot { background: rgba(249,115,22,0.12); color: var(--orange); }
.tb-up { background: rgba(34,197,94,0.12); color: var(--green); }

/* ── FOOTER ── */
.footer {
  padding: 12px 20px;
  font-size: 10px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  letter-spacing: 0.3px;
}
