/* BridgeUp Results — Congress / Team Stats blocks (light + dark ready) */

.bhr-cong {
  /* Paleta (jasny motyw – wartości domyślne) */
  --bhr-cong-accent: #0073aa;
  --bhr-text: #1d2327;
  --bhr-muted: #646970;
  --bhr-faint: #8a8f94;
  --bhr-border: #dcdcde;
  --bhr-line: #f0f0f1;
  --bhr-line2: #f6f7f7;
  --bhr-chip-bg: #f6f7f7;
  --bhr-chip-text: #50575e;
  --bhr-stripe: #fafbfc;
  --bhr-surface: #ffffff;
  --bhr-track: #eef0f1;
  --bhr-chip-active-bg: #1d2327;
  --bhr-chip-active-text: #ffffff;
  --bhr-on-accent: #ffffff;

  font-size: 15px;
  color: var(--bhr-text);
}

/* Ciemny motyw — wykryty przez JS (klasa) albo preferencja systemowa */
.bhr-cong.bhr-theme-dark {
  --bhr-cong-accent: #4aa8de;
  --bhr-text: #e3e5e8;
  --bhr-muted: #a7adb3;
  --bhr-faint: #8a9099;
  --bhr-border: #3a4149;
  --bhr-line: rgba(255,255,255,0.09);
  --bhr-line2: rgba(255,255,255,0.05);
  --bhr-chip-bg: rgba(255,255,255,0.08);
  --bhr-chip-text: #c7ccd1;
  --bhr-stripe: rgba(255,255,255,0.04);
  --bhr-surface: #20262e;
  --bhr-track: rgba(255,255,255,0.13);
  --bhr-chip-active-bg: #e3e5e8;
  --bhr-chip-active-text: #14181d;
  --bhr-on-accent: #0a1015;
}
@media (prefers-color-scheme: dark) {
  .bhr-cong:not(.bhr-theme-light) {
    --bhr-cong-accent: #4aa8de;
    --bhr-text: #e3e5e8;
    --bhr-muted: #a7adb3;
    --bhr-faint: #8a9099;
    --bhr-border: #3a4149;
    --bhr-line: rgba(255,255,255,0.09);
    --bhr-line2: rgba(255,255,255,0.05);
    --bhr-chip-bg: rgba(255,255,255,0.08);
    --bhr-chip-text: #c7ccd1;
    --bhr-stripe: rgba(255,255,255,0.04);
    --bhr-surface: #20262e;
    --bhr-track: rgba(255,255,255,0.13);
    --bhr-chip-active-bg: #e3e5e8;
    --bhr-chip-active-text: #14181d;
    --bhr-on-accent: #0a1015;
  }
}

.bhr-cong-head { margin-bottom: 12px; }
.bhr-cong-title { margin: 0 0 2px; font-size: 1.25em; }
.bhr-cong-summary { color: var(--bhr-muted); font-size: 0.85em; }

.bhr-cong-tabs,
.bhr-cong-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.bhr-cong-tab,
.bhr-cong-chip {
  border: 1px solid var(--bhr-border);
  background: var(--bhr-chip-bg);
  color: var(--bhr-chip-text);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.85em;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.bhr-cong-tab:hover,
.bhr-cong-chip:hover { border-color: var(--bhr-cong-accent); color: var(--bhr-cong-accent); }
.bhr-cong-tab.is-active {
  background: var(--bhr-cong-accent);
  border-color: var(--bhr-cong-accent);
  color: var(--bhr-on-accent);
}
.bhr-cong-chip.is-active {
  background: var(--bhr-chip-active-bg);
  border-color: var(--bhr-chip-active-bg);
  color: var(--bhr-chip-active-text);
}
.bhr-cong-chips { margin-top: -2px; }

.bhr-cong-ol { list-style: none; margin: 0; padding: 0; }
.bhr-cong-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--bhr-line);
}
.bhr-cong-row:nth-child(odd) { background: var(--bhr-stripe); }
.bhr-cong-rank {
  flex: 0 0 2.2em;
  text-align: center;
  font-weight: 600;
  color: var(--bhr-muted);
}
.bhr-cong-name { flex: 1 1 auto; }
a.bhr-cong-name { color: var(--bhr-cong-accent); text-decoration: none; }
a.bhr-cong-name:hover { text-decoration: underline; }
.bhr-cong-val {
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--bhr-cong-accent);
  font-variant-numeric: tabular-nums;
}
.bhr-cong-note { color: var(--bhr-muted); font-style: italic; padding: 8px 0; }

