:root {
    --bg: #0e0e10;
    --panel: #1c1c1e;
    --panel-2: #2c2c2e;
    --border: #3a3a3c;
    --text: #e5e5ea;
    --muted: #8e8e93;
    --accent: #0a84ff;
    --green: #32d74b;
    --red: #ff453a;
    --orange: #ff9f0a;
    --purple: #bf5af2;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.4;
}

.site-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-wrap: wrap;
}

.brand {
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 17px;
}

.crumbs { display: flex; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 20px;
}

h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 17px; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.grid { display: grid; gap: 12px; }

.team-card, .panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}

.team-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: var(--text);
}
.team-card:hover { border-color: var(--accent); }
.team-card .tname { font-weight: 600; font-size: 16px; }
.team-card .tdate { color: var(--muted); font-size: 13px; }

select {
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
}

.gametoolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }

.statboard { overflow-x: auto; }

table.stats {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
    white-space: nowrap;
}
table.stats th, table.stats td {
    padding: 8px 10px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}
table.stats th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
table.stats td.name { text-align: left; font-weight: 600; }
table.stats tbody tr:hover th, table.stats tbody tr:hover td { background: var(--panel-2); }
table.stats a { color: var(--text); text-decoration: none; }
table.stats a:hover { color: var(--accent); }

.pill {
    display: inline-block;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px 7px;
    font-size: 12px;
    margin-left: 5px;
    color: var(--muted);
}

.assist-section { margin-top: 8px; }
.assist-block { margin: 10px 0; }
.assist-block h4 { margin: 0 0 6px; font-size: 14px; color: var(--text); }
.assist-item { color: var(--muted); font-size: 13px; margin: 2px 0; }
.assist-item b { color: var(--text); }
.empty { color: var(--muted); padding: 16px; text-align: center; }
a.back { color: var(--accent); text-decoration: none; font-size: 13px; }
a.back:hover { text-decoration: underline; }

/* ---------- Shot chart & heat map ---------- */
.chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}
.chart-head h2 { margin: 0; }
.chart-toggle { display: inline-flex; gap: 4px; }
.chart-toggle button {
    background: var(--panel-2);
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
}
.chart-toggle button.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.chart-subbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 12px;
}
.chart-subbar label { display: inline-flex; align-items: center; gap: 6px; }
.chart-subbar select {
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 6px;
    font-size: 12px;
}
.chart-options { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.chart-options[hidden] { display: none; }
.chart-options label { display: inline-flex; align-items: center; gap: 6px; }
.chart-wrap {
    background: #2c2c2e;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
}
svg.chart { display: block; width: 100%; height: auto; }
.chart-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
    align-items: center;
}
.chart-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .lg i {
    width: 12px; height: 12px; display: inline-block; border-radius: 50%;
}
.chart-legend .lg.make i { background: var(--green); }
.chart-legend .lg.miss i {
    background: var(--red);
    border-radius: 2px;
    width: 12px; height: 4px;
}
.chart-legend .note.heat-note { margin-left: auto; }

/* ---------- Player card ---------- */
.panel.no-pad { padding: 0; }

/* Stat tiles carousel (chevron navigation instead of scrollbar) */
.stat-carousel {
    position: relative;
    padding: 14px 40px;
    overflow: hidden;
}
.stat-carousel .scroller {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
}
.stat-carousel .scroller::-webkit-scrollbar { display: none; }
.stat-tile {
    flex: 0 0 132px;
    scroll-snap-align: start;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 10px;
    text-align: center;
}
.stat-tile .st-label {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.stat-tile .st-value { font-size: 22px; font-weight: 700; }
.stat-tile .st-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.stat-carousel .chev {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: opacity 0.15s;
}
.stat-carousel .chev.prev { left: 6px; }
.stat-carousel .chev.next { right: 6px; }
.stat-carousel .chev:hover:not(:disabled) { border-color: var(--accent); }
.stat-carousel .chev:disabled, .stat-carousel .chev[disabled] { opacity: 0.3; cursor: default; }
.stat-carousel:not(.has-overflow) .chev { display: none; }

/* Chevron-paged tables (team board, per-game) */
.table-carousel { position: relative; }
.car-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.car-toolbar h2 { margin: 0; font-size: 17px; }
.car-pager { display: inline-flex; gap: 4px; }

.table-carousel .chev {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    font-size: 17px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.15s;
}
.table-carousel .chev:hover:not(:disabled) { border-color: var(--accent); }
.table-carousel .chev:disabled { opacity: 0.3; cursor: default; }

.table-carousel .scroller {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    max-width: 560px;
    margin: 0 auto;
}
.table-carousel .scroller::-webkit-scrollbar { display: none; }
.table-carousel .scroller table.stats { width: max-content; min-width: 100%; }
.table-carousel .scroller table.stats th:first-child,
.table-carousel .scroller table.stats td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    box-shadow: 8px 0 10px -6px rgba(0, 0, 0, 0.5);
    border-right: 1px solid var(--border);
}
.table-carousel .scroller table.stats thead th:first-child { z-index: 3; }
