/* EdgeStat — bpleone.com
   Dark, sharp, finance-grade UI. Inspired by Unusual Whales / Bloomberg terminals.
*/

/* CHART.JS GLOBAL GROWTH GUARD
   Chart.js with responsive:true + maintainAspectRatio:false (our base config)
   will try to fill its parent container's height. If the parent has no
   explicit height, it loops: canvas grows -> page taller -> canvas grows...
   This caps every chart at ~320px max so the loop can never escape the page.
   Charts that legitimately want to be larger can override with inline style
   on their wrapping div. */
canvas {
  max-height: 320px !important;
}
/* Donut/gauge centered overlays are positioned relative to a wrapper div
   that already sets height (e.g., 220px); keep that pattern. */
.hero-card canvas { max-height: 240px !important; }

:root {
  --bg-0: #07090d;
  --bg-1: #0c1118;
  --bg-2: #121823;
  --bg-3: #1a2230;
  --line: #1f2a3a;
  --line-soft: #182231;
  --text: #e7edf6;
  --text-2: #9fb0c8;
  --text-3: #6a7a93;
  --accent: #4ade80;      /* edge green */
  --accent-2: #22d3ee;    /* cyan */
  --gold: #fbbf24;
  --red: #f87171;
  --blue: #60a5fa;
  --purple: #a78bfa;
  --shadow: 0 6px 32px rgba(0,0,0,0.5);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { color: var(--text); margin: 0 0 12px; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 44px; line-height: 1.1; letter-spacing: -0.02em; }
h2 { font-size: 26px; }
h3 { font-size: 17px; }

.accent { color: var(--accent); }
.muted { color: var(--text-3); font-size: 13px; }
.caption { color: var(--text-3); font-size: 12px; margin-top: 8px; }
.positive { color: var(--accent); }
.negative { color: var(--red); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: flex-start; gap: 18px;
  padding: 10px 18px;
  background: rgba(7,9,13,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--text); font-size: 19px; }
.logo-mark { color: var(--accent); font-size: 22px; }
.logo-text .accent { color: var(--accent); }
.tagline { color: var(--text-3); font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; }
.mainnav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  flex: 1;
  margin-left: 20px;
  align-items: center;
  max-height: 64px;
  overflow-y: auto;
}
.mainnav::-webkit-scrollbar { width: 4px; }
.mainnav::-webkit-scrollbar-thumb { background: rgba(212,160,74,0.4); border-radius: 2px; }
.mainnav a {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  padding: 3px 2px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.mainnav a:hover { color: var(--text); }
.mainnav a.active { color: var(--accent); border-bottom-color: var(--accent); }

.topbar-actions { display: flex; align-items: center; gap: 14px; }
.ticker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.04em;
  padding: 6px 10px;
  background: rgba(74,222,128,0.08);
  border: 1px solid rgba(74,222,128,0.2);
  border-radius: 6px;
}

/* ---------- Buttons ---------- */
.btn-primary, .btn-ghost {
  display: inline-block;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #07090d;
}
.btn-primary:hover { background: #65e89a; color: #07090d; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.big { padding: 14px 22px; font-size: 15px; }

/* ---------- Container ---------- */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 36px;
  padding: 36px 0 24px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 28px;
}
.kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  margin-bottom: 14px;
}
.lede {
  color: var(--text-2);
  font-size: 17px;
  max-width: 620px;
  margin: 14px 0 24px;
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 16px;
  margin: 18px 0 24px;
  max-width: 620px;
}
.stat { padding: 14px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--text); }
.stat-value .unit { font-size: 13px; color: var(--text-2); margin-left: 2px; font-weight: 600; }
.stat-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.hero-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 13px; color: var(--text-2); }
.hero-card-foot { display: flex; justify-content: space-between; margin-top: 12px; font-size: 11px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); display: inline-block;
}
.dot.live { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.35;} }

/* ---------- Metric Strip ---------- */
.metric-strip {
  display: grid;
  grid-template-columns: repeat(6,1fr);
  gap: 12px;
  margin-bottom: 28px;
  padding: 16px;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.metric { text-align: center; padding: 4px 8px; }
.metric-num { display: block; font-size: 22px; font-weight: 800; color: var(--accent); font-family: 'JetBrains Mono', monospace; }
.metric-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; display: block; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  font-size: 13px; color: var(--text-2);
  font-weight: 600;
}
.big-card { grid-column: span 2; }

.card-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

