/* US Youth Soccer Prospect Tracker — USMNT light theme (v3) */
:root {
  --navy: #0a1b44;
  --navy-2: #122a5e;
  --bg: #eaeef7;
  --bg-soft: #f3f6fc;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --border: #d9e1f0;
  --border-soft: #e7ecf6;
  --text: #14223f;
  --text-dim: #5d6b8a;
  --red: #c8102e;
  --red-bright: #e11d3a;
  --blue: #2f5fb8;
  --blue-bright: #3b74e0;
  --white-accent: #cfd9ee;
  --accent: var(--red);
  --up: #1a9d56;
  --down: #d2283a;
  --flat: #8090ad;
  --shadow: 0 6px 20px rgba(20, 40, 90, 0.09);
  --shadow-lg: 0 12px 30px rgba(20, 40, 90, 0.12);
  --stripe: linear-gradient(90deg, var(--red) 0 50%, var(--blue) 50% 100%);
  --maxw: 1180px;
}

* { box-sizing: border-box; }

/* Always reserve the page scrollbar so every section computes the same usable
   width as the table's scroll container (otherwise the table looks wider). */
html { overflow-y: scroll; scrollbar-gutter: stable; }

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  min-height: 100vh;
  background:
    repeating-linear-gradient(135deg, rgba(20, 40, 90, 0.018) 0 1px, transparent 1px 26px),
    var(--bg);
}

/* ---------- header (stays dark navy) ---------- */
.site-header {
  padding: 40px 20px 26px;
  text-align: center;
  position: relative;
  color: #fff;
  background:
    radial-gradient(70% 150% at 50% -20%, rgba(91, 141, 239, 0.28), transparent 60%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
}
.site-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--stripe);
}
.header-inner { max-width: var(--maxw); margin: 0 auto; }
.site-header h1 {
  margin: 0; font-size: 2.15rem; font-weight: 800; letter-spacing: -0.5px; color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 16px;
}
.header-crest { height: 2.7rem; width: auto; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45)); }
.subtitle { margin: 12px 0 0; color: #c2cde6; font-size: 0.98rem; }
.source {
  display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 0.74rem; font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.3); letter-spacing: 0.3px;
}
.meta { margin: 8px 0 0; color: #9fb0d4; font-size: 0.8rem; }
.methodology { margin: 8px auto 0; max-width: 640px; color: #9fb0d4; font-size: 0.82rem; line-height: 1.5; }
.methodology strong { color: #c2cde6; }

/* ---------- top nav (tracker <-> blog) ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 22px;
  display: flex; align-items: center; gap: 8px;
}
.nav-link {
  position: relative; padding: 14px 4px; margin-right: 18px;
  color: var(--text-dim); text-decoration: none; font-weight: 800;
  font-size: 0.86rem; letter-spacing: 0.3px; transition: color 0.15s;
}
.nav-link:hover { color: var(--navy); }
.nav-link.active { color: var(--navy); }
.nav-link.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--stripe);
}
@media (max-width: 560px) { .nav-inner { padding: 0 16px; } }

/* ---------- section dividers ---------- */
.section-kicker {
  max-width: var(--maxw); margin: 44px auto 0; padding: 0 22px;
  display: flex; align-items: center; gap: 14px;
}
.section-kicker span {
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 2.5px; font-weight: 800;
  color: var(--navy); white-space: nowrap;
}
.section-kicker::before { content: ""; width: 30px; height: 4px; border-radius: 2px; background: var(--stripe); flex: 0 0 auto; }
.section-kicker::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border) 0%, transparent 100%); }

/* ---------- dashboard ---------- */
.dashboard { max-width: var(--maxw); margin: 16px auto 0; padding: 0 22px; }
/* one row of stat tiles, wrapping only on small screens */
.stat-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.stat-tile {
  flex: 1 1 150px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px;
  position: relative; overflow: hidden; box-shadow: var(--shadow);
}
.stat-tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--red); }
.stat-tile.blue::before { background: var(--blue); }
.stat-tile.gold::before { background: var(--navy); }
.stat-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim); font-weight: 800; }
.stat-num { font-size: 1.75rem; font-weight: 800; margin-top: 5px; line-height: 1.1; color: var(--navy); }
.stat-sub { font-size: 0.77rem; color: var(--text-dim); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub .up { color: var(--up); font-weight: 800; }
.stat-sub .down { color: var(--down); font-weight: 800; }

.panels { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; margin-top: 18px; }
@media (max-width: 760px) { .panels { grid-template-columns: 1fr; } }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px;
  box-shadow: var(--shadow);
}
.panel-title {
  font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim);
  margin: 0 0 14px; display: flex; justify-content: space-between; align-items: baseline; font-weight: 800;
}
.panel-title .hl { color: var(--navy); font-weight: 800; text-transform: none; letter-spacing: 0; font-size: 0.92rem; }

