/* Statistics, leaderboard and archive (Midnight Board). Podium and medals live in podium.css. */

.st-h1 { font: 700 26px var(--font-head); letter-spacing: -0.025em; margin: 0; }
.st-sub { color: var(--muted); font-size: 13.5px; line-height: 1.45; margin: -6px 0 0; }
.stv { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stv .help, .arch .help { margin: 0; }
.stv .sec { font: 700 11.5px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 6px 2px 10px; }
.stv .sec + .help { margin: -4px 2px 10px; }
.stv .legend.center { justify-content: center; margin: -4px 0 4px; }
.stv .empty-note { background: var(--surface); border: 1px dashed var(--border); border-radius: 18px; }

/* Segmented control (horizontally scrollable) */
.segscroll { overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 2px; }
.segscroll::-webkit-scrollbar { display: none; }
.seg { display: flex; background: var(--surface-alt); border-radius: 14px; padding: 4px; gap: 4px; width: max-content; min-width: 100%; }
.seg button { flex: 1; padding: 9px 13px; border-radius: 10px; border: none; background: none; font: 600 13px var(--font-body); color: var(--muted); line-height: 1.2; white-space: nowrap; cursor: pointer; touch-action: manipulation; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px var(--shadow); }

/* Tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 13px; box-shadow: var(--shadow-card); min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tile .l { font: 600 11px var(--font-body); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.tile .v { font: 700 26px var(--font-head); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.tile .s { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.tile .s .t { min-width: 0; overflow-wrap: anywhere; }

/* Avatar chip */
.av { width: var(--s, 36px); height: var(--s, 36px); border-radius: 50%; background: var(--c); color: var(--chip-ink); display: inline-grid; place-items: center; font: 700 calc(var(--s, 36px) * 0.42) var(--font-head); flex-shrink: 0; }

/* Table mood and legend */
.mood { display: flex; height: 16px; border-radius: 8px; overflow: hidden; gap: 2px; }
.mood span { height: 100%; }
.legend { display: flex; gap: 6px 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }

/* Hit-rate bars */
.hb { display: grid; grid-template-columns: 92px 1fr 56px; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.hb .who { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hb .who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb .tr { height: 14px; border-radius: 7px; background: var(--surface-alt); overflow: hidden; }
.hb .tr i { display: block; height: 100%; border-radius: 7px; background: var(--c); }
.hb .mono { text-align: right; }
.hb small { color: var(--muted); font: 500 11px var(--font-mono); display: block; }

/* Per-player table: scrolls sideways, first column sticks */
.tscroll { overflow-x: auto; margin: 0 -18px; padding: 0 18px; scrollbar-width: none; }
.tscroll::-webkit-scrollbar { display: none; }
table.st-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.st-table th, .st-table td { padding: 8px 7px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
.st-table th { color: var(--muted); font: 600 11px var(--font-body); text-transform: uppercase; letter-spacing: 0.04em; }
.st-table td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.st-table th:first-child, .st-table td:first-child { text-align: left; position: sticky; left: 0; z-index: 1; background: var(--bg); }
.st-table td:first-child { font-family: var(--font-body); font-weight: 600; }
.st-table .nm { display: inline-flex; align-items: center; gap: 6px; }

/* Leaderboard rows (4th place and below) */
.trk { height: 8px; border-radius: 4px; background: var(--surface-alt); overflow: hidden; margin: 7px 0 6px; }
.trk i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 55%, transparent), var(--c)); }
.lbr { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 12px; box-shadow: var(--shadow-card); }
.lbr .rk { font: 700 14px var(--font-mono); color: var(--muted); width: 16px; text-align: center; }
.lbr .grow, .gi .grow { flex: 1; min-width: 0; }
.lbr .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lbr .top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbr .pct { font-weight: 700; }
.lbr .meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); gap: 8px; }
.lbr .medcols { gap: 4px; }
.st-explain { background: var(--accent-soft); color: var(--accent); font-size: 13.5px; line-height: 1.45; }
.st-explain b { color: inherit; }

/* Head to head */
.vs { display: flex; align-items: center; gap: 10px; }
.vs select { flex: 1; min-width: 0; }
.vs b { color: var(--muted); font-size: 13px; }
.h2h-card { padding: 14px; }
.h2h-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.h2h-p { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.h2h-p b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h2h-score { text-align: center; flex-shrink: 0; }
.h2h-score .big { font: 700 42px/1.1 var(--font-head); letter-spacing: -0.025em; }
.h2h-score .big span { color: var(--muted); }
.h2h-split { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; margin-top: 16px; }
.h2h-split i { display: block; min-width: 0; }

/* Archive cards */
.arch { display: flex; flex-direction: column; gap: 8px; }
.gi { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow-card); color: var(--ink); cursor: pointer; font: inherit; margin-bottom: 8px; touch-action: manipulation; }
.arch .gi { margin-bottom: 0; }
.gi:active { background: var(--surface-alt); }
.gi b { font-weight: 700; font-size: 14.5px; }
.gi small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.35; }
.gi .chs { display: flex; margin-top: 7px; }
.gi .chs .av { margin-right: -5px; box-shadow: 0 0 0 2px var(--surface); }
.gtag { padding: 3px 9px; border-radius: 999px; font: 600 11.5px var(--font-mono); background: var(--accent-soft); color: var(--accent); white-space: nowrap; }

/* Legacy leaderboard rows (home view until it is rebuilt) */
.lb { display: flex; flex-direction: column; gap: 8px; }
.lb-row { display: grid; grid-template-columns: 22px 30px 1fr auto; column-gap: 10px; row-gap: 8px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-alt); }
.lb-row.first { background: var(--accent-soft); }
.lb-rank { font: 600 14px var(--font-mono); color: var(--muted); text-align: right; }
.lb-name { display: flex; flex-direction: column; min-width: 0; }
.lb-name b { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name small { font-size: 12px; color: var(--muted); }
.lb-score { text-align: right; font: 700 18px var(--font-mono); font-variant-numeric: tabular-nums; }
.lb-score small { display: block; font: 600 10px var(--font-body); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.meter { grid-column: 3 / 5; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 0 3px 3px 0; }