/* ---------- Pills ---------- */
.pill {
  display: inline-block;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid;
}
.pill.gold { color: var(--gold); border-color: rgba(251,191,36,0.4); background: rgba(251,191,36,0.07); }
.pill.green { color: var(--accent); border-color: rgba(74,222,128,0.4); background: rgba(74,222,128,0.07); }
.pill.red { color: var(--red); border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.07); }
.pill.blue { color: var(--blue); border-color: rgba(96,165,250,0.4); background: rgba(96,165,250,0.07); }
.pill.purple { color: var(--purple); border-color: rgba(167,139,250,0.4); background: rgba(167,139,250,0.07); }

/* ---------- Play of the Day Card ---------- */
.play-card { background: linear-gradient(135deg, var(--bg-2), #142016); border: 1px solid rgba(74,222,128,0.25); }
.play-title { font-size: 28px; }
.play-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.play-stat {
  background: rgba(7,9,13,0.45);
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 8px;
}
.stat-value-big { font-size: 19px; font-weight: 700; color: var(--text); font-family: 'JetBrains Mono', monospace; }
.play-summary { color: var(--text-2); font-size: 14px; line-height: 1.6; margin: 16px 0 18px; }

/* ---------- Flow List ---------- */
.flow-list { list-style: none; padding: 0; margin: 0 0 14px; }
.flow-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}
.flow-list li:last-child { border-bottom: none; }
.team { font-weight: 600; color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.flow { font-size: 13px; font-weight: 700; }
.flow.up { color: var(--accent); }
.flow.down { color: var(--red); }
.link-arrow { font-size: 13px; font-weight: 600; }

/* ---------- Section ---------- */
.section { margin-bottom: 36px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-2);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
}
.data-table td:first-child, .data-table th:first-child { padding-left: 18px; }
.data-table tr:hover td { background: rgba(34,211,238,0.03); }
.data-table .matchup { color: var(--text); font-weight: 600; }
.data-table .edge-pos { color: var(--accent); font-weight: 700; }
.data-table .edge-neg { color: var(--red); }
.data-table .rec { font-weight: 600; }
.data-table .rec.bet { color: var(--accent); }
.data-table .rec.pass { color: var(--text-3); }
.data-table .rec.lean { color: var(--gold); }

/* ---------- Features ---------- */
.feature-section { padding: 36px 0; }
.feature-section h2 { text-align: center; margin-bottom: 28px; }
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.feature {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.feature-icon { font-size: 28px; margin-bottom: 10px; }
.feature h3 { margin-bottom: 8px; }
.feature p { color: var(--text-2); font-size: 14px; margin: 0; }

/* ---------- Newsletter ---------- */
.newsletter { display: flex; justify-content: center; }
.newsletter-card {
  background: linear-gradient(135deg, var(--bg-2), #0c1a14);
  border: 1px solid rgba(74,222,128,0.3);
  border-radius: var(--radius);
  padding: 36px;
  max-width: 720px;
  width: 100%;
  text-align: center;
}
.newsletter-card form {
  display: flex; gap: 10px; justify-content: center; max-width: 460px; margin: 18px auto 0;
}
.newsletter-card input {
  flex: 1;
  background: var(--bg-1);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
.newsletter-card input:focus { outline: none; border-color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-1);
  padding: 36px 28px 20px;
  margin-top: 40px;
}
.foot-cols {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 36px;
  max-width: 1400px;
  margin: 0 auto;
}
.foot-cols h4 { font-size: 13px; color: var(--text); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.foot-cols a { display: block; color: var(--text-2); font-size: 13px; padding: 3px 0; }
.foot-cols a:hover { color: var(--accent); }
.foot-bot {
  display: flex; justify-content: space-between;
  max-width: 1400px; margin: 28px auto 0;
  padding-top: 18px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--text-3);
}

/* ---------- Play Detail (play-of-day.html) ---------- */
.play-hero {
  background: linear-gradient(135deg, #0e1f17, var(--bg-2));
  border: 1px solid rgba(74,222,128,0.3);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 28px;
}
.play-hero h1 { font-size: 36px; margin-bottom: 12px; }
.factor-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.factor {
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 12px 14px;
  border-radius: 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.factor .f-name { color: var(--text-2); font-size: 13px; }
.factor .f-val { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700; }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.bar-label { width: 160px; font-size: 13px; color: var(--text-2); }
.bar-track { flex: 1; height: 8px; background: var(--bg-3); border-radius: 4px; overflow: hidden; position: relative; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 4px; }
.bar-val { width: 60px; text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text); }

/* ---------- Learn Page ---------- */
.toc {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  position: sticky; top: 80px;
}
.toc h4 { margin-bottom: 10px; }
.toc a { display: block; padding: 6px 0; color: var(--text-2); font-size: 13px; border-bottom: 1px solid var(--line-soft); }
.toc a:hover { color: var(--accent); padding-left: 4px; transition: padding 0.15s; }

.learn-layout {
  display: grid; grid-template-columns: 260px 1fr; gap: 28px;
}
.learn-content { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px; }
.learn-content h2 { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.learn-content h2:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.learn-content p { color: var(--text-2); margin-bottom: 14px; }
.learn-content code { background: var(--bg-1); padding: 2px 6px; border-radius: 4px; color: var(--accent); font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.learn-content pre { background: var(--bg-1); border: 1px solid var(--line); padding: 14px; border-radius: 8px; overflow-x: auto; font-size: 13px; }
.callout {
  background: rgba(34,211,238,0.06);
  border-left: 3px solid var(--accent-2);
  padding: 14px 18px;
  border-radius: 6px;
  margin: 16px 0;
}
.callout strong { color: var(--accent-2); }

/* ---------- Filters ---------- */
.filterbar {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center;
}
.filterbar select, .filterbar input {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
}
.filterbar label { font-size: 12px; color: var(--text-3); margin-right: 4px; }

/* ---------- Page Header ---------- */
.page-head {
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 24px;
}
.page-head h1 { font-size: 32px; margin-bottom: 8px; }
.page-head p { color: var(--text-2); max-width: 720px; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; }
  .metric-strip { grid-template-columns: repeat(3,1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .card-row { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr 1fr; }
  .foot-cols { grid-template-columns: 1fr 1fr; }
  .play-grid { grid-template-columns: repeat(3, 1fr); }
  .learn-layout { grid-template-columns: 1fr; }
  .toc { position: static; }
}
@media (max-width: 720px) {
  h1 { font-size: 32px; }
  .topbar { flex-wrap: wrap; padding: 12px; gap: 12px; }
  .mainnav { overflow-x: auto; gap: 14px; }
  .container { padding: 16px; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .features { grid-template-columns: 1fr; }
  .play-grid { grid-template-columns: 1fr 1fr; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .foot-cols { grid-template-columns: 1fr; }
  /* Dense data tables: scroll horizontally instead of forcing the whole page to
     shrink-to-fit (zoom out) on a phone. A bare <table class="data-table"> that
     isn't wrapped in .table-wrap would otherwise expand the layout viewport to
     its natural ~720px width, rendering every page tiny on mobile. */
  .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  pre { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Collapse INLINE two/three-column grids to a single column on phones. Many
     sections set `style="display:grid;grid-template-columns:1fr 1fr"` inline,
     and an inline style beats the class-based collapse rules above -- so without
     this !important override the second column lands off-screen (~870px wide)
     and forces the whole page to shrink-to-fit (zoom out) on mobile. */
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  /* Let cards shrink below their content's intrinsic width (flex/grid items
     default to min-width:auto, which otherwise forces a card as wide as its
     widest table/row and overflows the page); keep table wrappers within the
     card so the table scrolls inside .table-wrap instead of pushing the page.
     overflow-x:auto lets a card with a wide fixed-column grid (e.g. the sport
     pages' dense game rows: 1.6fr 70px 70px 80px... ≈520px) scroll horizontally
     within itself rather than expand the page -- cards that already fit are
     unaffected (nothing to scroll). Cards are auto-height, so this adds no
     vertical scrollbar. */
  .card { min-width: 0; overflow-x: auto; }
  .table-wrap { max-width: 100%; }
}

/* ---- Data staleness banner ---- */
.stale-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 11px 14px;
  border: 1px solid rgba(251, 191, 36, 0.38);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  background: rgba(251, 191, 36, 0.07);
  color: #f3e6c4;
  font-size: 13px;
  line-height: 1.4;
}
.stale-banner-dot {
  flex: 0 0 auto;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.15);
  animation: stalePulse 2s ease-in-out infinite;
}
@keyframes stalePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.stale-banner-text { flex: 1 1 auto; }
.stale-banner-text strong { color: var(--gold); }
.stale-banner-x {
  flex: 0 0 auto;
  background: none; border: none;
  color: #f3e6c4; opacity: 0.6;
  font-size: 18px; line-height: 1;
  cursor: pointer; padding: 0 4px;
}
.stale-banner-x:hover { opacity: 1; }
