/* Design tokens */
:root {
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Fira Code", monospace;

  --r-xs: 5px; --r-sm: 10px; --r: 14px; --r-lg: 20px;
  --shell: 1160px;

  /* Light */
  --bg:    #eeeee8;
  --panel: #ffffff;
  --sub:   #f5f4f0;
  --ink:   #111110;
  --ink2:  #3d3c38;
  --muted: #8b8781;
  --line:  #e0ddd5;

  --green:    #047857; --green-h: #065f46; --green-fg: #fff;
  --green-bg: #ecfdf5; --green-b: #6ee7b7;
  --amber:    #b45309; --amber-bg: #fffbeb; --amber-b: #fde68a;
  --red:      #991b1b; --red-bg:   #fef2f2; --red-b:   #fecaca;

  --gold:   #b45309; --gold-bg:   #fef3c7; --gold-b:   #fbbf24;
  --silver: #4b5563; --silver-bg: #f3f4f6; --silver-b: #9ca3af;
  --bronze: #92400e; --bronze-bg: #fff7ed; --bronze-b: #fb923c;

  /* Fixed segment colours, readable in both modes */
  --s0: #22c55e; --s1: #f59e0b; --s2: #ef4444; --s3: #8b5cf6; --s4: #06b6d4;

  --sh-sm: 0 1px 3px rgb(0 0 0 / 5%), 0 4px 12px rgb(0 0 0 / 4%);
  --sh:    0 4px 16px rgb(0 0 0 / 8%), 0 20px 48px rgb(0 0 0 / 6%);
  --sh-pop:0 8px 32px rgb(0 0 0 / 14%), 0 2px 8px rgb(0 0 0 / 8%);
}

html.dark {
  --bg:    #0d0d0c; --panel: #1b1a18; --sub: #252320;
  --ink:   #f0ede8; --ink2: #bfbbb3; --muted: #69665f; --line: #2c2a27;
  --green: #10b981; --green-h: #34d399; --green-fg: #011812;
  --green-bg: #012018; --green-b: #047857;
  --amber: #fcd34d; --amber-bg: #1c1000; --amber-b: #92400e;
  --red:   #fca5a5; --red-bg:   #3b0a0a; --red-b:   #991b1b;
  --gold:  #fbbf24; --gold-bg:  #1a1000; --gold-b:  #b45309;
  --silver:#9ca3af; --silver-bg:#161b22; --silver-b:#4b5563;
  --bronze:#fb923c; --bronze-bg:#1a0800; --bronze-b:#92400e;
  --sh-sm: 0 1px 3px rgb(0 0 0 / 35%), 0 4px 12px rgb(0 0 0 / 25%);
  --sh:    0 4px 16px rgb(0 0 0 / 45%), 0 20px 48px rgb(0 0 0 / 35%);
  --sh-pop:0 8px 32px rgb(0 0 0 / 50%), 0 2px 8px rgb(0 0 0 / 30%);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green); }
code {
  background: var(--sub); border: 1px solid var(--line); border-radius: var(--r-xs);
  font-family: var(--font-mono); font-size: 0.87em; padding: 0.1em 0.38em;
}

/* Layout */
.shell { width: min(var(--shell), 100% - 32px); margin-inline: auto; }
#app { padding: 18px 0 28px; min-height: 60vh; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.overview-grid { display: grid; gap: 12px; grid-template-columns: minmax(360px, 0.95fr) minmax(340px, 1.05fr); align-items: start; }
.overview-left, .overview-side { display: grid; gap: 12px; min-width: 0; }
.top-rank-panel, .stat-panel { min-width: 0; }

