/* Statalyzer static site. Dark theme matching .streamlit/config.toml;
   mobile-first, so phones need no separate layout. */
:root {
  --bg: #0E1117;
  --panel: #1C1F26;
  --panel-2: #242832;
  --text: #E8E8E8;
  --muted: #9aa0aa;
  --primary: #4C8DFF;
  --second: #F2A541;
  --border: rgba(255, 255, 255, 0.12);
  --good: #3fb950;
  --bad: #f85149;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 "Source Sans 3", "Source Sans Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 12px; }

/* Header: logo + search on one row, nav pills scroll sideways on phones. */
header { border-bottom: 1px solid var(--border); padding: 8px 0 6px; position: sticky; top: 0; background: var(--bg); z-index: 10; }
.topbar { display: flex; align-items: center; gap: 10px; }
.topbar img.logo { height: 34px; width: auto; }
.search { position: relative; flex: 1; }
.search input {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font-size: 15px;
}
.search ul {
  position: absolute; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 0; list-style: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; max-height: 60vh; overflow-y: auto;
}
.search li a { display: block; padding: 8px 10px; color: var(--text); }
.search li a:hover, .search li a.active { background: var(--panel-2); text-decoration: none; }
nav.pills { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: thin; }
nav.pills a {
  flex: 0 0 auto; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font-size: 14px; white-space: nowrap;
}
nav.pills a.on { border-color: var(--primary); color: var(--primary); }
nav.pills a.ext { color: var(--muted); }

main { padding: 14px 0 30px; }
h1 { font-size: 1.5rem; margin: 6px 0 10px; }
h2 { font-size: 1.2rem; margin: 22px 0 8px; }
h3 { font-size: 1.02rem; margin: 16px 0 6px; }
.muted, .caption { color: var(--muted); font-size: 0.88rem; }
.note { background: #13233f; color: #9cc2ff; border-radius: 8px; padding: 10px 12px; font-size: 0.92rem; }

/* Cards: 1 per row on phones, up to 3 across on wider screens. */
.cards { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 700px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.card img.shot { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--panel-2); }
.card .name { font-weight: 600; }
.logo-sm { height: 16px; width: 16px; vertical-align: -3px; margin-right: 4px; }

/* Section tabs (pure CSS radio tabs would need no JS; a few lines of JS in
   tabs.js keep the markup simpler). */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin: 12px 0 10px; }
.tabs button {
  flex: 0 0 auto; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text);
  padding: 8px 10px; font: inherit; cursor: pointer;
}
.tabs button.on { border-color: var(--primary); color: var(--primary); }
.tabpanel { display: none; }
.tabpanel.on { display: block; }

/* Tables: horizontal scroll inside the box, never the page. */
.tbl { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: right; }
th:first-child, td:first-child, th.l, td.l { text-align: left; }
th { background: var(--panel); position: sticky; top: 0; cursor: pointer; user-select: none; }
th.sorted-asc::after { content: " ▲"; font-size: 0.7em; }
th.sorted-desc::after { content: " ▼"; font-size: 0.7em; }
tbody tr:hover { background: var(--panel); }
td.name { position: sticky; left: 0; background: var(--bg); }
.hide-sm { display: none; }
@media (min-width: 700px) { .hide-sm { display: table-cell; } }
/* Phones: logo only in the team column, tighter cells, smaller title. */
@media (max-width: 699px) {
  .abbr { display: none; }
  th, td { padding: 6px 5px; }
  table { font-size: 0.86rem; }
  h1 { font-size: 1.25rem; }
}

.games { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
@media (min-width: 700px) { .games { grid-template-columns: repeat(5, 1fr); } }
.games a { display: block; text-align: center; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); }

.matchup { display: grid; grid-template-columns: 1fr; gap: 10px 28px; }
@media (min-width: 900px) { .matchup { grid-template-columns: 1fr 1fr; } }

footer { border-top: 1px solid var(--border); padding: 14px 0 30px; color: var(--muted); font-size: 0.8rem; }
footer p { margin: 0 0 8px; }

/* Rolling-trend chart (trend.js). */
.trend-controls { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 6px 0 8px; }
.trend-controls label { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; color: var(--muted); }
.trend-controls select { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 6px; font: inherit; }
.trend-controls input[type=range] { width: 110px; }
.trend-canvas { position: relative; height: 260px; }
@media (min-width: 700px) { .trend-canvas { height: 360px; } }

/* Player / team header and stat tiles. */
.ph { display: flex; align-items: center; gap: 12px; margin: 8px 0 4px; }
.ph img.shot { width: 72px; height: 72px; border-radius: 50%; background: var(--panel); object-fit: cover; }
.ph h1 { margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.tile .k { color: var(--muted); font-size: 0.82rem; }
.tile .v { font-size: 1.3rem; font-weight: 600; }
.tile .d { color: var(--muted); font-size: 0.8rem; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.btn { display: inline-block; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font-size: 0.9rem; }
details { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; margin: 6px 0; }
details summary { padding: 8px 10px; cursor: pointer; }
details .body { padding: 4px 10px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font-size: 0.9rem; }
.badge { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; color: #fff; vertical-align: 1px; }

/* Team index logo grid: as many per row as fit. */
.teamgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.teamgrid a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font-size: 0.85rem; }
.teamgrid a:hover { border-color: var(--primary); text-decoration: none; }
.teamgrid img { width: 40px; height: 40px; }

/* Compare page pickers. */
.cmp-pick { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 8px 0 12px; }
@media (min-width: 700px) { .cmp-pick { grid-template-columns: 1fr 1fr; } }
.cmp-pick label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--muted); }
.cmp-pick input { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font-size: 15px; }

/* Terms of Service / Privacy Policy */
.legal { max-width: 760px; line-height: 1.6; }
.legal p, .legal li { font-size: 0.97rem; }
.legal ul { padding-left: 22px; }
.legal li { margin: 4px 0; }
.legal code { background: var(--panel); padding: 1px 5px; border-radius: 4px; font-size: 0.88em; }
footer .legal-links a { color: var(--text); }
