/* ============================================================
   ПОСОСАЛОЧКА stats — app stylesheet (prototype)

   Mirrors the SourceBans theme's token contract (black page, pink
   accent, square corners) so both sites read as one system, but this
   is a separate app with its own tokens.
   ============================================================ */
:root {
  color-scheme: dark;

  --page:      #05090a;
  --surface-1: #0b0f11;   /* card + chart surface — the validator ran against this */
  --surface-2: #12181b;
  --border:    #222222;
  --grid:      #1b2226;

  --ink:       #ffffff;
  --ink-2:     #cccccc;
  --ink-muted: #888888;

  --accent:      #ff66cc;   /* UI chrome only — never a data series */
  --accent-dim:  #e855b5;
  --link:        #6bc1ff;

  /* Series — TF2 team identity, stepped for this surface.
     Validated on #0b0f11: lightness band PASS, chroma PASS,
     CVD dE 19.2 (protan), normal-vision dE 29.0, contrast >= 3:1.
     The site's own #6bc1ff/#ff66cc were tried first and FAILED the dark
     lightness band and sat in the 6-8 CVD warn band. */
  --blu: #3987e5;
  --red: #e66767;

  /* Status — fixed, never themed, never reused as a series.
     Three levels, not four: the stock warning/serious pair measures
     normal-vision dE 13.6, below the 15 floor. Always paired with a
     written label so hue never carries meaning alone. */
  --good: #0ca30c;
  --okay: #fab219;
  --poor: #d03b3b;

  --font:    'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Ubuntu', var(--font);   /* header band only, matching the main site */
  --mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --marquee-h: 39px;
}

* { box-sizing: border-box; }
body {
  margin: 0; padding-top: var(--marquee-h);
  background: var(--page); color: var(--ink);
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
a { color: inherit; text-decoration: none; }

/* ---------- header band: ported from the SourceBans theme ---------- */
.marquee {
  position: fixed; inset: 0 0 auto 0; z-index: 999;
  overflow: hidden; white-space: nowrap;
  background: #111; color: var(--accent);
  border-bottom: 2px solid var(--accent);
  padding: 8px 0; font-family: var(--display); font-size: 14px;
  font-weight: 500; letter-spacing: 1px; text-transform: uppercase;
}
.marquee__inner { display: inline-block; padding-left: 100%; animation: scroll 15s linear infinite; }
@keyframes scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee__inner { animation: none; padding-left: 0; display: block; text-align: center; }
}