/* Typography */
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 900; letter-spacing: -0.05em; line-height: 0.96; margin-bottom: 6px; }
h2 { font-size: clamp(1.1rem, 2vw, 1.45rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 12px; }
h3 { font-size: 0.93rem; font-weight: 700; margin-bottom: 3px; letter-spacing: -0.01em; }
.eyebrow { color: var(--green); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.15em; margin: 0 0 8px; text-transform: uppercase; }
.lede { color: var(--muted); font-size: 0.93rem; margin-bottom: 0; }
.muted { color: var(--muted); }
.positive { color: var(--green); font-weight: 700; font-variant-numeric: tabular-nums; }
.negative { color: var(--red);   font-weight: 700; font-variant-numeric: tabular-nums; }

/* Header */
.site-header {
  background: rgb(238 238 232 / 92%);
  backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
  transition: background 0.2s;
}
html.dark .site-header { background: rgb(13 13 12 / 92%); }

.header-grid {
  align-items: center; display: grid; gap: 16px;
  grid-template-columns: minmax(0, 1fr) auto; padding: 15px 0 11px;
}
.header-actions { align-items: flex-end; display: flex; gap: 8px; }

.theme-btn {
  align-items: center; background: var(--sub); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--muted); display: flex; flex-shrink: 0;
  height: 40px; justify-content: center; width: 40px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.theme-btn:hover { background: var(--panel); border-color: var(--green); color: var(--green); }
html:not(.dark) .icon-moon, html.dark .icon-sun { display: none; }

/* Tabs */
.tabs { display: flex; gap: 2px; overflow-x: auto; padding: 0 0 10px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: transparent; border: none; border-radius: var(--r-sm); color: var(--muted);
  font-size: 0.84rem; font-weight: 600; padding: 6px 13px;
  transition: background 0.15s, color 0.15s; white-space: nowrap;
}
.tabs button:hover  { background: var(--sub); color: var(--ink2); }
.tabs button.active { background: var(--ink); color: var(--bg); }

/* Forms */
.jump label, .control label {
  color: var(--muted); display: block; font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.07em; margin-bottom: 4px; text-transform: uppercase;
}
.jump-row { display: flex; gap: 7px; }
input, select {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink); min-width: 0; padding: 9px 13px;
  transition: border-color 0.15s, box-shadow 0.15s; width: 100%;
}
input::placeholder { color: var(--muted); }
input:focus, select:focus {
  border-color: var(--green); box-shadow: 0 0 0 3px rgb(4 120 87 / 14%); outline: none;
}
html.dark input:focus, html.dark select:focus { box-shadow: 0 0 0 3px rgb(16 185 129 / 18%); }

/* Buttons */
.btn-primary {
  background: var(--green); border: none; border-radius: var(--r-sm);
  color: var(--green-fg); font-weight: 700; font-size: 0.88rem; padding: 9px 16px;
  transition: background 0.15s, transform 0.1s; white-space: nowrap;
}
.btn-primary:hover  { background: var(--green-h); }
.btn-primary:active { transform: scale(0.97); }

.btn-ghost {
  background: var(--sub); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink2); font-size: 0.84rem; font-weight: 600; padding: 7px 13px;
  transition: background 0.15s, border-color 0.15s;
}
.btn-ghost:hover { background: var(--panel); border-color: var(--green); color: var(--green); }

.name-button, .link-button {
  background: none; border: 0; color: var(--green); font-weight: 700;
  font-size: inherit; padding: 0; text-align: left;
  text-decoration: underline; text-decoration-color: transparent;
  text-underline-offset: 3px; transition: text-decoration-color 0.15s;
}
.name-button:hover, .link-button:hover { text-decoration-color: var(--green); }

/* Panels */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm); margin-bottom: 12px; padding: 20px;
}
.panel:last-child { margin-bottom: 0; }