.trend-chart { width: 100%; height: 168px; display: block; }
.trend-axis { fill: var(--text-dim); font-size: 10px; }
.trend-dot { fill: var(--red); stroke: #fff; stroke-width: 2; opacity: 0; transition: opacity 0.1s; pointer-events: none; }
.trend-dot.on { opacity: 1; }
.spark-dot { stroke-width: 1.3; }
.trend-hit { fill: transparent; cursor: pointer; }
.sparkline { overflow: visible; }
.chart-tip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--navy); color: #fff; border-radius: 9px; padding: 6px 11px;
  font-size: 0.82rem; box-shadow: 0 8px 22px rgba(10, 27, 68, 0.35);
  display: flex; flex-direction: column; line-height: 1.3; white-space: nowrap;
}
.chart-tip .tv { font-weight: 800; }
.chart-tip .td { color: #b9c6e2; font-size: 0.68rem; }
.chart-tip::after {
  content: ""; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--navy); border-bottom: 0;
}
.chart-tip.hidden { display: none; }

.split-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 0.86rem; }
.split-row:last-child { margin-bottom: 2px; }
.split-row .lbl { width: 66px; color: var(--text-dim); flex-shrink: 0; font-weight: 700; }
.split-track { flex: 1; height: 18px; background: #eef2f9; border-radius: 9px; overflow: hidden; border: 1px solid var(--border); }
.split-fill { display: block; height: 100%; min-width: 6px; border-radius: 9px; transition: width 0.5s ease; }
.split-fill.us { background: linear-gradient(90deg, var(--red), var(--red-bright)); }
.split-fill.eu { background: linear-gradient(90deg, var(--blue), var(--blue-bright)); }
.split-fill.other { background: #9aa8c6; }
.split-row .cnt { width: 28px; text-align: right; font-weight: 800; color: var(--navy); }

.topclubs-panel { margin-top: 18px; }
.topclubs-grid { columns: 2; column-gap: 30px; }
@media (max-width: 760px) { .topclubs-grid { columns: 1; } }
.topclubs-grid .topclub-row { break-inside: avoid; }
.topclub-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 0.88rem; border-bottom: 1px solid var(--border-soft); }
.topclub-row:last-child { border-bottom: none; }
.topclub-row img { width: 22px; height: 22px; object-fit: contain; }
.topclub-row .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topclub-row .ct { font-weight: 800; color: var(--blue); }

/* latest news */
.news-panel { margin-top: 18px; }
.news-pager { display: inline-flex; align-items: center; gap: 10px; }
.news-nav {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--navy); font-size: 1rem; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.news-nav:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.news-nav:disabled { opacity: 0.4; cursor: default; }
#news-range { min-width: 92px; text-align: center; }
.news-list { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 30px; }
@media (max-width: 760px) { .news-list { columns: 1; } }
.news-item { break-inside: avoid; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.news-item a { color: var(--text); text-decoration: none; font-size: 0.92rem; font-weight: 600; line-height: 1.35; }
.news-item a:hover { color: var(--blue); }
.news-meta { font-size: 0.74rem; color: var(--text-dim); margin-top: 5px; }
.news-meta .news-player {
  color: var(--red); font-weight: 800; background: rgba(200, 16, 46, 0.1);
  padding: 1px 7px; border-radius: 999px; margin-right: 4px;
}

/* ---------- controls (single line) ---------- */
.controls {
  max-width: var(--maxw); margin: 18px auto 0; padding: 0 22px;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
}
.sort { color: var(--text-dim); font-size: 0.85rem; display: flex; align-items: center; gap: 7px; font-weight: 700; }
#sort {
  padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 0.85rem;
}
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-left: auto; background: var(--surface); }
.view-btn {
  padding: 9px 16px; border: none; background: var(--surface); color: var(--text-dim);
  font-size: 0.85rem; cursor: pointer; transition: all 0.15s; font-weight: 700;
}
.view-btn:hover { color: var(--navy); }
.view-btn.active { background: var(--red); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 15px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-dim); font-size: 0.82rem;
  cursor: pointer; transition: all 0.15s; font-weight: 700;
}
.chip:hover { color: var(--navy); border-color: var(--blue); }
.chip.active { background: var(--red); color: #fff; border-color: var(--red); }

/* ---------- player grid ---------- */
.grid {
  max-width: var(--maxw); margin: 20px auto 0; padding: 0 22px 56px;
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--border);
  border-radius: 16px; padding: 20px; box-shadow: var(--shadow); position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card-u20 { border-top-color: var(--red); }
.card-sr { border-top-color: var(--blue); }
.card-pin { border-top-color: var(--navy); }
.card-top { display: flex; gap: 15px; align-items: center; }
.avatar {
  width: 66px; height: 66px; border-radius: 13px; object-fit: cover;
  background: #eef2f9; border: 1px solid var(--border); flex-shrink: 0;
}
.who { min-width: 0; }
.who h2 { margin: 0; font-size: 1.18rem; line-height: 1.2; color: var(--navy); }
.who .sub { margin: 4px 0 0; color: var(--text-dim); font-size: 0.82rem; }
.nat { margin-top: 5px; font-size: 0.78rem; color: var(--text-dim); }
.moved-badge {
  position: absolute; top: 16px; right: 16px; background: var(--red); color: #fff;
  font-size: 0.66rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; letter-spacing: 0.4px;
}

.value-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 0 4px; padding-top: 16px; border-top: 1px solid var(--border);
}
.value-main { display: flex; align-items: baseline; gap: 10px; }
.value-num { font-size: 1.55rem; font-weight: 800; color: var(--navy); }
.value-change { font-size: 0.82rem; font-weight: 800; }
.value-change.up { color: var(--up); }
.value-change.down { color: var(--down); }
.value-change.flat { color: var(--flat); }
.sparkline { height: 34px; width: 112px; }