/* ── sekcje, słupki, ciekawostki, scatter, heatmapa ── */

.bhr-cong-section {
  margin: 22px 0 6px;
  padding-top: 14px;
  border-top: 1px solid var(--bhr-line);
}
.bhr-cong-h { margin: 0 0 8px; font-size: 1.05em; }
.bhr-cong-mdesc { color: var(--bhr-muted); font-size: 0.82em; margin: 0 0 10px; }

.bhr-cong-bars { list-style: none; margin: 0; padding: 0; }
.bhr-cong-barrow {
  display: grid;
  grid-template-columns: 2.2em minmax(8em, 1fr) minmax(60px, 38%) auto;
  align-items: center;
  gap: 10px;
  padding: 6px 6px;
  border-bottom: 1px solid var(--bhr-line2);
}
.bhr-cong-barrow.is-top { background: var(--bhr-stripe); }
.bhr-cong-barname { overflow: hidden; text-overflow: ellipsis; }
.bhr-cong-barname a { color: var(--bhr-cong-accent); text-decoration: none; }
.bhr-cong-barname a:hover { text-decoration: underline; }
.bhr-cong-amp { color: var(--bhr-faint); }
.bhr-cong-sub { color: var(--bhr-faint); font-size: 0.78em; margin-left: 4px; }
.bhr-cong-bartrack { background: var(--bhr-track); border-radius: 999px; height: 9px; overflow: hidden; }
.bhr-cong-bar { display: block; height: 100%; background: linear-gradient(90deg, #2a9bd6, var(--bhr-cong-accent)); border-radius: 999px; }

/* Lista numeryczna (bez słupków), wielokolumnowa — np. Butler */
.bhr-cong-numlist {
  list-style: none; margin: 0; padding: 0;
  columns: 240px; column-gap: 22px;
}
.bhr-cong-numrow {
  display: flex; align-items: baseline; gap: 8px;
  padding: 5px 0; border-bottom: 1px solid var(--bhr-line2);
  break-inside: avoid; -webkit-column-break-inside: avoid;
}
.bhr-cong-numname { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bhr-cong-numname a { color: var(--bhr-cong-accent); text-decoration: none; }
.bhr-cong-numrow .bhr-cong-rank { flex: 0 0 2em; }
.bhr-cong-numrow .bhr-cong-val { flex: 0 0 auto; }
/* Pary: dwa nazwiska w wierszu — szersze kolumny niż zwykła lista numeryczna. */
.bhr-cong-pairlist { columns: 360px; }
.bhr-cong-amp { opacity: .45; padding: 0 2px; }

/* ── Hero-podium TOP3 ── */
.bhr-podium {
  display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 12px;
  align-items: end; margin: 14px 0 18px;
}
.bhr-podium-card {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 14px 10px 12px; border-radius: 14px; text-align: center;
  background: var(--bhr-surface); border: 1px solid var(--bhr-border);
  box-shadow: 0 6px 18px rgba(0,0,0,.07);
  animation: bhrPodiumRise .55s cubic-bezier(.2,.8,.3,1.1) both;
  position: relative; overflow: hidden;
}
.bhr-podium-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
}
.bhr-podium-card.is-gold    { padding-top: 22px; padding-bottom: 20px; }
.bhr-podium-card.is-gold::before   { background: linear-gradient(90deg,#f5c33b,#ffe28a,#f5c33b); }
.bhr-podium-card.is-silver::before { background: linear-gradient(90deg,#9aa3ad,#d7dde4,#9aa3ad); }
.bhr-podium-card.is-bronze::before { background: linear-gradient(90deg,#b07a45,#dca878,#b07a45); }
.bhr-podium-medal { font-size: 26px; line-height: 1; }
.bhr-podium-card.is-gold .bhr-podium-medal { font-size: 34px; }
.bhr-podium-name { font-weight: 600; color: var(--bhr-text); font-size: 14px; }
.bhr-podium-sub { font-size: 12px; color: var(--bhr-muted); }
.bhr-podium-val { font-size: 20px; font-weight: 700; color: var(--bhr-cong-accent); margin-top: 2px; }
.bhr-podium-card.is-gold .bhr-podium-val { font-size: 24px; }
@keyframes bhrPodiumRise {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
@media (max-width: 560px) {
  .bhr-podium { grid-template-columns: 1fr; align-items: stretch; }
  .bhr-podium-card.is-gold { order: -1; }
}

/* ── Wykresy SVG (puls / DNA / radar) ── */
.bhr-chart-sec { position: relative; } /* kotwica dla tooltipa */
.bhr-chart-sec .bhr-chart-svg { width: 100%; height: auto; display: block; margin-top: 6px; }
.bhr-chart-axis   { stroke: var(--bhr-line); stroke-width: 1; }
.bhr-chart-zero   { stroke: var(--bhr-muted); stroke-width: 1; stroke-dasharray: 2 3; opacity: .6; }
.bhr-chart-median { stroke: var(--bhr-cong-accent); stroke-width: 1.2; stroke-dasharray: 5 4; opacity: .55; }
.bhr-chart-tick   { fill: var(--bhr-muted); font-size: 9.5px; }
.bhr-chart-medlab { fill: var(--bhr-cong-accent); font-weight: 600; }
.bhr-chart-quad   { fill: var(--bhr-muted); font-size: 10px; font-weight: 600; letter-spacing: .4px; opacity: .8; text-transform: uppercase; }
/* fill/stroke kropki ustawiane inline (gradient wartości czerwień→zieleń) */
.bhr-chart-dot {
  fill-opacity: .62; stroke-width: 1; cursor: pointer;
  animation: bhrDotPop .45s cubic-bezier(.2,.8,.3,1.2) both;
  transition: fill-opacity .15s, stroke-width .15s;
  transform-box: fill-box; transform-origin: center;
}
.bhr-chart-dot:hover { fill-opacity: 1; stroke-width: 2.5; }
@keyframes bhrDotPop { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: scale(1); } }

/* Tooltip wykresów (HTML, podąża za kursorem) */
.bhr-chart-tip {
  position: absolute; z-index: 30; pointer-events: none;
  padding: 6px 10px; border-radius: 8px; font-size: 12.5px; line-height: 1.3;
  background: var(--bhr-surface); color: var(--bhr-text);
  border: 1px solid var(--bhr-border); box-shadow: 0 4px 14px rgba(0,0,0,.18);
  opacity: 0; transition: opacity .12s; white-space: nowrap; max-width: 90%;
}
.bhr-chart-tip.is-on { opacity: 1; }

/* Legenda gradientu (słabiej → lepiej) */
.bhr-chart-legend {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  margin-top: 8px; font-size: 10.5px; color: var(--bhr-muted);
}
.bhr-chart-legbar {
  width: 140px; height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, hsl(4,64%,46%), hsl(45,70%,48%), hsl(128,64%,42%));
}

/* Radar (karta gracza) */
.bhr-radar-wrap { display: flex; justify-content: center; }
.bhr-radar-svg { max-width: 400px; overflow: visible; }
.bhr-radar-ring  { fill: none; stroke: var(--bhr-line); stroke-width: 1; }
.bhr-radar-spoke { stroke: var(--bhr-line); stroke-width: 1; opacity: .7; }
.bhr-radar-label { fill: var(--bhr-text); font-size: 10.5px; font-weight: 600; }
.bhr-radar-pct   { fill: var(--bhr-cong-accent); font-weight: 700; }
.bhr-radar-shape {
  fill: var(--bhr-cong-accent); fill-opacity: .18;
  stroke: var(--bhr-cong-accent); stroke-width: 2; stroke-linejoin: round;
  animation: bhrRadarIn .7s cubic-bezier(.2,.8,.3,1.1) both;
  transform-box: fill-box; transform-origin: center;
}
.bhr-radar-vert { fill: var(--bhr-cong-accent); animation: bhrDotPop .4s .35s both; transform-box: fill-box; transform-origin: center; }
.bhr-radar-hint { text-align: center; }
@keyframes bhrRadarIn { from { opacity: 0; transform: scale(.55); } to { opacity: 1; transform: scale(1); } }

/* Bump chart (tor wyścigowy czołówki) */
.bhr-bump-line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; opacity: .85; transition: opacity .15s, stroke-width .15s; }
.bhr-bump-dot  { stroke: var(--bhr-surface); stroke-width: 1.2; cursor: pointer; transition: opacity .15s; }
/* Hover wyróżnia tor pogrubieniem — pozostałe tory bez zmian (bez przygaszania). */
.bhr-chart-sec.is-dim .bhr-bump-g.is-hot .bhr-bump-line { stroke-width: 3.4; opacity: 1; }
.bhr-bump-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; margin-top: 8px; font-size: 11.5px; color: var(--bhr-text); }
.bhr-bump-key { display: inline-flex; align-items: center; gap: 5px; cursor: default; }
/* Bold-duplikat (::after z data-l) rezerwuje szerokość pogrubienia — brak przesunięć przy hoverze. */
.bhr-bump-lbl { display: inline-flex; flex-direction: column; align-items: flex-start; }
.bhr-bump-lbl::after { content: attr(data-l); font-weight: 600; height: 0; overflow: hidden; visibility: hidden; pointer-events: none; }
.bhr-chart-sec.is-dim .bhr-bump-key.is-hot .bhr-bump-lbl { font-weight: 600; }
.bhr-bump-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Sparkline formy (karta gracza) */
.bhr-form-svg { max-width: 580px; }
.bhr-form-line { fill: none; stroke: var(--bhr-cong-accent); stroke-width: 1.8; stroke-linejoin: round; opacity: .6; }
.bhr-form-score { fill: var(--bhr-muted); font-size: 8.5px; }

/* Karta gracza — kotwica tooltipa wykresów (sparkline) */
.bhr-cong-cardbox { position: relative; }
/* Linia demograficzna pod nazwiskiem (K · S · klub (woj.)) */
.bhr-cong-demoline { margin: -4px 0 10px; font-size: 12.5px; color: var(--bhr-muted); }
/* Drugi rząd chipsów (grupy demograficzne) — lekko odsunięty od kategorii */
.bhr-cong-demochips { margin-top: 2px; }

@media (prefers-reduced-motion: reduce) {
  .bhr-podium-card, .bhr-chart-dot, .bhr-radar-shape, .bhr-radar-vert { animation: none; }
}

.bhr-cong-more {
  margin: 8px 0 2px; padding: 5px 14px;
  border: 1px solid var(--bhr-border); background: var(--bhr-chip-bg); color: var(--bhr-chip-text);
  border-radius: 999px; font-size: 0.82em; cursor: pointer;
}
.bhr-cong-more:hover { border-color: var(--bhr-cong-accent); color: var(--bhr-cong-accent); }

.bhr-cong-toggle { display: flex; align-items: center; gap: 6px; margin: 0 0 14px; }
.bhr-cong-tglab { font-size: 0.82em; color: var(--bhr-muted); }
.bhr-cong-tgb {
  border: 1px solid var(--bhr-border); background: var(--bhr-chip-bg); color: var(--bhr-chip-text);
  padding: 4px 12px; font-size: 0.82em; cursor: pointer;
}
.bhr-cong-tgb:first-of-type { border-radius: 999px 0 0 999px; }
.bhr-cong-tgb:last-of-type { border-radius: 0 999px 999px 0; border-left: 0; }
.bhr-cong-tgb.is-active { background: var(--bhr-cong-accent); border-color: var(--bhr-cong-accent); color: var(--bhr-on-accent); }

.bhr-cong-fun {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.bhr-cong-funcard { background: var(--bhr-stripe); border: 1px solid var(--bhr-line); border-radius: 8px; padding: 10px 12px; }
.bhr-cong-funh { margin: 0 0 6px; font-size: 0.92em; }
.bhr-cong-funcard .bhr-cong-barrow { grid-template-columns: 2em 1fr auto; }
.bhr-cong-funcard .bhr-cong-bartrack { display: none; }

.bhr-cong-scatter { width: 100%; max-width: 680px; height: auto; display: block; }
.bhr-cong-dot { fill: var(--bhr-cong-accent); fill-opacity: 0.55; stroke: var(--bhr-cong-accent); stroke-width: 0.7; }
.bhr-cong-dot:hover { fill-opacity: 0.9; }
.bhr-cong-axis { stroke: var(--bhr-border); stroke-width: 1; }
.bhr-cong-axis2 { stroke: var(--bhr-line); stroke-width: 1; stroke-dasharray: 3 3; }
.bhr-cong-qt { fill: var(--bhr-faint); font-size: 9px; text-transform: uppercase; letter-spacing: .4px; }
.bhr-cong-axl { fill: var(--bhr-faint); font-size: 9px; }

.bhr-cong-hwrap { overflow-x: auto; }
.bhr-cong-heat { border-collapse: collapse; font-size: 0.82em; }
.bhr-cong-heat th, .bhr-cong-heat td { padding: 5px 8px; text-align: center; }
.bhr-cong-heat thead th { color: var(--bhr-muted); font-weight: 600; border-bottom: 1px solid var(--bhr-border); }
.bhr-cong-hname { text-align: left !important; white-space: nowrap; font-weight: 500; }
.bhr-cong-hname a { color: var(--bhr-cong-accent); text-decoration: none; }
.bhr-cong-hcell { color: var(--bhr-text); min-width: 44px; border: 1px solid var(--bhr-surface); }

/* ── Wyszukiwarka + karta gracza ── */

.bhr-cong-search {
  width: 100%; max-width: 360px;
  padding: 8px 12px; border: 1px solid var(--bhr-border); border-radius: 8px; font-size: 0.95em;
  background: var(--bhr-surface); color: var(--bhr-text);
}
.bhr-cong-results { position: relative; max-width: 360px; }
.bhr-cong-opt, .bhr-cong-noopt {
  display: block; width: 100%; text-align: left;
  padding: 7px 12px; border: 0; border-bottom: 1px solid var(--bhr-line);
  background: var(--bhr-surface); color: var(--bhr-text);
  cursor: pointer; font-size: 0.9em;
}
.bhr-cong-opt:hover { background: var(--bhr-chip-bg); color: var(--bhr-cong-accent); }
.bhr-cong-opt .bhr-cong-sub { color: var(--bhr-faint); }
.bhr-cong-noopt { color: var(--bhr-muted); font-style: italic; cursor: default; }

.bhr-cong-card { margin-top: 14px; }
.bhr-cong-cardname { margin: 0 0 10px; font-size: 1.15em; }
.bhr-cong-cardname a { color: var(--bhr-cong-accent); text-decoration: none; }
.bhr-cong-pid { font-size: 0.6em; color: var(--bhr-faint); font-weight: 400; vertical-align: middle; }
.bhr-cong-ch { margin: 16px 0 6px; font-size: 0.95em; color: var(--bhr-chip-text); }

.bhr-cong-tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.bhr-cong-tile {
  flex: 0 0 auto; min-width: 84px;
  background: var(--bhr-stripe); border: 1px solid var(--bhr-line); border-radius: 8px;
  padding: 8px 12px; text-align: center;
}
.bhr-cong-tval { display: block; font-size: 1.25em; font-weight: 700; color: var(--bhr-cong-accent); font-variant-numeric: tabular-nums; }
.bhr-cong-tlab { display: block; font-size: 0.72em; color: var(--bhr-muted); text-transform: uppercase; letter-spacing: .3px; }

.bhr-cong-rk { list-style: none; margin: 0; padding: 0; }
.bhr-cong-rk li { padding: 4px 0; border-bottom: 1px solid var(--bhr-line2); }
.bhr-cong-rk a { color: var(--bhr-cong-accent); text-decoration: none; }
.bhr-cong-rkpos { display: inline-block; min-width: 2.2em; font-weight: 700; color: var(--bhr-text); }
.bhr-cong-hist th.bhr-cong-hname { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bhr-cong-flag {
  display: inline-block; font-size: 1.05em; vertical-align: middle; line-height: 1; cursor: help;
}
.bhr-cong-flag:not(:empty) { letter-spacing: 0; }