/* Metric cards */
.metric {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh-sm); overflow: hidden; padding: 16px; position: relative;
  transition: box-shadow 0.18s, transform 0.18s;
}
.metric:hover { box-shadow: var(--sh); transform: translateY(-1px); }
.metric-bar {
  background: linear-gradient(90deg, var(--green), var(--s2));
  border-radius: var(--r) var(--r) 0 0; height: 3px; left: 0; right: 0; top: 0; position: absolute;
}
.metric .label { color: var(--muted); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.metric .value { display: block; font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 900; letter-spacing: -0.05em; line-height: 1; margin-top: 9px; font-variant-numeric: tabular-nums; }
.metric .sub { color: var(--muted); display: block; font-size: 0.78rem; margin-top: 5px; }

/* Rank strip */
.rank-strip { display: grid; gap: 5px; }
.rank-row {
  align-items: center; display: grid; gap: 10px;
  grid-template-columns: 38px minmax(0,1fr) 88px 62px;
  padding: 9px 12px; border-radius: var(--r-sm);
  transition: background 0.12s; cursor: pointer;
}
.rank-row:hover { background: var(--sub); }
.rank-row .rr-name { font-weight: 700; font-size: 0.9rem; text-align: left; background: none; border: none; color: var(--ink); padding: 0; }
.rank-row .rr-name:hover { color: var(--green); }
.rank-row .rr-pts  { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 0.9rem; text-align: right; }
.rr-bar-track { background: var(--line); border-radius: 999px; height: 5px; overflow: hidden; }
.rr-bar-fill  {
  background: linear-gradient(90deg, var(--green), var(--s0));
  border-radius: inherit; height: 100%;
  animation: bar-grow 0.6s cubic-bezier(0.4,0,0.2,1) both;
  animation-delay: var(--d, 0ms);
}

/* Stat cards */
.stat-cards { display: grid; gap: 8px; }

.stat-card {
  border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer;
  display: grid; grid-template-columns: 86px minmax(0,1fr);
  gap: 10px; padding: 11px 12px; align-items: center;
  transition: background 0.12s, border-color 0.12s;
}
.stat-card:hover { background: var(--sub); border-color: var(--green); }
.stat-card:hover .sc-name { color: var(--green); }

.sc-copy  { min-width: 0; }
.sc-name  { font-weight: 700; font-size: 0.9rem; line-height: 1.2; overflow-wrap: anywhere; }
.sc-meta  { color: var(--muted); font-size: 0.75rem; }
.sc-big   {
  color: var(--green); font-size: clamp(1.35rem, 3vw, 1.8rem); font-weight: 900; line-height: 1;
  letter-spacing: -0.04em; text-align: right;
  font-variant-numeric: tabular-nums;
}
.sc-big.surprise { color: var(--red); }
.sc-big.spread   { color: var(--amber); }

/* Tables */
.toolbar { align-items: end; display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0,1fr)); margin-bottom: 14px; }
.control label { color: var(--muted); display: block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.07em; margin-bottom: 4px; text-transform: uppercase; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; min-width: 640px; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 9px 10px; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--sub); }
tbody tr:last-child td { border-bottom: none; }

/* Rank medals */
.rank-cell { font-weight: 800; font-size: 0.85rem; min-width: 36px; }
.rank-badge { border-radius: var(--r-xs); display: inline-block; font-size: 0.75rem; font-weight: 800; padding: 2px 6px; }
.rank-1 .rank-badge { background: var(--gold-bg);   border: 1px solid var(--gold-b);   color: var(--gold); }
.rank-2 .rank-badge { background: var(--silver-bg); border: 1px solid var(--silver-b); color: var(--silver); }
.rank-3 .rank-badge { background: var(--bronze-bg); border: 1px solid var(--bronze-b); color: var(--bronze); }

/* Mini pts bar */
.pts-bar-wrap { display: grid; gap: 3px; min-width: 90px; }
.pts-bar-val  { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.88rem; }
.pts-bar-track { background: var(--line); border-radius: 999px; height: 4px; overflow: hidden; }
.pts-bar-fill  {
  animation: bar-grow 0.65s cubic-bezier(0.4,0,0.2,1) both; animation-delay: var(--d, 0ms);
  background: linear-gradient(90deg, var(--green), var(--s0)); border-radius: inherit; height: 100%;
}
.points-cell { min-width: 116px; }
.points-cell strong { display: block; font-variant-numeric: tabular-nums; }
.points-cell span { color: var(--muted); display: block; font-size: 0.72rem; font-weight: 500; margin-top: 1px; white-space: nowrap; }

/* Clickable cell */
td.clickable { cursor: pointer; }
td.clickable:hover { color: var(--green); text-decoration: underline; text-decoration-color: var(--green); text-underline-offset: 3px; }

/* Stacked probability bar */
.stacked-wrap { display: grid; gap: 7px; }
.stacked-wrap.compact { gap: 4px; }

.stacked-bar {
  border-radius: var(--r-sm); display: flex; gap: 2px; height: 34px; overflow: hidden;
  clip-path: inset(0 100% 0 0); animation: bar-reveal 0.65s cubic-bezier(0.4,0,0.2,1) forwards 80ms;
}
.stacked-bar.sm { height: 16px; border-radius: 4px; }

@keyframes bar-reveal { to { clip-path: inset(0 0% 0 0); } }