.band { text-align: center; padding: 90px 16px 0; border-bottom: 1px solid var(--border); }
.band__logo { display: block; margin: 0 auto 5px; width: 200px; height: auto; }
.band__nav { font-family: var(--display); font-size: 16px; color: #aaa; margin: 20px 0 0; padding-bottom: 15px; }
.band__nav a { margin: 0 8px; }
.band__nav a:hover { text-decoration: underline; }
.n-main { color: #ff6b6b; } .n-bans { color: #ffb86c; } .n-stats { color: var(--link); }
.n-vip { color: var(--accent); } .n-dc { color: #a1d8ff; }

/* ---------- app nav (stats sections) ---------- */
.appnav {
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
  position: sticky; top: var(--marquee-h); z-index: 30;
}
.appnav__in { max-width: 1180px; margin: 0 auto; padding: 0 20px; display: flex; gap: 2px; overflow-x: auto; }
.appnav a {
  padding: 12px 14px; font-size: 13px; font-weight: 500; color: var(--ink-2);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.appnav a:hover { color: var(--ink); background: rgba(255,102,204,.06); }
.appnav a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 20px 64px; }

/* ---------- shared bits ---------- */
.sec { margin-bottom: 32px; }
.sec__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.sec__head h2 { font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.sec__head .more { margin-left: auto; font-size: 12px; color: var(--link); }
.sec__head .more:hover { text-decoration: underline; }

.card { background: var(--surface-1); border: 1px solid var(--border); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.key { width: 8px; height: 8px; flex: none; display: inline-block; }
.key--merc { background: var(--red); } .key--boss { background: var(--blu); }
.pos { color: var(--good); } .neg { color: var(--poor); }
.muted { color: var(--ink-muted); }
.mono { font-family: var(--mono); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 12px; text-align: right; font-size: 13px; }
th:first-child, td:first-child { text-align: left; }
/* Text columns that aren't first — a rank number often leads the row. */
th.tl, td.tl { text-align: left; }
thead th {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-muted); font-weight: 600; border-bottom: 1px solid var(--border);
}
tbody td { border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,102,204,.05); }
td.player { display: flex; align-items: center; gap: 8px; font-variant-numeric: normal; }
.tick { width: 3px; height: 16px; flex: none; }
.tick--merc { background: var(--red); } .tick--boss { background: var(--blu); }
.rat { font-weight: 700; }
tr.grp:hover { background: none; }
tr.grp td {
  padding: 10px 12px 4px; border-bottom: 0; text-align: left;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-muted); font-weight: 600;
}

/* ---------- live server card ---------- */
.srv { padding: 16px 18px; }
.srv__top { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.dot-live {
  width: 8px; height: 8px; border-radius: 50%; background: var(--poor);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--poor) 25%, transparent);
}
.srv__name { font-weight: 600; }
.srv__meta { font-size: 12px; color: var(--ink-muted); font-family: var(--mono); }
.srv__count { margin-left: auto; font-size: 13px; font-variant-numeric: tabular-nums; }

/* win probability — 2 series, legend present AND both sides direct-labeled */
.wp { margin-top: 14px; }
.wp__lab {
  display: flex; justify-content: space-between; font-size: 10px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 6px;
}
.wp__bar { display: flex; height: 22px; gap: 2px; }   /* 2px surface gap */
.wp__seg { display: flex; align-items: center; padding: 0 8px; font-size: 12px; font-weight: 700; color: #fff; }
.wp__seg--merc { background: var(--red); }
.wp__seg--boss { background: var(--blu); justify-content: flex-end; }
.legend { display: flex; gap: 14px; margin-top: 8px; font-size: 11px; color: var(--ink-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- activity sparkline ---------- */
.spark { display: block; width: 100%; height: 64px; }

/* ---------- rating card (player.html) ---------- */
.rcard { display: grid; grid-template-columns: 232px 1fr; }
@media (max-width: 800px) { .rcard { grid-template-columns: 1fr; } }
.identity {
  border-right: 1px solid var(--border); padding: 20px;
  display: flex; flex-direction: column; gap: 4px;
  background: linear-gradient(180deg, rgba(255,102,204,.06), transparent 55%);
}
@media (max-width: 800px) { .identity { border-right: 0; border-bottom: 1px solid var(--border); } }
.avatar {
  width: 88px; height: 88px; margin-bottom: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 32px; font-weight: 600; color: var(--accent);
}
.identity .name { font-size: 22px; font-weight: 700; }
.identity .sub { font-size: 12px; color: var(--ink-muted); font-family: var(--mono); }
.identity .rank-row { margin-top: 14px; display: flex; align-items: baseline; gap: 8px; }
.identity .rank-num { font-size: 20px; font-weight: 700; color: var(--accent); }
.identity .rank-lab { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); }
.btn {
  margin-top: auto; padding: 8px 14px; background: var(--accent); color: #fff; border: 0;
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
  text-transform: uppercase; letter-spacing: .06em;
}

.hero-row {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.side { text-align: center; }
.side .val { font-size: 26px; font-weight: 700; }
.side .lab {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-muted); margin-top: 2px; display: inline-flex; align-items: center; gap: 6px;
}
.side--merc .val { color: var(--red); }
.side--boss .val { color: var(--blu); }

/* Gauge sized so the verdict clears the arc on both sides. The apex sits at
   y=24 and the readout stack starts below it — at the previous 168x104 the
   word GOOD collided with the arc shoulders. No glow here: the hero figure is
   the one thing on the page that doesn't need help being noticed. */
.gauge { position: relative; width: 208px; height: 132px; }
.gauge svg { display: block; }
.gauge .readout {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; padding-bottom: 6px;
}
.gauge .status { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; }
.gauge .num { font-size: 50px; font-weight: 700; line-height: 1.05; letter-spacing: -.03em; }
.gauge .cap { font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-muted); }

/* ---------- stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 620px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { padding: 16px 18px 14px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.tile:nth-child(3n) { border-right: 0; }
.tile:nth-last-child(-n+3) { border-bottom: 0; }
.tile .val { font-size: 24px; font-weight: 700; }
.tile .val small { font-size: 14px; font-weight: 600; }
.tile .lab { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); margin-top: 1px; }

.meter { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
/* Fill carries severity; the track is the same hue at low alpha, so state
   reads across the whole bar rather than only the filled part. */
.meter .track { position: relative; flex: 1; height: 4px; background: color-mix(in srgb, currentColor 18%, transparent); }
.meter .fill {
  position: absolute; inset: 0 auto 0 0; background: currentColor;
  /* The HLTV glow. Decoration on the mark only — it never touches the gauge,
     and never sits under text, where a halo would eat contrast. */
  box-shadow: 0 0 6px currentColor, 0 0 12px color-mix(in srgb, currentColor 55%, transparent);
}
.meter .tag { font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: currentColor; }
.is-good { color: var(--good); } .is-okay { color: var(--okay); } .is-poor { color: var(--poor); }
/* Drop the halo only under forced-colors, where system colours take over and a
   shadow just muddies the mark. `prefers-reduced-transparency` was the wrong
   guard — it targets translucency and blur, not decorative shadows, and it
   silently suppressed the glow for anyone who has it set. */
@media (forced-colors: active) { .meter .fill { box-shadow: none; } }

/* ---------- game log ---------- */
.feed__row { display: flex; align-items: center; gap: 8px; padding: 5px 16px; font-size: 12px; color: var(--ink-2); }
.feed__row .who { font-weight: 600; color: var(--ink); }
.feed__row .who--boss { color: var(--red); }
.feed__row .t { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-muted); }
.feed__row .ico { width: 14px; text-align: center; opacity: .8; }

.note { margin-top: 10px; font-size: 12px; color: var(--ink-muted); border-left: 2px solid var(--border); padding-left: 12px; }

.foot { border-top: 1px solid var(--border); padding: 20px; text-align: center; font-size: 12px; color: var(--ink-muted); }
.foot a { color: var(--link); }

/* ---------- filter chips (ladder) ---------- */
.chip {
  display: inline-flex; align-items: center; padding: 5px 12px;
  background: var(--surface-1); border: 1px solid var(--border);
  color: var(--ink-2); font-size: 12px; font-weight: 500;
}
.chip:hover { color: var(--ink); border-color: #333; }
.chip--on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Round outcome. Team colours are the game's, not the palette's — RED and BLU
   mean something specific to a TF2 player and must not drift toward the
   good/bad axis used by ratings. Draw is deliberately neutral. */
.won--red  { color: var(--red); }
.won--blu  { color: var(--blu); }
.won--draw { color: var(--ink-muted); }

/* Bigger, and the Steam image fills the box rather than being letterboxed. */
.avatar { width: 128px; height: 128px; }
.avatar--img { object-fit: cover; padding: 0; }

/* Sample size belongs with the ratings it qualifies: 1.00 over 4 rounds and
   1.00 over 400 are different claims. */
.hero-row .rounds-badge {
  position: absolute; top: 0; right: 0;
  font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-muted); font-family: var(--mono);
}
.hero-row { position: relative; }

/* ---- live round view ---- */
/* minmax(0,1fr) so the map column can actually shrink — a plain 1fr refuses to
   go below its content and the feed never gets the width it was given. */
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 14px; }
@media (max-width: 1100px) { .live-grid { grid-template-columns: minmax(0, 1fr) 360px; } }
@media (max-width: 860px)  { .live-grid { grid-template-columns: 1fr; } }

