/* ==========================================================================
   Home Edge — Market Limits
   Visual system mirrors the Market Limits site: #071a14 canvas, emerald
   accents (#00e676 / #34d399), Inter + JetBrains Mono, 145deg gradient cards.
   Self-contained: no framework or utility-CSS dependency.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-var.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("../fonts/jetbrains-mono.woff2") format("woff2");
}

:root {
  /* site palette */
  --bg: #071a14;
  --bg-deep: #04100c;
  --card: #0b261e;
  --card-2: #0f382b;
  --line: rgba(6, 78, 59, 0.6);
  --line-soft: rgba(0, 230, 118, 0.12);
  --line-strong: rgba(0, 230, 118, 0.35);
  --accent: #00e676;
  --em: #10b981;
  --em-4: #34d399;
  --em-3: #6ee7b7;
  --text: #f1f5f9;
  --text-2: #cbd5e1;
  --body: #e2e8f0;
  --muted: #94a3b8;
  --amber: #fbbf24;
  --rose: #f87171;
  --grad-card: linear-gradient(145deg, #0b261e 0%, #071a14 100%);
  --shadow: 0 20px 40px -24px rgba(0, 0, 0, 0.85);
  --radius: 1rem;
  --radius-sm: 0.75rem;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --maxw: 1280px;
  --header-h: 5rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3, h4 { margin: 0; color: var(--text); }
a { color: var(--em-4); text-decoration: none; }
a:hover { color: var(--em-3); }
::selection { background: rgba(0, 230, 118, 0.35); color: #04130d; }
:focus-visible { outline: 3px solid var(--em-4); outline-offset: 2px; }
img { max-width: 100%; display: block; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--em);
  color: #071a14;
  padding: 0.65rem 1rem;
  border-radius: 0 0 0.75rem 0;
  font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ================================== HEADER ================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 26, 20, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(6, 78, 59, 0.4);
}
.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.75rem; color: var(--text); }
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark {
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
  background: linear-gradient(135deg, #10b981, #047857);
  border: 1px solid rgba(52, 211, 153, 0.3);
  box-shadow: 0 10px 15px -10px rgba(2, 44, 34, 0.9);
  color: #04130d;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}
.brand-mark img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.brand-name {
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  white-space: nowrap;
  transition: color 0.15s;
}
.brand:hover .brand-name { color: var(--em-4); }

.site-nav { display: flex; align-items: center; gap: 1.5rem; margin-left: auto; }
.nav-dd { position: relative; }
.nav-dd-btn {
  appearance: none;
  border: 0;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s;
}
.nav-dd-btn > i:first-child { margin-right: 0.1rem; }
.nav-dd-btn:hover, .nav-dd.open .nav-dd-btn { color: var(--em-4); }
.chev { font-size: 0.6rem; transition: transform 0.15s; }
.nav-dd.open .chev { transform: rotate(180deg); }

.nav-panel {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  padding-top: 0.75rem;
  z-index: 50;
}
.nav-dd-right .nav-panel { left: auto; right: 0; }
.nav-dd.open > .nav-panel { display: block; }
.nav-panel-inner {
  min-width: 15rem;
  background: var(--card);
  border: 1px solid rgba(6, 78, 59, 0.6);
  border-radius: 0.75rem;
  box-shadow: 0 20px 25px -12px rgba(0, 0, 0, 0.6);
  padding: 0.5rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.15s, color 0.15s;
}
.nav-item i { width: 1rem; text-align: center; font-size: 0.8rem; }
.nav-item:hover { background: rgba(2, 44, 34, 0.7); color: var(--em-4); }
.nav-item.is-current { color: var(--em-4); background: rgba(6, 78, 59, 0.45); font-weight: 700; }
.nav-item.is-current i { color: var(--em-4); }

.mobile-toggle {
  display: none;
  appearance: none;
  border: 0;
  background: none;
  color: var(--text-2);
  font-size: 1.25rem;
  padding: 0.5rem;
  cursor: pointer;
}
.mobile-toggle:hover { color: #fff; }

.mobile-menu {
  display: none;
  background: var(--card);
  border-bottom: 1px solid rgba(6, 78, 59, 0.5);
  padding: 1rem 1.5rem;
}
.mobile-menu[hidden] { display: none; }
.m-acc { padding: 0.2rem 0; }
.m-acc-btn {
  appearance: none;
  border: 0;
  background: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0;
  color: var(--text-2);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.m-acc-btn i { margin-right: 0.45rem; font-size: 0.85rem; }
.m-acc-btn:hover { color: #fff; }
.m-acc-btn[aria-expanded="true"] { color: var(--em-4); }
.m-acc-panel {
  padding: 0.25rem 0 0.35rem 1.5rem;
  margin: 0.25rem 0 0 0.5rem;
  border-left: 1px solid rgba(6, 78, 59, 0.5);
  display: grid;
  gap: 0.15rem;
}
.m-acc-panel[hidden] { display: none; }
.m-acc-panel a {
  display: block;
  padding: 0.3rem 0;
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 500;
}
.m-acc-panel a:hover { color: var(--em-4); }
.m-acc-panel a.is-current { color: var(--em-4); font-weight: 700; }

/* =================================== HERO ================================== */
.hero {
  position: relative;
  overflow: hidden;
  padding: 4rem 0;
  border-bottom: 1px solid rgba(6, 78, 59, 0.3);
}
.hero-glow {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(600px, 90vw);
  height: min(600px, 90vw);
  background: rgba(5, 150, 105, 0.1);
  filter: blur(140px);
  border-radius: 50%;
  pointer-events: none;
}
.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: #022c22;
  border: 1px solid rgba(4, 120, 87, 0.6);
  color: var(--em-4);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1.1rem;
}
.hero h1 {
  font-size: clamp(2.5rem, 5.4vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: #fff;
}
.hero-tagline {
  margin: 0.85rem 0 0;
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  font-weight: 600;
  color: var(--em-4);
  font-style: italic;
}
.hero-lede {
  margin: 1rem 0 0;
  max-width: 38rem;
  color: var(--text-2);
  font-size: 1rem;
  line-height: 1.7;
}
.hero-facts {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 1.5rem 0 0;
  padding: 0;
  font-size: 0.875rem;
  color: var(--text-2);
}
.hero-facts i { color: var(--em-4); margin-right: 0.5rem; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-2);
  background: rgba(2, 44, 34, 0.55);
  border: 1px solid rgba(6, 78, 59, 0.6);
  padding: 0.3rem 0.6rem;
  border-radius: 0.5rem;
  font-variant-numeric: tabular-nums;
}
.chip b { color: var(--text); font-weight: 600; }
.chip.accent { color: var(--em-3); border-color: rgba(16, 185, 129, 0.45); background: rgba(16, 185, 129, 0.12); }

.hero-card {
  background: var(--grad-card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.hero-card-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero-figure {
  margin: 0.5rem 0 0;
  font-family: var(--mono);
  font-size: clamp(2.1rem, 4.6vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.hero-figure small { font-family: var(--sans); font-size: 0.4em; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.hero-card-sub { margin: 0.5rem 0 0; font-size: 0.8rem; color: var(--muted); line-height: 1.5; }
.mini-rows { display: grid; gap: 0.45rem; margin-top: 1rem; }
.mini-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--text-2);
  border-top: 1px solid rgba(6, 78, 59, 0.45);
  padding-top: 0.45rem;
}
.mini-row b { font-family: var(--mono); font-size: 0.85rem; font-weight: 600; color: #fff; }

/* ================================= CONTROLS ================================ */
.dock {
  position: sticky;
  top: var(--header-h);
  z-index: 30;
  margin: 1.75rem 0 0;
  background: rgba(11, 38, 30, 0.92);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem clamp(0.85rem, 2vw, 1.25rem);
  box-shadow: var(--shadow);
}
.dock-row { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.sport-tabs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: rgba(2, 44, 34, 0.5);
  flex: none;
}
.sport-tab {
  appearance: none;
  border: 1px solid transparent;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
  min-width: 3.5rem;
}
.sport-tab:hover { background: rgba(6, 78, 59, 0.6); color: #fff; }
.sport-tab[aria-selected="true"] {
  background: var(--em);
  border-color: var(--em);
  color: #071a14;
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.2);
}
.sport-tab[aria-selected="true"]:hover { background: var(--em-4); color: #071a14; }

.filters { display: flex; align-items: flex-end; gap: 0.6rem; flex-wrap: wrap; flex: 1 1 620px; }
.field { display: flex; flex-direction: column; gap: 0.25rem; flex: 1 1 7.5rem; min-width: 0; }
.field label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 0.15rem;
}
select, input[type="search"] {
  appearance: none;
  width: 100%;
  background: rgba(2, 44, 34, 0.75);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.5rem 1.9rem 0.5rem 0.6rem;
  cursor: pointer;
  transition: border-color 0.15s;
  text-overflow: ellipsis;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2334d399' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}
select:hover, input[type="search"]:hover { border-color: rgba(16, 185, 129, 0.55); }
option { background: #0b261e; color: var(--text); }
.reset-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(2, 44, 34, 0.8);
  color: var(--em-3);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.5rem 0.9rem;
  border-radius: 0.5rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s;
}
.reset-btn i { margin-right: 0.35rem; font-size: 0.75rem; }
.reset-btn:hover { background: rgba(6, 78, 59, 0.9); border-color: rgba(16, 185, 129, 0.55); }

.dock-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(6, 78, 59, 0.45);
  font-size: 0.75rem;
  color: var(--muted);
}
.dock-foot b { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.sample-control { display: inline-flex; align-items: center; gap: 0.6rem; }
.sample-control label { font-size: 0.72rem; color: var(--muted); }
.sample-control b { font-family: var(--mono); color: var(--text); font-size: 0.8rem; }

input[type="range"] {
  appearance: none;
  width: 6.5rem;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--em) var(--fill, 50%), rgba(6, 78, 59, 0.9) var(--fill, 50%));
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--em-4);
  border: 2px solid #04130d;
  box-shadow: 0 0 0 1px var(--em);
}
input[type="range"]::-moz-range-thumb {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--em-4);
  border: 2px solid #04130d;
}

/* ================================= SECTIONS ================================ */
.block { padding: clamp(2.5rem, 5vw, 4rem) 0; border-bottom: 1px solid rgba(6, 78, 59, 0.25); scroll-margin-top: 6rem; }
.section-head { max-width: 46rem; margin-bottom: 1.5rem; }
.section-head h2 {
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}
.section-head p { margin: 0.6rem 0 0; color: var(--text-2); font-size: 0.9rem; line-height: 1.65; }
.section-head.with-control {
  max-width: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.section-head.with-control > div { max-width: 46rem; }

.panel {
  background: var(--grad-card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel + .panel { margin-top: 1rem; }
.panel-body { padding: clamp(1rem, 2vw, 1.5rem); }
.panel-body.tight { padding-top: 0.5rem; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.panel-head h3 { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.panel-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--em-4);
  margin-bottom: 0.6rem;
}
.panel-title.spaced { margin-top: 1.1rem; }
.panel-note { font-size: 0.72rem; color: var(--muted); }

/* ================================== KPIs =================================== */
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.kpi-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 1rem; }
.kpi {
  background: var(--grad-card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  transition: border-color 0.2s;
}
.kpi:hover { border-color: var(--line-strong); }
.kpi-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.kpi-value {
  margin-top: 0.45rem;
  font-family: var(--mono);
  font-size: clamp(1.4rem, 2.6vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.kpi-value.accent { color: var(--em-4); }
.kpi-value .unit { font-family: var(--sans); font-size: 0.45em; font-weight: 500; color: var(--muted); margin-left: 0.2rem; }
.kpi-foot {
  margin-top: 0.45rem;
  font-size: 0.7rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.kpi-foot .n { color: var(--text-2); }
.trend-tag {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 0.3rem;
  border: 1px solid var(--line);
  color: var(--muted);
}
.trend-tag.up { color: var(--em-3); background: rgba(16, 185, 129, 0.12); border-color: rgba(52, 211, 153, 0.3); }
.trend-tag.down { color: #fca5a5; background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.25); }

/* ================================= CHARTS ================================== */
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-svg text { font-family: var(--sans); }
.axis-line { stroke: rgba(148, 163, 184, 0.25); stroke-width: 1; }
.grid-line { stroke: rgba(148, 163, 184, 0.14); stroke-width: 1; }
.axis-label { fill: var(--muted); font-size: 10px; letter-spacing: 0.04em; }
.bar { transition: opacity 0.15s; cursor: pointer; }
.bar:hover { opacity: 0.85; }
.ci-cap { stroke: rgba(241, 245, 249, 0.5); stroke-width: 1.1; }
.ci-line { stroke: rgba(241, 245, 249, 0.32); stroke-width: 1; stroke-dasharray: 2 2; }
.point { cursor: pointer; }

.chart-tooltip {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  background: rgba(4, 16, 12, 0.97);
  border: 1px solid rgba(16, 185, 129, 0.45);
  border-radius: 0.6rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.72rem;
  color: var(--text);
  box-shadow: 0 20px 40px -20px #000;
  max-width: 17rem;
  opacity: 0;
  transition: opacity 0.12s;
  font-variant-numeric: tabular-nums;
}
.chart-tooltip.show { opacity: 1; }
.chart-tooltip .tt-title { font-weight: 700; color: var(--em-4); margin-bottom: 0.3rem; }
.chart-tooltip .tt-row { display: flex; justify-content: space-between; gap: 0.9rem; color: var(--muted); }
.chart-tooltip .tt-row b { color: var(--text); font-weight: 600; }
.chart-tooltip .tt-note { margin-top: 0.3rem; padding-top: 0.3rem; border-top: 1px solid rgba(6, 78, 59, 0.6); color: var(--muted); font-size: 0.68rem; }

.legend { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.7rem; color: var(--muted); }
.legend-swatch { width: 0.55rem; height: 0.55rem; border-radius: 2px; flex: none; }
.legend-swatch.line { height: 2px; width: 0.9rem; }

/* ================================== SEGMENTS =============================== */
.seg {
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: rgba(2, 44, 34, 0.4);
  flex-wrap: wrap;
}
.seg button {
  appearance: none;
  border: 1px solid transparent;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.4rem 0.65rem;
  border-radius: 0.5rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.seg button:hover { background: rgba(6, 78, 59, 0.6); color: #fff; }
.seg button[aria-pressed="true"] {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(52, 211, 153, 0.55);
  color: var(--em-3);
}

/* ================================== TABLES ================================= */
.table-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
  padding-top: 0.5rem;
}
.table-tools .left { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.search-wrap { position: relative; }
.search-wrap i { position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%); font-size: 0.7rem; color: var(--em-4); pointer-events: none; }
.search-wrap input { width: 13rem; padding-left: 1.85rem; cursor: text; }

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(2, 44, 34, 0.32);
  -webkit-overflow-scrolling: touch;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  min-width: 46rem;
}
table.data thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0b261e;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-align: right;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  user-select: none;
}
table.data thead th:first-child, table.data thead th.text-l { text-align: left; }
table.data thead th.sortable { cursor: pointer; }
table.data thead th.sortable:hover { color: var(--em-4); }
table.data thead th .arrow { opacity: 0.4; margin-left: 0.15rem; font-size: 0.65rem; }
table.data thead th[aria-sort="ascending"], table.data thead th[aria-sort="descending"] { color: var(--em-4); }
table.data thead th[aria-sort="ascending"] .arrow, table.data thead th[aria-sort="descending"] .arrow { opacity: 1; }
table.data tbody td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid rgba(6, 78, 59, 0.4);
  text-align: right;
  color: var(--text-2);
  white-space: nowrap;
}
table.data tbody td .ci { color: var(--muted); font-size: 0.65rem; margin-left: 0.25rem; }
table.data tbody td:first-child, table.data tbody td.text-l { text-align: left; }
table.data tbody tr:hover { background: rgba(6, 78, 59, 0.35); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.is-low-sample td { color: var(--muted); }
table.data tbody tr[data-team] { cursor: pointer; }
table.data tbody tr[data-team]:focus-visible { outline: 2px solid var(--em-4); outline-offset: -2px; }

.rank {
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 0.35rem;
  background: rgba(6, 78, 59, 0.6);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  margin-right: 0.45rem;
  flex: none;
}
.rank.top { background: rgba(16, 185, 129, 0.2); border-color: rgba(52, 211, 153, 0.5); color: var(--em-3); }
.team-cell { display: inline-flex; align-items: center; color: var(--text); font-weight: 500; }
.team-cell .sub { margin-left: 0.45rem; color: var(--muted); font-size: 0.68rem; font-weight: 400; }
.num-strong { color: #fff; font-weight: 600; }
.pos { color: var(--em-4) !important; }
.neg { color: var(--rose) !important; }
.muted { color: var(--muted); }
.sample-flag { font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--amber); }
.empty-state { padding: 2rem 1rem; text-align: center; color: var(--muted); font-size: 0.82rem; }
.table-caption { margin: 0.7rem 0 0; font-size: 0.72rem; line-height: 1.6; color: var(--muted); }
.table-caption b { color: var(--text-2); }

/* ================================== FOCUS ================================== */
.focus-card { display: grid; gap: 1rem; }
.focus-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.focus-name { font-size: 1.2rem; font-weight: 700; color: #fff; }
.focus-meta { font-size: 0.75rem; color: var(--muted); }
.split-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.6rem; }
.split-cell {
  background: rgba(2, 44, 34, 0.45);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
}
.split-cell .label { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.split-cell .value { margin-top: 0.3rem; font-family: var(--mono); font-size: 1.3rem; font-weight: 700; color: #fff; letter-spacing: -0.02em; }
.split-cell .sub { margin-top: 0.25rem; font-size: 0.68rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ================================ METHODOLOGY ============================== */
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
details.method {
  background: rgba(2, 44, 34, 0.35);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
  overflow: hidden;
}
details.method > summary {
  cursor: pointer;
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
details.method > summary::-webkit-details-marker { display: none; }
details.method > summary::after {
  content: "+";
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--em-4);
}
details.method[open] > summary::after { content: "−"; }
details.method > summary:hover { background: rgba(6, 78, 59, 0.45); }
.method-body { padding: 0 1rem 1rem; font-size: 0.8rem; color: var(--text-2); line-height: 1.7; }
.method-body.flush { padding: 0; }
.method-body p { margin: 0 0 0.65rem; }
.method-body p:last-child { margin-bottom: 0; }
.method-body ul { margin: 0 0 0.65rem; padding-left: 1.1rem; }
.method-body li { margin-bottom: 0.3rem; }
.method-body code, .mono {
  font-family: var(--mono);
  font-size: 0.72rem;
  background: rgba(2, 44, 34, 0.8);
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  padding: 0.05rem 0.3rem;
  color: var(--em-3);
}
.formula {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text);
  background: rgba(2, 44, 34, 0.7);
  border: 1px solid var(--line);
  border-left: 2px solid var(--em);
  border-radius: 0.4rem;
  padding: 0.7rem 0.8rem;
  margin: 0 0 0.65rem;
  overflow-x: auto;
  white-space: pre;
}
.integrity-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0.5rem; margin: 0; }
.integrity-item { background: rgba(2, 44, 34, 0.45); border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.6rem 0.7rem; }
.integrity-item dt { font-size: 0.6rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.15rem; }
.integrity-item dd { margin: 0; font-family: var(--mono); font-size: 0.82rem; color: #fff; font-variant-numeric: tabular-nums; }
.integrity-item dd small { display: block; margin-top: 0.15rem; font-family: var(--sans); font-size: 0.65rem; color: var(--muted); }
.hash {
  font-family: var(--mono);
  font-size: 0.6rem;
  line-height: 1.6;
  color: var(--muted);
  word-break: break-all;
  max-height: 9rem;
  overflow-y: auto;
  background: rgba(2, 44, 34, 0.4);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.6rem 0.7rem;
}
.data-stamp { margin: 0.7rem 0 0; font-size: 0.65rem; color: var(--muted); }

/* ================================== NOTES ================================== */
.note-card {
  background: rgba(2, 44, 34, 0.5);
  border: 1px solid var(--line);
  border-left: 2px solid rgba(52, 211, 153, 0.55);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  font-size: 0.8rem;
  color: var(--text-2);
}
.note-card h4 { font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--em-4); margin-bottom: 0.35rem; }
.note-card p { margin: 0; }

/* ================================== FOOTER ================================= */
.site-footer {
  margin-top: auto;
  border-top: 1px solid rgba(6, 78, 59, 0.4);
  background: var(--bg-deep);
  padding: 2.5rem 0;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.footer-inner p { margin: 0; }
.footer-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 1.25rem; }
.footer-nav a { color: var(--muted); }
.footer-nav a:hover { color: var(--em-4); }
.footer-sep { color: #334155; }

/* ================================= UTILITIES =============================== */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }
.skel {
  background: linear-gradient(90deg, rgba(6, 78, 59, 0.4), rgba(6, 78, 59, 0.75), rgba(6, 78, 59, 0.4));
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
  border-radius: 0.35rem;
  color: transparent !important;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.status-line { display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: var(--muted); padding: 0.5rem 0; }
.spinner {
  width: 0.7rem; height: 0.7rem; border-radius: 50%;
  border: 1.5px solid rgba(16, 185, 129, 0.25); border-top-color: var(--em);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fadeIn 0.3s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* ================================ RESPONSIVE =============================== */
/* 1024–1279: nav collapses, KPI grid steps down */
@media (max-width: 1279px) {
  .site-nav { display: none; }
  .mobile-toggle { display: block; }
  .mobile-menu { display: block; }
  .hero { padding: 3rem 0; }
}

@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .hero-card { max-width: 30rem; }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .dock { position: static; }
  .block { scroll-margin-top: 1rem; }
}

@media (max-width: 860px) {
  .header-inner { gap: 0.75rem; }
  .hero { padding: 2.5rem 0; }
  .hero-facts { gap: 0.4rem 1rem; font-size: 0.82rem; }
  .filters { flex: 1 1 100%; }
  .field { flex: 1 1 calc(50% - 0.3rem); }
  .reset-btn { flex: 1 1 100%; }
  .dock-row { gap: 0.75rem; }
  .sport-tabs { width: 100%; }
  .sport-tab { flex: 1; }
  .section-head.with-control { align-items: flex-start; }
  .seg { width: 100%; }
  .seg button { flex: 1 1 auto; }
  .table-tools .left { width: 100%; }
  .search-wrap { width: 100%; }
  .search-wrap input { width: 100%; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .kpi-grid, .kpi-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 1.35rem; }
  .kpi { padding: 0.75rem 0.85rem; }
  .hero h1 { font-size: 2.4rem; }
  .hero-tagline { font-size: 1.05rem; }
  .hero-lede { font-size: 0.92rem; }
  .hero-card { padding: 1.15rem; }
  .split-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-body { padding: 0.9rem; }
  .table-scroll { border-radius: 0.6rem; }
  table.data { min-width: 40rem; }
  .footer-nav { gap: 0.4rem 0.9rem; }
  .mobile-menu { padding: 0.75rem 1rem; }
}

@media (max-width: 420px) {
  .wrap { padding: 0 0.9rem; }
  .kpi-grid, .kpi-grid.four { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 2rem 0; }
  .hero h1 { font-size: 2.1rem; }
  .hero-facts li { width: 100%; }
  .sport-tab { padding: 0.5rem 0.4rem; font-size: 0.8rem; min-width: 0; }
  .field { flex: 1 1 100%; }
  .split-grid { grid-template-columns: minmax(0, 1fr); }
  .sample-control { width: 100%; justify-content: space-between; }
  input[type="range"] { width: 45%; }
  .footer-inner { font-size: 0.7rem; text-align: center; }
}

/* =====================================================================
   Tight header + merged overview (modelled on Upset Index)
   ===================================================================== */
.hero--tight { padding: 1.25rem 0 0.8rem; border-bottom: 0; }
.hero--tight .hero-glow { display: none; }
.hero--tight h1 {
  margin: 0;
  font-size: 1.875rem;
  line-height: 1.25;
  letter-spacing: -0.025em;
  font-weight: 800;
  color: #fff;
}
@media (min-width: 640px) {
  .hero--tight h1 { font-size: 2.25rem; line-height: 2.5rem; }
}
.hero-grad {
  background: linear-gradient(to right, #34d399, #a7f3d0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub { margin: 0.25rem 0 0; max-width: 42rem; color: var(--muted); font-size: 0.875rem; line-height: 1.25rem; }

.block--tight { padding: 1.25rem 0 2.25rem; }
.kpi-grid--compact { margin-bottom: 0.75rem; gap: 0.6rem; }
.kpi-grid--compact .kpi { padding: 0.7rem 0.9rem; }
.kpi-grid--compact .kpi-value { font-size: 1.55rem; }

.block--tight .panel-head { align-items: center; flex-wrap: wrap; gap: 0.75rem 1rem; margin-bottom: 0.75rem; }
.overview-split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 1.25rem;
  align-items: center;
}
.overview-chart { min-width: 0; }
.data--compact th, .data--compact td { padding: 0.5rem 0.55rem; font-size: 0.78rem; }
.data--compact th { font-size: 0.62rem; line-height: 1.25; }
.data--compact .ci { display: block; font-size: 0.62rem; }
@media (max-width: 1000px) {
  .overview-split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .hero--tight { padding: 1.25rem 0 0.8rem; }
  .block--tight { padding-top: 1rem; }
}
.overview-split { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); }
table.data.data--compact { min-width: 0; width: 100%; }
@media (max-width: 1000px) {
  .overview-split { grid-template-columns: minmax(0, 1fr); }
  table.data.data--compact { min-width: 34rem; }
}

/* Top-level Hashlines link */
.site-nav .nav-link { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.5rem 0; color: var(--text-2); font-size: 0.875rem; font-weight: 500; text-decoration: none; white-space: nowrap; transition: color 0.15s; }
.site-nav .nav-link:hover { color: var(--em-4); }
.site-nav .nav-link > i:first-child { margin-right: 0.1rem; }
.mobile-menu .m-link { display: block; padding: 0.35rem 0; color: var(--text-2); font-size: 0.9375rem; font-weight: 500; text-decoration: none; }
.mobile-menu .m-link i { margin-right: 0.45rem; font-size: 0.85rem; }
.mobile-menu .m-link:hover { color: #fff; }