.stacked-seg {
  align-items: center; display: flex; flex-shrink: 0;
  height: 100%; justify-content: center; min-width: 2px; overflow: hidden; position: relative;
}
.stacked-seg.winner {
  box-shadow:
    inset 0 0 0 2px rgb(255 255 255 / 78%),
    inset 0 0 0 3px rgb(0 0 0 / 18%),
    0 0 14px rgb(255 255 255 / 20%);
  filter: saturate(1.18) brightness(1.06);
  z-index: 1;
}
.seg-label {
  color: rgba(255,255,255,0.92); font-size: 0.7rem; font-weight: 800;
  letter-spacing: 0.02em; pointer-events: none; text-shadow: 0 1px 3px rgb(0 0 0 / 35%); white-space: nowrap;
}
.stacked-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.77rem; }
.leg-item { align-items: center; color: var(--ink2); display: flex; gap: 5px; white-space: nowrap; }
.leg-item.winner { color: var(--ink); font-weight: 800; }
.leg-item.winner::after { color: var(--green); content: "✓"; font-weight: 900; }
.leg-dot { border-radius: 3px; display: inline-block; flex-shrink: 0; height: 10px; width: 10px; }

/* Matches layout */
.matches-layout {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm);
  display: grid; grid-template-columns: 282px minmax(0, 1fr); height: calc(100vh - 168px); min-height: 520px; overflow: hidden;
}
.matches-sidebar { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.matches-sidebar-top { border-bottom: 1px solid var(--line); flex-shrink: 0; padding: 16px; }
.match-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px; scrollbar-color: var(--line) transparent; scrollbar-width: thin; }
.match-item {
  border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer; padding: 10px 11px;
  transition: background 0.1s, border-color 0.1s; margin-bottom: 3px;
}
.match-item:hover   { background: var(--sub); border-color: var(--line); }
.match-item.selected{ background: var(--green-bg); border-color: var(--green-b); }
.mi-head { align-items: flex-start; display: flex; gap: 8px; justify-content: space-between; margin-bottom: 6px; }
.mi-name { font-size: 0.86rem; font-weight: 700; flex: 1; line-height: 1.25; }
.mi-meta { color: var(--muted); font-size: 0.74rem; margin-top: 5px; }

.matches-detail { min-height: 0; overflow-y: auto; padding: 20px; }
.match-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.pick-pills { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }

/* Player sidebar */
.players-split { display: grid; gap: 12px; grid-template-columns: 255px minmax(0,1fr); align-items: start; }
.sidebar-panel { padding: 16px; position: sticky; top: 66px; }