.live-map__wrap { position: relative; aspect-ratio: 1 / 1; display: grid; place-items: center; }
.live-map__wrap img { width: 100%; height: 100%; object-fit: contain; }
.ls-marks { position: absolute; inset: 0; width: 100%; height: 100%; }
/* X markers. vector-effect keeps the stroke a constant screen width however far
   the viewBox is scaled — without it a large map draws hairlines and a small one
   draws slabs, because the stroke scales with the geometry. */
.ls-death {
  fill: none; stroke-width: 2; stroke-linecap: round;
  vector-effect: non-scaling-stroke; opacity: .85;
}
.ls-death--merc { stroke: var(--red); }
.ls-death--boss { stroke: var(--blu); }
.ls-nomap { font-size: 12px; }

.live-feed { max-height: 460px; overflow-y: auto; }
.live-feed__head { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.ls-feed { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.ls-feed li { display: flex; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.ls-t { font-family: var(--mono); color: var(--ink-muted); flex: none; }
.ls-ev--revive span:last-child, .ls-ev--uber span:last-child { color: var(--good); }
.ls-board tr.is-boss { background: rgba(230,103,103,.07); }
.ls-buffed { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.ls-buffed li { display: flex; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.ls-buffed .ls-t { min-width: 42px; color: var(--accent); }

/* ---- feed cards ----
   Each entry is a card with a coloured left edge rather than a line of text.
   The colour carries the KIND of play, so the feed can be skimmed for shape
   before it is read for detail — and every card still states its type in
   words, so the colour is never the only carrier. */
.live-feed { max-height: 620px; }
.ls-feed li {
  display: flex; gap: 9px; align-items: baseline;
  padding: 4px 9px; margin-bottom: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--ink-muted);
  line-height: 1.35;
}
.ls-feed .ls-t { flex: none; font-size: 11px; opacity: .7; }

.ls-feed .ls-ev--frag { border-left-color: var(--red); }
.ls-feed .ls-ev--backstab,
.ls-feed .ls-ev--market_garden { border-left-color: #ff66cc; }
.ls-feed .ls-ev--revive,
.ls-feed .ls-ev--heal_item,
.ls-feed .ls-ev--extinguish { border-left-color: var(--good); }
.ls-feed .ls-ev--uber,
.ls-feed .ls-ev--banner_deploy { border-left-color: var(--okay); }
.ls-feed .ls-ev--sapped { border-left-color: var(--poor); }
.ls-feed .ls-ev--unsap,
.ls-feed .ls-ev--teleport { border-left-color: var(--blu); }
.ls-feed .ls-ev--_buffed { border-left-color: var(--accent); opacity: .9; }

/* Round boundaries are structure, not events — full-width, no card. */
.ls-ev--_round_start,
.ls-ev--_round_end {
  background: none; border: none; border-top: 1px solid var(--border);
  border-radius: 0; text-transform: uppercase; letter-spacing: .06em;
  font-size: 11px; color: var(--ink-muted); margin: 10px 0 6px;
}

/* Round header. Not a card — it labels the block of cards beneath it, and the
   events indent under it so the grouping is visible without extra separators. */
.ls-round {
  display: flex; gap: 9px; align-items: baseline;
  margin: 14px 0 5px; padding: 0 0 4px;
  border-bottom: 1px solid var(--border);
  background: none;
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-muted);
}
.ls-feed > .ls-round:first-child { margin-top: 0; }
.ls-feed > .ls-ev { margin-left: 10px; }
.ls-ev--empty { border-left-color: var(--border); font-style: italic; }

/* Rounds badge needs to sit inside the card, not on its edge. */
.hero-row .rounds-badge { top: 10px; right: 12px; }

/* Avatar fills its column instead of floating at a fixed size in it. */
.avatar { width: 100%; height: auto; aspect-ratio: 1 / 1; margin-bottom: 14px; }
.avatar--img { display: block; }

/* Tooltip — square, bordered, mono, same contract as every other surface.
   Follows the pointer, so pointer-events must be off or it would sit under the
   cursor and immediately fire mouseleave on the element beneath it. */
.tip {
  position: absolute; z-index: 40; pointer-events: none;
  transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 5px 9px; white-space: nowrap;
  font-family: var(--mono); font-size: 11px; color: var(--ink);
}
.spark__hit:hover { fill: rgba(255,102,204,.06); }