.block { margin-top: 14px; }
.block-label { font-size: 0.67rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim); margin-bottom: 6px; font-weight: 800; }
.club-line { font-size: 0.92rem; font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--navy); }
.crest { width: 21px; height: 21px; object-fit: contain; flex-shrink: 0; }
.crest-sm { width: 17px; height: 17px; object-fit: contain; vertical-align: middle; margin-right: 5px; }
.transfer-line { font-size: 0.85rem; color: var(--text); }
.transfer-line .arrow { color: var(--blue); margin: 0 5px; }
.transfer-meta { color: var(--text-dim); font-size: 0.78rem; }
.fixtures { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fixture {
  display: flex; align-items: center; gap: 8px; font-size: 0.82rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 7px 10px;
}
.fixture .fdate { color: var(--text-dim); min-width: 58px; }
.fixture .ha { font-size: 0.66rem; font-weight: 800; padding: 1px 6px; border-radius: 5px; background: #e6ebf4; color: var(--text-dim); }
.fixture .ha.H { background: #d8f0e2; color: var(--up); }
.fixture .ha.A { background: #fbe0e3; color: var(--down); }
.fixture .opp { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--text-dim); font-size: 0.82rem; }
a.tm-link { color: var(--blue); text-decoration: none; font-size: 0.8rem; font-weight: 700; }
a.tm-link:hover { text-decoration: underline; }

/* tier badge */
.tier { display: inline-block; font-size: 0.66rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; letter-spacing: 0.3px; vertical-align: middle; }
.tier.t-2024 { background: rgba(47, 95, 184, 0.12); color: var(--blue); border: 1px solid rgba(47, 95, 184, 0.35); }
.tier.t-U20 { background: rgba(200, 16, 46, 0.1); color: var(--red); border: 1px solid rgba(200, 16, 46, 0.35); }
.tier.t-pinned { background: rgba(10, 27, 68, 0.08); color: var(--navy); border: 1px solid rgba(10, 27, 68, 0.25); }
.who .sub .tier { margin-left: 6px; }

/* ---------- table ---------- */
.table-wrap { max-width: var(--maxw); margin: 20px auto 0; padding: 0 22px 56px; }
.table-scroll { overflow-x: auto; overflow-y: hidden; border-radius: 14px; }
table.ptable { width: 100%; border-collapse: collapse; font-size: 0.86rem; background: var(--surface); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
table.ptable th, table.ptable td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
table.ptable thead th {
  position: sticky; top: 0; background: var(--navy); color: #cdd7ec;
  font-size: 0.71rem; text-transform: uppercase; letter-spacing: 0.5px; cursor: pointer; user-select: none; font-weight: 800;
}
table.ptable thead th:hover { color: #fff; }
table.ptable thead th.sorted-desc::after { content: " ▾"; color: #ff8a96; }
table.ptable thead th.sorted-asc::after  { content: " ▴"; color: #ff8a96; }
table.ptable tbody tr:hover { background: var(--surface-2); }
.tcell-player { display: flex; align-items: center; gap: 10px; }
.tcell-player img { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; background: #eef2f9; }
.tcell-player a { color: var(--navy); text-decoration: none; font-weight: 800; }
.tcell-player a:hover { color: var(--blue); }
.t-value { font-weight: 800; text-align: right; color: var(--navy); }
.t-change.up { color: var(--up); } .t-change.down { color: var(--down); } .t-change.flat { color: var(--flat); }
.t-moved { color: var(--red); font-weight: 800; font-size: 0.7rem; }
.t-arrow { color: var(--blue); font-weight: 800; }
td.num, th.num { text-align: right; }

/* ---------- value movers page ---------- */
.movers-wrap { max-width: var(--maxw); margin: 20px auto 0; padding: 0 22px 64px; }
.movers-summary { max-width: var(--maxw); margin: 0 0 14px; color: var(--text-dim); font-size: 0.9rem; }
table.movers-table thead th { cursor: default; }
table.movers-table thead th:hover { color: #cdd7ec; }
td.muted-val { color: var(--text-dim); font-weight: 400; }

/* ---------- latest blog posts (index page) ---------- */
.blog-latest {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  max-width: var(--maxw); margin: 18px auto 0; padding: 0 22px;
}
.blog-latest + .section-kicker { margin-top: 28px; }
@media (max-width: 900px) { .blog-latest { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .blog-latest { grid-template-columns: 1fr; padding-left: 16px; padding-right: 16px; } }
.blc {
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-top: 3px solid var(--red);
  border-radius: 12px; overflow: hidden; text-decoration: none; color: inherit;
  box-shadow: var(--shadow); transition: transform 0.15s, box-shadow 0.15s, border-top-color 0.15s;
}
.blc:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-top-color: var(--blue); }
.blc-img img { width: 100%; height: 90px; object-fit: cover; object-position: center 28%; display: block; }
.blc-body { padding: 9px 12px; display: flex; flex-direction: column; flex: 1; }
.blc-meta { font-size: 0.67rem; color: var(--text-dim); font-weight: 700; margin-bottom: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.blc-tag {
  font-size: 0.64rem; font-weight: 800; letter-spacing: 0.3px; padding: 1px 6px;
  border-radius: 999px; background: rgba(47,95,184,0.1); color: var(--blue);
  border: 1px solid rgba(47,95,184,0.28);
}
.blc-title { font-size: 0.86rem; font-weight: 800; color: var(--navy); line-height: 1.3; margin-bottom: 4px; }
.blc-excerpt {
  font-size: 0.75rem; color: var(--text-dim); line-height: 1.45; flex: 1; margin-bottom: 7px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.blc-read { font-size: 0.72rem; font-weight: 800; color: var(--red); margin-top: auto; }
.blc:hover .blc-read { color: var(--blue); }

/* ---------- states ---------- */
.empty { text-align: center; color: var(--text-dim); padding: 44px; }
.hidden { display: none; }
.loading { text-align: center; color: var(--text-dim); padding: 60px 20px; }
.error-box {
  max-width: 640px; margin: 44px auto; padding: 22px 26px; border-radius: 14px;
  background: #fdecee; border: 1px solid #f3c4cb; color: #8a1525;
}
.error-box code { background: #ffffff80; padding: 2px 6px; border-radius: 5px; }

/* ---------- small screens ---------- */
@media (max-width: 560px) {
  .site-header { padding: 26px 16px 20px; }
  .site-header h1 { font-size: 1.5rem; gap: 10px; }
  .header-crest { height: 2rem; }
  .subtitle { font-size: 0.86rem; }
  .section-kicker { margin-top: 32px; padding: 0 16px; gap: 10px; }
  .section-kicker span { letter-spacing: 1.8px; }
  .dashboard, .controls, .grid, .table-wrap { padding-left: 16px; padding-right: 16px; }
  .stat-grid { gap: 12px; }
  .stat-tile { flex: 1 1 calc(50% - 6px); padding: 14px 16px; }
  .stat-num { font-size: 1.5rem; }
  .panel { padding: 16px; }
  .panels { gap: 12px; }
  .card { padding: 16px; }
  .news-pager { gap: 6px; }
  /* hint that the wide table scrolls sideways */
  .table-scroll { -webkit-overflow-scrolling: touch; }
}