.player-list { display: grid; gap: 2px; margin-top: 10px; max-height: 62vh; overflow-y: auto; scrollbar-color: var(--line) transparent; scrollbar-width: thin; }
.player-list button {
  align-items: center; background: transparent; border: 1px solid transparent;
  border-radius: var(--r-sm); color: var(--ink2); display: flex; font-size: 0.85rem;
  justify-content: space-between; padding: 7px 9px; text-align: left;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.player-list button:hover  { background: var(--sub); border-color: var(--line); color: var(--ink); }
.player-list button.active { background: var(--green-bg); border-color: var(--green-b); color: var(--green); font-weight: 700; }
.player-list button .prank { color: var(--muted); font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.player-list button.active .prank { color: var(--green); }

/* Player profile */
.profile-kpis { display: grid; gap: 8px; grid-template-columns: repeat(4,minmax(0,1fr)); margin-bottom: 14px; }
.kpi { background: var(--sub); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 10px; text-align: center; }
.kpi-val   { display: block; font-size: 1.5rem; font-weight: 900; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--muted); display: block; font-size: 0.63rem; font-weight: 700; letter-spacing: 0.09em; margin-top: 4px; text-transform: uppercase; }

.donut-row { align-items: center; display: flex; gap: 14px; margin-bottom: 14px; }
.donut-wrap { align-items: center; display: inline-flex; flex-shrink: 0; justify-content: center; position: relative; }
.donut-label { font-size: 0.9rem; font-weight: 800; left: 50%; position: absolute; top: 50%; transform: translate(-50%,-50%); white-space: nowrap; }

.timeline-wrap { margin-top: 12px; }
.tl-label { color: var(--muted); font-size: 0.67rem; font-weight: 700; letter-spacing: 0.09em; margin-bottom: 6px; text-transform: uppercase; }
.timeline { display: flex; flex-wrap: wrap; gap: 4px; }
.tl-dot { border-radius: 50%; cursor: default; height: 11px; transition: transform 0.1s; width: 11px; }
.tl-dot:hover { transform: scale(1.5); }
.tl-dot.hit     { background: var(--green); }
.tl-dot.miss    { background: var(--red); }
.tl-dot.pending { background: var(--line); }

.breakdown-wrap { margin-top: 12px; }
.breakdown-bar { border-radius: var(--r-xs); display: flex; gap: 2px; height: 13px; overflow: hidden; }
.breakdown-seg { height: 100%; min-width: 2px; }
.breakdown-legend { display: flex; flex-wrap: wrap; font-size: 0.77rem; gap: 5px 16px; margin-top: 7px; }
.bd-item { align-items: center; color: var(--ink2); display: flex; gap: 5px; }
.bd-dot  { border-radius: 3px; display: inline-block; flex-shrink: 0; height: 9px; width: 9px; }

/* Daily bets */
.daily-table-wrap { margin-top: 12px; }
.daily-table { min-width: 720px; }
.daily-table th, .daily-table td { padding: 8px 10px; }
.daily-table .num { font-variant-numeric: tabular-nums; font-weight: 800; text-align: right; }
.daily-table td:nth-child(2) { text-align: center; width: 58px; }
.daily-table td:nth-child(3), .daily-table td:nth-child(4), .daily-table td:nth-child(5) { width: 86px; }
.daily-list { display: grid; gap: 9px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.daily-row {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh-sm); display: grid; gap: 10px; padding: 13px;
  transition: box-shadow 0.18s, transform 0.18s;
}
.daily-row:hover { box-shadow: var(--sh); transform: translateY(-1px); }
.daily-title { align-items: flex-start; display: flex; gap: 8px; justify-content: space-between; }
.daily-title h3 { margin: 0; }

.daily-result-strip {
  align-items: center; background: var(--sub); border: 1px solid var(--line);
  border-radius: var(--r-sm); display: flex; gap: 10px;
  justify-content: space-between; padding: 8px 12px;
}
.daily-result-strip.compact { padding: 7px 10px; }
.daily-result-val { font-size: 1.3rem; font-weight: 900; letter-spacing: -0.03em; }
.daily-result-val.yes { color: var(--green); }
.daily-result-val.no  { color: var(--red); }
.daily-result-val.pending { color: var(--muted); }

.daily-stats { display: grid; gap: 5px; grid-template-columns: repeat(3, 1fr); text-align: center; }
.daily-stats.compact { gap: 6px; }
.ds-val   { display: block; font-size: 1.1rem; font-weight: 900; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ds-label { color: var(--muted); display: block; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.07em; margin-top: 2px; text-transform: uppercase; }
.daily-participants { border-top: 1px solid var(--line); padding-top: 4px; }
.daily-table .daily-participants { border-top: 0; padding-top: 0; }
.participant-grid { display: grid; gap: 5px 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 8px; max-height: 220px; overflow-y: auto; padding-right: 4px; }
.participant-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: 160px; min-width: min(520px, 70vw); }
.participant-grid .name-button { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pills */
.pill { align-items: center; border-radius: 999px; display: inline-flex; font-size: 0.71rem; font-weight: 700; gap: 4px; letter-spacing: 0.03em; padding: 3px 8px; white-space: nowrap; }
.pill.good    { background: var(--green-bg); border: 1px solid var(--green-b); color: var(--green); }
.pill.bad     { background: var(--red-bg);   border: 1px solid var(--red-b);   color: var(--red); }
.pill.warn    { background: var(--amber-bg); border: 1px solid var(--amber-b); color: var(--amber); }
.pill.neutral { background: var(--sub);      border: 1px solid var(--line);    color: var(--muted); }
.mark { align-items: center; border-radius: 999px; display: inline-flex; font-size: 0.86rem; font-weight: 900; height: 22px; justify-content: center; line-height: 1; width: 22px; }
.mark.good { background: var(--green-bg); color: var(--green); }
.mark.bad { background: var(--red-bg); color: var(--red); }
.mark.neutral { background: var(--sub); color: var(--muted); }

/* Rules */
.rules { display: grid; gap: 5px; }
.rules p { font-size: 0.93rem; margin: 0; }
details summary { color: var(--green); cursor: pointer; font-weight: 700; padding: 4px 0; user-select: none; }
details summary:hover { opacity: 0.8; }

/* Notice */
.notice { background: var(--amber-bg); border: 1px solid var(--amber-b); border-radius: var(--r-sm); color: var(--amber); font-size: 0.85rem; padding: 10px 13px; }

/* Loading */
.loading-panel { padding: 60px 24px; text-align: center; }
.loading-spinner { animation: spin 0.75s linear infinite; border: 3px solid var(--line); border-radius: 50%; border-top-color: var(--green); height: 34px; margin: 0 auto 20px; width: 34px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Footer */
.site-footer { border-top: 1px solid var(--line); color: var(--muted); display: flex; flex-wrap: wrap; font-size: 0.78rem; gap: 8px 20px; justify-content: space-between; margin-top: 4px; padding: 13px 0 26px; }
.footer-link { color: var(--green); font-weight: 600; text-decoration: none; }
.footer-link:hover { text-decoration: underline; }

/* Popover */
#popover {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-pop); max-width: min(320px, calc(100vw - 24px)); min-width: min(260px, calc(100vw - 24px)); opacity: 0; padding: 15px;
  position: absolute; transform: translateY(-6px) scale(0.97);
  transition: opacity 0.15s, transform 0.15s; z-index: 300;
}
#popover.visible { opacity: 1; transform: translateY(0) scale(1); }

.pop-head { align-items: center; display: flex; gap: 10px; margin-bottom: 12px; }
.pop-name { font-size: 1rem; font-weight: 800; }
.pop-kpis { display: grid; gap: 6px; grid-template-columns: repeat(3,1fr); margin-bottom: 10px; }
.pop-kpi  { background: var(--sub); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 6px; text-align: center; }
.pop-val  { display: block; font-size: 1.1rem; font-weight: 900; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.pop-lbl  { color: var(--muted); display: block; font-size: 0.63rem; font-weight: 700; letter-spacing: 0.08em; margin-top: 2px; text-transform: uppercase; }
.pop-rank-box { flex-shrink: 0; }
.pop-goto {
  background: var(--green); border: none; border-radius: var(--r-sm); color: var(--green-fg);
  display: block; font-size: 0.82rem; font-weight: 700; margin-top: 12px; padding: 8px 12px;
  text-align: center; transition: background 0.15s; width: 100%;
}
.pop-goto:hover { background: var(--green-h); }

.pop-divider { border: none; border-top: 1px solid var(--line); margin: 10px 0; }
.pop-bet-row { align-items: center; display: flex; justify-content: space-between; font-size: 0.83rem; padding: 4px 0; gap: 10px; }
.pop-bet-label { color: var(--ink2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-total { border-top: 1px solid var(--line); font-size: 0.83rem; margin-top: 8px; padding-top: 8px; }
.pop-head-label { color: var(--muted); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.09em; margin-bottom: 10px; text-transform: uppercase; }

.pop-match-name { font-size: 1.05rem; font-weight: 800; margin-bottom: 10px; letter-spacing: -0.02em; }
.pop-match-meta { font-size: 0.82rem; color: var(--muted); margin-top: 10px; }
.pop-match-meta strong { color: var(--ink); }
#popover .stacked-legend { display: grid; grid-template-columns: 1fr; gap: 4px; }
#popover .leg-item { justify-content: flex-start; white-space: nowrap; }
#popover .stacked-bar { height: 32px; }

/* Animations */
@keyframes bar-grow { from { width: 0; } to { width: var(--bar-w, 0%); } }
@keyframes fade-up  { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
#app > * { animation: fade-up 0.2s ease-out both; }
#app > *:nth-child(2) { animation-delay: 45ms; }
#app > *:nth-child(3) { animation-delay: 90ms; }

/* Responsive */
@media (max-width: 920px) {
  .header-grid { grid-template-columns: 1fr; }
  .header-actions { justify-content: space-between; }
  .grid.metrics { grid-template-columns: repeat(2,1fr); }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: 1fr; }
  .players-split { grid-template-columns: 1fr; }
  .sidebar-panel { position: static; }
  .profile-kpis { grid-template-columns: repeat(2,1fr); }
  .toolbar { grid-template-columns: 1fr; }
  .site-header { position: static; }
  .matches-layout { grid-template-columns: 1fr; height: auto; min-height: auto; }
  .matches-sidebar { border-right: none; border-bottom: 1px solid var(--line); max-height: 40vh; }
  .daily-list { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .shell { width: min(100% - 16px, var(--shell)); }
  .panel { border-radius: var(--r); padding: 14px; }
  .grid.metrics { grid-template-columns: repeat(2,1fr); }
  .tabs button { font-size: 0.78rem; padding: 5px 9px; }
  h1 { font-size: 1.9rem; }
  .rank-row { grid-template-columns: 36px minmax(0,1fr) 70px; }
  .rank-row .rr-bar-track { display: none; }
  .stat-card { grid-template-columns: 72px minmax(0, 1fr); }
  .match-kpis { grid-template-columns: 1fr; }
  .participant-grid { grid-template-columns: 1fr; }
  .participant-grid.compact { grid-template-columns: 1fr; min-width: 220px; }
}
